From 4c717829b340538510716412a1cf2d876095e4df Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 16 Apr 2015 23:54:55 +0800 Subject: [PATCH] update test.php, remove old SwaggerPetstore-php --- .../php/SwaggerPetstore-php/README.md | 52 -- .../SwaggerPetstore-php/SwaggerPetstore.php | 16 - .../php/SwaggerPetstore-php/composer.json | 32 -- .../php/SwaggerPetstore-php/lib/APIClient.php | 304 ----------- .../lib/APIClientException.php | 38 -- .../php/SwaggerPetstore-php/lib/PetApi.php | 493 ------------------ .../php/SwaggerPetstore-php/lib/StoreApi.php | 258 --------- .../php/SwaggerPetstore-php/lib/UserApi.php | 472 ----------------- .../lib/models/Category.php | 64 --- .../SwaggerPetstore-php/lib/models/Order.php | 83 --- .../SwaggerPetstore-php/lib/models/Pet.php | 83 --- .../SwaggerPetstore-php/lib/models/Tag.php | 64 --- .../SwaggerPetstore-php/lib/models/User.php | 91 ---- .../SwaggerPetstore-php/tests/PetApiTest.php | 19 - samples/client/petstore/php/old/README.md | 52 -- .../petstore/php/old/SwaggerPetstore.php | 16 - samples/client/petstore/php/old/composer.json | 32 -- .../client/petstore/php/old/lib/APIClient.php | 304 ----------- .../php/old/lib/APIClientException.php | 38 -- .../client/petstore/php/old/lib/PetApi.php | 493 ------------------ .../client/petstore/php/old/lib/StoreApi.php | 258 --------- .../client/petstore/php/old/lib/UserApi.php | 472 ----------------- .../petstore/php/old/lib/models/Category.php | 64 --- .../petstore/php/old/lib/models/Order.php | 83 --- .../petstore/php/old/lib/models/Pet.php | 83 --- .../petstore/php/old/lib/models/Tag.php | 64 --- .../petstore/php/old/lib/models/User.php | 91 ---- .../petstore/php/old/tests/PetApiTest.php | 19 - samples/client/petstore/php/test.php | 8 +- 29 files changed, 4 insertions(+), 4142 deletions(-) delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/README.md delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/SwaggerPetstore.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/composer.json delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/APIClient.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/APIClientException.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/PetApi.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/StoreApi.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/UserApi.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/models/Category.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/models/Order.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/models/Pet.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/models/Tag.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/lib/models/User.php delete mode 100644 samples/client/petstore/php/SwaggerPetstore-php/tests/PetApiTest.php delete mode 100644 samples/client/petstore/php/old/README.md delete mode 100644 samples/client/petstore/php/old/SwaggerPetstore.php delete mode 100644 samples/client/petstore/php/old/composer.json delete mode 100644 samples/client/petstore/php/old/lib/APIClient.php delete mode 100644 samples/client/petstore/php/old/lib/APIClientException.php delete mode 100644 samples/client/petstore/php/old/lib/PetApi.php delete mode 100644 samples/client/petstore/php/old/lib/StoreApi.php delete mode 100644 samples/client/petstore/php/old/lib/UserApi.php delete mode 100644 samples/client/petstore/php/old/lib/models/Category.php delete mode 100644 samples/client/petstore/php/old/lib/models/Order.php delete mode 100644 samples/client/petstore/php/old/lib/models/Pet.php delete mode 100644 samples/client/petstore/php/old/lib/models/Tag.php delete mode 100644 samples/client/petstore/php/old/lib/models/User.php delete mode 100644 samples/client/petstore/php/old/tests/PetApiTest.php diff --git a/samples/client/petstore/php/SwaggerPetstore-php/README.md b/samples/client/petstore/php/SwaggerPetstore-php/README.md deleted file mode 100644 index 6dfd19a292a..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/README.md +++ /dev/null @@ -1,52 +0,0 @@ -## Requirements - -PHP 5.3.3 and later. - -## Composer - -You can install the bindings via [Composer](http://getcomposer.org/). Add this to your `composer.json`: - - { - "repositories": [ - { - "type": "git", - "url": "https://github.com/wing328/SwaggerPetstore-php.git" - } - ], - "require": { - "SwaggerPetstore/SwaggerPetstore-php": "*@dev" - } - } - -Then install via: - - composer install - -To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading): - - require_once('vendor/autoload.php'); - -## Manual Installation - -If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the `SwaggerPetstore.php` file. - - require_once('/path/to/SwaggerPetstore-php/SwaggerPetstore.php'); - -## Getting Started - -php test.php - -## Documentation - -TODO - -## Tests - -In order to run tests first install [PHPUnit](http://packagist.org/packages/phpunit/phpunit) via [Composer](http://getcomposer.org/): - - composer update - -To run the test suite: - - ./vendor/bin/phpunit tests - diff --git a/samples/client/petstore/php/SwaggerPetstore-php/SwaggerPetstore.php b/samples/client/petstore/php/SwaggerPetstore-php/SwaggerPetstore.php deleted file mode 100644 index 058aa169504..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/SwaggerPetstore.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/samples/client/petstore/php/SwaggerPetstore-php/composer.json b/samples/client/petstore/php/SwaggerPetstore-php/composer.json deleted file mode 100644 index 7109d7a8790..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "SwaggerPetstore/SwaggerPetstore-php", - "description": "", - "keywords": [ - "swagger", - "php", - "sdk", - "api" - ], - "homepage": "http://swagger.io", - "license": "Apache v2", - "authors": [ - { - "name": "Swagger and contributors", - "homepage": "https://github.com/swagger-api/swagger-codegen" - } - ], - "require": { - "php": ">=5.3.3", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "~0.6.1", - "squizlabs/php_codesniffer": "~2.0" - }, - "autoload": { - "psr-4": { "SwaggerPetstore\\" : "lib/" } - } -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/APIClient.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/APIClient.php deleted file mode 100644 index 681bb8cee3c..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/APIClient.php +++ /dev/null @@ -1,304 +0,0 @@ -host = $host; - $this->headerName = $headerName; - $this->headerValue = $headerValue; - } - - /** - * Set the user agent of the API client - * - * @param string $user_agent The user agent of the API client - */ - public function setUserAgent($user_agent) { - if (!is_string($user_agent)) { - throw new Exception('User-agent must be a string.'); - } - $this->user_agent= $user_agent; - } - - /** - * @param integer $seconds Number of seconds before timing out [set to 0 for no timeout] - */ - public function setTimeout($seconds) { - if (!is_numeric($seconds)) { - throw new Exception('Timeout variable must be numeric.'); - } - $this->curl_timeout = $seconds; - } - - /** - * @param string $resourcePath path to method endpoint - * @param string $method method to call - * @param array $queryParams parameters to be place in query URL - * @param array $postData parameters to be placed in POST body - * @param array $headerParams parameters to be place in request header - * @return mixed - */ - public function callAPI($resourcePath, $method, $queryParams, $postData, - $headerParams) { - - $headers = array(); - - # Allow API key from $headerParams to override default - $added_api_key = False; - if ($headerParams != null) { - foreach ($headerParams as $key => $val) { - $headers[] = "$key: $val"; - if ($key == $this->headerName) { - $added_api_key = True; - } - } - } - if (! $added_api_key && $this->headerName != null) { - $headers[] = $this->headerName . ": " . $this->headerValue; - } - - if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) { - $postData = json_encode($this->sanitizeForSerialization($postData)); - } - - $url = $this->host . $resourcePath; - - $curl = curl_init(); - // set timeout, if needed - if ($this->curl_timeout != 0) { - curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timeout); - } - // return the result on success, rather than just TRUE - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - - if (! empty($queryParams)) { - $url = ($url . '?' . http_build_query($queryParams)); - } - - if ($method == self::$POST) { - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$PATCH) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$PUT) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$DELETE) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method != self::$GET) { - throw new Exception('Method ' . $method . ' is not recognized.'); - } - curl_setopt($curl, CURLOPT_URL, $url); - - // Set user agent - curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent); - - // Make the request - $response = curl_exec($curl); - $response_info = curl_getinfo($curl); - - // Handle the response - if ($response_info['http_code'] == 0) { - throw new APIClientException("TIMEOUT: api call to " . $url . - " took more than 5s to return", 0, $response_info, $response); - } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { - $data = json_decode($response); - if (json_last_error() > 0) { // if response is a string - $data = $response; - } - } else if ($response_info['http_code'] == 401) { - throw new APIClientException("Unauthorized API request to " . $url . - ": " . serialize($response), 0, $response_info, $response); - } else if ($response_info['http_code'] == 404) { - $data = null; - } else { - throw new APIClientException("Can't connect to the api: " . $url . - " response code: " . - $response_info['http_code'], 0, $response_info, $response); - } - return $data; - } - - /** - * Build a JSON POST object - */ - protected function sanitizeForSerialization($data) - { - if (is_scalar($data) || null === $data) { - $sanitized = $data; - } else if ($data instanceof \DateTime) { - $sanitized = $data->format(\DateTime::ISO8601); - } else if (is_array($data)) { - foreach ($data as $property => $value) { - $data[$property] = $this->sanitizeForSerialization($value); - } - $sanitized = $data; - } else if (is_object($data)) { - $values = array(); - foreach (array_keys($data::$swaggerTypes) as $property) { - $values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property); - } - $sanitized = $values; - } else { - $sanitized = (string)$data; - } - - return $sanitized; - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the path, by url-encoding. - * @param string $value a string which will be part of the path - * @return string the serialized object - */ - public static function toPathValue($value) { - return rawurlencode(self::toString($value)); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. - * @param object $object an object to be serialized to a string - * @return string the serialized object - */ - public static function toQueryValue($object) { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the header. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * @param string $value a string which will be part of the header - * @return string the header string - */ - public static function toHeaderValue($value) { - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * @param string $value the value of the form parameter - * @return string the form string - */ - public static function toFormValue($value) { - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * @param string $value the value of the parameter - * @return string the header string - */ - public static function toString($value) { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(\DateTime::ISO8601); - } - else { - return $value; - } - } - - /** - * Deserialize a JSON string into an object - * - * @param object $object object or primitive to be deserialized - * @param string $class class name is passed as a string - * @return object an instance of $class - */ - - public static function deserialize($data, $class) - { - if (null === $data) { - $deserialized = null; - } elseif (substr($class, 0, 4) == 'map[') { - $inner = substr($class, 4, -1); - $values = array(); - if(strrpos($inner, ",") !== false) { - $subClass_array = explode(',', $inner, 2); - $subClass = $subClass_array[1]; - foreach ($data as $key => $value) { - $values[] = array($key => self::deserialize($value, $subClass)); - } - } - $deserialized = $values; - } elseif (strcasecmp(substr($class, 0, 6),'array[') == 0) { - $subClass = substr($class, 6, -1); - $values = array(); - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass); - } - $deserialized = $values; - } elseif ($class == 'DateTime') { - $deserialized = new \DateTime($data); - } elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool'))) { - settype($data, $class); - $deserialized = $data; - } else { - $class = "SwaggerPetstore\\models\\".$class; - $instance = new $class(); - foreach ($instance::$swaggerTypes as $property => $type) { - if (isset($data->$property)) { - $original_property_name = $instance::$attributeMap[$property]; - $instance->$property = self::deserialize($data->$original_property_name, $type); - } - } - $deserialized = $instance; - } - - return $deserialized; - } - -} - diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/APIClientException.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/APIClientException.php deleted file mode 100644 index 8f083caf6f9..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/APIClientException.php +++ /dev/null @@ -1,38 +0,0 @@ -response_info = $response_info; - $this->response = $response; - } - - public function getResponse() { - return $this->response; - } - - public function getResponseInfo() { - return $this->response_info; - } -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/PetApi.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/PetApi.php deleted file mode 100644 index 1b31db8915d..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/PetApi.php +++ /dev/null @@ -1,493 +0,0 @@ -apiClient = $apiClient; - } - - - /** - * updatePet - * - * Update an existing pet - * - * @param Pet $body Pet object that needs to be added to the store (required) - * @return void - */ - public function updatePet($body) { - - // parse inputs - $resourcePath = "/pet"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "PUT"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array('application/json','application/xml',); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * addPet - * - * Add a new pet to the store - * - * @param Pet $body Pet object that needs to be added to the store (required) - * @return void - */ - public function addPet($body) { - - // parse inputs - $resourcePath = "/pet"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array('application/json','application/xml',); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * findPetsByStatus - * - * Finds Pets by status - * - * @param array[string] $status Status values that need to be considered for filter (required) - * @return array[Pet] - */ - public function findPetsByStatus($status) { - - // parse inputs - $resourcePath = "/pet/findByStatus"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - // query params - if($status !== null) { - $queryParams['status'] = $this->apiClient->toQueryValue($status); - } - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'array[Pet]'); - return $responseObject; - } - - /** - * findPetsByTags - * - * Finds Pets by tags - * - * @param array[string] $tags Tags to filter by (required) - * @return array[Pet] - */ - public function findPetsByTags($tags) { - - // parse inputs - $resourcePath = "/pet/findByTags"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - // query params - if($tags !== null) { - $queryParams['tags'] = $this->apiClient->toQueryValue($tags); - } - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'array[Pet]'); - return $responseObject; - } - - /** - * getPetById - * - * Find pet by ID - * - * @param int $pet_id ID of pet that needs to be fetched (required) - * @return Pet - */ - public function getPetById($pet_id) { - - // parse inputs - $resourcePath = "/pet/{petId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'Pet'); - return $responseObject; - } - - /** - * updatePetWithForm - * - * Updates a pet in the store with form data - * - * @param string $pet_id ID of pet that needs to be updated (required) - * @param string $name Updated name of the pet (required) - * @param string $status Updated status of the pet (required) - * @return void - */ - public function updatePetWithForm($pet_id, $name, $status) { - - // parse inputs - $resourcePath = "/pet/{petId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array('application/x-www-form-urlencoded',); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } - // form params - if ($name !== null) { - $formParams['name'] = $this->apiClient->toFormValue($name); - }// form params - if ($status !== null) { - $formParams['status'] = $this->apiClient->toFormValue($status); - } - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * deletePet - * - * Deletes a pet - * - * @param string $api_key (required) - * @param int $pet_id Pet id to delete (required) - * @return void - */ - public function deletePet($api_key, $pet_id) { - - // parse inputs - $resourcePath = "/pet/{petId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "DELETE"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - // header params - if($api_key !== null) { - $headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key); - } - // path params - if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * uploadFile - * - * uploads an image - * - * @param int $pet_id ID of pet to update (required) - * @param string $additional_metadata Additional data to pass to server (required) - * @param file $file file to upload (required) - * @return void - */ - public function uploadFile($pet_id, $additional_metadata, $file) { - - // parse inputs - $resourcePath = "/pet/{petId}/uploadImage"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array('multipart/form-data',); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } - // form params - if ($additional_metadata !== null) { - $formParams['additionalMetadata'] = $this->apiClient->toFormValue($additional_metadata); - }// form params - if ($file !== null) { - $formParams['file'] = '@' . $this->apiClient->toFormValue($file); - } - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/StoreApi.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/StoreApi.php deleted file mode 100644 index 83a3f0520fa..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/StoreApi.php +++ /dev/null @@ -1,258 +0,0 @@ -apiClient = $apiClient; - } - - - /** - * getInventory - * - * Returns pet inventories by status - * - * @return map[string,int] - */ - public function getInventory() { - - // parse inputs - $resourcePath = "/store/inventory"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'map[string,int]'); - return $responseObject; - } - - /** - * placeOrder - * - * Place an order for a pet - * - * @param Order $body order placed for purchasing the pet (required) - * @return Order - */ - public function placeOrder($body) { - - // parse inputs - $resourcePath = "/store/order"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'Order'); - return $responseObject; - } - - /** - * getOrderById - * - * Find purchase order by ID - * - * @param string $order_id ID of pet that needs to be fetched (required) - * @return Order - */ - public function getOrderById($order_id) { - - // parse inputs - $resourcePath = "/store/order/{orderId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($order_id !== null) { - $resourcePath = str_replace("{" . "orderId" . "}", - $this->apiClient->toPathValue($order_id), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'Order'); - return $responseObject; - } - - /** - * deleteOrder - * - * Delete purchase order by ID - * - * @param string $order_id ID of the order that needs to be deleted (required) - * @return void - */ - public function deleteOrder($order_id) { - - // parse inputs - $resourcePath = "/store/order/{orderId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "DELETE"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($order_id !== null) { - $resourcePath = str_replace("{" . "orderId" . "}", - $this->apiClient->toPathValue($order_id), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/UserApi.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/UserApi.php deleted file mode 100644 index d55b430d7a1..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/UserApi.php +++ /dev/null @@ -1,472 +0,0 @@ -apiClient = $apiClient; - } - - - /** - * createUser - * - * Create user - * - * @param User $body Created user object (required) - * @return void - */ - public function createUser($body) { - - // parse inputs - $resourcePath = "/user"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * createUsersWithArrayInput - * - * Creates list of users with given input array - * - * @param array[User] $body List of user object (required) - * @return void - */ - public function createUsersWithArrayInput($body) { - - // parse inputs - $resourcePath = "/user/createWithArray"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * createUsersWithListInput - * - * Creates list of users with given input array - * - * @param array[User] $body List of user object (required) - * @return void - */ - public function createUsersWithListInput($body) { - - // parse inputs - $resourcePath = "/user/createWithList"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * loginUser - * - * Logs user into the system - * - * @param string $username The user name for login (required) - * @param string $password The password for login in clear text (required) - * @return string - */ - public function loginUser($username, $password) { - - // parse inputs - $resourcePath = "/user/login"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - // query params - if($username !== null) { - $queryParams['username'] = $this->apiClient->toQueryValue($username); - }// query params - if($password !== null) { - $queryParams['password'] = $this->apiClient->toQueryValue($password); - } - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'string'); - return $responseObject; - } - - /** - * logoutUser - * - * Logs out current logged in user session - * - * @return void - */ - public function logoutUser() { - - // parse inputs - $resourcePath = "/user/logout"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * getUserByName - * - * Get user by user name - * - * @param string $username The name that needs to be fetched. Use user1 for testing. (required) - * @return User - */ - public function getUserByName($username) { - - // parse inputs - $resourcePath = "/user/{username}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'User'); - return $responseObject; - } - - /** - * updateUser - * - * Updated user - * - * @param string $username name that need to be deleted (required) - * @param User $body Updated user object (required) - * @return void - */ - public function updateUser($username, $body) { - - // parse inputs - $resourcePath = "/user/{username}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "PUT"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * deleteUser - * - * Delete user - * - * @param string $username The name that needs to be deleted (required) - * @return void - */ - public function deleteUser($username) { - - // parse inputs - $resourcePath = "/user/{username}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "DELETE"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Category.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Category.php deleted file mode 100644 index 101222b4503..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Category.php +++ /dev/null @@ -1,64 +0,0 @@ - 'int', - 'name' => 'string' - ); - - static $attributeMap = array( - 'id' => 'id', - 'name' => 'name' - ); - - - public $id; /* int */ - public $name; /* string */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->name = $data["name"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Order.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Order.php deleted file mode 100644 index 87e8c812eb7..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Order.php +++ /dev/null @@ -1,83 +0,0 @@ - 'int', - 'pet_id' => 'int', - 'quantity' => 'int', - 'ship_date' => 'DateTime', - 'status' => 'string', - 'complete' => 'boolean' - ); - - static $attributeMap = array( - 'id' => 'id', - 'pet_id' => 'petId', - 'quantity' => 'quantity', - 'ship_date' => 'shipDate', - 'status' => 'status', - 'complete' => 'complete' - ); - - - public $id; /* int */ - public $pet_id; /* int */ - public $quantity; /* int */ - public $ship_date; /* DateTime */ - /** - * Order Status - */ - public $status; /* string */ - public $complete; /* boolean */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->pet_id = $data["pet_id"]; - $this->quantity = $data["quantity"]; - $this->ship_date = $data["ship_date"]; - $this->status = $data["status"]; - $this->complete = $data["complete"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Pet.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Pet.php deleted file mode 100644 index eb67904bf13..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Pet.php +++ /dev/null @@ -1,83 +0,0 @@ - 'int', - 'category' => 'Category', - 'name' => 'string', - 'photo_urls' => 'array[string]', - 'tags' => 'array[Tag]', - 'status' => 'string' - ); - - static $attributeMap = array( - 'id' => 'id', - 'category' => 'category', - 'name' => 'name', - 'photo_urls' => 'photoUrls', - 'tags' => 'tags', - 'status' => 'status' - ); - - - public $id; /* int */ - public $category; /* Category */ - public $name; /* string */ - public $photo_urls; /* array[string] */ - public $tags; /* array[Tag] */ - /** - * pet status in the store - */ - public $status; /* string */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->category = $data["category"]; - $this->name = $data["name"]; - $this->photo_urls = $data["photo_urls"]; - $this->tags = $data["tags"]; - $this->status = $data["status"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Tag.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Tag.php deleted file mode 100644 index a9982317ece..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/Tag.php +++ /dev/null @@ -1,64 +0,0 @@ - 'int', - 'name' => 'string' - ); - - static $attributeMap = array( - 'id' => 'id', - 'name' => 'name' - ); - - - public $id; /* int */ - public $name; /* string */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->name = $data["name"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/User.php b/samples/client/petstore/php/SwaggerPetstore-php/lib/models/User.php deleted file mode 100644 index 8662f937bc8..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/lib/models/User.php +++ /dev/null @@ -1,91 +0,0 @@ - 'int', - 'username' => 'string', - 'first_name' => 'string', - 'last_name' => 'string', - 'email' => 'string', - 'password' => 'string', - 'phone' => 'string', - 'user_status' => 'int' - ); - - static $attributeMap = array( - 'id' => 'id', - 'username' => 'username', - 'first_name' => 'firstName', - 'last_name' => 'lastName', - 'email' => 'email', - 'password' => 'password', - 'phone' => 'phone', - 'user_status' => 'userStatus' - ); - - - public $id; /* int */ - public $username; /* string */ - public $first_name; /* string */ - public $last_name; /* string */ - public $email; /* string */ - public $password; /* string */ - public $phone; /* string */ - /** - * User Status - */ - public $user_status; /* int */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->username = $data["username"]; - $this->first_name = $data["first_name"]; - $this->last_name = $data["last_name"]; - $this->email = $data["email"]; - $this->password = $data["password"]; - $this->phone = $data["phone"]; - $this->user_status = $data["user_status"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/SwaggerPetstore-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerPetstore-php/tests/PetApiTest.php deleted file mode 100644 index 77413fd30d8..00000000000 --- a/samples/client/petstore/php/SwaggerPetstore-php/tests/PetApiTest.php +++ /dev/null @@ -1,19 +0,0 @@ -getPetById($petId); - $this->assertSame($response->id, $petId); - } -} - -?> diff --git a/samples/client/petstore/php/old/README.md b/samples/client/petstore/php/old/README.md deleted file mode 100644 index 6dfd19a292a..00000000000 --- a/samples/client/petstore/php/old/README.md +++ /dev/null @@ -1,52 +0,0 @@ -## Requirements - -PHP 5.3.3 and later. - -## Composer - -You can install the bindings via [Composer](http://getcomposer.org/). Add this to your `composer.json`: - - { - "repositories": [ - { - "type": "git", - "url": "https://github.com/wing328/SwaggerPetstore-php.git" - } - ], - "require": { - "SwaggerPetstore/SwaggerPetstore-php": "*@dev" - } - } - -Then install via: - - composer install - -To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading): - - require_once('vendor/autoload.php'); - -## Manual Installation - -If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the `SwaggerPetstore.php` file. - - require_once('/path/to/SwaggerPetstore-php/SwaggerPetstore.php'); - -## Getting Started - -php test.php - -## Documentation - -TODO - -## Tests - -In order to run tests first install [PHPUnit](http://packagist.org/packages/phpunit/phpunit) via [Composer](http://getcomposer.org/): - - composer update - -To run the test suite: - - ./vendor/bin/phpunit tests - diff --git a/samples/client/petstore/php/old/SwaggerPetstore.php b/samples/client/petstore/php/old/SwaggerPetstore.php deleted file mode 100644 index 058aa169504..00000000000 --- a/samples/client/petstore/php/old/SwaggerPetstore.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/samples/client/petstore/php/old/composer.json b/samples/client/petstore/php/old/composer.json deleted file mode 100644 index 7109d7a8790..00000000000 --- a/samples/client/petstore/php/old/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "SwaggerPetstore/SwaggerPetstore-php", - "description": "", - "keywords": [ - "swagger", - "php", - "sdk", - "api" - ], - "homepage": "http://swagger.io", - "license": "Apache v2", - "authors": [ - { - "name": "Swagger and contributors", - "homepage": "https://github.com/swagger-api/swagger-codegen" - } - ], - "require": { - "php": ">=5.3.3", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "~0.6.1", - "squizlabs/php_codesniffer": "~2.0" - }, - "autoload": { - "psr-4": { "SwaggerPetstore\\" : "lib/" } - } -} diff --git a/samples/client/petstore/php/old/lib/APIClient.php b/samples/client/petstore/php/old/lib/APIClient.php deleted file mode 100644 index 681bb8cee3c..00000000000 --- a/samples/client/petstore/php/old/lib/APIClient.php +++ /dev/null @@ -1,304 +0,0 @@ -host = $host; - $this->headerName = $headerName; - $this->headerValue = $headerValue; - } - - /** - * Set the user agent of the API client - * - * @param string $user_agent The user agent of the API client - */ - public function setUserAgent($user_agent) { - if (!is_string($user_agent)) { - throw new Exception('User-agent must be a string.'); - } - $this->user_agent= $user_agent; - } - - /** - * @param integer $seconds Number of seconds before timing out [set to 0 for no timeout] - */ - public function setTimeout($seconds) { - if (!is_numeric($seconds)) { - throw new Exception('Timeout variable must be numeric.'); - } - $this->curl_timeout = $seconds; - } - - /** - * @param string $resourcePath path to method endpoint - * @param string $method method to call - * @param array $queryParams parameters to be place in query URL - * @param array $postData parameters to be placed in POST body - * @param array $headerParams parameters to be place in request header - * @return mixed - */ - public function callAPI($resourcePath, $method, $queryParams, $postData, - $headerParams) { - - $headers = array(); - - # Allow API key from $headerParams to override default - $added_api_key = False; - if ($headerParams != null) { - foreach ($headerParams as $key => $val) { - $headers[] = "$key: $val"; - if ($key == $this->headerName) { - $added_api_key = True; - } - } - } - if (! $added_api_key && $this->headerName != null) { - $headers[] = $this->headerName . ": " . $this->headerValue; - } - - if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) { - $postData = json_encode($this->sanitizeForSerialization($postData)); - } - - $url = $this->host . $resourcePath; - - $curl = curl_init(); - // set timeout, if needed - if ($this->curl_timeout != 0) { - curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timeout); - } - // return the result on success, rather than just TRUE - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - - if (! empty($queryParams)) { - $url = ($url . '?' . http_build_query($queryParams)); - } - - if ($method == self::$POST) { - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$PATCH) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$PUT) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method == self::$DELETE) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } else if ($method != self::$GET) { - throw new Exception('Method ' . $method . ' is not recognized.'); - } - curl_setopt($curl, CURLOPT_URL, $url); - - // Set user agent - curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent); - - // Make the request - $response = curl_exec($curl); - $response_info = curl_getinfo($curl); - - // Handle the response - if ($response_info['http_code'] == 0) { - throw new APIClientException("TIMEOUT: api call to " . $url . - " took more than 5s to return", 0, $response_info, $response); - } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { - $data = json_decode($response); - if (json_last_error() > 0) { // if response is a string - $data = $response; - } - } else if ($response_info['http_code'] == 401) { - throw new APIClientException("Unauthorized API request to " . $url . - ": " . serialize($response), 0, $response_info, $response); - } else if ($response_info['http_code'] == 404) { - $data = null; - } else { - throw new APIClientException("Can't connect to the api: " . $url . - " response code: " . - $response_info['http_code'], 0, $response_info, $response); - } - return $data; - } - - /** - * Build a JSON POST object - */ - protected function sanitizeForSerialization($data) - { - if (is_scalar($data) || null === $data) { - $sanitized = $data; - } else if ($data instanceof \DateTime) { - $sanitized = $data->format(\DateTime::ISO8601); - } else if (is_array($data)) { - foreach ($data as $property => $value) { - $data[$property] = $this->sanitizeForSerialization($value); - } - $sanitized = $data; - } else if (is_object($data)) { - $values = array(); - foreach (array_keys($data::$swaggerTypes) as $property) { - $values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property); - } - $sanitized = $values; - } else { - $sanitized = (string)$data; - } - - return $sanitized; - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the path, by url-encoding. - * @param string $value a string which will be part of the path - * @return string the serialized object - */ - public static function toPathValue($value) { - return rawurlencode(self::toString($value)); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. - * @param object $object an object to be serialized to a string - * @return string the serialized object - */ - public static function toQueryValue($object) { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the header. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * @param string $value a string which will be part of the header - * @return string the header string - */ - public static function toHeaderValue($value) { - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * @param string $value the value of the form parameter - * @return string the form string - */ - public static function toFormValue($value) { - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * @param string $value the value of the parameter - * @return string the header string - */ - public static function toString($value) { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(\DateTime::ISO8601); - } - else { - return $value; - } - } - - /** - * Deserialize a JSON string into an object - * - * @param object $object object or primitive to be deserialized - * @param string $class class name is passed as a string - * @return object an instance of $class - */ - - public static function deserialize($data, $class) - { - if (null === $data) { - $deserialized = null; - } elseif (substr($class, 0, 4) == 'map[') { - $inner = substr($class, 4, -1); - $values = array(); - if(strrpos($inner, ",") !== false) { - $subClass_array = explode(',', $inner, 2); - $subClass = $subClass_array[1]; - foreach ($data as $key => $value) { - $values[] = array($key => self::deserialize($value, $subClass)); - } - } - $deserialized = $values; - } elseif (strcasecmp(substr($class, 0, 6),'array[') == 0) { - $subClass = substr($class, 6, -1); - $values = array(); - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass); - } - $deserialized = $values; - } elseif ($class == 'DateTime') { - $deserialized = new \DateTime($data); - } elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool'))) { - settype($data, $class); - $deserialized = $data; - } else { - $class = "SwaggerPetstore\\models\\".$class; - $instance = new $class(); - foreach ($instance::$swaggerTypes as $property => $type) { - if (isset($data->$property)) { - $original_property_name = $instance::$attributeMap[$property]; - $instance->$property = self::deserialize($data->$original_property_name, $type); - } - } - $deserialized = $instance; - } - - return $deserialized; - } - -} - diff --git a/samples/client/petstore/php/old/lib/APIClientException.php b/samples/client/petstore/php/old/lib/APIClientException.php deleted file mode 100644 index 8f083caf6f9..00000000000 --- a/samples/client/petstore/php/old/lib/APIClientException.php +++ /dev/null @@ -1,38 +0,0 @@ -response_info = $response_info; - $this->response = $response; - } - - public function getResponse() { - return $this->response; - } - - public function getResponseInfo() { - return $this->response_info; - } -} diff --git a/samples/client/petstore/php/old/lib/PetApi.php b/samples/client/petstore/php/old/lib/PetApi.php deleted file mode 100644 index 1b31db8915d..00000000000 --- a/samples/client/petstore/php/old/lib/PetApi.php +++ /dev/null @@ -1,493 +0,0 @@ -apiClient = $apiClient; - } - - - /** - * updatePet - * - * Update an existing pet - * - * @param Pet $body Pet object that needs to be added to the store (required) - * @return void - */ - public function updatePet($body) { - - // parse inputs - $resourcePath = "/pet"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "PUT"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array('application/json','application/xml',); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * addPet - * - * Add a new pet to the store - * - * @param Pet $body Pet object that needs to be added to the store (required) - * @return void - */ - public function addPet($body) { - - // parse inputs - $resourcePath = "/pet"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array('application/json','application/xml',); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * findPetsByStatus - * - * Finds Pets by status - * - * @param array[string] $status Status values that need to be considered for filter (required) - * @return array[Pet] - */ - public function findPetsByStatus($status) { - - // parse inputs - $resourcePath = "/pet/findByStatus"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - // query params - if($status !== null) { - $queryParams['status'] = $this->apiClient->toQueryValue($status); - } - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'array[Pet]'); - return $responseObject; - } - - /** - * findPetsByTags - * - * Finds Pets by tags - * - * @param array[string] $tags Tags to filter by (required) - * @return array[Pet] - */ - public function findPetsByTags($tags) { - - // parse inputs - $resourcePath = "/pet/findByTags"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - // query params - if($tags !== null) { - $queryParams['tags'] = $this->apiClient->toQueryValue($tags); - } - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'array[Pet]'); - return $responseObject; - } - - /** - * getPetById - * - * Find pet by ID - * - * @param int $pet_id ID of pet that needs to be fetched (required) - * @return Pet - */ - public function getPetById($pet_id) { - - // parse inputs - $resourcePath = "/pet/{petId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'Pet'); - return $responseObject; - } - - /** - * updatePetWithForm - * - * Updates a pet in the store with form data - * - * @param string $pet_id ID of pet that needs to be updated (required) - * @param string $name Updated name of the pet (required) - * @param string $status Updated status of the pet (required) - * @return void - */ - public function updatePetWithForm($pet_id, $name, $status) { - - // parse inputs - $resourcePath = "/pet/{petId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array('application/x-www-form-urlencoded',); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } - // form params - if ($name !== null) { - $formParams['name'] = $this->apiClient->toFormValue($name); - }// form params - if ($status !== null) { - $formParams['status'] = $this->apiClient->toFormValue($status); - } - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * deletePet - * - * Deletes a pet - * - * @param string $api_key (required) - * @param int $pet_id Pet id to delete (required) - * @return void - */ - public function deletePet($api_key, $pet_id) { - - // parse inputs - $resourcePath = "/pet/{petId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "DELETE"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - // header params - if($api_key !== null) { - $headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key); - } - // path params - if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * uploadFile - * - * uploads an image - * - * @param int $pet_id ID of pet to update (required) - * @param string $additional_metadata Additional data to pass to server (required) - * @param file $file file to upload (required) - * @return void - */ - public function uploadFile($pet_id, $additional_metadata, $file) { - - // parse inputs - $resourcePath = "/pet/{petId}/uploadImage"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array('multipart/form-data',); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } - // form params - if ($additional_metadata !== null) { - $formParams['additionalMetadata'] = $this->apiClient->toFormValue($additional_metadata); - }// form params - if ($file !== null) { - $formParams['file'] = '@' . $this->apiClient->toFormValue($file); - } - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - -} diff --git a/samples/client/petstore/php/old/lib/StoreApi.php b/samples/client/petstore/php/old/lib/StoreApi.php deleted file mode 100644 index 83a3f0520fa..00000000000 --- a/samples/client/petstore/php/old/lib/StoreApi.php +++ /dev/null @@ -1,258 +0,0 @@ -apiClient = $apiClient; - } - - - /** - * getInventory - * - * Returns pet inventories by status - * - * @return map[string,int] - */ - public function getInventory() { - - // parse inputs - $resourcePath = "/store/inventory"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'map[string,int]'); - return $responseObject; - } - - /** - * placeOrder - * - * Place an order for a pet - * - * @param Order $body order placed for purchasing the pet (required) - * @return Order - */ - public function placeOrder($body) { - - // parse inputs - $resourcePath = "/store/order"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'Order'); - return $responseObject; - } - - /** - * getOrderById - * - * Find purchase order by ID - * - * @param string $order_id ID of pet that needs to be fetched (required) - * @return Order - */ - public function getOrderById($order_id) { - - // parse inputs - $resourcePath = "/store/order/{orderId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($order_id !== null) { - $resourcePath = str_replace("{" . "orderId" . "}", - $this->apiClient->toPathValue($order_id), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'Order'); - return $responseObject; - } - - /** - * deleteOrder - * - * Delete purchase order by ID - * - * @param string $order_id ID of the order that needs to be deleted (required) - * @return void - */ - public function deleteOrder($order_id) { - - // parse inputs - $resourcePath = "/store/order/{orderId}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "DELETE"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($order_id !== null) { - $resourcePath = str_replace("{" . "orderId" . "}", - $this->apiClient->toPathValue($order_id), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - -} diff --git a/samples/client/petstore/php/old/lib/UserApi.php b/samples/client/petstore/php/old/lib/UserApi.php deleted file mode 100644 index d55b430d7a1..00000000000 --- a/samples/client/petstore/php/old/lib/UserApi.php +++ /dev/null @@ -1,472 +0,0 @@ -apiClient = $apiClient; - } - - - /** - * createUser - * - * Create user - * - * @param User $body Created user object (required) - * @return void - */ - public function createUser($body) { - - // parse inputs - $resourcePath = "/user"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * createUsersWithArrayInput - * - * Creates list of users with given input array - * - * @param array[User] $body List of user object (required) - * @return void - */ - public function createUsersWithArrayInput($body) { - - // parse inputs - $resourcePath = "/user/createWithArray"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * createUsersWithListInput - * - * Creates list of users with given input array - * - * @param array[User] $body List of user object (required) - * @return void - */ - public function createUsersWithListInput($body) { - - // parse inputs - $resourcePath = "/user/createWithList"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * loginUser - * - * Logs user into the system - * - * @param string $username The user name for login (required) - * @param string $password The password for login in clear text (required) - * @return string - */ - public function loginUser($username, $password) { - - // parse inputs - $resourcePath = "/user/login"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - // query params - if($username !== null) { - $queryParams['username'] = $this->apiClient->toQueryValue($username); - }// query params - if($password !== null) { - $queryParams['password'] = $this->apiClient->toQueryValue($password); - } - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'string'); - return $responseObject; - } - - /** - * logoutUser - * - * Logs out current logged in user session - * - * @return void - */ - public function logoutUser() { - - // parse inputs - $resourcePath = "/user/logout"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * getUserByName - * - * Get user by user name - * - * @param string $username The name that needs to be fetched. Use user1 for testing. (required) - * @return User - */ - public function getUserByName($username) { - - // parse inputs - $resourcePath = "/user/{username}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - if(! $response) { - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'User'); - return $responseObject; - } - - /** - * updateUser - * - * Updated user - * - * @param string $username name that need to be deleted (required) - * @param User $body Updated user object (required) - * @return void - */ - public function updateUser($username, $body) { - - // parse inputs - $resourcePath = "/user/{username}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "PUT"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } - - // body params - $body = null; - if (isset($body)) { - $body = $body; - } - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - /** - * deleteUser - * - * Delete user - * - * @param string $username The name that needs to be deleted (required) - * @return void - */ - public function deleteUser($username) { - - // parse inputs - $resourcePath = "/user/{username}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "DELETE"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = 'application/json, application/xml'; - if ($_header_accept !== '') { - $headerParams['Accept'] = $_header_accept; - } - $_header_content_type = array(); - $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; - - - - // path params - if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } - - - - // for model (json/xml) - if (isset($body)) { - $httpBody = $body; // $body is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { - $httpBody = http_build_query($formParams); - } - - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $httpBody, - $headerParams); - - - } - - -} diff --git a/samples/client/petstore/php/old/lib/models/Category.php b/samples/client/petstore/php/old/lib/models/Category.php deleted file mode 100644 index 101222b4503..00000000000 --- a/samples/client/petstore/php/old/lib/models/Category.php +++ /dev/null @@ -1,64 +0,0 @@ - 'int', - 'name' => 'string' - ); - - static $attributeMap = array( - 'id' => 'id', - 'name' => 'name' - ); - - - public $id; /* int */ - public $name; /* string */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->name = $data["name"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/old/lib/models/Order.php b/samples/client/petstore/php/old/lib/models/Order.php deleted file mode 100644 index 87e8c812eb7..00000000000 --- a/samples/client/petstore/php/old/lib/models/Order.php +++ /dev/null @@ -1,83 +0,0 @@ - 'int', - 'pet_id' => 'int', - 'quantity' => 'int', - 'ship_date' => 'DateTime', - 'status' => 'string', - 'complete' => 'boolean' - ); - - static $attributeMap = array( - 'id' => 'id', - 'pet_id' => 'petId', - 'quantity' => 'quantity', - 'ship_date' => 'shipDate', - 'status' => 'status', - 'complete' => 'complete' - ); - - - public $id; /* int */ - public $pet_id; /* int */ - public $quantity; /* int */ - public $ship_date; /* DateTime */ - /** - * Order Status - */ - public $status; /* string */ - public $complete; /* boolean */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->pet_id = $data["pet_id"]; - $this->quantity = $data["quantity"]; - $this->ship_date = $data["ship_date"]; - $this->status = $data["status"]; - $this->complete = $data["complete"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/old/lib/models/Pet.php b/samples/client/petstore/php/old/lib/models/Pet.php deleted file mode 100644 index eb67904bf13..00000000000 --- a/samples/client/petstore/php/old/lib/models/Pet.php +++ /dev/null @@ -1,83 +0,0 @@ - 'int', - 'category' => 'Category', - 'name' => 'string', - 'photo_urls' => 'array[string]', - 'tags' => 'array[Tag]', - 'status' => 'string' - ); - - static $attributeMap = array( - 'id' => 'id', - 'category' => 'category', - 'name' => 'name', - 'photo_urls' => 'photoUrls', - 'tags' => 'tags', - 'status' => 'status' - ); - - - public $id; /* int */ - public $category; /* Category */ - public $name; /* string */ - public $photo_urls; /* array[string] */ - public $tags; /* array[Tag] */ - /** - * pet status in the store - */ - public $status; /* string */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->category = $data["category"]; - $this->name = $data["name"]; - $this->photo_urls = $data["photo_urls"]; - $this->tags = $data["tags"]; - $this->status = $data["status"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/old/lib/models/Tag.php b/samples/client/petstore/php/old/lib/models/Tag.php deleted file mode 100644 index a9982317ece..00000000000 --- a/samples/client/petstore/php/old/lib/models/Tag.php +++ /dev/null @@ -1,64 +0,0 @@ - 'int', - 'name' => 'string' - ); - - static $attributeMap = array( - 'id' => 'id', - 'name' => 'name' - ); - - - public $id; /* int */ - public $name; /* string */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->name = $data["name"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/old/lib/models/User.php b/samples/client/petstore/php/old/lib/models/User.php deleted file mode 100644 index 8662f937bc8..00000000000 --- a/samples/client/petstore/php/old/lib/models/User.php +++ /dev/null @@ -1,91 +0,0 @@ - 'int', - 'username' => 'string', - 'first_name' => 'string', - 'last_name' => 'string', - 'email' => 'string', - 'password' => 'string', - 'phone' => 'string', - 'user_status' => 'int' - ); - - static $attributeMap = array( - 'id' => 'id', - 'username' => 'username', - 'first_name' => 'firstName', - 'last_name' => 'lastName', - 'email' => 'email', - 'password' => 'password', - 'phone' => 'phone', - 'user_status' => 'userStatus' - ); - - - public $id; /* int */ - public $username; /* string */ - public $first_name; /* string */ - public $last_name; /* string */ - public $email; /* string */ - public $password; /* string */ - public $phone; /* string */ - /** - * User Status - */ - public $user_status; /* int */ - - public function __construct(array $data = null) { - $this->id = $data["id"]; - $this->username = $data["username"]; - $this->first_name = $data["first_name"]; - $this->last_name = $data["last_name"]; - $this->email = $data["email"]; - $this->password = $data["password"]; - $this->phone = $data["phone"]; - $this->user_status = $data["user_status"]; - } - - public function offsetExists($offset) { - return isset($this->$offset); - } - - public function offsetGet($offset) { - return $this->$offset; - } - - public function offsetSet($offset, $value) { - $this->$offset = $value; - } - - public function offsetUnset($offset) { - unset($this->$offset); - } -} diff --git a/samples/client/petstore/php/old/tests/PetApiTest.php b/samples/client/petstore/php/old/tests/PetApiTest.php deleted file mode 100644 index 77413fd30d8..00000000000 --- a/samples/client/petstore/php/old/tests/PetApiTest.php +++ /dev/null @@ -1,19 +0,0 @@ -getPetById($petId); - $this->assertSame($response->id, $petId); - } -} - -?> diff --git a/samples/client/petstore/php/test.php b/samples/client/petstore/php/test.php index df10876feb5..7cbbfce3cbb 100644 --- a/samples/client/petstore/php/test.php +++ b/samples/client/petstore/php/test.php @@ -1,12 +1,12 @@ getPetById($petId); var_dump($response);