Methods |
final
public
|
getCurler(
string $path,
int<-1, max>|null $expiry = -1,
?HttpHeadersInterface $headers = null,
?CurlerPagerInterface $pager = null,
bool $alwaysPaginate = false,
?DateFormatterInterface $dateFormatter = null,
): CurlerInterface
Get a Curler instance bound to an API endpoint, optionally overriding the
provider's default configuration
Get a Curler instance bound to an API endpoint, optionally overriding the
provider's default configuration
Parameters
$expiry |
Number of seconds before cached responses
expire, or:
-
null : do not cache responses
-
0 : cache responses indefinitely
-
-1 (default): use value returned by {@see getExpiry()}
|
|
#
|
final
public
|
getEndpointUrl(string $path): string
Get the URL of an API endpoint
Get the URL of an API endpoint
|
#
|
abstract
protected
|
getBaseUrl(string $path): string
Get the base URL of the upstream API
Get the base URL of the upstream API
$path should be ignored unless the provider uses endpoint-specific base
URLs to connect to the API. It must not be added to the return value.
|
#
|
protected
|
getHeaders(string $path): ?HttpHeadersInterface
Override to return HTTP headers required by the upstream API
Override to return HTTP headers required by the upstream API
|
#
|
final
protected
|
headers(): HttpHeaders
Get a new HttpHeaders instance
Get a new HttpHeaders instance
|
#
|
protected
|
getPager(string $path): ?CurlerPagerInterface
Override to return a handler for paginated data from the upstream API
Override to return a handler for paginated data from the upstream API
|
#
|
protected
|
getAlwaysPaginate(string $path): bool
Override if the pager returned by getPager() should be used to process
requests even if no pagination is required
Override if the pager returned by getPager() should be used to process
requests even if no pagination is required
|
#
|
protected
|
getExpiry(string $path): int<0, max>|null
Override to specify the number of seconds before cached responses from
the upstream API expire
Override to specify the number of seconds before cached responses from
the upstream API expire
Returns
-
null (default): do not cache responses
-
0 : cache responses indefinitely
|
#
|
protected
|
filterCurler(CurlerInterface $curler, string $path): CurlerInterface
Override to customise Curler instances before they are used to perform
sync operations
Override to customise Curler instances before they are used to perform
sync operations
Values passed to {@see HttpSyncProvider::getCurler()} are applied before
this method is called.
|
#
|
final
public
|
getDefinition(string $entity): SyncDefinitionInterface
Get the provider's implementation of sync operations for an entity
Get the provider's implementation of sync operations for an entity
Implements
|
#
|
protected
|
getHttpDefinition<TEntity is SyncEntityInterface>(class-string<TEntity> $entity): HttpSyncDefinition<TEntity, $this>
Override to implement sync operations by returning an HttpSyncDefinition
object for the given entity
Override to implement sync operations by returning an HttpSyncDefinition
object for the given entity
|
#
|
final
protected
|
builderFor<TEntity is SyncEntityInterface>(class-string<TEntity> $entity): HttpSyncDefinitionBuilder<TEntity, $this>
Get a new HttpSyncDefinitionBuilder for an entity
Get a new HttpSyncDefinitionBuilder for an entity
|
#
|
final
public
|
checkHeartbeat(int $ttl = 300)
Throw an exception if the backend isn't reachable
Throw an exception if the backend isn't reachable
Positive results should be cached for $ttl seconds. Negative results
must never be cached.
Overrides
Implements
|
#
|
protected
|
getHeartbeat(): mixed
Get a low-cost resource from the backend to confirm reachability
Get a low-cost resource from the backend to confirm reachability
|
#
|