class PendingRequest mixin PendingRequest

Traits

Properties

protected TResource> $resource
protected bool $enableMiddleware
protected array $middlewareOptions
protected array $guzzleOptions
protected array<callable|object|string> $requestMiddleware
protected array<callable|object|string> $responseMiddleware
protected PendingRequest|null $request
protected Pipeline $pipeline

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

__construct(ApiClient $client, Pipeline|null $pipeline = null)

No description

enableMiddleware()

Enable or disable middleware for the request.

disableMiddleware()

Disable middleware for the request.

withMiddlewareOptions(array $options)

Set the options for the middleware.

withGuzzleOptions(array $options)

Set the Guzzle options for the request.

withRequestMiddleware(array $middleware)

Set the request middleware for the request.

withAddedRequestMiddleware(array $middleware)

Add request middleware to the existing request middleware.

withResponseMiddleware(array $middleware)

Set the response middleware for the request.

withAddedResponseMiddleware(array $middleware)

Add response middleware to the existing response middleware.

withResource(string $resource)

Set the resource class for the request.

get(string $url, array|JsonSerializable|string|null $query = null)

Issue a GET request to the given URL.

head(string $url, array|string|null $query = null)

Issue a HEAD request to the given URL.

post(string $url, array|JsonSerializable $data = [])

Issue a POST request to the given URL.

patch(string $url, array $data = [])

Issue a PATCH request to the given URL.

put(string $url, array $data = [])

Issue a PUT request to the given URL.

delete(string $url, array $data = [])

Issue a DELETE request to the given URL.

send(string $method, string $url, array $options = [])

Send the request to the given URL.

__call(string $method, array $parameters)

Provide a dynamic method to pass calls to the pending request.

sendRequest()

No description

handleMiddlewareRequest(ApiRequest $request)

No description

array
createMiddleware(array $middlewareClasses)

No description

getClient()

No description

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

at line 52
__construct(ApiClient $client, Pipeline|null $pipeline = null)

No description

Parameters

ApiClient $client
Pipeline|null $pipeline

at line 66
PendingRequest enableMiddleware()

Enable or disable middleware for the request.

Return Value

PendingRequest

at line 76
PendingRequest disableMiddleware()

Disable middleware for the request.

Return Value

PendingRequest

at line 86
PendingRequest withMiddlewareOptions(array $options)

Set the options for the middleware.

Parameters

array $options

Return Value

PendingRequest

at line 96
PendingRequest withGuzzleOptions(array $options)

Set the Guzzle options for the request.

Parameters

array $options

Return Value

PendingRequest

at line 106
PendingRequest withRequestMiddleware(array $middleware)

Set the request middleware for the request.

Parameters

array $middleware

Return Value

PendingRequest

at line 116
PendingRequest withAddedRequestMiddleware(array $middleware)

Add request middleware to the existing request middleware.

Parameters

array $middleware

Return Value

PendingRequest

at line 126
PendingRequest withResponseMiddleware(array $middleware)

Set the response middleware for the request.

Parameters

array $middleware

Return Value

PendingRequest

at line 136
PendingRequest withAddedResponseMiddleware(array $middleware)

Add response middleware to the existing response middleware.

Parameters

array $middleware

Return Value

PendingRequest

at line 149
PendingRequest withResource(string $resource)

Set the resource class for the request.

Parameters

string $resource

Return Value

PendingRequest

Exceptions

InvalidArgumentException

at line 174
ApiResource get(string $url, array|JsonSerializable|string|null $query = null)

Issue a GET request to the given URL.

Parameters

string $url
array|JsonSerializable|string|null $query

Return Value

ApiResource

Exceptions

ConnectionException

at line 185
ApiResource head(string $url, array|string|null $query = null)

Issue a HEAD request to the given URL.

Parameters

string $url
array|string|null $query

Return Value

ApiResource

Exceptions

ConnectionException

at line 196
ApiResource post(string $url, array|JsonSerializable $data = [])

Issue a POST request to the given URL.

Parameters

string $url
array|JsonSerializable $data

Return Value

ApiResource

Exceptions

ConnectionException

at line 207
ApiResource patch(string $url, array $data = [])

Issue a PATCH request to the given URL.

Parameters

string $url
array $data

Return Value

ApiResource

Exceptions

ConnectionException

at line 218
ApiResource put(string $url, array $data = [])

Issue a PUT request to the given URL.

Parameters

string $url
array $data

Return Value

ApiResource

Exceptions

ConnectionException

at line 229
ApiResource delete(string $url, array $data = [])

Issue a DELETE request to the given URL.

Parameters

string $url
array $data

Return Value

ApiResource

Exceptions

ConnectionException

at line 240
ApiResource send(string $method, string $url, array $options = [])

Send the request to the given URL.

Parameters

string $method
string $url
array $options

Return Value

ApiResource

Exceptions

Throwable

at line 248
PendingRequest __call(string $method, array $parameters)

Provide a dynamic method to pass calls to the pending request.

Parameters

string $method
array $parameters

Return Value

PendingRequest

at line 256
protected ApiResource sendRequest()

No description

Return Value

ApiResource

at line 284
protected ApiRequest handleMiddlewareRequest(ApiRequest $request)

No description

Parameters

ApiRequest $request

Return Value

ApiRequest

at line 292
protected ApiResponse handleMiddlewareResponse(ApiResponse $response)

No description

Parameters

ApiResponse $response

Return Value

ApiResponse

at line 300
protected array createMiddleware(array $middlewareClasses)

No description

Parameters

array $middlewareClasses

Return Value

array

at line 315
protected PendingRequest getClient()

No description

Return Value

PendingRequest