mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
110 lines
3.9 KiB
PHP
110 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
use Appwrite\Utopia\Response;
|
|
use Appwrite\Utopia\Response\Model;
|
|
use Utopia\Database\Role;
|
|
|
|
class Execution extends Model
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this
|
|
->addRule('$id', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Execution ID.',
|
|
'default' => '',
|
|
'example' => '5e5ea5c16897e',
|
|
])
|
|
->addRule('$createdAt', [
|
|
'type' => self::TYPE_DATETIME,
|
|
'description' => 'Execution creation date in ISO 8601 format.',
|
|
'default' => '',
|
|
'example' => self::TYPE_DATETIME_EXAMPLE,
|
|
])
|
|
->addRule('$updatedAt', [
|
|
'type' => self::TYPE_DATETIME,
|
|
'description' => 'Execution upate date in ISO 8601 format.',
|
|
'default' => '',
|
|
'example' => self::TYPE_DATETIME_EXAMPLE,
|
|
])
|
|
->addRule('$permissions', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Execution roles.',
|
|
'default' => '',
|
|
'example' => [Role::any()->toString()],
|
|
'array' => true,
|
|
])
|
|
->addRule('functionId', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Function ID.',
|
|
'default' => '',
|
|
'example' => '5e5ea6g16897e',
|
|
])
|
|
->addRule('trigger', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.',
|
|
'default' => '',
|
|
'example' => 'http',
|
|
])
|
|
->addRule('status', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.',
|
|
'default' => '',
|
|
'example' => 'processing',
|
|
])
|
|
->addRule('statusCode', [
|
|
'type' => self::TYPE_INTEGER,
|
|
'description' => 'The script status code.',
|
|
'default' => 0,
|
|
'example' => 0,
|
|
])
|
|
->addRule('response', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'The script response output string. Logs the last 4,000 characters of the execution response output.',
|
|
'default' => '',
|
|
'example' => '',
|
|
])
|
|
->addRule('stdout', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'The script stdout output string. Logs the last 4,000 characters of the execution stdout output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.',
|
|
'default' => '',
|
|
'example' => '',
|
|
])
|
|
->addRule('stderr', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'The script stderr output string. Logs the last 4,000 characters of the execution stderr output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.',
|
|
'default' => '',
|
|
'example' => '',
|
|
])
|
|
->addRule('duration', [
|
|
'type' => self::TYPE_FLOAT,
|
|
'description' => 'The script execution duration in seconds.',
|
|
'default' => 0,
|
|
'example' => 0.400,
|
|
])
|
|
;
|
|
}
|
|
|
|
/**
|
|
* Get Name
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getName(): string
|
|
{
|
|
return 'Execution';
|
|
}
|
|
|
|
/**
|
|
* Get Type
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getType(): string
|
|
{
|
|
return Response::MODEL_EXECUTION;
|
|
}
|
|
}
|