class Client

Abstract client for common code for the different clients.

Methods

__construct(string $token, string $baseUri, string $api, LoggerInterface $logger = null, ClientInterface $guzzle = null)

Client constructor.

$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.

$this
setIntegration(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.

array
request(string $method, string $path, array $options = [])

No description

string
getSdkNameAndVersion()

The name of the library to be used in the User-Agent header.

string
getContentfulUserAgent()

Returns the value of the User-Agent header for any requests made to Contentful

static array
decodeJson(string $json)

No description

Details

at line 86
__construct(string $token, string $baseUri, string $api, LoggerInterface $logger = null, ClientInterface $guzzle = null)

Client constructor.

Parameters

string $token
string $baseUri
string $api
LoggerInterface $logger
ClientInterface $guzzle

at line 105
$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.

Parameters

string|null $name
string|null $version

Return Value

$this

at line 124
$this setIntegration(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.

Parameters

string|null $name
string|null $version

Return Value

$this

at line 142
protected array request(string $method, string $path, array $options = [])

Parameters

string $method
string $path
array $options

Return Value

array

at line 251
abstract protected string getSdkNameAndVersion()

The name of the library to be used in the User-Agent header.

Return Value

string

at line 258
protected string getContentfulUserAgent()

Returns the value of the User-Agent header for any requests made to Contentful

Return Value

string

at line 307
static array decodeJson(string $json)

Parameters

string $json JSON encoded object or array

Return Value

array

Exceptions

RuntimeException On invalid JSON