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 64
__construct(string $accessToken, string $host, LoggerInterface $logger = null, Client $httpClient = null, bool $storeMessages = true)
Client constructor.
at line 106
protected
callApi(string $method, string $uri, array $options = [])
Make a call to the API and returns the parsed JSON.
at line 168
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 173
getLogger()
at line 184
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 192
clearMesssages()
Clears the store of Message objects.
at line 197
getHost()
at line 205
useApplication(ApplicationInterface $application)
Sets the current application.
The values are used as part of the X-Contentful-User-Agent header.
at line 220
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 230
useIntegration(IntegrationInterface $integration)
Sets the current integration.
The values are used as part of the X-Contentful-User-Agent header.
at line 241
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 248
static
getVersion()
at line 253
static protected
getVersionForPackage(string $package)
at line 274
abstract static protected
getPackageName()
Returns the packagist name of the current package.
at line 279
abstract static protected
getSdkName()
The name of the library to be used in the User-Agent header.
at line 284
abstract static protected
getApiContentType()
Returns the Content-Type (MIME-Type) to be used when communication with the API.