Alternc
latest
Alternc logiel libre pour l'hébergement
|
Service API used by server to export API methods this class can be used to implement an API service / endpoint a REST and POST api is provided as an example. More...
Public Member Functions | |
__construct ($options) | |
Constructor of the Api Service Wrapper. More... | |
auth ($auth) | |
Authenticate into an AlternC server. More... | |
call ($request) | |
Manage an API Call. More... | |
doc ($element) | |
Return documentation of the API, either general (no parameters) or for a specific action or auth class. More... | |
getDb () | |
Getter for the databaseAdapter (used by authAdapter) More... | |
Public Attributes | |
$db | |
$token | |
const | ERR_INVALID_ARGUMENT = 111801 |
const | ERR_METHOD_DENIED = 111802 |
const | ERR_INVALID_ANSWER = 111803 |
const | ERR_SETUID_FORBIDDEN = 111804 |
const | ERR_SETUID_USER_NOT_FOUND = 111805 |
const | ERR_OBJECT_NOT_FOUND = 111806 |
const | ERR_ACTION_NOT_FOUND = 111807 |
const | ERR_INVALID_TOKEN = 111808 |
Private Attributes | |
$loggerList | |
$allowedAuth | |
Service API used by server to export API methods this class can be used to implement an API service / endpoint a REST and POST api is provided as an example.
Definition at line 11 of file Service.php.
Alternc_Api_Service::__construct | ( | $options | ) |
Constructor of the Api Service Wrapper.
$options | an hash with databaseAdapter: an already initialized PDO object see http://php.net/PDO loginAdapterList: (not mandatory) list of allowed authentication adapters (their codename) see Alternc/Api/Auth/* loggerAdapter: (not mandatory), a PSR3-Interface-compliant class or a list of it. see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md for more information |
Definition at line 40 of file Service.php.
Alternc_Api_Service::auth | ( | $auth | ) |
Authenticate into an AlternC server.
$auth | hash with method: string describing the authentication name (in Alternc_Api_Auth_xxx) options: array list of parameters for the corresponding auth. if 'uid' is set in the option hash, the account MUST be an administrator one and as a result, the returned Api_Token will be set to this UID and not the admin one. |
Definition at line 78 of file Service.php.
References $token.
Alternc_Api_Service::call | ( | $request | ) |
Manage an API Call.
Alternc_Api_Request | $request | The API call the request must have "object" and "action" elements, and a "token" to authenticate "options" are sent as it is to the Api Call. |
Definition at line 130 of file Service.php.
References $request, $token, and Alternc_Api_Token\tokenGet().
Alternc_Api_Service::doc | ( | $element | ) |
Return documentation of the API, either general (no parameters) or for a specific action or auth class.
string | $element | the name of the object for which documentation is requested |
Definition at line 165 of file Service.php.
Alternc_Api_Service::getDb | ( | ) |
Getter for the databaseAdapter (used by authAdapter)
Definition at line 190 of file Service.php.
References $db.
|
private |
Definition at line 15 of file Service.php.
Alternc_Api_Service::$db |
Definition at line 13 of file Service.php.
Referenced by getDb().
|
private |
Definition at line 14 of file Service.php.
Alternc_Api_Service::$token |
Definition at line 16 of file Service.php.
const Alternc_Api_Service::ERR_ACTION_NOT_FOUND = 111807 |
Definition at line 24 of file Service.php.
const Alternc_Api_Service::ERR_INVALID_ANSWER = 111803 |
Definition at line 20 of file Service.php.
const Alternc_Api_Service::ERR_INVALID_ARGUMENT = 111801 |
Definition at line 18 of file Service.php.
const Alternc_Api_Service::ERR_INVALID_TOKEN = 111808 |
Definition at line 25 of file Service.php.
const Alternc_Api_Service::ERR_METHOD_DENIED = 111802 |
Definition at line 19 of file Service.php.
const Alternc_Api_Service::ERR_OBJECT_NOT_FOUND = 111806 |
Definition at line 23 of file Service.php.
const Alternc_Api_Service::ERR_SETUID_FORBIDDEN = 111804 |
Definition at line 21 of file Service.php.
const Alternc_Api_Service::ERR_SETUID_USER_NOT_FOUND = 111805 |
Definition at line 22 of file Service.php.