appwrite/src/Appwrite/Utopia/Response/Model/File.php

97 lines
2.8 KiB
PHP
Raw Normal View History

2020-06-23 15:01:20 +00:00
<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class File extends Model
{
public function __construct()
{
$this
->addRule('$id', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'File ID.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => '5e5ea5c16897e',
])
2021-05-03 22:20:40 +00:00
->addRule('$read', [
'type' => self::TYPE_STRING,
'description' => 'File read permissions.',
'default' => [],
2021-06-19 14:24:39 +00:00
'example' => 'role:all',
2021-05-03 22:20:40 +00:00
'array' => true,
])
->addRule('$write', [
'type' => self::TYPE_STRING,
'description' => 'File write permissions.',
'default' => [],
2021-06-19 14:24:39 +00:00
'example' => 'user:608f9da25e7e1',
2021-05-03 22:20:40 +00:00
'array' => true,
])
->addRule('name', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'File name.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => 'Pink.png',
])
->addRule('dateCreated', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_INTEGER,
'description' => 'File creation date in Unix timestamp.',
2021-01-13 16:17:28 +00:00
'default' => 0,
'example' => 1592981250,
])
->addRule('signature', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'File MD5 signature.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => '5d529fd02b544198ae075bd57c1762bb',
])
->addRule('mimeType', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'File mime type.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => 'image/png',
])
->addRule('sizeOriginal', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_INTEGER,
'description' => 'File original size in bytes.',
2021-01-13 16:10:42 +00:00
'default' => 0,
'example' => 17890,
])
2021-07-07 10:07:11 +00:00
->addRule('totalChunks', [
'type' => self::TYPE_INTEGER,
'description' => 'Total number of chunks available',
'default' => 0,
'example' => 17890,
])
->addRule('uploadedChunks', [
'type' => self::TYPE_INTEGER,
'description' => 'Total number of chunks uploaded',
'default' => 0,
'example' => 17890,
])
;
2020-06-23 15:01:20 +00:00
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'File';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_FILE;
2020-06-23 15:01:20 +00:00
}
}