From 20f5f03173ae67a05bc96bebdcabbc4ea888b038 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 13 Aug 2021 16:58:36 -0400 Subject: [PATCH] Create formatted string attribute models --- src/Appwrite/Utopia/Response/Model/Email.php | 43 ++++++++++++++++++++ src/Appwrite/Utopia/Response/Model/IP.php | 43 ++++++++++++++++++++ src/Appwrite/Utopia/Response/Model/URL.php | 43 ++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 src/Appwrite/Utopia/Response/Model/Email.php create mode 100644 src/Appwrite/Utopia/Response/Model/IP.php create mode 100644 src/Appwrite/Utopia/Response/Model/URL.php diff --git a/src/Appwrite/Utopia/Response/Model/Email.php b/src/Appwrite/Utopia/Response/Model/Email.php new file mode 100644 index 0000000000..e876019f8f --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/Email.php @@ -0,0 +1,43 @@ +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; + } +} \ No newline at end of file diff --git a/src/Appwrite/Utopia/Response/Model/IP.php b/src/Appwrite/Utopia/Response/Model/IP.php new file mode 100644 index 0000000000..e818055506 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/IP.php @@ -0,0 +1,43 @@ +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; + } +} \ No newline at end of file diff --git a/src/Appwrite/Utopia/Response/Model/URL.php b/src/Appwrite/Utopia/Response/Model/URL.php new file mode 100644 index 0000000000..37340ab61f --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/URL.php @@ -0,0 +1,43 @@ +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; + } +} \ No newline at end of file