CFOApi
in package
Class to support CFO API call
Table of Contents
Properties
- $core : Core7
- $error : mixed
- $errorCode : mixed
- $errorMsg : mixed
- $apiUrl : string
- $headers : array<string|int, mixed>
Methods
- __construct() : mixed
- DataSQL constructor.
- display() : array<string|int, mixed>|false
- GET the structure to Display the data for a given CFO and ID
- readEntities() : array<string|int, mixed>|bool
- Read data from $cfo
- readEntity() : array<string|int, mixed>|bool
- Read data from $cfo with $id
- setAPIUrl() : void
- Set the api URL to be used in API Calls
- setHeaders() : void
- Set the headers to be used in API Calls
- update() : array<string|int, mixed>|false
- GET the structure to Display the data for a given CFO and ID
- updateEntity() : array<string|int, mixed>|bool
- Read data from $cfo
- view() : array<string|int, mixed>|false
- GET the structure to Display the data for a given CFO and ID
- addError() : bool
- Add an error in the class
- getCFOEntities() : array<string|int, mixed>|false
- Get CFO entities from API
- getCFOEntity() : array<string|int, mixed>|false
- Get CFO entity from API
Properties
$core
public
Core7
$core
$error
public
mixed
$error
= \false
$errorCode
public
mixed
$errorCode
= \null
$errorMsg
public
mixed
$errorMsg
= []
$apiUrl
protected
string
$apiUrl
= 'https://api.cloudframework.io/core/cfo/cfi'
URL to be used in API CALLS
$headers
protected
array<string|int, mixed>
$headers
= ['X-WEB-KEY' => \null, 'X-DS-TOKEN']
headers to be used in API Calls
Methods
__construct()
DataSQL constructor.
public
__construct(Core &$core) : mixed
Parameters
- $core : Core
display()
GET the structure to Display the data for a given CFO and ID
public
display(string $cfo, string|int $id[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|false
Parameters
- $cfo : string
-
The CFO value
- $id : string|int
-
The ID value
- $params : array<string|int, mixed> = []
-
optional array to send parameters or filters
Return values
array<string|int, mixed>|false —Returns the data for the given CFO and ID
readEntities()
Read data from $cfo
public
readEntities(string $cfo[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|bool
Parameters
- $cfo : string
-
The CFO value
- $params : array<string|int, mixed> = []
-
Additional parameters to pass in the request (default [])
Return values
array<string|int, mixed>|bool —Returns an array of data if found, otherwise returns false
readEntity()
Read data from $cfo with $id
public
readEntity(string $cfo, string|int $id) : array<string|int, mixed>|bool
Parameters
- $cfo : string
-
The CFO value
- $id : string|int
-
The ID value
Return values
array<string|int, mixed>|bool —Returns an array of data if found, otherwise returns false
setAPIUrl()
Set the api URL to be used in API Calls
public
setAPIUrl(string $apiUrl) : void
Parameters
- $apiUrl : string
-
The headers to be set.
setHeaders()
Set the headers to be used in API Calls
public
setHeaders(array<string|int, mixed> $headers) : void
Parameters
- $headers : array<string|int, mixed>
-
The headers to be set.
update()
GET the structure to Display the data for a given CFO and ID
public
update(string $cfo, string|int $id[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|false
Parameters
- $cfo : string
-
The CFO value
- $id : string|int
-
The ID value
- $params : array<string|int, mixed> = []
-
optional array to send parameters or filters
Return values
array<string|int, mixed>|false —Returns the data for the given CFO and ID or false if error
updateEntity()
Read data from $cfo
public
updateEntity(string $cfo, int $id, array<string|int, mixed> $data) : array<string|int, mixed>|bool
Parameters
- $cfo : string
-
The CFO value
- $id : int
-
The ID value
- $data : array<string|int, mixed>
Return values
array<string|int, mixed>|bool —Returns an array of data if found, otherwise returns false
view()
GET the structure to Display the data for a given CFO and ID
public
view(string $cfo[, string $view = 'default' ][, mixed $filters = [] ]) : array<string|int, mixed>|false
Parameters
- $cfo : string
-
The CFO value
- $view : string = 'default'
- $filters : mixed = []
Return values
array<string|int, mixed>|false —Returns the data for the given CFO and ID
addError()
Add an error in the class
private
addError(string $code, mixed $value) : bool
Parameters
- $code : string
-
Code of error
- $value : mixed
Return values
bool —Always return null to facilitate other return functions
getCFOEntities()
Get CFO entities from API
private
getCFOEntities(string $cfo[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|false
Parameters
- $cfo : string
-
CFO value
- $params : array<string|int, mixed> = []
-
Additional parameters to pass in the request (default [])
Return values
array<string|int, mixed>|false —Returns the data of the CFO entity if successful, otherwise null
getCFOEntity()
Get CFO entity from API
private
getCFOEntity(string $command, string $cfo, string|int $id[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|false
Parameters
- $command : string
-
The command to execute: display|update
- $cfo : string
-
CFO value
- $id : string|int
-
ID of the entity
- $params : array<string|int, mixed> = []
-
Additional parameters to pass in the request (default [])
Return values
array<string|int, mixed>|false —Returns the data of the CFO entity if successful, otherwise null