2021-08-27 17:11:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class AttributeList extends Model
|
|
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
2022-02-27 09:57:09 +00:00
|
|
|
->addRule('total', [
|
2021-08-27 17:11:29 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2022-02-28 09:25:38 +00:00
|
|
|
'description' => 'Total number of attributes in the given collection.',
|
2021-08-27 17:11:29 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 5,
|
|
|
|
|
])
|
|
|
|
|
->addRule('attributes', [
|
2021-09-14 08:26:16 +00:00
|
|
|
'type' => [
|
|
|
|
|
Response::MODEL_ATTRIBUTE_BOOLEAN,
|
|
|
|
|
Response::MODEL_ATTRIBUTE_INTEGER,
|
|
|
|
|
Response::MODEL_ATTRIBUTE_FLOAT,
|
|
|
|
|
Response::MODEL_ATTRIBUTE_EMAIL,
|
2021-10-07 02:25:03 +00:00
|
|
|
Response::MODEL_ATTRIBUTE_ENUM,
|
2021-09-14 08:26:16 +00:00
|
|
|
Response::MODEL_ATTRIBUTE_URL,
|
|
|
|
|
Response::MODEL_ATTRIBUTE_IP,
|
2022-07-25 08:53:41 +00:00
|
|
|
Response::MODEL_ATTRIBUTE_DATETIME,
|
2023-03-14 08:24:53 +00:00
|
|
|
Response::MODEL_ATTRIBUTE_RELATIONSHIP,
|
2025-08-22 07:17:15 +00:00
|
|
|
Response::MODEL_ATTRIBUTE_POINT,
|
|
|
|
|
Response::MODEL_ATTRIBUTE_LINE,
|
|
|
|
|
Response::MODEL_ATTRIBUTE_POLYGON,
|
2021-09-14 08:26:16 +00:00
|
|
|
Response::MODEL_ATTRIBUTE_STRING // needs to be last, since its condition would dominate any other string attribute
|
|
|
|
|
],
|
2021-08-27 17:11:29 +00:00
|
|
|
'description' => 'List of attributes.',
|
|
|
|
|
'default' => [],
|
2021-09-14 08:26:16 +00:00
|
|
|
'array' => true
|
2021-08-27 17:11:29 +00:00
|
|
|
])
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getName(): string
|
2021-08-27 17:11:29 +00:00
|
|
|
{
|
|
|
|
|
return 'Attributes List';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-09-15 15:17:09 +00:00
|
|
|
* Get Type
|
2021-08-27 17:11:29 +00:00
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getType(): string
|
2021-08-27 17:11:29 +00:00
|
|
|
{
|
|
|
|
|
return Response::MODEL_ATTRIBUTE_LIST;
|
|
|
|
|
}
|
2022-05-23 14:54:50 +00:00
|
|
|
}
|