A generic client which executes actions on the Shellbox server.
More...
|
| __construct (ClientInterface $httpClient, UriInterface $uri, string $key, array $options=[]) |
|
| setLogger (LoggerInterface $logger) |
|
| call ( $routeName, $functionName, $params=[], $options=[]) |
|
| sendRequest ( $path, $parts, $outputFiles=[], $outputGlobs=[]) |
| Send an arbitrary request to the server.
|
|
| areUrlFilesAllowed () |
| Whether the client can download input files and upload output files specified with BoxedCommand::inputFileFromUrl and the like.
|
|
A generic client which executes actions on the Shellbox server.
◆ __construct()
Shellbox\Client::__construct |
( |
ClientInterface | $httpClient, |
|
|
UriInterface | $uri, |
|
|
string | $key, |
|
|
array | $options = [] ) |
- Parameters
-
ClientInterface | $httpClient | An object which requests an HTTP resource. It is permissible to throw an exception for propagation back to the caller. However, a successfully received response with a status code of >=400 should ideally be returned to Shellbox as a ResponseInterface, so that Shellbox can parse and rethrow its own error messages. With Guzzle this could be achieved by passing setting RequestOptions::HTTP_ERROR option to false when creating the client. |
UriInterface | $uri | The base URI of the server |
string | $key | The key for HMAC authentication |
array | $options | An associative array of options, which may contain:
- allowUrlFiles: Set this to true to allow input files to be downloaded, and output files to be uploaded, on the server side. If this is set, the server configuration variable allowUrlFiles must also be set to true.
|
◆ areUrlFilesAllowed()
Shellbox\Client::areUrlFilesAllowed |
( |
| ) |
|
Whether the client can download input files and upload output files specified with BoxedCommand::inputFileFromUrl and the like.
- Since
- 4.1.0
- Returns
- bool
◆ sendRequest()
Shellbox\Client::sendRequest |
( |
| $path, |
|
|
| $parts, |
|
|
| $outputFiles = [], |
|
|
| $outputGlobs = [] ) |
Send an arbitrary request to the server.
- Parameters
-
string | $path | The URL path relative to the server's base URL |
array | $parts | An array of multipart parts to send, in the format specified by MultipartStream. Each part is an associative array which for our purposes may contain:
- "name": The part name. Required but ignored when there is a Content-Disposition header.
- "contents": Here always a StreamInterface or string
- "headers": An associative array of part headers.
|
OutputFile[] | $outputFiles | Output files. The objects will have their contents populated with data received from the server. |
OutputGlob[] | $outputGlobs | Output globs. The objects will be populated with data received from the server. |
- Returns
- array An associative array of output data
- Exceptions
-
◆ setLogger()
Shellbox\Client::setLogger |
( |
LoggerInterface | $logger | ) |
|
The documentation for this class was generated from the following file: