2020-10-30 02:07:56 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
class Collection extends Model
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this
|
|
|
|
->addRule('$id', [
|
2020-11-08 11:14:48 +13:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-30 02:07:56 +13:00
|
|
|
'description' => 'Collection ID.',
|
|
|
|
'example' => '5e5ea5c16897e',
|
|
|
|
])
|
|
|
|
->addRule('$permissions', [
|
|
|
|
'type' => Response::MODEL_PERMISSIONS,
|
|
|
|
'description' => 'Collection permissions.',
|
|
|
|
'example' => new \stdClass,
|
|
|
|
'array' => false,
|
|
|
|
])
|
|
|
|
->addRule('name', [
|
2020-11-08 11:14:48 +13:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-30 02:07:56 +13:00
|
|
|
'description' => 'Collection name.',
|
|
|
|
'example' => 'Movies',
|
|
|
|
])
|
|
|
|
->addRule('dateCreated', [
|
2020-11-08 11:14:48 +13:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2020-10-30 02:07:56 +13:00
|
|
|
'description' => 'Collection creation date in Unix timestamp.',
|
|
|
|
'example' => 1592981250,
|
|
|
|
])
|
|
|
|
->addRule('dateUpdated', [
|
2020-11-08 11:14:48 +13:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2020-10-30 02:07:56 +13:00
|
|
|
'description' => 'Collection creation date in Unix timestamp.',
|
|
|
|
'example' => 1592981550,
|
|
|
|
])
|
|
|
|
->addRule('rules', [
|
|
|
|
'type' => Response::MODEL_RULE,
|
|
|
|
'description' => 'Collection rules.',
|
|
|
|
'default' => [],
|
|
|
|
'array' => true,
|
|
|
|
])
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Name
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName():string
|
|
|
|
{
|
|
|
|
return 'Collection';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Collection
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getType():string
|
|
|
|
{
|
|
|
|
return Response::MODEL_COLLECTION;
|
|
|
|
}
|
|
|
|
}
|