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 64
__construct(string $accessToken, string $host, LoggerInterface $logger = \null, Client $httpClient = \null)
Client constructor.
at line 106
protected array
callApi(string $method, string $uri, array $options = [])
Make a call to the API and returns the parsed JSON.
at line 172
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 180
LoggerInterface
getLogger()
at line 191
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 199
string
getHost()
at line 207
useApplication(ApplicationInterface $application)
Sets the current application.
The values are used as part of the X-Contentful-User-Agent header.
at line 222
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 232
useIntegration(IntegrationInterface $integration)
Sets the current integration.
The values are used as part of the X-Contentful-User-Agent header.
at line 243
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 253
static string
getVersion()
at line 263
static protected string
getVersionForPackage(string $package)
at line 286
abstract static protected string
getPackageName()
Returns the packagist name of the current package.
at line 293
abstract static protected string
getSdkName()
The name of the library to be used in the User-Agent header.
at line 300
abstract static protected string
getApiContentType()
Returns the Content-Type (MIME-Type) to be used when communication with the API.