Documentation

OlcRequest
in package

Table of Contents

Properties

$apiKey  : string
$client  : Client|null
$endpoint  : string|null
$version  : string|null

Methods

__construct()  : mixed
delete()  : mixed
Send a DELETE request to the API.
get()  : mixed
Send a GET request to the API.
getApiKey()  : string
Get the API key.
getClient()  : Client
patch()  : mixed
Send a PATCH request to the API.
post()  : mixed
Send a POST request to the API.
put()  : mixed
Send a PUT request to the API.
retrieveValueByPath()  : mixed
setApiKey()  : void
Set the API key.
toBaseUrl()  : string
initOptions()  : array<string|int, mixed>

Properties

$endpoint

protected string|null $endpoint = null

Methods

__construct()

public __construct(string|null $version[, string|null $endpoint = null ]) : mixed
Parameters
$version : string|null
$endpoint : string|null = null

delete()

Send a DELETE request to the API.

public delete(string $route[, bool $options = [] ]) : mixed
Parameters
$route : string

(required) The route to be called.

$options : bool = []

['authorize'] (optional) If true, the request will initiate with the API key

Tags
throws
OlcRequestError

if the request fails

Return values
mixed

The response from the API.

get()

Send a GET request to the API.

public get(string $route[, bool $options = [] ]) : mixed
Parameters
$route : string

(required) The route to be called.

$options : bool = []

['authorize'] (optional) If true, the request will initiate with the API key

Tags
throws
OlcRequestError

if the request fails

Return values
mixed

The response from the API.

getApiKey()

Get the API key.

public getApiKey() : string
Return values
string

getClient()

public getClient() : Client
Return values
Client

patch()

Send a PATCH request to the API.

public patch(string $route[, array<string, mixed> $data = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$route : string

(required) The route to be called.

$data : array<string, mixed> = []

(optional) Data to be sent with the request

$options : array<string|int, mixed> = []

['client'] (optional) Client options pass to the Guzzle

Tags
throws
OlcRequestError

if the request fails

Return values
mixed

The response from the API.

post()

Send a POST request to the API.

public post(string $route[, array<string, mixed> $data = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$route : string

(required) The route to be called.

$data : array<string, mixed> = []

(optional) Data to be sent with the request

$options : array<string|int, mixed> = []

['client'] (optional) Client options pass to the Guzzle

Tags
throws
OlcRequestError

if the request fails

Return values
mixed

The response from the API.

put()

Send a PUT request to the API.

public put(string $route[, array<string, mixed> $data = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$route : string

(required) The route to be called.

$data : array<string, mixed> = []

(optional) Data to be sent with the request

$options : array<string|int, mixed> = []

['client'] (optional) Client options pass to the Guzzle

Tags
throws
OlcRequestError

if the request fails

Return values
mixed

The response from the API.

retrieveValueByPath()

public retrieveValueByPath(ResponseInterface $response[, string|null $key = null ]) : mixed
Parameters
$response : ResponseInterface
$key : string|null = null

setApiKey()

Set the API key.

public setApiKey(string $apiKey) : void
Parameters
$apiKey : string

toBaseUrl()

public toBaseUrl(string ...$routes) : string
Parameters
$routes : string
Return values
string

initOptions()

protected initOptions([mixed $options = [] ]) : array<string|int, mixed>
Parameters
$options : mixed = []
Return values
array<string|int, mixed>

        
On this page

Search results