Rebuild Petstare sample for Java, Android, PHP, etc.

This commit is contained in:
xhh 2015-06-17 16:15:37 +08:00
parent 7f4586a47f
commit 9c4e5ed596
12 changed files with 31 additions and 31 deletions

View File

@ -108,10 +108,10 @@ object PetApi {
* Expected answers:
* code 400 : (Invalid pet value)
*
* @param apiKey
* @param petId Pet id to delete
* @param apiKey
*/
def deletePet(apiKey: Option[String] = None, petId: Long): ApiRequest[Unit] =
def deletePet(petId: Long, apiKey: Option[String] = None): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.DELETE, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/json")
.withPathParam("petId", petId)
.withHeaderParam("api_key", apiKey)

View File

@ -391,11 +391,11 @@ public class PetApi {
/**
* Deletes a pet
*
* @param apiKey
* @param petId Pet id to delete
* @param apiKey
* @return void
*/
public void deletePet (String apiKey, Long petId) throws ApiException {
public void deletePet (Long petId, String apiKey) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set

View File

@ -1,8 +1,8 @@
package io.swagger.client.model;
import io.swagger.client.model.Category;
import java.util.*;
import io.swagger.client.model.Tag;
import java.util.*;
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;

View File

@ -118,7 +118,7 @@ public class PetApiTest {
api.addPet(pet);
Pet fetched = api.getPetById(pet.getId());
api.deletePet(null, fetched.getId());
api.deletePet(fetched.getId(), null);
try {
fetched = api.getPetById(fetched.getId());

View File

@ -322,7 +322,7 @@ public class PetApi {
}
try {
String[] authNames = new String[] { "petstore_auth", "api_key" };
String[] authNames = new String[] { "api_key", "petstore_auth" };
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
if(response != null){
return (Pet) apiClient.deserialize(response, "", Pet.class);
@ -417,11 +417,11 @@ public class PetApi {
/**
* Deletes a pet
*
* @param apiKey
* @param petId Pet id to delete
* @param apiKey
* @return void
*/
public void deletePet (String apiKey, Long petId) throws ApiException {
public void deletePet (Long petId, String apiKey) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set

View File

@ -1,8 +1,8 @@
package io.swagger.client.model;
import io.swagger.client.model.Category;
import java.util.*;
import io.swagger.client.model.Tag;
import java.util.*;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;

View File

@ -151,7 +151,7 @@ public class PetApiTest {
api.addPet(pet);
Pet fetched = api.getPetById(pet.getId());
api.deletePet(null, fetched.getId());
api.deletePet(fetched.getId(), null);
try {
fetched = api.getPetById(fetched.getId());

View File

@ -59,7 +59,7 @@ class PetApi {
*
* Update an existing pet
*
* @param Pet $body Pet object that needs to be added to the store (required)
* @param Pet $body Pet object that needs to be added to the store
* @return void
*/
public function updatePet($body) {
@ -113,7 +113,7 @@ class PetApi {
*
* Add a new pet to the store
*
* @param Pet $body Pet object that needs to be added to the store (required)
* @param Pet $body Pet object that needs to be added to the store
* @return void
*/
public function addPet($body) {
@ -167,7 +167,7 @@ class PetApi {
*
* Finds Pets by status
*
* @param array[string] $status Status values that need to be considered for filter (required)
* @param array[string] $status Status values that need to be considered for filter
* @return array[Pet]
*/
public function findPetsByStatus($status) {
@ -225,7 +225,7 @@ class PetApi {
*
* Finds Pets by tags
*
* @param array[string] $tags Tags to filter by (required)
* @param array[string] $tags Tags to filter by
* @return array[Pet]
*/
public function findPetsByTags($tags) {
@ -327,7 +327,7 @@ class PetApi {
}
// authentication setting, if any
$authSettings = array('petstore_auth', 'api_key');
$authSettings = array('api_key', 'petstore_auth');
// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
@ -348,8 +348,8 @@ class PetApi {
* 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)
* @param string $name Updated name of the pet
* @param string $status Updated status of the pet
* @return void
*/
public function updatePetWithForm($pet_id, $name, $status) {
@ -414,11 +414,11 @@ class PetApi {
*
* Deletes a pet
*
* @param string $api_key (required)
* @param int $pet_id Pet id to delete (required)
* @param string $api_key
* @return void
*/
public function deletePet($api_key, $pet_id) {
public function deletePet($pet_id, $api_key) {
// verify the required parameter 'pet_id' is set
if ($pet_id === null) {
@ -478,8 +478,8 @@ class PetApi {
* 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 string $file file to upload (required)
* @param string $additional_metadata Additional data to pass to server
* @param string $file file to upload
* @return void
*/
public function uploadFile($pet_id, $additional_metadata, $file) {

View File

@ -113,7 +113,7 @@ class StoreApi {
*
* Place an order for a pet
*
* @param Order $body order placed for purchasing the pet (required)
* @param Order $body order placed for purchasing the pet
* @return Order
*/
public function placeOrder($body) {

View File

@ -59,7 +59,7 @@ class UserApi {
*
* Create user
*
* @param User $body Created user object (required)
* @param User $body Created user object
* @return void
*/
public function createUser($body) {
@ -113,7 +113,7 @@ class UserApi {
*
* Creates list of users with given input array
*
* @param array[User] $body List of user object (required)
* @param array[User] $body List of user object
* @return void
*/
public function createUsersWithArrayInput($body) {
@ -167,7 +167,7 @@ class UserApi {
*
* Creates list of users with given input array
*
* @param array[User] $body List of user object (required)
* @param array[User] $body List of user object
* @return void
*/
public function createUsersWithListInput($body) {
@ -221,8 +221,8 @@ class UserApi {
*
* 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)
* @param string $username The user name for login
* @param string $password The password for login in clear text
* @return string
*/
public function loginUser($username, $password) {
@ -397,7 +397,7 @@ class UserApi {
* Updated user
*
* @param string $username name that need to be deleted (required)
* @param User $body Updated user object (required)
* @param User $body Updated user object
* @return void
*/
public function updateUser($username, $body) {

View File

@ -16,8 +16,8 @@ require 'swagger_client/models/order'
# APIs
require 'swagger_client/api/user_api'
require 'swagger_client/api/store_api'
require 'swagger_client/api/pet_api'
require 'swagger_client/api/store_api'
module SwaggerClient
# Initialize the default configuration

View File

@ -190,7 +190,7 @@ module SwaggerClient
post_body = nil
auth_names = ['petstore_auth', 'api_key']
auth_names = ['api_key', 'petstore_auth']
response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
obj = Pet.new() and obj.build_from_hash(response)
end