Reference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class RequestWrapper.
The RequestWrapper is responsible for delivering and signing requests.
Methods
__construct
config
array
Configuration options. Please see {@see} for the other available options.
↳ componentVersion
string
The current version of the component from which the request originated.
↳ accessToken
string
Access token used to sign requests.
↳ asyncHttpHandler
callable
Experimental
A handler used to deliver PSR-7 requests asynchronously. Function signature should match: function (RequestInterface $request, array $options = []) : PromiseInterface<ResponseInterface>
.
↳ authHttpHandler
callable
A handler used to deliver PSR-7 requests specifically for authentication. Function signature should match: function (RequestInterface $request, array $options = []) : ResponseInterface
.
↳ httpHandler
callable
A handler used to deliver PSR-7 requests. Function signature should match: function (RequestInterface $request, array $options = []) : ResponseInterface
.
↳ restOptions
array
HTTP client specific configuration options.
↳ shouldSignRequest
bool
Whether to enable request signing.
↳ restRetryFunction
callable
Sets the conditions for whether or not a request should attempt to retry. Function signature should match: function (\Exception $ex) : bool
.
↳ restDelayFunction
callable
Executes a delay, defaults to utilizing usleep
. Function signature should match: function (int $delay) : void
.
↳ restCalcDelayFunction
callable
Sets the conditions for determining how long to wait between attempts to retry. Function signature should match: function (int $attempt) : int
.
send
Deliver the request.
request
Psr\Http\Message\RequestInterface
A PSR-7 request.
options
array
Request options.
↳ requestTimeout
float
Seconds to wait before timing out the request. Defaults to 0
.
↳ retries
int
Number of retries for a failed request. Defaults to 3
.
↳ restRetryFunction
callable
Sets the conditions for whether or not a request should attempt to retry. Function signature should match: function (\Exception $ex) : bool
.
↳ restDelayFunction
callable
Executes a delay, defaults to utilizing usleep
. Function signature should match: function (int $delay) : void
.
↳ restCalcDelayFunction
callable
Sets the conditions for determining how long to wait between attempts to retry. Function signature should match: function (int $attempt) : int
.
↳ restOptions
array
HTTP client specific configuration options.
Psr\Http\Message\ResponseInterface
sendAsync
Deliver the request asynchronously.
request
Psr\Http\Message\RequestInterface
A PSR-7 request.
options
array
Request options.
↳ requestTimeout
float
Seconds to wait before timing out the request. Defaults to 0
.
↳ retries
int
Number of retries for a failed request. Defaults to 3
.
↳ restRetryFunction
callable
Sets the conditions for whether or not a request should attempt to retry. Function signature should match: function (\Exception $ex, int $retryAttempt) : bool
.
↳ restDelayFunction
callable
Executes a delay, defaults to utilizing usleep
. Function signature should match: function (int $delay) : void
.
↳ restCalcDelayFunction
callable
Sets the conditions for determining how long to wait between attempts to retry. Function signature should match: function (int $attempt) : int
.
↳ restOptions
array
HTTP client specific configuration options.
GuzzleHttp\Promise\PromiseInterface<\psr\http\message\responseinterface>