appwrite/src/Appwrite/Utopia/Response/Model/Token.php

66 lines
1.7 KiB
PHP
Raw Normal View History

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' => '',
'example' => 'bb8ea5c16897e',
])
->addRule('$createdAt', [
'type' => self::TYPE_INTEGER,
'description' => 'Token creation date in Unix timestamp.',
'default' => 0,
'example' => 1592981250,
])
->addRule('userId', [
'type' => self::TYPE_STRING,
'description' => 'User ID.',
2021-01-13 15:06:36 +00:00
'default' => '',
'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
*
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
*
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
}
}