1
0
Fork 0
mirror of synced 2024-06-20 19:50:30 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/Task.php

138 lines
4.3 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class Task extends Model
{
/**
* @var bool
*/
protected $public = false;
public function __construct()
{
$this
->addRule('$id', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Task ID.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('name', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Task name.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'My Task',
])
->addRule('security', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_BOOLEAN,
'description' => 'Indicated if SSL / TLS Certificate verification is enabled.',
2021-01-14 04:06:36 +13:00
'default' => true,
'example' => true,
])
->addRule('httpMethod', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Task HTTP Method.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'POST',
])
->addRule('httpUrl', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Task HTTP URL.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'https://example.com/task',
])
->addRule('httpHeaders', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Task HTTP headers.',
'default' => [],
2021-02-02 10:31:54 +13:00
'example' => 'key:value',
'array' => true,
])
->addRule('httpUser', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'HTTP basic authentication username.',
'default' => '',
'example' => 'username',
])
->addRule('httpPass', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'HTTP basic authentication password.',
'default' => '',
'example' => 'password',
])
->addRule('duration', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_FLOAT,
'description' => 'Task duration in seconds.',
'default' => 0,
'example' => 1.2,
])
->addRule('delay', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_FLOAT,
'description' => 'Task delay time in seconds.',
'default' => 0,
'example' => 1.2,
])
->addRule('failures', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Number of recurring task failures.',
'default' => 0,
'example' => 0,
])
->addRule('schedule', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Task schedule in CRON syntax.',
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => '* * * * *',
])
->addRule('status', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_STRING,
'description' => 'Task status. Possible values: play, pause', // TODO - change to enabled disabled
2021-01-14 04:06:36 +13:00
'default' => '',
'example' => 'enabled',
])
->addRule('updated', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Task last updated time in Unix timestamp.',
'default' => 0,
'example' => 1592981250,
])
->addRule('previous', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Task previous run time in Unix timestamp.',
'default' => 0,
'example' => 1592981250,
])
->addRule('next', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
'description' => 'Task next run time in Unix timestamp.',
'default' => 0,
'example' => 1592981650,
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'Task';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_TASK;
}
}