1
0
Fork 0
mirror of synced 2024-06-18 18:54:55 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/File.php

79 lines
2.1 KiB
PHP
Raw Normal View History

2020-06-24 03:01:20 +12: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-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'File ID.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('$permissions', [
'type' => Response::MODEL_PERMISSIONS,
'description' => 'File permissions.',
2021-01-14 05:11:56 +13:00
'default' => new \stdClass,
'example' => new \stdClass,
'array' => false,
])
->addRule('name', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'File name.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'Pink.png',
])
->addRule('dateCreated', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'File creation date in Unix timestamp.',
2021-01-14 05:17:28 +13:00
'default' => 0,
'example' => 1592981250,
])
->addRule('signature', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'File MD5 signature.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => '5d529fd02b544198ae075bd57c1762bb',
])
->addRule('mimeType', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'File mime type.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'image/png',
])
->addRule('sizeOriginal', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'File original size in bytes.',
2021-01-14 05:10:42 +13:00
'default' => 0,
'example' => 17890,
])
;
2020-06-24 03:01:20 +12:00
}
/**
* Get Name
*
2020-06-24 03:01:20 +12:00
* @return string
*/
public function getName():string
{
return 'File';
}
/**
* Get Collection
*
2020-06-24 03:01:20 +12:00
* @return string
*/
public function getType():string
{
return Response::MODEL_FILE;
2020-06-24 03:01:20 +12:00
}
}