PendingRequest
class PendingRequest implements Transient mixin PendingRequest
Traits
Properties
| protected array<string, mixed> | $context | from HasContext | |
| protected TResource> | $resource | ||
| protected list<callable|object|string> | $requestMiddleware | ||
| protected list<callable|object|string> | $responseMiddleware | ||
| protected PendingRequest|null | $request | ||
| protected Pipeline | $pipeline | ||
| protected ApiRequest|null | $activeRequest |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Forward a method call to the given object.
Forward a method call to the given object, returning $this if the forwarded call returned itself.
Throw a bad method call exception for the given method.
Set the API request/response context.
Get the API request/response context.
Add middleware to the API request pipeline.
Replace the API request middleware pipeline.
Add middleware to the API response pipeline.
Replace the API response middleware pipeline.
Remove all API middleware from the request.
Prepend middleware to the underlying HTTP request pipeline.
Set the resource class for the request.
Issue a GET request to the given URL.
Issue a HEAD request to the given URL.
Issue a QUERY request to the given URL.
Issue a POST request to the given URL.
Issue a PATCH request to the given URL.
Issue a DELETE request to the given URL.
Send the request to the given URL.
Enable or disable asynchronous requests.
Reject a custom Guzzle client that would bypass the API request pipeline.
Send an API request.
Get the underlying HTTP pending request.
Dynamically pass method calls to the underlying HTTP client.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
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.
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.
in
ForwardsCalls at line 22
protected mixed
forwardCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object.
in
ForwardsCalls at line 52
protected mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object, returning $this if the forwarded call returned itself.
in
ForwardsCalls at line 66
static protected never
throwBadMethodCallException(string $method)
Throw a bad method call exception for the given method.
in
HasContext at line 19
HasContext
withContext(array|string $key, mixed $value = null)
Set the API request/response context.
in
HasContext at line 35
mixed
context(string|null $key = null, mixed $default = null)
Get the API request/response context.
at line 117
__construct(Pipeline|null $pipeline = null)
Create a new pending API request instance.
at line 125
PendingRequest
withApiRequestMiddleware(callable|object|string $middleware)
Add middleware to the API request pipeline.
at line 137
PendingRequest
replaceApiRequestMiddleware(array $middleware)
Replace the API request middleware pipeline.
at line 147
PendingRequest
withApiResponseMiddleware(callable|object|string $middleware)
Add middleware to the API response pipeline.
at line 159
PendingRequest
replaceApiResponseMiddleware(array $middleware)
Replace the API response middleware pipeline.
at line 169
PendingRequest
withoutApiMiddleware()
Remove all API middleware from the request.
at line 182
PendingRequest
prependMiddleware(callable $middleware)
Prepend middleware to the underlying HTTP request pipeline.
at line 206
PendingRequest
withResource(string $resource)
Set the resource class for the request.
at line 226
ApiResource
get(string $url, Arrayable|array|JsonSerializable|string|null $query = null)
Issue a GET request to the given URL.
at line 240
ApiResource
head(string $url, Arrayable|array|JsonSerializable|string|null $query = null)
Issue a HEAD request to the given URL.
at line 254
ApiResource
query(string $url, Arrayable|array|JsonSerializable $data = [])
Issue a QUERY request to the given URL.
at line 266
ApiResource
post(string $url, Arrayable|array|JsonSerializable $data = [])
Issue a POST request to the given URL.
at line 278
ApiResource
patch(string $url, Arrayable|array|JsonSerializable $data = [])
Issue a PATCH request to the given URL.
at line 290
ApiResource
put(string $url, Arrayable|array|JsonSerializable $data = [])
Issue a PUT request to the given URL.
at line 302
ApiResource
delete(string $url, Arrayable|array|JsonSerializable $data = [])
Issue a DELETE request to the given URL.
at line 314
ApiResource
send(string $method, string $url, array $options = [])
Send the request to the given URL.
at line 322
PendingRequest
async(bool $async = true)
Enable or disable asynchronous requests.
at line 334
never
setClient(ClientInterface $client)
Reject a custom Guzzle client that would bypass the API request pipeline.
at line 347
protected ApiResource
sendRequest(string $method, mixed ...$arguments)
Send an API request.
at line 373
protected ApiRequest
runRequestMiddleware(ApiRequest $request)
Run the API request middleware.
at line 384
protected ApiResponse
runResponseMiddleware(ApiResponse $response)
Run the API response middleware.
at line 395
protected PendingRequest
getRequest()
Get the underlying HTTP pending request.
at line 422
mixed
__call(string $method, array $parameters)
Dynamically pass method calls to the underlying HTTP client.
at line 87
static void
baseUrl(string $url)
No description
at line 87
static void
withBody(Stringable $content, string $contentType = '\'application/json\'')
No description
at line 87
static void
asJson()
No description
at line 87
static void
asForm()
No description
at line 87
static void
attach(array|string $name, resource|string $contents = '\'\'', ?string $filename = 'null', array $headers = '[]')
No description
at line 87
static void
asMultipart()
No description
at line 87
static void
bodyFormat(string $format)
No description
at line 87
static void
withQueryParameters(array $parameters)
No description
at line 87
static void
contentType(string $contentType)
No description
at line 87
static void
acceptJson()
No description
at line 87
static void
accept(string $contentType)
No description
at line 87
static void
withHeaders(array $headers)
No description
at line 87
static void
withHeader(string $name, mixed $value)
No description
at line 87
static void
replaceHeaders(array $headers)
No description
at line 87
static void
withBasicAuth(string $username, string $password)
No description
at line 87
static void
withDigestAuth(string $username, string $password)
No description
at line 87
static void
withToken(string $token, string $type = '\'Bearer\'')
No description
at line 87
static void
withUserAgent(bool|string $userAgent)
No description
at line 87
static void
withUrlParameters(array $parameters = '[]')
No description
at line 87
static void
withCookie(SetCookie $cookie)
No description
at line 87
static void
withCookies(array $cookies, string $domain)
No description
at line 87
static void
maxRedirects(int $max)
No description
at line 87
static void
withoutRedirecting()
No description
at line 87
static void
withoutVerifying()
No description
at line 87
static void
sink(StreamInterface|string $to)
No description
at line 87
static void
timeout(float|int $seconds)
No description
at line 87
static void
connectTimeout(float|int $seconds)
No description
at line 87
static void
retry(array|int $times, Closure|int $sleepMilliseconds = '0', ?callable $when = 'null', bool $throw = 'true')
No description
at line 87
static void
withOptions(array $options)
No description
at line 87
static void
withMiddleware(callable $middleware)
No description
at line 87
static void
withRequestMiddleware(callable $middleware)
No description
at line 87
static void
withResponseMiddleware(callable $middleware)
No description
at line 87
static void
withAttributes(array $attributes)
No description
at line 87
static void
withoutTelescope()
No description
at line 87
static void
withTelescopeTags(array $tags)
No description
at line 87
static void
beforeSending(callable $callback)
No description
at line 87
static void
afterResponse(callable $callback)
No description
at line 87
static void
throw(?callable $callback = 'null')
No description
at line 87
static void
throwIf(bool|callable $condition, ?callable $callback = 'null')
No description
at line 87
static void
throwUnless(bool|callable $condition, ?callable $callback = 'null')
No description
at line 87
static void
dump()
No description
at line 87
static void
dd()
No description
at line 87
static void
stub(Collection $callback)
No description
at line 87
static void
preventStrayRequests(bool $prevent = 'true')
No description
at line 87
static void
allowStrayRequests(array $only)
No description
at line 87
static void
truncateExceptionsAt(int $length)
No description
at line 87
static void
dontTruncateExceptions()
No description
at line 87
static void
setHandler(callable $handler)
No description
at line 87
static void
connection(string $connection, ?array $config = 'null')
No description