1
0
Fork 0
mirror of synced 2024-06-28 11:10:46 +12:00

Create formatted string attribute models

This commit is contained in:
kodumbeats 2021-08-13 16:58:36 -04:00
parent 3172f3073c
commit 20f5f03173
3 changed files with 129 additions and 0 deletions

View file

@ -0,0 +1,43 @@
<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model\AttributeString;
class Email extends AttributeString
{
public function __construct()
{
$this
->addRule('format', [
'type' => self::TYPE_STRING,
'description' => 'String format.',
'default' => 'email',
'example' => 'email',
'array' => false,
'required' => true,
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'Email';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_EMAIL;
}
}

View file

@ -0,0 +1,43 @@
<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model\AttributeString;
class IP extends AttributeString
{
public function __construct()
{
$this
->addRule('format', [
'type' => self::TYPE_STRING,
'description' => 'String format.',
'default' => 'ip',
'example' => 'ip',
'array' => false,
'required' => true,
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'IP';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_IP;
}
}

View file

@ -0,0 +1,43 @@
<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model\AttributeString;
class URL extends AttributeString
{
public function __construct()
{
$this
->addRule('format', [
'type' => self::TYPE_STRING,
'description' => 'String format.',
'default' => 'url',
'example' => 'url',
'array' => false,
'required' => true,
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'URL';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_URL;
}
}