1: <?php declare(strict_types=1);
2:
3: namespace Salient\Curler;
4:
5: use Psr\Http\Message\RequestInterface;
6: use Psr\Http\Message\ResponseInterface;
7: use Psr\Http\Message\UriInterface as PsrUriInterface;
8: use Salient\Contract\Cache\CacheInterface;
9: use Salient\Contract\Core\Arrayable;
10: use Salient\Contract\Core\DateFormatterInterface;
11: use Salient\Contract\Curler\CurlerInterface;
12: use Salient\Contract\Curler\CurlerMiddlewareInterface;
13: use Salient\Contract\Curler\CurlerPagerInterface;
14: use Salient\Contract\Http\AccessTokenInterface;
15: use Salient\Contract\Http\FormDataFlag;
16: use Salient\Contract\Http\HttpHeadersInterface;
17: use Salient\Contract\Http\HttpRequestHandlerInterface;
18: use Salient\Contract\Http\HttpResponseInterface;
19: use Salient\Core\Builder;
20: use Closure;
21: use Stringable;
22:
23: /**
24: * @method $this uri(PsrUriInterface|Stringable|string|null $value) Endpoint URI (cannot have query or fragment components)
25: * @method $this headers(Arrayable<string,string[]|string>|iterable<string,string[]|string>|null $value) Request headers
26: * @method $this accessToken(AccessTokenInterface|null $value) Access token applied to request headers
27: * @method $this accessTokenHeaderName(string $value) Name of access token header (default: `"Authorization"`)
28: * @method $this sensitiveHeaders(string[] $value) Headers treated as sensitive (default: {@see HttpHeaderGroup::SENSITIVE})
29: * @method $this mediaType(string|null $value) Media type applied to request headers
30: * @method $this userAgent(string|null $value) User agent applied to request headers
31: * @method $this expectJson(bool $value = true) Explicitly accept JSON-encoded responses and assume responses with no content type contain JSON (default: true)
32: * @method $this postJson(bool $value = true) Use JSON to encode POST/PUT/PATCH/DELETE data (default: true)
33: * @method $this dateFormatter(DateFormatterInterface|null $value) Date formatter used to format and parse the endpoint's date and time values
34: * @method $this formDataFlags(int-mask-of<FormDataFlag::*> $value) Flags used to encode data for query strings and message bodies (default: {@see FormDataFlag::PRESERVE_NUMERIC_KEYS} `|` {@see FormDataFlag::PRESERVE_STRING_KEYS})
35: * @method $this jsonDecodeFlags(int-mask-of<\JSON_BIGINT_AS_STRING|\JSON_INVALID_UTF8_IGNORE|\JSON_INVALID_UTF8_SUBSTITUTE|\JSON_OBJECT_AS_ARRAY|\JSON_THROW_ON_ERROR> $value) Flags used to decode JSON returned by the endpoint (default: {@see \JSON_OBJECT_AS_ARRAY})
36: * @method $this middleware(array<array{CurlerMiddlewareInterface|HttpRequestHandlerInterface|Closure(RequestInterface $request, Closure(RequestInterface): HttpResponseInterface $next, CurlerInterface $curler): ResponseInterface,1?:string|null}> $value) Middleware applied to the request handler stack
37: * @method $this pager(CurlerPagerInterface|null $value) Pagination handler
38: * @method $this alwaysPaginate(bool $value = true) Use the pager to process requests even if no pagination is required (default: false)
39: * @method $this cacheStore(CacheInterface|null $value) Cache store used for cookie and response caching instead of the {@see Cache} facade's underlying store
40: * @method $this handleCookies(bool $value = true) Enable cookie handling (default: false)
41: * @method $this cookiesCacheKey(string|null $value) Key to cache cookies under (cookie handling is implicitly enabled if given)
42: * @method $this cacheResponses(bool $value = true) Cache responses to GET and HEAD requests (HTTP caching headers are ignored; USE RESPONSIBLY) (default: false)
43: * @method $this cachePostResponses(bool $value = true) Cache responses to repeatable POST requests (ignored if GET and HEAD request caching is disabled) (default: false)
44: * @method $this cacheKeyCallback((callable(RequestInterface $request, CurlerInterface $curler): (string[]|string))|null $value) Override values hashed and combined with request method and URI to create response cache keys (headers not in {@see HttpHeaderGroup::UNSTABLE} are used by default)
45: * @method $this cacheLifetime(int<-1,max> $value) Seconds before cached responses expire when caching is enabled (`0` = cache indefinitely; `-1` = do not cache; default: `3600`)
46: * @method $this refreshCache(bool $value = true) Replace cached responses even if they haven't expired (default: false)
47: * @method $this timeout(int<0,max>|null $value) Connection timeout in seconds (`null` = use underlying default of `300` seconds; default: `null`)
48: * @method $this followRedirects(bool $value = true) Follow "Location" headers (default: false)
49: * @method $this maxRedirects(int<-1,max>|null $value) Limit the number of "Location" headers followed (`-1` = unlimited; `0` = do not follow redirects; `null` = use underlying default of `30`; default: `null`)
50: * @method $this retryAfterTooManyRequests(bool $value = true) Retry throttled requests when the endpoint returns a "Retry-After" header (default: false)
51: * @method $this retryAfterMaxSeconds(int<0,max> $value) Limit the delay between request attempts (`0` = unlimited; default: `300`)
52: * @method $this throwHttpErrors(bool $value = true) Throw exceptions for HTTP errors (default: true)
53: * @method HttpHeadersInterface head(mixed[]|null $query = null) Send a HEAD request to the endpoint
54: * @method mixed get(mixed[]|null $query = null) Send a GET request to the endpoint and return the body of the response
55: * @method mixed post(mixed[]|object|null $data = null, mixed[]|null $query = null) Send a POST request to the endpoint and return the body of the response
56: * @method mixed put(mixed[]|object|null $data = null, mixed[]|null $query = null) Send a PUT request to the endpoint and return the body of the response
57: * @method mixed patch(mixed[]|object|null $data = null, mixed[]|null $query = null) Send a PATCH request to the endpoint and return the body of the response
58: * @method mixed delete(mixed[]|object|null $data = null, mixed[]|null $query = null) Send a DELETE request to the endpoint and return the body of the response
59: * @method iterable<mixed> getP(mixed[]|null $query = null) Send a GET request to the endpoint and iterate over response pages
60: * @method iterable<mixed> postP(mixed[]|object|null $data = null, mixed[]|null $query = null) Send a POST request to the endpoint and iterate over response pages
61: * @method iterable<mixed> putP(mixed[]|object|null $data = null, mixed[]|null $query = null) Send a PUT request to the endpoint and iterate over response pages
62: * @method iterable<mixed> patchP(mixed[]|object|null $data = null, mixed[]|null $query = null) Send a PATCH request to the endpoint and iterate over response pages
63: * @method iterable<mixed> deleteP(mixed[]|object|null $data = null, mixed[]|null $query = null) Send a DELETE request to the endpoint and iterate over response pages
64: * @method mixed postR(string $data, string $mediaType, mixed[]|null $query = null) Send raw data to the endpoint in a POST request and return the body of the response
65: * @method mixed putR(string $data, string $mediaType, mixed[]|null $query = null) Send raw data to the endpoint in a PUT request and return the body of the response
66: * @method mixed patchR(string $data, string $mediaType, mixed[]|null $query = null) Send raw data to the endpoint in a PATCH request and return the body of the response
67: * @method mixed deleteR(string $data, string $mediaType, mixed[]|null $query = null) Send raw data to the endpoint in a DELETE request and return the body of the response
68: *
69: * @api
70: *
71: * @extends Builder<Curler>
72: *
73: * @generated
74: */
75: final class CurlerBuilder extends Builder
76: {
77: /**
78: * @internal
79: */
80: protected static function getService(): string
81: {
82: return Curler::class;
83: }
84:
85: /**
86: * @internal
87: */
88: protected static function getTerminators(): array
89: {
90: return [
91: 'head',
92: 'get',
93: 'post',
94: 'put',
95: 'patch',
96: 'delete',
97: 'getP',
98: 'postP',
99: 'putP',
100: 'patchP',
101: 'deleteP',
102: 'postR',
103: 'putR',
104: 'patchR',
105: 'deleteR',
106: ];
107: }
108: }
109: