Client
class Client extends BaseClient
A Client is used to communicate the Contentful Delivery API.
A Client is only responsible for one space and one environment. When access to multiple spaces or environments is required, create multiple Clients.
This class can be configured to use the Preview API instead of the Delivery API. This grants access to not yet published content.
Constants
VERSION |
|
API_DELIVERY |
|
API_PREVIEW |
|
URI_DELIVERY |
The URI for the Delivery API. |
URI_PREVIEW |
The URI for the Preview API. |
Methods
Client constructor.
{@inheritdoc}
No description
The name of the library to be used in the User-Agent header.
The version of the library to be used in the User-Agent header.
Returns the Content-Type (MIME-Type) to be used when communication with the API.
Returns the instance repository currently in use.
No description
No description
Resolve a link to it's resource.
Parse a JSON string.
Checks a data structure and extracts the environment ID, if present.
Internal method for \Contentful\Delivery\Synchronization\Manager.
Returns true when using the Preview API.
Get an instance of the synchronization manager. Note that with the Preview API only an inital sync is giving valid results.
Details
at line 112
__construct(string $token, string $spaceId, string $environmentId = 'master', bool $preview = false, string|null $defaultLocale = null, array $options = [])
Client constructor.
at line 156
getApi()
{@inheritdoc}
at line 164
ResourceBuilder
getResourceBuilder()
at line 174
protected string
getSdkName()
The name of the library to be used in the User-Agent header.
at line 184
protected string
getSdkVersion()
The version of the library to be used in the User-Agent header.
at line 194
protected string
getApiContentType()
Returns the Content-Type (MIME-Type) to be used when communication with the API.
at line 204
InstanceRepository
getInstanceRepository()
Returns the instance repository currently in use.
at line 231
Asset
getAsset(string $assetId, string|null $locale = null)
at line 248
ResourceArray
getAssets(Query $query = null)
at line 266
ContentType
getContentType(string $contentTypeId)
at line 281
ResourceArray
getContentTypes(Query $query = null)
at line 292
Environment
getEnvironment()
at line 321
Entry
getEntry(string $entryId, string|null $locale = null)
at line 338
ResourceArray
getEntries(Query $query = null)
at line 354
Space
getSpace()
at line 374
Asset|Entry
resolveLink(Link $link, string|null $locale = null)
Resolve a link to it's resource.
at line 404
ResourceInterface|ResourceArray
parseJson(string $json)
Parse a JSON string.
at line 467
string|null
extractEnvironmentId(array $data)
Checks a data structure and extracts the environment ID, if present.
at line 504
mixed
syncRequest(array $queryData)
Internal method for \Contentful\Delivery\Synchronization\Manager.
at line 516
bool
isPreview()
Returns true when using the Preview API.
at line 529
Manager
getSynchronizationManager()
Get an instance of the synchronization manager. Note that with the Preview API only an inital sync is giving valid results.