2020-10-29 13:07:56 +00: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-07 22:14:48 +00:00
'type' => self :: TYPE_STRING ,
2020-10-29 13:07:56 +00:00
'description' => 'Collection ID.' ,
2021-01-13 15:06:36 +00:00
'default' => '' ,
2020-10-29 13:07:56 +00:00
'example' => '5e5ea5c16897e' ,
])
2022-06-15 12:46:52 +00:00
-> addRule ( '$createdAt' , [
2022-07-04 09:55:11 +00:00
'type' => self :: TYPE_DATETIME ,
2022-09-04 21:26:16 +00:00
'description' => 'Collection creation date in ISO 8601 format.' ,
2022-07-04 09:55:11 +00:00
'default' => '' ,
2022-08-14 10:27:07 +00:00
'example' => self :: TYPE_DATETIME_EXAMPLE ,
2022-06-15 12:46:52 +00:00
])
-> addRule ( '$updatedAt' , [
2022-07-04 09:55:11 +00:00
'type' => self :: TYPE_DATETIME ,
2022-09-04 21:26:16 +00:00
'description' => 'Collection update date in ISO 8601 format.' ,
2022-07-04 09:55:11 +00:00
'default' => '' ,
2022-08-14 10:27:07 +00:00
'example' => self :: TYPE_DATETIME_EXAMPLE ,
2022-06-15 12:46:52 +00:00
])
2022-08-02 09:18:49 +00:00
-> addRule ( '$permissions' , [
2021-06-10 18:19:10 +00:00
'type' => self :: TYPE_STRING ,
2023-10-13 13:43:44 +00:00
'description' => 'Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).' ,
2021-06-10 18:19:10 +00:00
'default' => '' ,
2022-08-14 10:33:36 +00:00
'example' => [ 'read("any")' ],
2021-06-10 18:19:10 +00:00
'array' => true
2020-10-29 13:07:56 +00:00
])
2022-06-22 10:51:49 +00:00
-> addRule ( 'databaseId' , [
'type' => self :: TYPE_STRING ,
'description' => 'Database ID.' ,
'default' => '' ,
'example' => '5e5ea5c16897e' ,
])
2020-10-29 13:07:56 +00:00
-> addRule ( 'name' , [
2020-11-07 22:14:48 +00:00
'type' => self :: TYPE_STRING ,
2020-10-29 13:07:56 +00:00
'description' => 'Collection name.' ,
2021-01-13 15:06:36 +00:00
'default' => '' ,
2021-08-21 04:48:28 +00:00
'example' => 'My Collection' ,
2020-10-29 13:07:56 +00:00
])
2021-12-13 12:42:04 +00:00
-> addRule ( 'enabled' , [
'type' => self :: TYPE_BOOLEAN ,
2023-08-22 20:11:33 +00:00
'description' => 'Collection enabled. Can be \'enabled\' or \'disabled\'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys.' ,
2021-12-13 12:42:04 +00:00
'default' => true ,
'example' => false ,
2020-10-29 13:07:56 +00:00
])
2022-08-02 09:18:49 +00:00
-> addRule ( 'documentSecurity' , [
'type' => self :: TYPE_BOOLEAN ,
2023-10-13 13:43:44 +00:00
'description' => 'Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions).' ,
2021-08-21 04:48:28 +00:00
'default' => '' ,
2022-08-02 09:18:49 +00:00
'example' => true ,
2020-10-29 13:07:56 +00:00
])
2021-06-10 18:19:10 +00:00
-> 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 ,
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-06-10 18:19:10 +00:00
'description' => 'Collection attributes.' ,
2020-10-29 13:07:56 +00:00
'default' => [],
2022-05-23 14:54:50 +00:00
'example' => new \stdClass (),
2020-10-29 13:07:56 +00:00
'array' => true ,
])
2021-06-10 18:19:10 +00:00
-> addRule ( 'indexes' , [
2021-06-11 15:27:51 +00:00
'type' => Response :: MODEL_INDEX ,
2021-06-10 18:19:10 +00:00
'description' => 'Collection indexes.' ,
2021-06-11 15:27:51 +00:00
'default' => [],
2022-05-23 14:54:50 +00:00
'example' => new \stdClass (),
2021-06-10 18:19:10 +00:00
'array' => true
2020-10-29 13:07:56 +00:00
])
;
}
/**
* Get Name
2021-10-06 14:22:38 +00:00
*
2020-10-29 13:07:56 +00:00
* @ return string
*/
2022-05-23 14:54:50 +00:00
public function getName () : string
2020-10-29 13:07:56 +00:00
{
return 'Collection' ;
}
/**
2021-12-15 10:19:29 +00:00
* Get Type
2021-10-06 14:22:38 +00:00
*
2020-10-29 13:07:56 +00:00
* @ return string
*/
2022-05-23 14:54:50 +00:00
public function getType () : string
2020-10-29 13:07:56 +00:00
{
return Response :: MODEL_COLLECTION ;
}
2021-10-06 14:22:38 +00:00
}