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.
Namespace
Google \ Cloud \ CoreMethods
__construct
Parameters | |
---|---|
Name | Description |
config |
array
Configuration options. Please see Google\Cloud\Core\RequestWrapperTrait::setCommonDefaults() 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. Deprecated: This option is no longer supported. Use the |
↳ asyncHttpHandler |
callable
Experimental A handler used to deliver PSR-7 requests asynchronously. Function signature should match: |
↳ authHttpHandler |
callable
A handler used to deliver PSR-7 requests specifically for authentication. Function signature should match: |
↳ httpHandler |
callable
A handler used to deliver PSR-7 requests. Function signature should match: |
↳ 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: |
↳ restDelayFunction |
callable
Executes a delay, defaults to utilizing |
↳ restCalcDelayFunction |
callable
Sets the conditions for determining how long to wait between attempts to retry. Function signature should match: |
send
Deliver the request.
Parameters | |
---|---|
Name | Description |
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 |
↳ retries |
int
Number of retries for a failed request. Defaults to |
↳ restRetryFunction |
callable
Sets the conditions for whether or not a request should attempt to retry. Function signature should match: |
↳ restRetryListener |
callable
Runs after the restRetryFunction. This might be used to simply consume the exception and $arguments b/w retries. This returns the new $arguments thus allowing modification on demand for $arguments. For ex: changing the headers in b/w retries. |
↳ restDelayFunction |
callable
Executes a delay, defaults to utilizing |
↳ restCalcDelayFunction |
callable
Sets the conditions for determining how long to wait between attempts to retry. Function signature should match: |
↳ restOptions |
array
HTTP client specific configuration options. |
Returns | |
---|---|
Type | Description |
Psr\Http\Message\ResponseInterface |
sendAsync
Deliver the request asynchronously.
Parameters | |
---|---|
Name | Description |
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 |
↳ retries |
int
Number of retries for a failed request. Defaults to |
↳ restRetryFunction |
callable
Sets the conditions for whether or not a request should attempt to retry. Function signature should match: |
↳ restDelayFunction |
callable
Executes a delay, defaults to utilizing |
↳ restCalcDelayFunction |
callable
Sets the conditions for determining how long to wait between attempts to retry. Function signature should match: |
↳ restOptions |
array
HTTP client specific configuration options. |
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<\psr\http\message\responseinterface> |