abstract class Base (View source)

Base Client class.

Constants

DEFAULT_API_BASE_URL

DEFAULT_API_VERSION

API_KEY_HEADER

API_VERSION_HEADER

Properties

protected ClientInterface $client

Client to access Rokka.

protected string|null $defaultOrganization

Default organization.

Methods

__construct(ClientInterface $client, string|null $defaultOrganization)

Constructor.

setCredentials(string $key)

Set the credentials.

ResponseInterface
call(string $method, string $path, array $options = [], bool $needsCredentials = true)

Call the API rokka endpoint.

string
getOrganizationName(string|null $organization = null)

Return the organization or the default if empty.

Details

__construct(ClientInterface $client, string|null $defaultOrganization)

Constructor.

Parameters

ClientInterface $client

Client instance

string|null $defaultOrganization

setCredentials(string $key)

Set the credentials.

Parameters

string $key

API key

protected ResponseInterface call(string $method, string $path, array $options = [], bool $needsCredentials = true)

Call the API rokka endpoint.

Parameters

string $method

HTTP method to use

string $path

Path on the API

array $options

Request options

bool $needsCredentials

True if credentials are needed

Return Value

ResponseInterface

Exceptions

GuzzleException

protected string getOrganizationName(string|null $organization = null)

Return the organization or the default if empty.

Parameters

string|null $organization Organization

Return Value

string

Exceptions

RuntimeException