1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/AttributeFloat.php

86 lines
2.5 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model\Attribute;
class AttributeFloat extends Attribute
{
public function __construct()
{
$this
2021-08-24 09:25:32 +12:00
->addRule('key', [
'type' => self::TYPE_STRING,
'description' => 'Attribute Key.',
'default' => '',
'example' => 'fullName',
])
->addRule('type', [
'type' => self::TYPE_STRING,
'description' => 'Attribute type.',
'default' => '',
'example' => 'string',
])
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'Attribute status. Possible values: `available`, `processing`, `deleting`, or `failed`',
'default' => '',
'example' => 'string',
])
->addRule('required', [
'type' => self::TYPE_BOOLEAN,
'description' => 'Is attribute required?',
'default' => false,
'example' => true,
])
->addRule('array', [
'type' => self::TYPE_BOOLEAN,
'description' => 'Is attribute an array?',
'default' => false,
'example' => false,
'require' => false
])
2021-08-17 10:59:33 +12:00
->addRule('format', [
'type' => self::TYPE_FLOAT,
2021-08-17 10:59:33 +12:00
'description' => 'Float format.',
'default' => null,
2021-08-17 10:59:33 +12:00
'example' => \json_encode([
'name' => APP_DATABASE_ATTRIBUTE_FLOAT_RANGE,
'min' => 1.5,
'max' => 2.5,
]),
'array' => false,
2021-08-17 10:59:33 +12:00
'require' => false,
])
->addRule('default', [
'type' => self::TYPE_FLOAT,
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
'default' => null,
'example' => 2.5,
'array' => false,
2021-08-17 10:59:33 +12:00
'require' => false,
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'AttributeFloat';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_ATTRIBUTE_FLOAT;
}
}