2021-06-14 10:58:18 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class Bucket extends Model
|
|
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
2022-02-23 05:57:21 +00:00
|
|
|
->addRule('$id', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Bucket ID.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => '5e5ea5c16897e',
|
|
|
|
|
])
|
2022-06-15 12:46:52 +00:00
|
|
|
->addRule('$createdAt', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
|
|
|
|
'description' => 'Bucket creation date in Unix timestamp.',
|
|
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 1592981250,
|
|
|
|
|
])
|
|
|
|
|
->addRule('$updatedAt', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
|
|
|
|
'description' => 'Bucket update date in Unix timestamp.',
|
|
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 1592981250,
|
|
|
|
|
])
|
2022-08-02 09:19:15 +00:00
|
|
|
->addRule('$permissions', [
|
2022-02-23 05:57:21 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2022-08-02 09:19:15 +00:00
|
|
|
'description' => 'File permissions.',
|
2022-02-23 05:57:21 +00:00
|
|
|
'default' => [],
|
2022-08-14 05:21:11 +00:00
|
|
|
'example' => [Permission::read(Role::any())],
|
2022-02-23 05:57:21 +00:00
|
|
|
'array' => true,
|
|
|
|
|
])
|
2022-08-02 09:19:15 +00:00
|
|
|
->addRule('fileSecurity', [
|
2022-02-23 05:57:21 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2022-08-02 09:19:15 +00:00
|
|
|
'description' => 'Whether file-level security is enabled.',
|
2022-02-23 05:57:21 +00:00
|
|
|
'default' => '',
|
2022-08-02 09:19:15 +00:00
|
|
|
'example' => true,
|
2022-02-23 05:57:21 +00:00
|
|
|
])
|
|
|
|
|
->addRule('name', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Bucket name.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => 'Documents',
|
|
|
|
|
])
|
|
|
|
|
->addRule('enabled', [
|
|
|
|
|
'type' => self::TYPE_BOOLEAN,
|
|
|
|
|
'description' => 'Bucket enabled.',
|
|
|
|
|
'default' => true,
|
|
|
|
|
'example' => false,
|
|
|
|
|
])
|
|
|
|
|
->addRule('maximumFileSize', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
|
|
|
|
'description' => 'Maximum file size supported.',
|
|
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 100,
|
|
|
|
|
])
|
|
|
|
|
->addRule('allowedFileExtensions', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Allowed file extensions.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => ['jpg', 'png'],
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('encryption', [
|
|
|
|
|
'type' => self::TYPE_BOOLEAN,
|
|
|
|
|
'description' => 'Bucket is encrypted.',
|
|
|
|
|
'default' => true,
|
|
|
|
|
'example' => false,
|
|
|
|
|
])
|
|
|
|
|
->addRule('antivirus', [
|
|
|
|
|
'type' => self::TYPE_BOOLEAN,
|
|
|
|
|
'description' => 'Virus scanning is enabled.',
|
|
|
|
|
'default' => true,
|
|
|
|
|
'example' => false,
|
|
|
|
|
])
|
|
|
|
|
;
|
2021-06-14 10:58:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'Bucket';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Collection
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getType(): string
|
|
|
|
|
{
|
|
|
|
|
return Response::MODEL_BUCKET;
|
|
|
|
|
}
|
|
|
|
|
}
|