diff --git a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache index 11fe3827d48..35c065c81de 100644 --- a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache @@ -231,7 +231,7 @@ class ApiClient } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { // return raw body if response is a file if ($responseType == '\SplFileObject') { - return array($http_body, $http_header); + return array($http_body, $response_info['http_code'], $http_header); } $data = json_decode($http_body); @@ -249,7 +249,7 @@ class ApiClient $response_info['http_code'], $http_header, $data ); } - return array($data, $http_header); + return array($data, $response_info['http_code'], $http_header); } /** diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 53a81030813..2ba06331d50 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -92,7 +92,7 @@ use \{{invokerPackage}}\ObjectSerializer; {{#operation}} /** - * {{{nickname}}} + * {{{operationId}}} * * {{{summary}}} * @@ -100,12 +100,28 @@ use \{{invokerPackage}}\ObjectSerializer; {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} * @throws \{{invokerPackage}}\ApiException on non-2xx response */ - public function {{nickname}}({{#allParams}}${{paramName}}{{^required}}=null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + public function {{operationId}} ({{#allParams}}${{paramName}}{{^required}}=null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { + list($response, $statusCode, $httpHeader) = $this->{{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + return $response; + } + + + /** + * {{{operationId}}} + * + * {{{summary}}} + * + {{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional){{/required}} + {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} + * @throws \{{invokerPackage}}\ApiException on non-2xx response + */ + public function {{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{^required}}=null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if (${{paramName}} === null) { - throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{nickname}}'); + throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{operationId}}'); }{{/required}}{{/allParams}} // parse inputs @@ -182,17 +198,17 @@ use \{{invokerPackage}}\ObjectSerializer; // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams{{#returnType}}, '{{returnType}}'{{/returnType}} ); {{#returnType}} if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, '{{returnType}}', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, '{{returnType}}', $httpHeader)); {{/returnType}} } catch (ApiException $e) { switch ($e->getCode()) { {{#responses}}{{#dataType}} @@ -205,7 +221,7 @@ use \{{invokerPackage}}\ObjectSerializer; throw $e; } {{#returnType}} - return null; + return array(null, $statusCode, $httpHeader); {{/returnType}} } {{/operation}} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index bc03a7974d3..0e971841f50 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -100,7 +100,23 @@ class PetApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updatePet($body=null) + public function updatePet ($body=null) + { + list($response, $statusCode, $httpHeader) = $this->updatePetWithHttpInfo ($body); + return $response; + } + + + /** + * updatePet + * + * Update an existing pet + * + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function updatePetWithHttpInfo ($body=null) { @@ -143,7 +159,7 @@ class PetApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -167,7 +183,23 @@ class PetApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function addPet($body=null) + public function addPet ($body=null) + { + list($response, $statusCode, $httpHeader) = $this->addPetWithHttpInfo ($body); + return $response; + } + + + /** + * addPet + * + * Add a new pet to the store + * + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function addPetWithHttpInfo ($body=null) { @@ -210,7 +242,7 @@ class PetApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -234,7 +266,23 @@ class PetApi * @return \Swagger\Client\Model\Pet[] * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByStatus($status=null) + public function findPetsByStatus ($status=null) + { + list($response, $statusCode, $httpHeader) = $this->findPetsByStatusWithHttpInfo ($status); + return $response; + } + + + /** + * findPetsByStatus + * + * Finds Pets by status + * + * @param string[] $status Status values that need to be considered for filter (optional) + * @return \Swagger\Client\Model\Pet[] + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function findPetsByStatusWithHttpInfo ($status=null) { @@ -276,17 +324,17 @@ class PetApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\Swagger\Client\Model\Pet[]' ); if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader)); } catch (ApiException $e) { switch ($e->getCode()) { @@ -299,7 +347,7 @@ class PetApi throw $e; } - return null; + return array(null, $statusCode, $httpHeader); } @@ -312,7 +360,23 @@ class PetApi * @return \Swagger\Client\Model\Pet[] * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByTags($tags=null) + public function findPetsByTags ($tags=null) + { + list($response, $statusCode, $httpHeader) = $this->findPetsByTagsWithHttpInfo ($tags); + return $response; + } + + + /** + * findPetsByTags + * + * Finds Pets by tags + * + * @param string[] $tags Tags to filter by (optional) + * @return \Swagger\Client\Model\Pet[] + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function findPetsByTagsWithHttpInfo ($tags=null) { @@ -354,17 +418,17 @@ class PetApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\Swagger\Client\Model\Pet[]' ); if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader)); } catch (ApiException $e) { switch ($e->getCode()) { @@ -377,7 +441,7 @@ class PetApi throw $e; } - return null; + return array(null, $statusCode, $httpHeader); } @@ -390,7 +454,23 @@ class PetApi * @return \Swagger\Client\Model\Pet * @throws \Swagger\Client\ApiException on non-2xx response */ - public function getPetById($pet_id) + public function getPetById ($pet_id) + { + list($response, $statusCode, $httpHeader) = $this->getPetByIdWithHttpInfo ($pet_id); + return $response; + } + + + /** + * getPetById + * + * Find pet by ID + * + * @param int $pet_id ID of pet that needs to be fetched (required) + * @return \Swagger\Client\Model\Pet + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function getPetByIdWithHttpInfo ($pet_id) { // verify the required parameter 'pet_id' is set @@ -442,17 +522,17 @@ class PetApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\Swagger\Client\Model\Pet' ); if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader)); } catch (ApiException $e) { switch ($e->getCode()) { @@ -465,7 +545,7 @@ class PetApi throw $e; } - return null; + return array(null, $statusCode, $httpHeader); } @@ -480,7 +560,25 @@ class PetApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updatePetWithForm($pet_id, $name=null, $status=null) + public function updatePetWithForm ($pet_id, $name=null, $status=null) + { + list($response, $statusCode, $httpHeader) = $this->updatePetWithFormWithHttpInfo ($pet_id, $name, $status); + return $response; + } + + + /** + * 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 (optional) + * @param string $status Updated status of the pet (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function updatePetWithFormWithHttpInfo ($pet_id, $name=null, $status=null) { // verify the required parameter 'pet_id' is set @@ -542,7 +640,7 @@ class PetApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -567,7 +665,24 @@ class PetApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function deletePet($pet_id, $api_key=null) + public function deletePet ($pet_id, $api_key=null) + { + list($response, $statusCode, $httpHeader) = $this->deletePetWithHttpInfo ($pet_id, $api_key); + return $response; + } + + + /** + * deletePet + * + * Deletes a pet + * + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function deletePetWithHttpInfo ($pet_id, $api_key=null) { // verify the required parameter 'pet_id' is set @@ -620,7 +735,7 @@ class PetApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -646,7 +761,25 @@ class PetApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function uploadFile($pet_id, $additional_metadata=null, $file=null) + public function uploadFile ($pet_id, $additional_metadata=null, $file=null) + { + list($response, $statusCode, $httpHeader) = $this->uploadFileWithHttpInfo ($pet_id, $additional_metadata, $file); + return $response; + } + + + /** + * uploadFile + * + * uploads an image + * + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function uploadFileWithHttpInfo ($pet_id, $additional_metadata=null, $file=null) { // verify the required parameter 'pet_id' is set @@ -714,7 +847,7 @@ class PetApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index d709330b056..d32b2ac783e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -99,7 +99,22 @@ class StoreApi * @return map[string,int] * @throws \Swagger\Client\ApiException on non-2xx response */ - public function getInventory() + public function getInventory () + { + list($response, $statusCode, $httpHeader) = $this->getInventoryWithHttpInfo (); + return $response; + } + + + /** + * getInventory + * + * Returns pet inventories by status + * + * @return map[string,int] + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function getInventoryWithHttpInfo () { @@ -140,17 +155,17 @@ class StoreApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, 'map[string,int]' ); if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader)); } catch (ApiException $e) { switch ($e->getCode()) { @@ -163,7 +178,7 @@ class StoreApi throw $e; } - return null; + return array(null, $statusCode, $httpHeader); } @@ -176,7 +191,23 @@ class StoreApi * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response */ - public function placeOrder($body=null) + public function placeOrder ($body=null) + { + list($response, $statusCode, $httpHeader) = $this->placeOrderWithHttpInfo ($body); + return $response; + } + + + /** + * placeOrder + * + * Place an order for a pet + * + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (optional) + * @return \Swagger\Client\Model\Order + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function placeOrderWithHttpInfo ($body=null) { @@ -214,17 +245,17 @@ class StoreApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\Swagger\Client\Model\Order' ); if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader)); } catch (ApiException $e) { switch ($e->getCode()) { @@ -237,7 +268,7 @@ class StoreApi throw $e; } - return null; + return array(null, $statusCode, $httpHeader); } @@ -250,7 +281,23 @@ class StoreApi * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response */ - public function getOrderById($order_id) + public function getOrderById ($order_id) + { + list($response, $statusCode, $httpHeader) = $this->getOrderByIdWithHttpInfo ($order_id); + return $response; + } + + + /** + * getOrderById + * + * Find purchase order by ID + * + * @param string $order_id ID of pet that needs to be fetched (required) + * @return \Swagger\Client\Model\Order + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function getOrderByIdWithHttpInfo ($order_id) { // verify the required parameter 'order_id' is set @@ -295,17 +342,17 @@ class StoreApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\Swagger\Client\Model\Order' ); if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader)); } catch (ApiException $e) { switch ($e->getCode()) { @@ -318,7 +365,7 @@ class StoreApi throw $e; } - return null; + return array(null, $statusCode, $httpHeader); } @@ -331,7 +378,23 @@ class StoreApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function deleteOrder($order_id) + public function deleteOrder ($order_id) + { + list($response, $statusCode, $httpHeader) = $this->deleteOrderWithHttpInfo ($order_id); + return $response; + } + + + /** + * deleteOrder + * + * Delete purchase order by ID + * + * @param string $order_id ID of the order that needs to be deleted (required) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function deleteOrderWithHttpInfo ($order_id) { // verify the required parameter 'order_id' is set @@ -376,7 +439,7 @@ class StoreApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 8ce6301a51e..890b876a106 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -100,7 +100,23 @@ class UserApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUser($body=null) + public function createUser ($body=null) + { + list($response, $statusCode, $httpHeader) = $this->createUserWithHttpInfo ($body); + return $response; + } + + + /** + * createUser + * + * Create user + * + * @param \Swagger\Client\Model\User $body Created user object (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function createUserWithHttpInfo ($body=null) { @@ -138,7 +154,7 @@ class UserApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -162,7 +178,23 @@ class UserApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithArrayInput($body=null) + public function createUsersWithArrayInput ($body=null) + { + list($response, $statusCode, $httpHeader) = $this->createUsersWithArrayInputWithHttpInfo ($body); + return $response; + } + + + /** + * createUsersWithArrayInput + * + * Creates list of users with given input array + * + * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function createUsersWithArrayInputWithHttpInfo ($body=null) { @@ -200,7 +232,7 @@ class UserApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -224,7 +256,23 @@ class UserApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithListInput($body=null) + public function createUsersWithListInput ($body=null) + { + list($response, $statusCode, $httpHeader) = $this->createUsersWithListInputWithHttpInfo ($body); + return $response; + } + + + /** + * createUsersWithListInput + * + * Creates list of users with given input array + * + * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function createUsersWithListInputWithHttpInfo ($body=null) { @@ -262,7 +310,7 @@ class UserApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -287,7 +335,24 @@ class UserApi * @return string * @throws \Swagger\Client\ApiException on non-2xx response */ - public function loginUser($username=null, $password=null) + public function loginUser ($username=null, $password=null) + { + list($response, $statusCode, $httpHeader) = $this->loginUserWithHttpInfo ($username, $password); + return $response; + } + + + /** + * loginUser + * + * Logs user into the system + * + * @param string $username The user name for login (optional) + * @param string $password The password for login in clear text (optional) + * @return string + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function loginUserWithHttpInfo ($username=null, $password=null) { @@ -327,17 +392,17 @@ class UserApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, 'string' ); if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader)); } catch (ApiException $e) { switch ($e->getCode()) { @@ -350,7 +415,7 @@ class UserApi throw $e; } - return null; + return array(null, $statusCode, $httpHeader); } @@ -362,7 +427,22 @@ class UserApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function logoutUser() + public function logoutUser () + { + list($response, $statusCode, $httpHeader) = $this->logoutUserWithHttpInfo (); + return $response; + } + + + /** + * logoutUser + * + * Logs out current logged in user session + * + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function logoutUserWithHttpInfo () { @@ -396,7 +476,7 @@ class UserApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -420,7 +500,23 @@ class UserApi * @return \Swagger\Client\Model\User * @throws \Swagger\Client\ApiException on non-2xx response */ - public function getUserByName($username) + public function getUserByName ($username) + { + list($response, $statusCode, $httpHeader) = $this->getUserByNameWithHttpInfo ($username); + return $response; + } + + + /** + * getUserByName + * + * Get user by user name + * + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * @return \Swagger\Client\Model\User + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function getUserByNameWithHttpInfo ($username) { // verify the required parameter 'username' is set @@ -465,17 +561,17 @@ class UserApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\Swagger\Client\Model\User' ); if (!$response) { - return null; + return array(null, $statusCode, $httpHeader); } - return $this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader); + return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader)); } catch (ApiException $e) { switch ($e->getCode()) { @@ -488,7 +584,7 @@ class UserApi throw $e; } - return null; + return array(null, $statusCode, $httpHeader); } @@ -502,7 +598,24 @@ class UserApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updateUser($username, $body=null) + public function updateUser ($username, $body=null) + { + list($response, $statusCode, $httpHeader) = $this->updateUserWithHttpInfo ($username, $body); + return $response; + } + + + /** + * updateUser + * + * Updated user + * + * @param string $username name that need to be deleted (required) + * @param \Swagger\Client\Model\User $body Updated user object (optional) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function updateUserWithHttpInfo ($username, $body=null) { // verify the required parameter 'username' is set @@ -551,7 +664,7 @@ class UserApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams @@ -575,7 +688,23 @@ class UserApi * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function deleteUser($username) + public function deleteUser ($username) + { + list($response, $statusCode, $httpHeader) = $this->deleteUserWithHttpInfo ($username); + return $response; + } + + + /** + * deleteUser + * + * Delete user + * + * @param string $username The name that needs to be deleted (required) + * @return void + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function deleteUserWithHttpInfo ($username) { // verify the required parameter 'username' is set @@ -620,7 +749,7 @@ class UserApi // make the API Call try { - list($response, $httpHeader) = $this->apiClient->callApi( + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php index a0bb07273e4..b5b63793e85 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php @@ -231,7 +231,7 @@ class ApiClient } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { // return raw body if response is a file if ($responseType == '\SplFileObject') { - return array($http_body, $http_header); + return array($http_body, $response_info['http_code'], $http_header); } $data = json_decode($http_body); @@ -249,7 +249,7 @@ class ApiClient $response_info['http_code'], $http_header, $data ); } - return array($data, $http_header); + return array($data, $response_info['http_code'], $http_header); } /**