mirror of
https://github.com/appwrite/appwrite
synced 2026-05-06 06:48:22 +00:00
82 lines
No EOL
2.4 KiB
PHP
82 lines
No EOL
2.4 KiB
PHP
<?php
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
use Appwrite\Utopia\Response;
|
|
use Appwrite\Utopia\Response\Model\AttributeString;
|
|
|
|
class AttributeURL extends AttributeString
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this
|
|
->addRule('key', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Attribute Key.',
|
|
'default' => '',
|
|
'example' => 'fullName',
|
|
])
|
|
->addRule('type', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Attribute type.',
|
|
'default' => '',
|
|
'example' => 'string',
|
|
])
|
|
->addRule('status', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Attribute status. Possible values: `available`, `processing`, `deleting`, or `failed`',
|
|
'default' => '',
|
|
'example' => 'string',
|
|
])
|
|
->addRule('required', [
|
|
'type' => self::TYPE_BOOLEAN,
|
|
'description' => 'Is attribute required?',
|
|
'default' => false,
|
|
'example' => true,
|
|
])
|
|
->addRule('array', [
|
|
'type' => self::TYPE_BOOLEAN,
|
|
'description' => 'Is attribute an array?',
|
|
'default' => false,
|
|
'example' => false,
|
|
'require' => false
|
|
])
|
|
->addRule('format', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'String format.',
|
|
'default' => APP_DATABASE_ATTRIBUTE_URL,
|
|
'example' => APP_DATABASE_ATTRIBUTE_URL,
|
|
'array' => false,
|
|
'required' => true,
|
|
])
|
|
->addRule('default', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
|
'default' => null,
|
|
'example' => 'http://example.com',
|
|
'array' => false,
|
|
'require' => false,
|
|
])
|
|
;
|
|
}
|
|
|
|
/**
|
|
* Get Name
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getName():string
|
|
{
|
|
return 'AttributeURL';
|
|
}
|
|
|
|
/**
|
|
* Get Collection
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getType():string
|
|
{
|
|
return Response::MODEL_ATTRIBUTE_URL;
|
|
}
|
|
} |