$httpClient
$httpClient : \GuzzleHttp\ClientInterface
The Guzzle ServiceClient serves as the foundation for creating web service clients that interact with RPC-style APIs.
$httpClient : \GuzzleHttp\ClientInterface
$handlerStack : \GuzzleHttp\HandlerStack
$commandToRequestTransformer : callable
$responseToResultTransformer : callable
__construct(\GuzzleHttp\ClientInterface $httpClient, callable $commandToRequestTransformer, callable $responseToResultTransformer, \GuzzleHttp\HandlerStack $commandHandlerStack = null) : mixed
Instantiates a Guzzle ServiceClient for making requests to a web service.
\GuzzleHttp\ClientInterface | $httpClient | A fully-configured Guzzle HTTP client that will be used to perform the underlying HTTP requests. |
callable | $commandToRequestTransformer | A callable that transforms
a Command into a Request. The function should accept a
|
callable | $responseToResultTransformer | A callable that transforms a
Response into a Result. The function should accept a
|
\GuzzleHttp\HandlerStack | $commandHandlerStack | A Guzzle HandlerStack, which can be used to add command-level middleware to the service client. |
getCommand(mixed $name, array $params = []) : \GuzzleHttp\Command\CommandInterface
Create a command for an operation name.
Special keys may be set on the command to control how it behaves. Implementations SHOULD be able to utilize the following keys or throw an exception if unable.
mixed | $name | Name of the operation to use in the command |
array | $params |
executeAsync(\GuzzleHttp\Command\CommandInterface $command) : \GuzzleHttp\Promise\PromiseInterface
Execute a single command asynchronously
\GuzzleHttp\Command\CommandInterface | $command | Command to execute |
A Promise that resolves to a Result.
executeAll(mixed $commands, array $options = []) : array
Executes multiple commands concurrently using a fixed pool size.
mixed | $commands | Array or iterator that contains CommandInterface objects to execute with the client. |
array | $options | Associative array of options to apply.
|
executeAllAsync(mixed $commands, array $options = []) : \GuzzleHttp\Promise\PromiseInterface
Executes multiple commands concurrently and asynchronously using a fixed pool size.
mixed | $commands | Array or iterator that contains CommandInterface objects to execute with the client. |
array | $options | Associative array of options to apply.
|
__call(string $name, array $args) : \GuzzleHttp\Command\ResultInterface|\GuzzleHttp\Promise\PromiseInterface
Creates and executes a command for an operation by name.
string | $name | Name of the command to execute. |
array | $args | Arguments to pass to the getCommand method. |
transformResponseToResult(\Psr\Http\Message\ResponseInterface $response, \Psr\Http\Message\RequestInterface $request, \GuzzleHttp\Command\CommandInterface $command) : \GuzzleHttp\Command\ResultInterface
Transforms a Response object, also using data from the Request object, into a Result object.
\Psr\Http\Message\ResponseInterface | $response | |
\Psr\Http\Message\RequestInterface | $request | |
\GuzzleHttp\Command\CommandInterface | $command |