diff --git a/src/Console/Commands/GenerateClientDocblockCommand.php b/src/Console/Commands/GenerateClientDocblockCommand.php deleted file mode 100644 index 44f261f..0000000 --- a/src/Console/Commands/GenerateClientDocblockCommand.php +++ /dev/null @@ -1,69 +0,0 @@ -in(app_path('Services'))->files()->depth(0) as $file) { - $reflection = new \ReflectionClass('App\\Services\\'.$file->getFilenameWithoutExtension()); - - if ($reflection->getDocComment() || ! $reflection->getExtensionName() === GeneratedClient::class) { - continue; - } - - $instance = $reflection->newInstance(); - $docBlock = "/**\n"; - - foreach ($instance::FUNCTION_MAP as $function => $method) { - $docBlock .= " * @method \Illuminate\Http\Client\Response ".Str::camel($function)."(array|null \$data)\n"; - } - - $docBlock .= " */\n"; - - $this->files->put($file->getPathname(), str_replace( - "final class {$file->getFilenameWithoutExtension()} extends GeneratedClient", - "{$docBlock}final class {$file->getFilenameWithoutExtension()} extends GeneratedClient", - $this->files->get($file->getPathname()), - )); - } - - return 0; - } -} diff --git a/src/Http/GeneratedClient.php b/src/Http/GeneratedClient.php deleted file mode 100644 index 2f0fbe6..0000000 --- a/src/Http/GeneratedClient.php +++ /dev/null @@ -1,48 +0,0 @@ -client = $this->setUp(); - } - - public function setUp(): PendingRequest - { - return $this->asFake() - ? Http::fake()->baseUrl('https://getskore.com') - : Http::baseUrl(config('services.netcall_one.base_url', '')); - } - - public function asFake(): bool - { - return empty(config('services.netcall_one.base_url', '')); - } - - public function __call(string $method, array $arguments) - { - $function = Str::snake($method); - - if (! $functionMethod = self::FUNCTION_MAP[$function] ?? null) { - throw new \Exception('Method not yet implemented in the client.'); - } - - $response = $this->client->asJson()->send($functionMethod, '/', [ - 'json' => [ - 'client_unique_identifier' => (string) Str::ulid(), - 'function' => Str::snake($method), - 'data' => $arguments, - ], - ]); - - return $response; - } -}