2021-06-08 19:30:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class Attribute extends Model
|
|
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
2021-08-21 04:48:28 +00:00
|
|
|
->addRule('key', [
|
2021-06-09 21:10:19 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2021-08-21 04:48:28 +00:00
|
|
|
'description' => 'Attribute Key.',
|
2021-06-09 21:10:19 +00:00
|
|
|
'default' => '',
|
2021-08-21 04:48:28 +00:00
|
|
|
'example' => 'fullName',
|
2021-06-09 21:10:19 +00:00
|
|
|
])
|
2021-08-21 04:48:28 +00:00
|
|
|
->addRule('type', [
|
2021-06-08 19:30:42 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2021-08-21 04:48:28 +00:00
|
|
|
'description' => 'Attribute type.',
|
2021-06-08 19:30:42 +00:00
|
|
|
'default' => '',
|
2021-08-21 04:48:28 +00:00
|
|
|
'example' => 'string',
|
2021-06-08 19:30:42 +00:00
|
|
|
])
|
2021-08-21 04:48:28 +00:00
|
|
|
->addRule('status', [
|
2021-06-08 19:30:42 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2021-10-05 00:23:15 +00:00
|
|
|
'description' => 'Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`',
|
2021-06-08 19:30:42 +00:00
|
|
|
'default' => '',
|
2021-08-23 20:39:31 +00:00
|
|
|
'example' => 'available',
|
2021-06-08 19:30:42 +00:00
|
|
|
])
|
|
|
|
|
->addRule('required', [
|
|
|
|
|
'type' => self::TYPE_BOOLEAN,
|
|
|
|
|
'description' => 'Is attribute required?',
|
|
|
|
|
'default' => false,
|
2021-07-05 18:28:38 +00:00
|
|
|
'example' => true,
|
2021-06-08 19:30:42 +00:00
|
|
|
])
|
|
|
|
|
->addRule('array', [
|
|
|
|
|
'type' => self::TYPE_BOOLEAN,
|
|
|
|
|
'description' => 'Is attribute an array?',
|
|
|
|
|
'default' => false,
|
2022-09-02 23:19:20 +00:00
|
|
|
'required' => false,
|
2021-06-08 19:30:42 +00:00
|
|
|
'example' => false,
|
|
|
|
|
])
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-14 08:26:16 +00:00
|
|
|
public array $conditions = [];
|
|
|
|
|
|
2021-06-08 19:30:42 +00:00
|
|
|
/**
|
|
|
|
|
* Get Name
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-06-08 19:30:42 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getName(): string
|
2021-06-08 19:30:42 +00:00
|
|
|
{
|
|
|
|
|
return 'Attribute';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Collection
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-06-08 19:30:42 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getType(): string
|
2021-06-08 19:30:42 +00:00
|
|
|
{
|
|
|
|
|
return Response::MODEL_ATTRIBUTE;
|
|
|
|
|
}
|
2021-08-23 19:06:47 +00:00
|
|
|
}
|