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

54 lines
1.1 KiB
PHP
Raw Normal View History

2020-06-23 15:01:20 +00:00
<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class Error extends Model
{
public function __construct()
{
$this
->addRule('message', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
2020-06-23 15:01:20 +00:00
'description' => 'Error message.',
2021-01-13 15:06:36 +00:00
'default' => '',
2020-06-23 15:01:20 +00:00
'example' => 'Not found',
])
->addRule('code', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
2020-06-23 15:01:20 +00:00
'description' => 'Error code.',
2021-01-13 15:06:36 +00:00
'default' => '',
2020-06-23 15:01:20 +00:00
'example' => '404',
])
->addRule('version', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
2020-06-23 15:01:20 +00:00
'description' => 'Server version number.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => '1.0',
2020-06-23 15:01:20 +00:00
])
;
}
/**
* Get Name
*
2020-06-23 15:01:20 +00:00
* @return string
*/
public function getName():string
{
return 'Error';
}
/**
2021-12-15 10:19:29 +00:00
* Get Type
*
2020-06-23 15:01:20 +00:00
* @return string
*/
public function getType():string
{
return Response::MODEL_ERROR;
}
}