From 1c547e959880c2ca1b2273cbc6663ea7e61c3f58 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 27 Mar 2015 22:40:59 +0800 Subject: [PATCH 1/2] update php documentation --- .../src/main/resources/php/api.mustache | 7 +- samples/client/petstore/php/PetApi.php | 66 ++++++++----------- samples/client/petstore/php/StoreApi.php | 26 ++++---- samples/client/petstore/php/UserApi.php | 58 +++++++--------- 4 files changed, 68 insertions(+), 89 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index bdf66defcaf..375ff8a4f48 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -31,11 +31,10 @@ class {{classname}} { * {{{nickname}}} * * {{{summary}}} - {{#allParams}}* {{paramName}}, {{dataType}}: {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}} - * {{/allParams}} - * @return {{{returnType}}} + * +{{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}} +{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ - public function {{nickname}}({{#allParams}}${{paramName}}{{#optional}}=null{{/optional}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { // parse inputs diff --git a/samples/client/petstore/php/PetApi.php b/samples/client/petstore/php/PetApi.php index 49f623b4da4..25c3ea24bd7 100644 --- a/samples/client/petstore/php/PetApi.php +++ b/samples/client/petstore/php/PetApi.php @@ -30,11 +30,10 @@ function __construct($apiClient) { * updatePet * * Update an existing pet - * body, Pet: Pet object that needs to be added to the store (required) - * - * @return + * + * @param Pet $body Pet object that needs to be added to the store (required) + * @return void */ - public function updatePet($body) { // parse inputs @@ -76,11 +75,10 @@ public function updatePet($body) { * addPet * * Add a new pet to the store - * body, Pet: Pet object that needs to be added to the store (required) - * - * @return + * + * @param Pet $body Pet object that needs to be added to the store (required) + * @return void */ - public function addPet($body) { // parse inputs @@ -122,11 +120,10 @@ public function addPet($body) { * findPetsByStatus * * Finds Pets by status - * status, array[string]: Status values that need to be considered for filter (required) - * - * @return array[Pet] + * + * @param array[string] $status Status values that need to be considered for filter (required) + * @return array[Pet] */ - public function findPetsByStatus($status) { // parse inputs @@ -173,11 +170,10 @@ public function findPetsByStatus($status) { * findPetsByTags * * Finds Pets by tags - * tags, array[string]: Tags to filter by (required) - * - * @return array[Pet] + * + * @param array[string] $tags Tags to filter by (required) + * @return array[Pet] */ - public function findPetsByTags($tags) { // parse inputs @@ -224,11 +220,10 @@ public function findPetsByTags($tags) { * getPetById * * Find pet by ID - * pet_id, int: ID of pet that needs to be fetched (required) - * - * @return Pet + * + * @param int $pet_id ID of pet that needs to be fetched (required) + * @return Pet */ - public function getPetById($pet_id) { // parse inputs @@ -276,13 +271,12 @@ public function getPetById($pet_id) { * updatePetWithForm * * Updates a pet in the store with form data - * pet_id, string: ID of pet that needs to be updated (required) - * * name, string: Updated name of the pet (required) - * * status, string: Updated status of the pet (required) - * - * @return + * + * @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 @@ -330,12 +324,11 @@ public function updatePetWithForm($pet_id, $name, $status) { * deletePet * * Deletes a pet - * api_key, string: (required) - * * pet_id, int: Pet id to delete (required) - * - * @return + * + * @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 @@ -380,13 +373,12 @@ public function deletePet($api_key, $pet_id) { * uploadFile * * uploads an image - * pet_id, int: ID of pet to update (required) - * * additional_metadata, string: Additional data to pass to server (required) - * * file, file: file to upload (required) - * - * @return + * + * @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 diff --git a/samples/client/petstore/php/StoreApi.php b/samples/client/petstore/php/StoreApi.php index 12b46286502..fbd2fc0afe5 100644 --- a/samples/client/petstore/php/StoreApi.php +++ b/samples/client/petstore/php/StoreApi.php @@ -30,10 +30,9 @@ function __construct($apiClient) { * getInventory * * Returns pet inventories by status - - * @return map[string,int] + * + * @return map[string,int] */ - public function getInventory() { // parse inputs @@ -77,11 +76,10 @@ public function getInventory() { * placeOrder * * Place an order for a pet - * body, Order: order placed for purchasing the pet (required) - * - * @return Order + * + * @param Order $body order placed for purchasing the pet (required) + * @return Order */ - public function placeOrder($body) { // parse inputs @@ -129,11 +127,10 @@ public function placeOrder($body) { * getOrderById * * Find purchase order by ID - * order_id, string: ID of pet that needs to be fetched (required) - * - * @return Order + * + * @param string $order_id ID of pet that needs to be fetched (required) + * @return Order */ - public function getOrderById($order_id) { // parse inputs @@ -181,11 +178,10 @@ public function getOrderById($order_id) { * deleteOrder * * Delete purchase order by ID - * order_id, string: ID of the order that needs to be deleted (required) - * - * @return + * + * @param string $order_id ID of the order that needs to be deleted (required) + * @return void */ - public function deleteOrder($order_id) { // parse inputs diff --git a/samples/client/petstore/php/UserApi.php b/samples/client/petstore/php/UserApi.php index cd5d197394b..9e0b5280e46 100644 --- a/samples/client/petstore/php/UserApi.php +++ b/samples/client/petstore/php/UserApi.php @@ -30,11 +30,10 @@ function __construct($apiClient) { * createUser * * Create user - * body, User: Created user object (required) - * - * @return + * + * @param User $body Created user object (required) + * @return void */ - public function createUser($body) { // parse inputs @@ -76,11 +75,10 @@ public function createUser($body) { * createUsersWithArrayInput * * Creates list of users with given input array - * body, array[User]: List of user object (required) - * - * @return + * + * @param array[User] $body List of user object (required) + * @return void */ - public function createUsersWithArrayInput($body) { // parse inputs @@ -122,11 +120,10 @@ public function createUsersWithArrayInput($body) { * createUsersWithListInput * * Creates list of users with given input array - * body, array[User]: List of user object (required) - * - * @return + * + * @param array[User] $body List of user object (required) + * @return void */ - public function createUsersWithListInput($body) { // parse inputs @@ -168,12 +165,11 @@ public function createUsersWithListInput($body) { * loginUser * * Logs user into the system - * username, string: The user name for login (required) - * * password, string: The password for login in clear text (required) - * - * @return string + * + * @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 @@ -223,10 +219,9 @@ public function loginUser($username, $password) { * logoutUser * * Logs out current logged in user session - - * @return + * + * @return void */ - public function logoutUser() { // parse inputs @@ -264,11 +259,10 @@ public function logoutUser() { * getUserByName * * Get user by user name - * username, string: The name that needs to be fetched. Use user1 for testing. (required) - * - * @return User + * + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * @return User */ - public function getUserByName($username) { // parse inputs @@ -316,12 +310,11 @@ public function getUserByName($username) { * updateUser * * Updated user - * username, string: name that need to be deleted (required) - * * body, User: Updated user object (required) - * - * @return + * + * @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 @@ -367,11 +360,10 @@ public function updateUser($username, $body) { * deleteUser * * Delete user - * username, string: The name that needs to be deleted (required) - * - * @return + * + * @param string $username The name that needs to be deleted (required) + * @return void */ - public function deleteUser($username) { // parse inputs From 6ab51bcb4e52eae61634d40902c1efc6494c0b68 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 27 Mar 2015 23:11:13 +0800 Subject: [PATCH 2/2] remove tab with 2 spaces in php api template --- .../src/main/resources/php/api.mustache | 44 ++-- samples/client/petstore/php/PetApi.php | 234 +++++++++--------- samples/client/petstore/php/StoreApi.php | 114 ++++----- samples/client/petstore/php/UserApi.php | 224 ++++++++--------- 4 files changed, 308 insertions(+), 308 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 375ff8a4f48..74c32a891f3 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -22,25 +22,25 @@ {{#operations}} class {{classname}} { - function __construct($apiClient) { - $this->apiClient = $apiClient; - } + function __construct($apiClient) { + $this->apiClient = $apiClient; + } {{#operation}} - /** - * {{{nickname}}} + /** + * {{{nickname}}} * - * {{{summary}}} + * {{{summary}}} * {{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}} {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} - */ + */ public function {{nickname}}({{#allParams}}${{paramName}}{{#optional}}=null{{/optional}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { - // parse inputs - $resourcePath = "{{path}}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "{{httpMethod}}"; + // parse inputs + $resourcePath = "{{path}}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "{{httpMethod}}"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -49,17 +49,17 @@ class {{classname}} { {{#queryParams}}// query params if(${{paramName}} !== null) { - $queryParams['{{baseName}}'] = $this->apiClient->toQueryValue(${{paramName}}); - }{{/queryParams}} + $queryParams['{{baseName}}'] = $this->apiClient->toQueryValue(${{paramName}}); + }{{/queryParams}} {{#headerParams}}// header params if(${{paramName}} !== null) { - $headerParams['{{baseName}}'] = $this->apiClient->toHeaderValue(${{paramName}}); - }{{/headerParams}} + $headerParams['{{baseName}}'] = $this->apiClient->toHeaderValue(${{paramName}}); + }{{/headerParams}} {{#pathParams}}// path params if(${{paramName}} !== null) { - $resourcePath = str_replace("{" . "{{baseName}}" . "}", - $this->apiClient->toPathValue(${{paramName}}), $resourcePath); - }{{/pathParams}} + $resourcePath = str_replace("{" . "{{baseName}}" . "}", + $this->apiClient->toPathValue(${{paramName}}), $resourcePath); + }{{/pathParams}} {{#formParams}}// form params if (${{paramName}} !== null) { $formParams['{{baseName}}'] = {{#isFile}}'@' . {{/isFile}}$this->apiClient->toFormValue(${{paramName}}); @@ -77,10 +77,10 @@ class {{classname}} { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); {{#returnType}}if(! $response) { return null; diff --git a/samples/client/petstore/php/PetApi.php b/samples/client/petstore/php/PetApi.php index 25c3ea24bd7..87850e3128d 100644 --- a/samples/client/petstore/php/PetApi.php +++ b/samples/client/petstore/php/PetApi.php @@ -21,25 +21,25 @@ */ class PetApi { - function __construct($apiClient) { - $this->apiClient = $apiClient; - } + function __construct($apiClient) { + $this->apiClient = $apiClient; + } - /** - * updatePet + /** + * updatePet * - * Update an existing pet + * 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"; + // parse inputs + $resourcePath = "/pet"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "PUT"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -63,28 +63,28 @@ public function updatePet($body) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * addPet + /** + * addPet * - * Add a new pet to the store + * 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"; + // parse inputs + $resourcePath = "/pet"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "POST"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -108,28 +108,28 @@ public function addPet($body) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * findPetsByStatus + /** + * findPetsByStatus * - * Finds Pets by status + * 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"; + // parse inputs + $resourcePath = "/pet/findByStatus"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "GET"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -138,8 +138,8 @@ public function findPetsByStatus($status) { // query params if($status !== null) { - $queryParams['status'] = $this->apiClient->toQueryValue($status); - } + $queryParams['status'] = $this->apiClient->toQueryValue($status); + } @@ -152,10 +152,10 @@ public function findPetsByStatus($status) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); if(! $response) { return null; @@ -166,20 +166,20 @@ public function findPetsByStatus($status) { return $responseObject; } - /** - * findPetsByTags + /** + * findPetsByTags * - * Finds Pets by tags + * 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"; + // parse inputs + $resourcePath = "/pet/findByTags"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "GET"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -188,8 +188,8 @@ public function findPetsByTags($tags) { // query params if($tags !== null) { - $queryParams['tags'] = $this->apiClient->toQueryValue($tags); - } + $queryParams['tags'] = $this->apiClient->toQueryValue($tags); + } @@ -202,10 +202,10 @@ public function findPetsByTags($tags) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); if(! $response) { return null; @@ -216,20 +216,20 @@ public function findPetsByTags($tags) { return $responseObject; } - /** - * getPetById + /** + * getPetById * - * Find pet by ID + * 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"; + // parse inputs + $resourcePath = "/pet/{petId}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "GET"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -240,9 +240,9 @@ public function getPetById($pet_id) { // path params if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } + $resourcePath = str_replace("{" . "petId" . "}", + $this->apiClient->toPathValue($pet_id), $resourcePath); + } @@ -253,10 +253,10 @@ public function getPetById($pet_id) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); if(! $response) { return null; @@ -267,22 +267,22 @@ public function getPetById($pet_id) { return $responseObject; } - /** - * updatePetWithForm + /** + * updatePetWithForm * - * Updates a pet in the store with form data + * 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"; + // parse inputs + $resourcePath = "/pet/{petId}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "POST"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -293,9 +293,9 @@ public function updatePetWithForm($pet_id, $name, $status) { // path params if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } + $resourcePath = str_replace("{" . "petId" . "}", + $this->apiClient->toPathValue($pet_id), $resourcePath); + } // form params if ($name !== null) { $formParams['name'] = $this->apiClient->toFormValue($name); @@ -312,29 +312,29 @@ public function updatePetWithForm($pet_id, $name, $status) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * deletePet + /** + * deletePet * - * Deletes a pet + * 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"; + // parse inputs + $resourcePath = "/pet/{petId}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "DELETE"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -344,13 +344,13 @@ public function deletePet($api_key, $pet_id) { // header params if($api_key !== null) { - $headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key); - } + $headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key); + } // path params if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } + $resourcePath = str_replace("{" . "petId" . "}", + $this->apiClient->toPathValue($pet_id), $resourcePath); + } @@ -361,30 +361,30 @@ public function deletePet($api_key, $pet_id) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * uploadFile + /** + * uploadFile * - * uploads an image + * 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"; + // parse inputs + $resourcePath = "/pet/{petId}/uploadImage"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "POST"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -395,9 +395,9 @@ public function uploadFile($pet_id, $additional_metadata, $file) { // path params if($pet_id !== null) { - $resourcePath = str_replace("{" . "petId" . "}", - $this->apiClient->toPathValue($pet_id), $resourcePath); - } + $resourcePath = str_replace("{" . "petId" . "}", + $this->apiClient->toPathValue($pet_id), $resourcePath); + } // form params if ($additional_metadata !== null) { $formParams['additionalMetadata'] = $this->apiClient->toFormValue($additional_metadata); @@ -414,10 +414,10 @@ public function uploadFile($pet_id, $additional_metadata, $file) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } diff --git a/samples/client/petstore/php/StoreApi.php b/samples/client/petstore/php/StoreApi.php index fbd2fc0afe5..6ff2f83d1be 100644 --- a/samples/client/petstore/php/StoreApi.php +++ b/samples/client/petstore/php/StoreApi.php @@ -21,24 +21,24 @@ */ class StoreApi { - function __construct($apiClient) { - $this->apiClient = $apiClient; - } + function __construct($apiClient) { + $this->apiClient = $apiClient; + } - /** - * getInventory + /** + * getInventory * - * Returns pet inventories by status + * 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"; + // parse inputs + $resourcePath = "/store/inventory"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "GET"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -58,10 +58,10 @@ public function getInventory() { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); if(! $response) { return null; @@ -72,20 +72,20 @@ public function getInventory() { return $responseObject; } - /** - * placeOrder + /** + * placeOrder * - * Place an order for a pet + * 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"; + // parse inputs + $resourcePath = "/store/order"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "POST"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -109,10 +109,10 @@ public function placeOrder($body) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); if(! $response) { return null; @@ -123,20 +123,20 @@ public function placeOrder($body) { return $responseObject; } - /** - * getOrderById + /** + * getOrderById * - * Find purchase order by ID + * 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"; + // parse inputs + $resourcePath = "/store/order/{orderId}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "GET"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -147,9 +147,9 @@ public function getOrderById($order_id) { // path params if($order_id !== null) { - $resourcePath = str_replace("{" . "orderId" . "}", - $this->apiClient->toPathValue($order_id), $resourcePath); - } + $resourcePath = str_replace("{" . "orderId" . "}", + $this->apiClient->toPathValue($order_id), $resourcePath); + } @@ -160,10 +160,10 @@ public function getOrderById($order_id) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); if(! $response) { return null; @@ -174,20 +174,20 @@ public function getOrderById($order_id) { return $responseObject; } - /** - * deleteOrder + /** + * deleteOrder * - * Delete purchase order by ID + * 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"; + // parse inputs + $resourcePath = "/store/order/{orderId}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "DELETE"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -198,9 +198,9 @@ public function deleteOrder($order_id) { // path params if($order_id !== null) { - $resourcePath = str_replace("{" . "orderId" . "}", - $this->apiClient->toPathValue($order_id), $resourcePath); - } + $resourcePath = str_replace("{" . "orderId" . "}", + $this->apiClient->toPathValue($order_id), $resourcePath); + } @@ -211,10 +211,10 @@ public function deleteOrder($order_id) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } diff --git a/samples/client/petstore/php/UserApi.php b/samples/client/petstore/php/UserApi.php index 9e0b5280e46..a811d8c9f97 100644 --- a/samples/client/petstore/php/UserApi.php +++ b/samples/client/petstore/php/UserApi.php @@ -21,25 +21,25 @@ */ class UserApi { - function __construct($apiClient) { - $this->apiClient = $apiClient; - } + function __construct($apiClient) { + $this->apiClient = $apiClient; + } - /** - * createUser + /** + * createUser * - * Create user + * 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"; + // parse inputs + $resourcePath = "/user"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "POST"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -63,28 +63,28 @@ public function createUser($body) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * createUsersWithArrayInput + /** + * createUsersWithArrayInput * - * Creates list of users with given input array + * 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"; + // parse inputs + $resourcePath = "/user/createWithArray"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "POST"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -108,28 +108,28 @@ public function createUsersWithArrayInput($body) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * createUsersWithListInput + /** + * createUsersWithListInput * - * Creates list of users with given input array + * 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"; + // parse inputs + $resourcePath = "/user/createWithList"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "POST"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -153,29 +153,29 @@ public function createUsersWithListInput($body) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * loginUser + /** + * loginUser * - * Logs user into the system + * 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"; + // parse inputs + $resourcePath = "/user/login"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "GET"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -184,11 +184,11 @@ public function loginUser($username, $password) { // query params if($username !== null) { - $queryParams['username'] = $this->apiClient->toQueryValue($username); - }// query params + $queryParams['username'] = $this->apiClient->toQueryValue($username); + }// query params if($password !== null) { - $queryParams['password'] = $this->apiClient->toQueryValue($password); - } + $queryParams['password'] = $this->apiClient->toQueryValue($password); + } @@ -201,10 +201,10 @@ public function loginUser($username, $password) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); if(! $response) { return null; @@ -215,19 +215,19 @@ public function loginUser($username, $password) { return $responseObject; } - /** - * logoutUser + /** + * logoutUser * - * Logs out current logged in user session + * 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"; + // parse inputs + $resourcePath = "/user/logout"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "GET"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -247,28 +247,28 @@ public function logoutUser() { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * getUserByName + /** + * getUserByName * - * Get user by user name + * 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"; + // parse inputs + $resourcePath = "/user/{username}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "GET"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -279,9 +279,9 @@ public function getUserByName($username) { // path params if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } + $resourcePath = str_replace("{" . "username" . "}", + $this->apiClient->toPathValue($username), $resourcePath); + } @@ -292,10 +292,10 @@ public function getUserByName($username) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); if(! $response) { return null; @@ -306,21 +306,21 @@ public function getUserByName($username) { return $responseObject; } - /** - * updateUser + /** + * updateUser * - * Updated user + * 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"; + // parse inputs + $resourcePath = "/user/{username}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "PUT"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -331,9 +331,9 @@ public function updateUser($username, $body) { // path params if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } + $resourcePath = str_replace("{" . "username" . "}", + $this->apiClient->toPathValue($username), $resourcePath); + } // body params $body = null; @@ -348,28 +348,28 @@ public function updateUser($username, $body) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); } - /** - * deleteUser + /** + * deleteUser * - * Delete user + * 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"; + // parse inputs + $resourcePath = "/user/{username}"; + $resourcePath = str_replace("{format}", "json", $resourcePath); + $method = "DELETE"; $queryParams = array(); $headerParams = array(); $formParams = array(); @@ -380,9 +380,9 @@ public function deleteUser($username) { // path params if($username !== null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } + $resourcePath = str_replace("{" . "username" . "}", + $this->apiClient->toPathValue($username), $resourcePath); + } @@ -393,10 +393,10 @@ public function deleteUser($username) { $body = http_build_query($body); } - // make the API Call - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); + // make the API Call + $response = $this->apiClient->callAPI($resourcePath, $method, + $queryParams, $body, + $headerParams); }