Base
abstract class Base (View source)
Base Client class.
Constants
DEFAULT_API_BASE_URL |
|
protected DEFAULT_API_VERSION |
|
protected API_KEY_HEADER |
|
protected API_AUTHORIZATION_HEADER |
|
protected API_VERSION_HEADER |
|
Properties
protected ClientInterface | $client | Client to access Rokka. |
|
protected string|null | $defaultOrganization | Default organization. |
Methods
Constructor.
Set the credentials.
Set the API Token.
Get the API Token.
Get the API Token Payload (unverified).
Returns for how many seconds a token is valid for.
Call the API rokka endpoint.
Return the organization or the default if empty.
Gets the payload of an API JWT Token (not validated against the signature).
Details
__construct(ClientInterface $client, string|null $defaultOrganization)
Constructor.
void
setCredentials(string|null $key)
Set the credentials.
void
setToken(string|null $token)
Set the API Token.
string|null
getToken()
Get the API Token.
array|null
getTokenPayload(string|null $token = null)
Get the API Token Payload (unverified).
int
getTokenIsValidFor(string|null $token = null)
Returns for how many seconds a token is valid for.
Doesn't check for other validity (like ip restrictions)
Returns -1 if there's no token
protected ResponseInterface
call(string $method, string $path, array $options = [], bool $needsCredentials = true, array $credentials = [])
Call the API rokka endpoint.
protected string
getOrganizationName(string|null $organization = null)
Return the organization or the default if empty.
protected array|null
getUnvalidatedPayload(string $token)
Gets the payload of an API JWT Token (not validated against the signature).