2020-10-29 13:07:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class Key extends Model
|
|
|
|
|
{
|
2020-11-12 05:12:14 +00:00
|
|
|
/**
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
protected $public = false;
|
|
|
|
|
|
2020-10-29 13:07:56 +00:00
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
|
|
|
|
->addRule('$id', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Key ID.',
|
|
|
|
|
'example' => '5e5ea5c16897e',
|
|
|
|
|
])
|
|
|
|
|
->addRule('name', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Key name.',
|
|
|
|
|
'example' => 'My API Key',
|
|
|
|
|
])
|
|
|
|
|
->addRule('scopes', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Allowed permission scopes.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => ['users.read', 'documents.write'],
|
|
|
|
|
'array' => true,
|
|
|
|
|
])
|
|
|
|
|
->addRule('secret', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Secret key.',
|
|
|
|
|
'example' => '919c2d18fb5d4...a2ae413da83346ad2',
|
|
|
|
|
])
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getName():string
|
|
|
|
|
{
|
|
|
|
|
return 'Key';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Collection
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getType():string
|
|
|
|
|
{
|
|
|
|
|
return Response::MODEL_KEY;
|
|
|
|
|
}
|
|
|
|
|
}
|