2020-06-23 15:01:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class Token extends Model
|
|
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
2020-11-12 11:54:16 +00:00
|
|
|
$this
|
|
|
|
|
->addRule('$id', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Token ID.',
|
2021-01-13 15:06:36 +00:00
|
|
|
'default' => '',
|
2020-11-26 06:12:24 +00:00
|
|
|
'example' => 'bb8ea5c16897e',
|
|
|
|
|
])
|
2022-06-15 12:46:52 +00:00
|
|
|
->addRule('$createdAt', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
|
|
|
|
'description' => 'Token creation date in Unix timestamp.',
|
|
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 1592981250,
|
|
|
|
|
])
|
2020-11-26 06:12:24 +00:00
|
|
|
->addRule('userId', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'User ID.',
|
2021-01-13 15:06:36 +00:00
|
|
|
'default' => '',
|
2020-11-26 06:12:24 +00:00
|
|
|
'example' => '5e5ea5c168bb8',
|
2020-11-12 11:54:16 +00:00
|
|
|
])
|
2020-11-18 19:38:31 +00:00
|
|
|
->addRule('secret', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.',
|
2021-01-13 15:06:36 +00:00
|
|
|
'default' => '',
|
2020-11-18 19:38:31 +00:00
|
|
|
'example' => '',
|
|
|
|
|
])
|
2020-11-12 11:54:16 +00:00
|
|
|
->addRule('expire', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
|
|
|
|
'description' => 'Token expiration date in Unix timestamp.',
|
|
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 1592981250,
|
|
|
|
|
])
|
|
|
|
|
;
|
2020-06-23 15:01:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
2021-10-06 14:22:38 +00:00
|
|
|
*
|
2020-06-23 15:01:20 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getName(): string
|
2020-06-23 15:01:20 +00:00
|
|
|
{
|
2020-11-12 11:54:16 +00:00
|
|
|
return 'Token';
|
2020-06-23 15:01:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-12-15 10:19:29 +00:00
|
|
|
* Get Type
|
2021-10-06 14:22:38 +00:00
|
|
|
*
|
2020-06-23 15:01:20 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getType(): string
|
2020-06-23 15:01:20 +00:00
|
|
|
{
|
2020-11-12 11:54:16 +00:00
|
|
|
return Response::MODEL_TOKEN;
|
2020-06-23 15:01:20 +00:00
|
|
|
}
|
2021-10-06 14:22:38 +00:00
|
|
|
}
|