Client
class Client extends Client
A Client is used to communicate the Contentful Delivery API.
A Client is only responsible for one Space. When access to multiple spaces 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 |
|
Methods
Client constructor.
Set the application name and version. The values are used as part of the X-Contentful-User-Agent header.
Set the integration name and version. The values are used as part of the X-Contentful-User-Agent header.
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.
No description
No description
Revive JSON previously cached.
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 77
__construct(string $token, string $spaceId, bool $preview = false, string|null $defaultLocale = null, array $options = [])
Client constructor.
in Client at line 84
$this
setApplication(string|null $name, string|null $version = null)
Set the application name and version. The values are used as part of the X-Contentful-User-Agent header.
in Client at line 99
$this
setIntegration(string|null $name, string|null $version = null)
Set the integration name and version. The values are used as part of the X-Contentful-User-Agent header.
in Client at line 117
protected array|null
request(string $method, string $path, array $options = [])
in Client at line 233
protected string[]
getExceptionMap()
in Client at line 247
LoggerInterface
getLogger()
at line 113
protected string
getSdkName()
The name of the library to be used in the User-Agent header.
at line 123
protected string
getSdkVersion()
The version of the library to be used in the User-Agent header.
at line 133
protected string
getApiContentType()
Returns the Content-Type (MIME-Type) to be used when communication with the API.
at line 146
Asset
getAsset(string $id, string|null $locale = null)
at line 162
ResourceArray
getAssets(Query $query = null)
at line 182
ContentType
getContentType(string $id)
at line 203
ResourceArray
getContentTypes(Query $query = null)
at line 220
EntryInterface
getEntry(string $id, string|null $locale = null)
at line 236
ResourceArray
getEntries(Query $query = null)
at line 252
Space
getSpace()
at line 276
Asset|EntryInterface
resolveLink(Link $link, string|null $locale = null)
Resolve a link to it's resource.
at line 300
Asset|ContentType|DynamicEntry|Space|DeletedAsset|DeletedContentType|DeletedEntry|ResourceArray
reviveJson(string $json)
Revive JSON previously cached.
at line 316
mixed
syncRequest(array $queryData)
Internal method for \Contentful\Delivery\Synchronization\Manager.
at line 330
bool
isPreview()
Returns true when using the Preview API.
at line 343
Manager
getSynchronizationManager()
Get an instance of the synchronization manager. Note that with the Preview API only an inital sync is giving valid results.