2017-01-13 19:50:35 +01:00
|
|
|
<?php
|
2017-04-21 05:34:20 +02:00
|
|
|
/**
|
|
|
|
* @api {OBJECT} APIKey APIKey
|
2020-01-25 01:37:05 +01:00
|
|
|
* @apiVersion 4.6.0
|
2017-04-21 05:34:20 +02:00
|
|
|
* @apiGroup Data Structures
|
|
|
|
* @apiParam {String} name Name of the APIKey.
|
|
|
|
* @apiParam {String} token Token of the APIKey.
|
|
|
|
*/
|
2017-01-13 19:50:35 +01:00
|
|
|
|
|
|
|
class APIKey extends DataStore {
|
|
|
|
const TABLE = 'apikey';
|
2019-11-16 20:07:02 +01:00
|
|
|
const REGISTRATION = 'REGISTRATION';
|
|
|
|
const TICKET_CREATE = 'TICKET_CREATE';
|
|
|
|
const TYPES = [APIKey::REGISTRATION, APIKey::TICKET_CREATE];
|
2017-01-13 19:50:35 +01:00
|
|
|
|
|
|
|
public static function getProps() {
|
|
|
|
return [
|
|
|
|
'name',
|
2019-11-16 20:07:02 +01:00
|
|
|
'token',
|
|
|
|
'type'
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDefaultProps() {
|
|
|
|
return [
|
|
|
|
'type' => APIKey::REGISTRATION
|
2017-01-13 19:50:35 +01:00
|
|
|
];
|
|
|
|
}
|
2017-01-15 05:36:04 +01:00
|
|
|
|
2017-01-13 19:50:35 +01:00
|
|
|
public function toArray() {
|
|
|
|
return [
|
|
|
|
'name' => $this->name,
|
2019-11-16 20:07:02 +01:00
|
|
|
'token' => $this->token,
|
|
|
|
'type' => $this->type
|
2017-01-13 19:50:35 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|