Connector
abstract class Connector
Traits
Properties
| protected null|Response> | $response | The default response class. |
from HasCustomResponses |
| static protected array | $macros | The registered string macros. |
from Macroable |
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.
Handle the final PSR request before it is sent.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new instance with the given arguments.
Determine if the response should throw a request exception.
Resolve the integration base URL.
Create a bounded request pool.
Resolve the HTTP connection used by this connector.
Resolve whether requests may replace this connector's base URL.
Get the default headers.
Get the default query parameters.
Get the default request options.
Get the default authenticator.
Get the default request delay in milliseconds.
Copy the default body repository for a pending request.
Resolve the default headers.
Resolve the default query parameters.
Resolve the default request options.
Resolve the default authenticator.
Resolve the default request delay in milliseconds.
Resolve the default body repository.
Resolve the cacheable HTTP methods.
Determine if this connector defines rate limits.
Resolve the connector's admission policies.
Resolve the connector's rate limiter store.
Determine if connector rate limits should be awaited.
Resolve the connector's stable cooldown key.
Resolve the connector cooldown imposed by a response.
Define the cacheable HTTP methods.
Flush all static state.
Details
in
CreatesDtoFromResponse at line 17
mixed
createDtoFromResponse(Response $response)
Create a data object from the response.
in
Bootable at line 14
void
boot(PendingRequest $pendingRequest)
Configure a pending request for this resource.
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
HandlesPsrRequest at line 15
RequestInterface
handlePsrRequest(RequestInterface $request, PendingRequest $pendingRequest)
Handle the final PSR request before it is sent.
in
HasCustomResponses at line 23
string|null
resolveResponseClass(Response $response)
Resolve the custom response class.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
Makeable at line 12
static Makeable
make(mixed ...$arguments)
Create a new instance with the given arguments.
in
ManagesExceptions at line 15
bool|null
hasRequestFailed(Response $response)
Determine if the request failed.
in
ManagesExceptions at line 23
RequestException|null
getRequestException(Response $response)
Resolve the request exception.
in
ManagesExceptions at line 31
bool
shouldThrowRequestException(Response $response)
Determine if the response should throw a request exception.
at line 42
abstract string
resolveBaseUrl()
Resolve the integration base URL.
at line 51
Response
send(Request $request, MockClient|null $mockClient = null)
Send a request through this connector.
at line 66
Pool
pool(iterable|callable $requests = [], int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)
Create a bounded request pool.
at line 78
string|null
resolveHttpConnection()
Resolve the HTTP connection used by this connector.
at line 86
bool
allowsBaseUrlOverride()
Resolve whether requests may replace this connector's base URL.
at line 96
final array
headers()
Get the default headers.
at line 106
final array
queryParameters()
Get the default query parameters.
at line 116
final array
options()
Get the default request options.
at line 124
final Authenticator|null
authenticator()
Get the default authenticator.
at line 132
final int|null
delayMilliseconds()
Get the default request delay in milliseconds.
at line 142
final BodyRepository|null
copyDefaultBodyRepository()
| internal |
Copy the default body repository for a pending request.
at line 154
protected array
defaultHeaders()
Resolve the default headers.
at line 164
protected array
defaultQuery()
Resolve the default query parameters.
at line 174
protected array
defaultOptions()
Resolve the default request options.
at line 182
protected Authenticator|null
defaultAuth()
Resolve the default authenticator.
at line 190
protected int|null
defaultDelay()
Resolve the default request delay in milliseconds.
at line 198
protected BodyRepository|null
defaultBodyRepository()
Resolve the default body repository.
at line 208
final string|null
resolveCacheKey(PendingRequest $pendingRequest)
| internal |
Resolve the custom cache key.
at line 219
final array
resolveCacheableMethods()
| internal |
Resolve the cacheable HTTP methods.
at line 229
bool
usesRateLimits()
| internal |
Determine if this connector defines rate limits.
at line 240
array
resolveRateLimitPolicies(PendingRequest $pendingRequest)
| internal |
Resolve the connector's admission policies.
at line 250
UnitEnum|string|null
resolveRateLimitStoreName()
| internal |
Resolve the connector's rate limiter store.
at line 260
bool
shouldWaitForRateLimits()
| internal |
Determine if connector rate limits should be awaited.
at line 270
string
resolveRateLimitCooldownKeyFor(PendingRequest $pendingRequest)
| internal |
Resolve the connector's stable cooldown key.
at line 280
int|null
resolveRateLimitCooldownFor(Response $response)
| internal |
Resolve the connector cooldown imposed by a response.
at line 288
protected string|null
cacheKey(PendingRequest $pendingRequest)
Define a custom cache key.
at line 298
protected array
cacheableMethods()
Define the cacheable HTTP methods.
at line 306
static void
flushState()
Flush all static state.