OlcRequest
in package
Table of Contents
Properties
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
$apiKey
protected
string
$apiKey
$client
protected
Client|null
$client
= null
$endpoint
protected
string|null
$endpoint
= null
$version
protected
string|null
$version
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
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
Return values
mixed —The response from the API.
getApiKey()
Get the API key.
public
getApiKey() : string
Return values
stringgetClient()
public
getClient() : Client
Return values
Clientpatch()
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
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
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
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
stringinitOptions()
protected
initOptions([mixed $options = [] ]) : array<string|int, mixed>
Parameters
- $options : mixed = []