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.
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 59
__construct(string $accessToken, string $host, LoggerInterface $logger = null, Client $httpClient = null)
Client constructor.
at line 99
protected
callApi(string $method, string $uri, array $options = [])
Make a call to the API and returns the parsed JSON.
at line 159
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 164
getLogger()
at line 175
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 180
getHost()
at line 188
useApplication(ApplicationInterface $application)
Sets the current application.
The values are used as part of the X-Contentful-User-Agent header.
at line 203
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 213
useIntegration(IntegrationInterface $integration)
Sets the current integration.
The values are used as part of the X-Contentful-User-Agent header.
at line 224
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 231
static
getVersion()
at line 236
static protected
getVersionForPackage(string $package)
at line 257
abstract static protected
getPackageName()
Returns the packagist name of the current package.
at line 262
abstract static protected
getSdkName()
The name of the library to be used in the User-Agent header.
at line 267
abstract static protected
getApiContentType()
Returns the Content-Type (MIME-Type) to be used when communication with the API.