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

113 lines
3.4 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
use stdClass;
use Utopia\Database\Document;
class Func extends Model
{
public function __construct()
{
$this
->addRule('$id', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Function ID.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('$createdAt', [
2022-07-04 09:55:11 +00:00
'type' => self::TYPE_DATETIME,
2022-09-04 21:26:16 +00:00
'description' => 'Function 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,
])
->addRule('$updatedAt', [
2022-07-04 09:55:11 +00:00
'type' => self::TYPE_DATETIME,
2022-09-04 21:26:16 +00:00
'description' => 'Function 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,
])
2021-08-07 12:49:36 +00:00
->addRule('execute', [
2021-12-14 10:42:34 +00:00
'type' => self::TYPE_STRING,
'description' => 'Execution permissions.',
'default' => [],
2022-08-03 04:17:49 +00:00
'example' => 'users',
'array' => true,
2020-12-30 12:25:42 +00:00
])
->addRule('name', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Function name.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => 'My Function',
])
->addRule('enabled', [
'type' => self::TYPE_BOOLEAN,
'description' => 'Function enabled.',
'default' => true,
'example' => false,
])
2021-06-22 15:56:05 +00:00
->addRule('runtime', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
2021-06-22 15:56:05 +00:00
'description' => 'Function execution runtime.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => 'python-3.8',
])
->addRule('deployment', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Function\'s active deployment ID.',
'default' => '',
'example' => '5e5ea5c16897e',
])
2022-08-09 12:00:16 +00:00
->addRule('vars', [
'type' => Response::MODEL_VARIABLE,
2022-08-19 09:57:59 +00:00
'description' => 'Function variables.',
'default' => [],
'example' => [],
'array' => true
2022-08-09 12:00:16 +00:00
])
->addRule('events', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Function trigger events.',
'default' => [],
2021-02-01 21:31:54 +00:00
'example' => 'account.create',
'array' => true,
])
->addRule('schedule', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Function execution schedult in CRON format.',
'default' => '',
'example' => '5 4 * * *',
])
->addRule('timeout', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_INTEGER,
'description' => 'Function execution timeout in seconds.',
'default' => 15,
'example' => 1592981237,
])
;
}
/**
* Get Name
*
* @return string
*/
2022-05-23 14:54:50 +00:00
public function getName(): string
{
return 'Function';
}
/**
2021-12-15 10:19:29 +00:00
* Get Type
*
* @return string
*/
2022-05-23 14:54:50 +00:00
public function getType(): string
{
return Response::MODEL_FUNCTION;
}
}