TerApiClient
class \
- Extends
- AbstractJsonApiClient
Connector to the TER REST API at https://extensions.typo3.org/api/v1.
Reads the catalogue live, without the local mirror of extensions.xml.gz. Downloading is not its business: an extension is fetched from the archive TER stores for it, which TerExtensionRemote already does.
Responses are cached for a short period, so paginating and navigating back and forth does not hammer TER, and a rate limit is not spent on repeating the same question; see AbstractJsonApiClient.
Internal
This class is a specific implementation and is not part of the Public TYPO3 API.
Table of Contents
Constants
- UNAVAILABLE_CACHE_IDENTIFIER : mixed = 'ter_api_unavailable'
- UNAVAILABLE_LIFETIME : mixed = 300
Properties
Methods
- __construct() : mixed
- getExtension() : TerExtension|null
- getVersions() : array
- query() : TerExtensionListResult
- getRequestOptions() : array<string, mixed>
- Error statuses are inspected here rather than thrown by the HTTP client, since a 404 is an answer. The timeouts are deliberately short: the imported list answers when TER is slow, which beats leaving the module hanging.
- isSuccessfulResponse() : bool
- request() : array|null
- requestJson() : array|null
- unwrapEnvelope() : array|null
- Unwraps the single-element outer array the API uses to envelope single resources, e.g. [{...}] becomes {...}. Recognized by the presence of the given discriminator key on the inner element.
Constants
UNAVAILABLE_CACHE_IDENTIFIER
protected
mixed
UNAVAILABLE_CACHE_IDENTIFIER
= 'ter_api_unavailable'
UNAVAILABLE_LIFETIME
protected
mixed
UNAVAILABLE_LIFETIME
= 300
Properties
$cache read-only
protected
FrontendInterface
$cache
$requestFactory read-only
protected
RequestFactory
$requestFactory
$typo3Version read-only
protected
Typo3Version
$typo3Version
Methods
__construct()
public
__construct(RequestFactory $requestFactory, FrontendInterface $cache, Typo3Version $typo3Version) : mixed
Parameters
- $requestFactory : RequestFactory
- $cache : FrontendInterface
- $typo3Version : Typo3Version
getExtension()
public
getExtension(string $extensionKey) : TerExtension|null
Parameters
- $extensionKey : string
Return values
TerExtension|nullgetVersions()
public
getVersions(string $extensionKey) : array
Parameters
- $extensionKey : string
Return values
arrayquery()
public
query(string $search, int $typo3MajorVersion[, int $page = 1 ][, int $perPage = 20 ][, string|null $category = null ][, string|null $username = null ]) : TerExtensionListResult
Parameters
- $search : string
- $typo3MajorVersion : int
- $page : int = 1
- $perPage : int = 20
- $category : string|null = null
- $username : string|null = null
Return values
TerExtensionListResultgetRequestOptions()
Error statuses are inspected here rather than thrown by the HTTP client, since a 404 is an answer. The timeouts are deliberately short: the imported list answers when TER is slow, which beats leaving the module hanging.
protected
getRequestOptions() : array<string, mixed>
Return values
array<string, mixed>isSuccessfulResponse()
protected
isSuccessfulResponse(ResponseInterface $response) : bool
Parameters
- $response : ResponseInterface
Return values
boolrequest()
protected
request(string $path[, array<string, mixed> $query = [] ]) : array|null
Parameters
- $path : string
- $query : array<string, mixed> = []
Tags
Return values
array|null —null when the remote does not know the resource
requestJson()
protected
requestJson(string $url) : array|null
Parameters
- $url : string
Tags
Return values
array|null —null when the remote does not know the resource
unwrapEnvelope()
Unwraps the single-element outer array the API uses to envelope single resources, e.g. [{...}] becomes {...}. Recognized by the presence of the given discriminator key on the inner element.
protected
unwrapEnvelope(array|null $data, string $discriminatorKey) : array|null
Parameters
- $data : array|null
- $discriminatorKey : string