2021-08-13 20:58:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
|
2021-08-27 20:24:48 +00:00
|
|
|
class AttributeURL extends Attribute
|
2021-08-13 20:58:36 +00:00
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
2021-08-24 14:31:02 +00:00
|
|
|
parent::__construct();
|
|
|
|
|
|
2021-08-13 20:58:36 +00:00
|
|
|
$this
|
2022-03-14 06:03:55 +00:00
|
|
|
->addRule('key', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Attribute Key.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => 'githubUrl',
|
|
|
|
|
])
|
|
|
|
|
->addRule('type', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Attribute type.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => 'string',
|
|
|
|
|
])
|
2021-08-13 20:58:36 +00:00
|
|
|
->addRule('format', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'String format.',
|
2022-09-02 23:19:20 +00:00
|
|
|
'default' => APP_DATABASE_ATTRIBUTE_URL,
|
|
|
|
|
'example' => APP_DATABASE_ATTRIBUTE_URL,
|
2021-08-13 20:58:36 +00:00
|
|
|
])
|
2021-08-16 20:06:27 +00:00
|
|
|
->addRule('default', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
|
|
|
|
'default' => null,
|
2022-09-02 23:19:20 +00:00
|
|
|
'required' => false,
|
2021-08-16 20:06:27 +00:00
|
|
|
'example' => 'http://example.com',
|
|
|
|
|
])
|
2021-08-13 20:58:36 +00:00
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-14 08:26:16 +00:00
|
|
|
public array $conditions = [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'format' => \APP_DATABASE_ATTRIBUTE_URL
|
|
|
|
|
];
|
|
|
|
|
|
2021-08-13 20:58:36 +00:00
|
|
|
/**
|
|
|
|
|
* Get Name
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-08-13 20:58:36 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getName(): string
|
2021-08-13 20:58:36 +00:00
|
|
|
{
|
2021-08-16 19:54:25 +00:00
|
|
|
return 'AttributeURL';
|
2021-08-13 20:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-09-15 15:17:09 +00:00
|
|
|
* Get Type
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-08-13 20:58:36 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getType(): string
|
2021-08-13 20:58:36 +00:00
|
|
|
{
|
2021-08-16 19:54:25 +00:00
|
|
|
return Response::MODEL_ATTRIBUTE_URL;
|
2021-08-13 20:58:36 +00:00
|
|
|
}
|
2022-05-23 14:54:50 +00:00
|
|
|
}
|