1
0
Fork 0
mirror of synced 2024-09-22 04:21:21 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/Rule.php

89 lines
2.5 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class Rule extends Model
{
public function __construct()
{
$this
->addRule('$id', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Rule ID.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('$collection', [ // TODO remove this from public response
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Rule Collection.',
'example' => '5e5e66c16897e',
])
->addRule('type', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Rule type. Possible values: ',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'title',
])
->addRule('key', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Rule key.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'title',
])
->addRule('label', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Rule label.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'Title',
])
->addRule('default', [ // TODO should be of mixed types
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Rule default value.',
'default' => '',
2021-01-14 04:06:36 +13:00
'example' => 'Movie Name',
])
->addRule('array', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_BOOLEAN,
'description' => 'Is array?',
2021-01-14 04:06:36 +13:00
'default' => false,
'example' => false,
])
->addRule('required', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_BOOLEAN,
'description' => 'Is required?',
2021-01-14 04:06:36 +13:00
'default' => false,
'example' => true,
])
->addRule('list', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'List of allowed values',
'array' => true,
'default' => [],
2021-02-02 10:31:54 +13:00
'example' => '5e5ea5c168099',
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'Rule';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_RULE;
}
}