BaseClient
class BaseClient implements ClientInterface
Abstract client for common code for the different clients.
Methods
Client constructor.
Make a call to the API and returns the parsed JSON.
Override this method for registering a custom namespace where the Client will look for an exception. If no exception is found in the custom namespace, the default namespace will be used.
No description
Returns an array of Message objects.
Clears the store of Message objects.
No description
Set the application name and version.
Set the integration name and version.
No description
No description
Returns the packagist name of the current package.
The name 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.
Details
at line 63
__construct(string $accessToken, string $host, LoggerInterface $logger = null, Client $httpClient = null, bool $storeMessages = true)
Client constructor.
at line 105
protected
callApi(string $method, string $uri, array $options = [])
Make a call to the API and returns the parsed JSON.
at line 167
protected string|null
getExceptionNamespace()
Override this method for registering a custom namespace where the Client will look for an exception. If no exception is found in the custom namespace, the default namespace will be used.
at line 172
getLogger()
at line 183
Message[]
getMessages()
Returns an array of Message objects.
This can be used to inspect all API calls that have been made by the current client.
at line 191
clearMesssages()
Clears the store of Message objects.
at line 196
getHost()
at line 204
useApplication(ApplicationInterface $application)
Sets the current application.
The values are used as part of the X-Contentful-User-Agent header.
at line 219
setApplication(string $name, string $version = '')
Set the application name and version.
The values are used as part of the X-Contentful-User-Agent header.
at line 229
useIntegration(IntegrationInterface $integration)
Sets the current integration.
The values are used as part of the X-Contentful-User-Agent header.
at line 240
setIntegration(string $name, string $version = '')
Set the integration name and version.
The values are used as part of the X-Contentful-User-Agent header.
at line 247
static
getVersion()
at line 252
static protected
getVersionForPackage(string $package)
at line 273
abstract static protected
getPackageName()
Returns the packagist name of the current package.
at line 278
abstract static protected
getSdkName()
The name of the library to be used in the User-Agent header.
at line 283
abstract static protected
getApiContentType()
Returns the Content-Type (MIME-Type) to be used when communication with the API.