1
0
Fork 0
mirror of synced 2024-05-19 20:22:33 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/Func.php

122 lines
3.9 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class Func extends Model
{
public function __construct()
{
$this
->addRule('$id', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Function ID.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => '5e5ea5c16897e',
])
2021-08-08 00:49:36 +12:00
->addRule('execute', [
2021-10-22 23:32:38 +13:00
'type' => Response::MODEL_FUNC_PERMISSIONS,
2020-12-31 01:25:42 +13:00
'description' => 'Function permissions.',
2021-01-14 04:06:36 +13:00
'default' => new \stdClass,
2020-12-31 01:25:42 +13:00
'example' => new \stdClass,
'array' => false,
])
->addRule('name', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Function name.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'My Function',
])
->addRule('dateCreated', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Function creation date in Unix timestamp.',
2021-01-14 04:06:36 +13:00
'default' => 0,
'example' => 1592981250,
])
->addRule('dateUpdated', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Function update date in Unix timestamp.',
2021-01-14 04:06:36 +13:00
'default' => 0,
'example' => 1592981257,
])
->addRule('status', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
2021-08-21 16:48:28 +12:00
'description' => 'Function status. Possible values: `disabled`, `enabled`',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'enabled',
])
2021-06-23 03:56:05 +12:00
->addRule('runtime', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
2021-06-23 03:56:05 +12:00
'description' => 'Function execution runtime.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'python-3.8',
])
->addRule('tag', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Function active tag ID.',
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('vars', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_JSON,
'description' => 'Function environment variables.',
'default' => new \stdClass,
'example' => ['key' => 'value'],
])
->addRule('events', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Function trigger events.',
'default' => [],
2021-02-02 10:31:54 +13:00
'example' => 'account.create',
'array' => true,
])
->addRule('schedule', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Function execution schedult in CRON format.',
'default' => '',
'example' => '5 4 * * *',
])
->addRule('scheduleNext', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Function next scheduled execution date in Unix timestamp.',
'default' => 0,
2021-01-14 04:06:36 +13:00
'example' => 1592981292,
])
->addRule('schedulePrevious', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Function next scheduled execution date in Unix timestamp.',
'default' => 0,
2021-01-14 04:06:36 +13:00
'example' => 1592981237,
])
->addRule('timeout', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Function execution timeout in seconds.',
'default' => 15,
'example' => 1592981237,
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'Function';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_FUNCTION;
}
}