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 72
__construct(string $token, string $spaceId, bool $preview = false, string|null $defaultLocale = null, array $options = [])
Client constructor.
in Client at line 80
$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 95
$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 113
protected array|null
request(string $method, string $path, array $options = [])
in Client at line 229
protected string[]
getExceptionMap()
in Client at line 242
LoggerInterface
getLogger()
at line 108
protected string
getSdkName()
The name of the library to be used in the User-Agent header.
at line 118
protected string
getSdkVersion()
The version of the library to be used in the User-Agent header.
at line 128
protected string
getApiContentType()
Returns the Content-Type (MIME-Type) to be used when communication with the API.
at line 141
Asset
getAsset(string $id, string|null $locale = null)
at line 157
ResourceArray
getAssets(Query $query = null)
at line 177
ContentType
getContentType(string $id)
at line 198
ResourceArray
getContentTypes(Query $query = null)
at line 215
EntryInterface
getEntry(string $id, string|null $locale = null)
at line 231
ResourceArray
getEntries(Query $query = null)
at line 249
Space
getSpace()
at line 275
Asset|EntryInterface
resolveLink(Link $link, string|null $locale = null)
Resolve a link to it's resource.
at line 301
Asset|ContentType|DynamicEntry|Space|DeletedAsset|DeletedEntry|ResourceArray
reviveJson(string $json)
Revive JSON previously cached.
at line 318
mixed
syncRequest(array $queryData)
Internal method for \Contentful\Delivery\Synchronization\Manager
at line 333
bool
isPreview()
Returns true when using the Preview API
at line 347
Manager
getSynchronizationManager()
Get an instance of the synchronization manager. Note that with the Preview API only an inital sync is giving valid results.