diff options
| author | root <root@kabir-PC> | 2016-03-23 11:31:51 +0100 |
|---|---|---|
| committer | root <root@kabir-PC> | 2016-03-23 11:31:51 +0100 |
| commit | a26989103d70fb0dd3ff6834de107cae246778c3 (patch) | |
| tree | 0f243c83b790ffb57f19261fc2a509131f6776ce /server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php | |
| parent | 1342db60283cb61a1c3810993575d35b9fb33ac0 (diff) | |
| parent | 6e78d76f887d1149ea85bfb06db7ee7ad7435f5a (diff) | |
Merge branch 'develop' of https://github.com/manzerbredes/istic-openstack into develop
Diffstat (limited to 'server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php')
| -rw-r--r-- | server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php b/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php new file mode 100644 index 0000000..225e025 --- /dev/null +++ b/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php @@ -0,0 +1,100 @@ +<?php + +namespace OpenCloud\Common\Api; + +abstract class AbstractParams +{ + // locations + const QUERY = 'query'; + const HEADER = 'header'; + const URL = 'url'; + const JSON = 'json'; + const RAW = 'raw'; + + // types + const STRING_TYPE = "string"; + const BOOL_TYPE = "boolean"; + const BOOLEAN_TYPE = self::BOOL_TYPE; + const OBJECT_TYPE = "object"; + const ARRAY_TYPE = "array"; + const NULL_TYPE = "NULL"; + const INT_TYPE = 'integer'; + const INTEGER_TYPE = self::INT_TYPE; + + public static function isSupportedLocation($val) + { + return in_array($val, [self::QUERY, self::HEADER, self::URL, self::JSON, self::RAW]); + } + + public function limit() + { + return [ + 'type' => self::INT_TYPE, + 'location' => 'query', + 'description' => <<<DESC +This will limit the total amount of elements returned in a list up to the number specified. For example, specifying a +limit of 10 will return 10 elements, regardless of the actual count. +DESC + ]; + } + + public function marker() + { + return [ + 'type' => 'string', + 'location' => 'query', + 'description' => <<<DESC +Specifying a marker will begin the list from the value specified. Elements will have a particular attribute that +identifies them, such as a name or ID. The marker value will search for an element whose identifying attribute matches +the marker value, and begin the list from there. +DESC + ]; + } + + public function id($type) + { + return [ + 'description' => sprintf("The unique ID, or identifier, for the %s", $type), + 'type' => self::STRING_TYPE, + 'location' => self::JSON, + ]; + } + + public function idPath() + { + return [ + 'type' => self::STRING_TYPE, + 'location' => self::URL, + 'description' => 'The unique ID of the resource', + ]; + } + + public function name($resource) + { + return [ + 'description' => sprintf("The name of the %s", $resource), + 'type' => self::STRING_TYPE, + 'location' => self::JSON, + ]; + } + + + public function sortDir() + { + return [ + 'type' => self::STRING_TYPE, + 'location' => self::QUERY, + 'description' => "Sorts by one or more sets of attribute and sort direction combinations.", + 'enum' => ['asc', 'desc'] + ]; + } + + public function sortKey() + { + return [ + 'type' => self::STRING_TYPE, + 'location' => self::QUERY, + 'description' => "Sorts by one or more sets of attribute and sort direction combinations.", + ]; + } +} |
