From f097859ce3f66294667285e6508c75d9a6759f09 Mon Sep 17 00:00:00 2001 From: Ian Boston Date: Thu, 10 Mar 2016 15:45:20 +0000 Subject: [PATCH 01/23] Fixed broken builds when definition contains no description --- .../main/resources/Java/libraries/okhttp-gson/model.mustache | 2 +- .../src/main/resources/Java/libraries/retrofit/model.mustache | 2 +- .../src/main/resources/Java/libraries/retrofit2/model.mustache | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache index f469a1346ae..0b544b9e06c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache @@ -13,7 +13,7 @@ import com.google.gson.annotations.SerializedName; /** * {{description}} **/{{/description}} -@ApiModel(description = "{{{description}}}") +{{#description}}@ApiModel(description = "{{{description}}}"){{/description}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/model.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/model.mustache index 07ac2095f98..779a56fedb7 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/model.mustache @@ -13,7 +13,7 @@ import com.google.gson.annotations.SerializedName; /** * {{description}} **/{{/description}} -@ApiModel(description = "{{{description}}}") +{{#description}}@ApiModel(description = "{{{description}}}"){{/description}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/model.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/model.mustache index 07ac2095f98..779a56fedb7 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/model.mustache @@ -13,7 +13,7 @@ import com.google.gson.annotations.SerializedName; /** * {{description}} **/{{/description}} -@ApiModel(description = "{{{description}}}") +{{#description}}@ApiModel(description = "{{{description}}}"){{/description}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}}{{#isEnum}} From 7505b167b70a9db2b2fe6ec9f1c8bc150facee58 Mon Sep 17 00:00:00 2001 From: xhh Date: Mon, 14 Mar 2016 15:36:08 +0800 Subject: [PATCH 02/23] Ruby docs: add require and print statements --- .../src/main/resources/ruby/api_doc.mustache | 8 ++- samples/client/petstore/ruby/README.md | 7 +- samples/client/petstore/ruby/docs/Name.md | 8 +++ samples/client/petstore/ruby/docs/PetApi.md | 27 ++++++++ samples/client/petstore/ruby/docs/StoreApi.md | 17 +++++ samples/client/petstore/ruby/docs/UserApi.md | 26 +++++++- samples/client/petstore/ruby/git_push.sh | 6 +- .../petstore/ruby/lib/petstore/api/pet_api.rb | 6 +- .../ruby/lib/petstore/api/store_api.rb | 2 +- .../ruby/lib/petstore/api/user_api.rb | 2 +- .../ruby/lib/petstore/configuration.rb | 51 ++++++++------- .../petstore/models/inline_response_200.rb | 64 +++++++++---------- .../spec/models/inline_response_200_spec.rb | 43 ++++++------- .../ruby/spec/models/model_return_spec.rb | 2 +- 14 files changed, 180 insertions(+), 89 deletions(-) create mode 100644 samples/client/petstore/ruby/docs/Name.md diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache index f71a066b74f..a3f0bccc642 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache @@ -18,7 +18,10 @@ Method | HTTP request | Description {{notes}}{{/notes}} ### Example -```ruby{{#hasAuthMethods}} +```ruby +require '{{{gemName}}}' +{{#hasAuthMethods}} + {{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}} # Configure HTTP basic authorization: {{{name}}} config.username = 'YOUR USERNAME' @@ -41,7 +44,8 @@ opts = { {{#allParams}}{{^required}} }{{/hasOptionalParams}}{{/hasParams}} begin - {{#returnType}}result = {{/returnType}}api.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}} + {{#returnType}}result = {{/returnType}}api.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}} + p result{{/returnType}} rescue {{{moduleName}}}::ApiError => e puts "Exception when calling {{{operationId}}}: #{e}" end diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 9ec5c8ccc69..f708fabd397 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -6,7 +6,7 @@ Version: 1.0.0 Automatically generated by the Ruby Swagger Codegen project: -- Build date: 2016-03-11T18:59:01.854+08:00 +- Build date: 2016-03-14T15:33:44.953+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -108,6 +108,7 @@ Class | Method | HTTP request | Description - [Petstore::Category](docs/Category.md) - [Petstore::InlineResponse200](docs/InlineResponse200.md) - [Petstore::ModelReturn](docs/ModelReturn.md) + - [Petstore::Name](docs/Name.md) - [Petstore::Order](docs/Order.md) - [Petstore::Pet](docs/Pet.md) - [Petstore::SpecialModelName](docs/SpecialModelName.md) @@ -145,6 +146,10 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key - **Location**: HTTP header +### test_http_basic + +- **Type**: HTTP basic authentication + ### test_api_key_query - **Type**: API key diff --git a/samples/client/petstore/ruby/docs/Name.md b/samples/client/petstore/ruby/docs/Name.md new file mode 100644 index 00000000000..0fa18840f0c --- /dev/null +++ b/samples/client/petstore/ruby/docs/Name.md @@ -0,0 +1,8 @@ +# Petstore::Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md index b0dc8f82cee..d1ce71a0e06 100644 --- a/samples/client/petstore/ruby/docs/PetApi.md +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -26,6 +26,8 @@ Add a new pet to the store ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -74,6 +76,8 @@ Fake endpoint to test byte array in body parameter for adding a new pet to the s ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -122,6 +126,8 @@ Deletes a pet ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -173,6 +179,8 @@ Multiple status values can be provided with comma separated strings ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -186,6 +194,7 @@ opts = { begin result = api.find_pets_by_status(opts) + p result rescue Petstore::ApiError => e puts "Exception when calling find_pets_by_status: #{e}" end @@ -221,6 +230,8 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -234,6 +245,7 @@ opts = { begin result = api.find_pets_by_tags(opts) + p result rescue Petstore::ApiError => e puts "Exception when calling find_pets_by_tags: #{e}" end @@ -269,6 +281,8 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -286,6 +300,7 @@ pet_id = 789 # [Integer] ID of pet that needs to be fetched begin result = api.get_pet_by_id(pet_id) + p result rescue Petstore::ApiError => e puts "Exception when calling get_pet_by_id: #{e}" end @@ -321,6 +336,8 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -338,6 +355,7 @@ pet_id = 789 # [Integer] ID of pet that needs to be fetched begin result = api.get_pet_by_id_in_object(pet_id) + p result rescue Petstore::ApiError => e puts "Exception when calling get_pet_by_id_in_object: #{e}" end @@ -373,6 +391,8 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -390,6 +410,7 @@ pet_id = 789 # [Integer] ID of pet that needs to be fetched begin result = api.pet_pet_idtesting_byte_arraytrue_get(pet_id) + p result rescue Petstore::ApiError => e puts "Exception when calling pet_pet_idtesting_byte_arraytrue_get: #{e}" end @@ -425,6 +446,8 @@ Update an existing pet ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -473,6 +496,8 @@ Updates a pet in the store with form data ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" @@ -526,6 +551,8 @@ uploads an image ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure OAuth2 access token for authorization: petstore_auth config.access_token = "YOUR ACCESS TOKEN" diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index 071a42e08ff..f3bab7e3d69 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -21,6 +21,8 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ### Example ```ruby +require 'petstore' + api = Petstore::StoreApi.new order_id = "order_id_example" # [String] ID of the order that needs to be deleted @@ -63,6 +65,8 @@ A single status value can be provided as a string ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure API key authorization: test_api_client_id config.api_key['x-test_api_client_id'] = "YOUR API KEY" @@ -83,6 +87,7 @@ opts = { begin result = api.find_orders_by_status(opts) + p result rescue Petstore::ApiError => e puts "Exception when calling find_orders_by_status: #{e}" end @@ -118,6 +123,8 @@ Returns a map of status codes to quantities ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure API key authorization: api_key config.api_key['api_key'] = "YOUR API KEY" @@ -129,6 +136,7 @@ api = Petstore::StoreApi.new begin result = api.get_inventory + p result rescue Petstore::ApiError => e puts "Exception when calling get_inventory: #{e}" end @@ -161,6 +169,8 @@ Returns an arbitrary object which is actually a map of status codes to quantitie ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure API key authorization: api_key config.api_key['api_key'] = "YOUR API KEY" @@ -172,6 +182,7 @@ api = Petstore::StoreApi.new begin result = api.get_inventory_in_object + p result rescue Petstore::ApiError => e puts "Exception when calling get_inventory_in_object: #{e}" end @@ -204,6 +215,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values w ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure API key authorization: test_api_key_query config.api_key['test_api_key_query'] = "YOUR API KEY" @@ -223,6 +236,7 @@ order_id = "order_id_example" # [String] ID of pet that needs to be fetched begin result = api.get_order_by_id(order_id) + p result rescue Petstore::ApiError => e puts "Exception when calling get_order_by_id: #{e}" end @@ -258,6 +272,8 @@ Place an order for a pet ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure API key authorization: test_api_client_id config.api_key['x-test_api_client_id'] = "YOUR API KEY" @@ -278,6 +294,7 @@ opts = { begin result = api.place_order(opts) + p result rescue Petstore::ApiError => e puts "Exception when calling place_order: #{e}" end diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index b7dbb9c69aa..c629e696410 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -23,6 +23,8 @@ This can only be done by the logged in user. ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new opts = { @@ -66,6 +68,8 @@ Creates list of users with given input array ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new opts = { @@ -109,6 +113,8 @@ Creates list of users with given input array ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new opts = { @@ -152,6 +158,14 @@ This can only be done by the logged in user. ### Example ```ruby +require 'petstore' + +Petstore.configure do |config| + # Configure HTTP basic authorization: test_http_basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + api = Petstore::UserApi.new username = "username_example" # [String] The name that needs to be deleted @@ -176,7 +190,7 @@ nil (empty response body) ### Authorization -No authorization required +[test_http_basic](../README.md#test_http_basic) ### HTTP reuqest headers @@ -194,6 +208,8 @@ Get user by user name ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new username = "username_example" # [String] The name that needs to be fetched. Use user1 for testing. @@ -201,6 +217,7 @@ username = "username_example" # [String] The name that needs to be fetched. Use begin result = api.get_user_by_name(username) + p result rescue Petstore::ApiError => e puts "Exception when calling get_user_by_name: #{e}" end @@ -236,6 +253,8 @@ Logs user into the system ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new opts = { @@ -245,6 +264,7 @@ opts = { begin result = api.login_user(opts) + p result rescue Petstore::ApiError => e puts "Exception when calling login_user: #{e}" end @@ -281,6 +301,8 @@ Logs out current logged in user session ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new begin @@ -317,6 +339,8 @@ This can only be done by the logged in user. ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new username = "username_example" # [String] name that need to be deleted diff --git a/samples/client/petstore/ruby/git_push.sh b/samples/client/petstore/ruby/git_push.sh index 1a36388db02..6ca091b49d9 100644 --- a/samples/client/petstore/ruby/git_push.sh +++ b/samples/client/petstore/ruby/git_push.sh @@ -8,17 +8,17 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi if [ "$release_note" = "" ]; then - release_note="Minor update" + release_note="" echo "[INFO] No command line input provided. Set \$release_note to $release_note" fi diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index 29f631a983e..4a5d45d766c 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -360,7 +360,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['api_key', 'petstore_auth'] + auth_names = ['petstore_auth', 'api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, @@ -420,7 +420,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['api_key', 'petstore_auth'] + auth_names = ['petstore_auth', 'api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, @@ -480,7 +480,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['api_key', 'petstore_auth'] + auth_names = ['petstore_auth', 'api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index 11bdfaadf62..7bdfd013bf6 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -301,7 +301,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['test_api_key_header', 'test_api_key_query'] + auth_names = ['test_api_key_query', 'test_api_key_header'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index 0a295335eda..54d943bdc44 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -238,7 +238,7 @@ module Petstore # http body (model) post_body = nil - auth_names = [] + auth_names = ['test_http_basic'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index e5f39898027..a5c37d54e9c 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -157,26 +157,12 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { - 'test_api_key_header' => + 'petstore_auth' => { - type: 'api_key', + type: 'oauth2', in: 'header', - key: 'test_api_key_header', - value: api_key_with_prefix('test_api_key_header') - }, - 'api_key' => - { - type: 'api_key', - in: 'header', - key: 'api_key', - value: api_key_with_prefix('api_key') - }, - 'test_api_client_secret' => - { - type: 'api_key', - in: 'header', - key: 'x-test_api_client_secret', - value: api_key_with_prefix('x-test_api_client_secret') + key: 'Authorization', + value: "Bearer #{access_token}" }, 'test_api_client_id' => { @@ -185,6 +171,27 @@ module Petstore key: 'x-test_api_client_id', value: api_key_with_prefix('x-test_api_client_id') }, + 'test_api_client_secret' => + { + type: 'api_key', + in: 'header', + key: 'x-test_api_client_secret', + value: api_key_with_prefix('x-test_api_client_secret') + }, + 'api_key' => + { + type: 'api_key', + in: 'header', + key: 'api_key', + value: api_key_with_prefix('api_key') + }, + 'test_http_basic' => + { + type: 'basic', + in: 'header', + key: 'Authorization', + value: basic_auth_token + }, 'test_api_key_query' => { type: 'api_key', @@ -192,12 +199,12 @@ module Petstore key: 'test_api_key_query', value: api_key_with_prefix('test_api_key_query') }, - 'petstore_auth' => + 'test_api_key_header' => { - type: 'oauth2', + type: 'api_key', in: 'header', - key: 'Authorization', - value: "Bearer #{access_token}" + key: 'test_api_key_header', + value: api_key_with_prefix('test_api_key_header') }, } end diff --git a/samples/client/petstore/ruby/lib/petstore/models/inline_response_200.rb b/samples/client/petstore/ruby/lib/petstore/models/inline_response_200.rb index 190170f18eb..a793250e45b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/inline_response_200.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/inline_response_200.rb @@ -18,34 +18,34 @@ require 'date' module Petstore class InlineResponse200 - attr_accessor :tags + attr_accessor :photo_urls + + attr_accessor :name attr_accessor :id attr_accessor :category + attr_accessor :tags + # pet status in the store attr_accessor :status - attr_accessor :name - - attr_accessor :photo_urls - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'tags' => :'tags', + :'photo_urls' => :'photoUrls', + + :'name' => :'name', :'id' => :'id', :'category' => :'category', - :'status' => :'status', + :'tags' => :'tags', - :'name' => :'name', - - :'photo_urls' => :'photoUrls' + :'status' => :'status' } end @@ -53,12 +53,12 @@ module Petstore # Attribute type mapping. def self.swagger_types { - :'tags' => :'Array', + :'photo_urls' => :'Array', + :'name' => :'String', :'id' => :'Integer', :'category' => :'Object', - :'status' => :'String', - :'name' => :'String', - :'photo_urls' => :'Array' + :'tags' => :'Array', + :'status' => :'String' } end @@ -70,12 +70,16 @@ module Petstore attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} - if attributes[:'tags'] - if (value = attributes[:'tags']).is_a?(Array) - self.tags = value + if attributes[:'photoUrls'] + if (value = attributes[:'photoUrls']).is_a?(Array) + self.photo_urls = value end end + if attributes[:'name'] + self.name = attributes[:'name'] + end + if attributes[:'id'] self.id = attributes[:'id'] end @@ -84,20 +88,16 @@ module Petstore self.category = attributes[:'category'] end + if attributes[:'tags'] + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + if attributes[:'status'] self.status = attributes[:'status'] end - if attributes[:'name'] - self.name = attributes[:'name'] - end - - if attributes[:'photoUrls'] - if (value = attributes[:'photoUrls']).is_a?(Array) - self.photo_urls = value - end - end - end # Custom attribute writer method checking allowed values (enum). @@ -113,12 +113,12 @@ module Petstore def ==(o) return true if self.equal?(o) self.class == o.class && - tags == o.tags && + photo_urls == o.photo_urls && + name == o.name && id == o.id && category == o.category && - status == o.status && - name == o.name && - photo_urls == o.photo_urls + tags == o.tags && + status == o.status end # @see the `==` method @@ -128,7 +128,7 @@ module Petstore # Calculate hash code according to all attributes. def hash - [tags, id, category, status, name, photo_urls].hash + [photo_urls, name, id, category, tags, status].hash end # build the object from hash diff --git a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb index 6010167fe8d..241a2ded1d1 100644 --- a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb +++ b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb @@ -36,8 +36,17 @@ describe 'InlineResponse200' do @instance.should be_a(Petstore::InlineResponse200) end end - - describe 'test attribute "tags"' do + describe 'test attribute "photo_urls"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "name"' do it 'should work' do # assertion here # should be_a() @@ -67,6 +76,16 @@ describe 'InlineResponse200' do end end + describe 'test attribute "tags"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + describe 'test attribute "status"' do it 'should work' do # assertion here @@ -77,25 +96,5 @@ describe 'InlineResponse200' do end end - describe 'test attribute "name"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - describe 'test attribute "photo_urls"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - end diff --git a/samples/client/petstore/ruby/spec/models/model_return_spec.rb b/samples/client/petstore/ruby/spec/models/model_return_spec.rb index 4081c495457..018798b47e3 100644 --- a/samples/client/petstore/ruby/spec/models/model_return_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_return_spec.rb @@ -18,7 +18,7 @@ require 'spec_helper' require 'json' require 'date' -# Unit tests for Petstore:: +# Unit tests for Petstore::ModelReturn # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'ModelReturn' do From 532d22c5a301ae8e38919e725fe2e264dc3f76d8 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 14 Mar 2016 17:25:11 +0800 Subject: [PATCH 03/23] add api documentation to php --- .../codegen/languages/PhpClientCodegen.java | 99 +++- .../src/main/resources/php/README.mustache | 40 +- .../src/main/resources/php/composer.mustache | 2 +- .../php/SwaggerClient-php/docs/Category.md | 16 + .../docs/InlineResponse200.md | 20 + .../php/SwaggerClient-php/docs/ModelReturn.md | 15 + .../php/SwaggerClient-php/docs/Name.md | 15 + .../php/SwaggerClient-php/docs/Order.md | 20 + .../php/SwaggerClient-php/docs/Pet.md | 20 + .../php/SwaggerClient-php/docs/PetApi.md | 557 ++++++++++++++++++ .../docs/SpecialModelName.md | 15 + .../php/SwaggerClient-php/docs/StoreApi.md | 311 ++++++++++ .../php/SwaggerClient-php/docs/Tag.md | 16 + .../php/SwaggerClient-php/docs/User.md | 22 + .../php/SwaggerClient-php/docs/UserApi.md | 371 ++++++++++++ .../php/SwaggerClient-php/lib/Api/UserApi.php | 5 + 16 files changed, 1539 insertions(+), 5 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/Category.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/Name.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/Order.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/Pet.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/Tag.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/User.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index 89eb2ebed7e..b8a891e4c66 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -3,6 +3,7 @@ package io.swagger.codegen.languages; import io.swagger.codegen.CliOption; import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.CodegenParameter; import io.swagger.codegen.CodegenType; import io.swagger.codegen.DefaultCodegen; import io.swagger.codegen.SupportingFile; @@ -35,6 +36,8 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { protected String artifactVersion = "1.0.0"; protected String srcBasePath = "lib"; protected String variableNamingConvention= "snake_case"; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; public PhpClientCodegen() { super(); @@ -49,6 +52,9 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { modelPackage = invokerPackage + "\\Model"; testPackage = invokerPackage + "\\Tests"; + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + setReservedWordsLowerCase( Arrays.asList( // local variables used in api methods (endpoints) @@ -110,8 +116,8 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, "The main namespace to use for all classes. e.g. Yay\\Pets")); cliOptions.add(new CliOption(PACKAGE_PATH, "The main package name for classes. e.g. GeneratedPetstore")); cliOptions.add(new CliOption(SRC_BASE_PATH, "The directory under packagePath to serve as source root.")); - cliOptions.add(new CliOption(COMPOSER_VENDOR_NAME, "The vendor name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. yaypets")); - cliOptions.add(new CliOption(COMPOSER_PROJECT_NAME, "The project name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. petstore-client")); + cliOptions.add(new CliOption(COMPOSER_VENDOR_NAME, "The vendor name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. yaypets. IMPORTANT NOTE (2016/03): composerVendorName will be deprecated and replaced by gitUserId in the next swagger-codegen release")); + cliOptions.add(new CliOption(COMPOSER_PROJECT_NAME, "The project name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. petstore-client. IMPORTANT NOTE (2016/03): composerProjectName will be deprecated and replaced by gitRepoId in the next swagger-codegen release")); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, "The version to use in the composer package version field. e.g. 1.2.3")); } @@ -217,6 +223,10 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { additionalProperties.put("escapedInvokerPackage", invokerPackage.replace("\\", "\\\\")); + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + supportingFiles.add(new SupportingFile("configuration.mustache", toPackagePath(invokerPackage, srcBasePath), "Configuration.php")); supportingFiles.add(new SupportingFile("ApiClient.mustache", toPackagePath(invokerPackage, srcBasePath), "ApiClient.php")); supportingFiles.add(new SupportingFile("ApiException.mustache", toPackagePath(invokerPackage, srcBasePath), "ApiException.php")); @@ -254,6 +264,28 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { return (outputFolder + "/" + toPackagePath(testPackage, srcBasePath)); } + @Override + public String apiDocFileFolder() { + //return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + return (outputFolder + "/" + getPackagePath() + "/" + apiDocPath); + } + + @Override + public String modelDocFileFolder() { + //return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + return (outputFolder + "/" + getPackagePath() + "/" + modelDocPath); + } + + @Override + public String toModelDocFilename(String name) { + return toModelName(name); + } + + @Override + public String toApiDocFilename(String name) { + return toApiName(name); + } + @Override public String getTypeDeclaration(Property p) { if (p instanceof ArrayProperty) { @@ -460,4 +492,67 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { return null; } + @Override + public void setParameterExampleValue(CodegenParameter p) { + String example; + + if (p.defaultValue == null) { + example = p.example; + } else { + example = p.defaultValue; + } + + String type = p.baseType; + if (type == null) { + type = p.dataType; + } + + if ("String".equals(type)) { + if (example == null) { + example = p.paramName + "_example"; + } + example = "\"" + escapeText(example) + "\""; + } else if ("Integer".equals(type)) { + if (example == null) { + example = "56"; + } + } else if ("Float".equals(type)) { + if (example == null) { + example = "3.4"; + } + } else if ("BOOLEAN".equals(type)) { + if (example == null) { + example = "True"; + } + } else if ("File".equals(type)) { + if (example == null) { + example = "/path/to/file"; + } + example = escapeText(example); + } else if ("Date".equals(type)) { + if (example == null) { + example = "2013-10-20"; + } + example = "new DateTime(\"" + escapeText(example) + "\")"; + } else if ("DateTime".equals(type)) { + if (example == null) { + example = "2013-10-20T19:20:30+01:00"; + } + example = "new DateTime(\"" + escapeText(example) + "\")"; + } else if (!languageSpecificPrimitives.contains(type)) { + // type is a model class, e.g. User + example = "new " + type + "()"; + } + + if (example == null) { + example = "NULL"; + } else if (Boolean.TRUE.equals(p.isListContainer)) { + example = "array(" + example + ")"; + } else if (Boolean.TRUE.equals(p.isMapContainer)) { + example = "array('key' => " + example + ")"; + } + + p.example = example; + } + } diff --git a/modules/swagger-codegen/src/main/resources/php/README.mustache b/modules/swagger-codegen/src/main/resources/php/README.mustache index a795b58be1d..00146f48944 100644 --- a/modules/swagger-codegen/src/main/resources/php/README.mustache +++ b/modules/swagger-codegen/src/main/resources/php/README.mustache @@ -14,11 +14,11 @@ You can install the bindings via [Composer](http://getcomposer.org/). Add this t "repositories": [ { "type": "git", - "url": "https://github.com/{{composerVendorName}}/{{composerProjectName}}.git" + "url": "https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}{{composerVendorName}}{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{composerProjectName}}{{/gitRepoId}}.git" } ], "require": { - "{{composerVendorName}}/{{composerProjectName}}": "*@dev" + "{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}{{composerVendorName}}{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{composerProjectName}}{{/gitRepoId}}": "*@dev" } } ``` @@ -40,6 +40,42 @@ composer install ./vendor/bin/phpunit lib/Tests ``` +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{nickname}}**]({{apiDocPath}}{{classname}}.md#{{nickname}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation For Models + +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{/model}}{{/models}} + +## Documentation For Authorization + +{{^authMethods}} All endpoints do not require authorization. +{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} +{{#authMethods}}## {{{name}}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{{flow}}} +- **Authorizatoin URL**: {{{authorizationUrl}}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + ## Author {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} diff --git a/modules/swagger-codegen/src/main/resources/php/composer.mustache b/modules/swagger-codegen/src/main/resources/php/composer.mustache index 994b6f1ccc7..64564e4ec57 100644 --- a/modules/swagger-codegen/src/main/resources/php/composer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/composer.mustache @@ -1,5 +1,5 @@ { - "name": "{{composerVendorName}}/{{composerProjectName}}",{{#artifactVersion}} + "name": "{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}{{composerVendorName}}{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{composerProjectName}}{{/gitRepoId}}",{{#artifactVersion}} "version": "{{artifactVersion}}",{{/artifactVersion}} "description": "{{description}}", "keywords": [ diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Category.md b/samples/client/petstore/php/SwaggerClient-php/docs/Category.md new file mode 100644 index 00000000000..1f57eb29678 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Category.md @@ -0,0 +1,16 @@ +# ::Object::Category + +## Load the model package +```perl +use ::Object::Category; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md new file mode 100644 index 00000000000..116f6808b07 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md @@ -0,0 +1,20 @@ +# ::Object::InlineResponse200 + +## Load the model package +```perl +use ::Object::InlineResponse200; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional] +**id** | **int** | | +**category** | **object** | | [optional] +**status** | **string** | pet status in the store | [optional] +**name** | **string** | | [optional] +**photo_urls** | **string[]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md b/samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md new file mode 100644 index 00000000000..1d6a183fecb --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md @@ -0,0 +1,15 @@ +# ::Object::ModelReturn + +## Load the model package +```perl +use ::Object::ModelReturn; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Name.md b/samples/client/petstore/php/SwaggerClient-php/docs/Name.md new file mode 100644 index 00000000000..2c95721327a --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Name.md @@ -0,0 +1,15 @@ +# ::Object::Name + +## Load the model package +```perl +use ::Object::Name; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md new file mode 100644 index 00000000000..79c68cff275 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md @@ -0,0 +1,20 @@ +# ::Object::Order + +## Load the model package +```perl +use ::Object::Order; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**pet_id** | **int** | | [optional] +**quantity** | **int** | | [optional] +**ship_date** | [**\DateTime**](\DateTime.md) | | [optional] +**status** | **string** | Order Status | [optional] +**complete** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Pet.md b/samples/client/petstore/php/SwaggerClient-php/docs/Pet.md new file mode 100644 index 00000000000..a97841d399b --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Pet.md @@ -0,0 +1,20 @@ +# ::Object::Pet + +## Load the model package +```perl +use ::Object::Pet; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**\Swagger\Client\Model\Category**](Category.md) | | [optional] +**name** | **string** | | +**photo_urls** | **string[]** | | +**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional] +**status** | **string** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md new file mode 100644 index 00000000000..946074e7687 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md @@ -0,0 +1,557 @@ +# ::PetApi + +## Load the API package +```perl +use ::Object::PetApi; +``` + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**addPetUsingByteArray**](PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**getPetByIdInObject**](PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +[**petPetIdtestingByteArraytrueGet**](PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + +# **addPet** +> addPet(body => $body) + +Add a new pet to the store + + + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $body = ::Object::\Swagger\Client\Model\Pet->new(); # [\Swagger\Client\Model\Pet] Pet object that needs to be added to the store + +eval { + $api->addPet(body => $body); +}; +if ($@) { + warn "Exception when calling PetApi->addPet: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **addPetUsingByteArray** +> addPetUsingByteArray(body => $body) + +Fake endpoint to test byte array in body parameter for adding a new pet to the store + + + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $body = ::Object::string->new(); # [string] Pet object in the form of byte array + +eval { + $api->addPetUsingByteArray(body => $body); +}; +if ($@) { + warn "Exception when calling PetApi->addPetUsingByteArray: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **string**| Pet object in the form of byte array | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **deletePet** +> deletePet(pet_id => $pet_id, api_key => $api_key) + +Deletes a pet + + + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $pet_id = 789; # [int] Pet id to delete +my $api_key = api_key_example; # [string] + +eval { + $api->deletePet(pet_id => $pet_id, api_key => $api_key); +}; +if ($@) { + warn "Exception when calling PetApi->deletePet: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| Pet id to delete | + **api_key** | **string**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findPetsByStatus** +> \Swagger\Client\Model\Pet[] findPetsByStatus(status => $status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $status = (array(available)); # [string[]] Status values that need to be considered for query + +eval { + my $result = $api->findPetsByStatus(status => $status); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling PetApi->findPetsByStatus: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**string[]**](string.md)| Status values that need to be considered for query | [optional] [default to available] + +### Return type + +[**\Swagger\Client\Model\Pet[]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findPetsByTags** +> \Swagger\Client\Model\Pet[] findPetsByTags(tags => $tags) + +Finds Pets by tags + +Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $tags = (nil); # [string[]] Tags to filter by + +eval { + my $result = $api->findPetsByTags(tags => $tags); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling PetApi->findPetsByTags: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**string[]**](string.md)| Tags to filter by | [optional] + +### Return type + +[**\Swagger\Client\Model\Pet[]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getPetById** +> \Swagger\Client\Model\Pet getPetById(pet_id => $pet_id) + +Find pet by ID + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: api_key +::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $pet_id = 789; # [int] ID of pet that needs to be fetched + +eval { + my $result = $api->getPetById(pet_id => $pet_id); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling PetApi->getPetById: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**\Swagger\Client\Model\Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getPetByIdInObject** +> \Swagger\Client\Model\InlineResponse200 getPetByIdInObject(pet_id => $pet_id) + +Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: api_key +::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $pet_id = 789; # [int] ID of pet that needs to be fetched + +eval { + my $result = $api->getPetByIdInObject(pet_id => $pet_id); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling PetApi->getPetByIdInObject: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**\Swagger\Client\Model\InlineResponse200**](InlineResponse200.md) + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **petPetIdtestingByteArraytrueGet** +> string petPetIdtestingByteArraytrueGet(pet_id => $pet_id) + +Fake endpoint to test byte array return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: api_key +::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $pet_id = 789; # [int] ID of pet that needs to be fetched + +eval { + my $result = $api->petPetIdtestingByteArraytrueGet(pet_id => $pet_id); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling PetApi->petPetIdtestingByteArraytrueGet: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +**string** + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updatePet** +> updatePet(body => $body) + +Update an existing pet + + + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $body = ::Object::\Swagger\Client\Model\Pet->new(); # [\Swagger\Client\Model\Pet] Pet object that needs to be added to the store + +eval { + $api->updatePet(body => $body); +}; +if ($@) { + warn "Exception when calling PetApi->updatePet: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updatePetWithForm** +> updatePetWithForm(pet_id => $pet_id, name => $name, status => $status) + +Updates a pet in the store with form data + + + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $pet_id = pet_id_example; # [string] ID of pet that needs to be updated +my $name = name_example; # [string] Updated name of the pet +my $status = status_example; # [string] Updated status of the pet + +eval { + $api->updatePetWithForm(pet_id => $pet_id, name => $name, status => $status); +}; +if ($@) { + warn "Exception when calling PetApi->updatePetWithForm: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **string**| ID of pet that needs to be updated | + **name** | **string**| Updated name of the pet | [optional] + **status** | **string**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **uploadFile** +> uploadFile(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file) + +uploads an image + + + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api = ::PetApi->new(); +my $pet_id = 789; # [int] ID of pet to update +my $additional_metadata = additional_metadata_example; # [string] Additional data to pass to server +my $file = new Swagger\Client\\SplFileObject(); # [\SplFileObject] file to upload + +eval { + $api->uploadFile(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); +}; +if ($@) { + warn "Exception when calling PetApi->uploadFile: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **additional_metadata** | **string**| Additional data to pass to server | [optional] + **file** | **\SplFileObject**| file to upload | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md b/samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md new file mode 100644 index 00000000000..d0775fc6a2f --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md @@ -0,0 +1,15 @@ +# ::Object::SpecialModelName + +## Load the model package +```perl +use ::Object::SpecialModelName; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**special_property_name** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md new file mode 100644 index 00000000000..f8d61015d5c --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md @@ -0,0 +1,311 @@ +# ::StoreApi + +## Load the API package +```perl +use ::Object::StoreApi; +``` + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**findOrdersByStatus**](StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getInventoryInObject**](StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +> deleteOrder(order_id => $order_id) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```perl +use Data::Dumper; + +my $api = ::StoreApi->new(); +my $order_id = order_id_example; # [string] ID of the order that needs to be deleted + +eval { + $api->deleteOrder(order_id => $order_id); +}; +if ($@) { + warn "Exception when calling StoreApi->deleteOrder: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **string**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findOrdersByStatus** +> \Swagger\Client\Model\Order[] findOrdersByStatus(status => $status) + +Finds orders by status + +A single status value can be provided as a string + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: test_api_client_id +::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; +# Configure API key authorization: test_api_client_secret +::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; + +my $api = ::StoreApi->new(); +my $status = placed; # [string] Status value that needs to be considered for query + +eval { + my $result = $api->findOrdersByStatus(status => $status); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling StoreApi->findOrdersByStatus: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **string**| Status value that needs to be considered for query | [optional] [default to placed] + +### Return type + +[**\Swagger\Client\Model\Order[]**](Order.md) + +### Authorization + +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getInventory** +> map[string,int] getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: api_key +::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; + +my $api = ::StoreApi->new(); + +eval { + my $result = $api->getInventory(); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling StoreApi->getInventory: $@\n"; +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**map[string,int]**](map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getInventoryInObject** +> object getInventoryInObject() + +Fake endpoint to test arbitrary object return by 'Get inventory' + +Returns an arbitrary object which is actually a map of status codes to quantities + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: api_key +::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; + +my $api = ::StoreApi->new(); + +eval { + my $result = $api->getInventoryInObject(); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling StoreApi->getInventoryInObject: $@\n"; +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**object** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getOrderById** +> \Swagger\Client\Model\Order getOrderById(order_id => $order_id) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: test_api_key_header +::Configuration::api_key->{'test_api_key_header'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'test_api_key_header'} = "BEARER"; +# Configure API key authorization: test_api_key_query +::Configuration::api_key->{'test_api_key_query'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'test_api_key_query'} = "BEARER"; + +my $api = ::StoreApi->new(); +my $order_id = order_id_example; # [string] ID of pet that needs to be fetched + +eval { + my $result = $api->getOrderById(order_id => $order_id); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling StoreApi->getOrderById: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **string**| ID of pet that needs to be fetched | + +### Return type + +[**\Swagger\Client\Model\Order**](Order.md) + +### Authorization + +[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **placeOrder** +> \Swagger\Client\Model\Order placeOrder(body => $body) + +Place an order for a pet + + + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: test_api_client_id +::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; +# Configure API key authorization: test_api_client_secret +::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; + +my $api = ::StoreApi->new(); +my $body = ::Object::\Swagger\Client\Model\Order->new(); # [\Swagger\Client\Model\Order] order placed for purchasing the pet + +eval { + my $result = $api->placeOrder(body => $body); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling StoreApi->placeOrder: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\Order**](\Swagger\Client\Model\Order.md)| order placed for purchasing the pet | [optional] + +### Return type + +[**\Swagger\Client\Model\Order**](Order.md) + +### Authorization + +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Tag.md b/samples/client/petstore/php/SwaggerClient-php/docs/Tag.md new file mode 100644 index 00000000000..fe7f063852d --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Tag.md @@ -0,0 +1,16 @@ +# ::Object::Tag + +## Load the model package +```perl +use ::Object::Tag; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/User.md b/samples/client/petstore/php/SwaggerClient-php/docs/User.md new file mode 100644 index 00000000000..306021a79d0 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/User.md @@ -0,0 +1,22 @@ +# ::Object::User + +## Load the model package +```perl +use ::Object::User; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **string** | | [optional] +**first_name** | **string** | | [optional] +**last_name** | **string** | | [optional] +**email** | **string** | | [optional] +**password** | **string** | | [optional] +**phone** | **string** | | [optional] +**user_status** | **int** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md new file mode 100644 index 00000000000..8de0f56fec4 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md @@ -0,0 +1,371 @@ +# ::UserApi + +## Load the API package +```perl +use ::Object::UserApi; +``` + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +# **createUser** +> createUser(body => $body) + +Create user + +This can only be done by the logged in user. + +### Example +```perl +use Data::Dumper; + +my $api = ::UserApi->new(); +my $body = ::Object::\Swagger\Client\Model\User->new(); # [\Swagger\Client\Model\User] Created user object + +eval { + $api->createUser(body => $body); +}; +if ($@) { + warn "Exception when calling UserApi->createUser: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Created user object | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body => $body) + +Creates list of users with given input array + + + +### Example +```perl +use Data::Dumper; + +my $api = ::UserApi->new(); +my $body = (::Object::\Swagger\Client\Model\User[]->new()); # [\Swagger\Client\Model\User[]] List of user object + +eval { + $api->createUsersWithArrayInput(body => $body); +}; +if ($@) { + warn "Exception when calling UserApi->createUsersWithArrayInput: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **createUsersWithListInput** +> createUsersWithListInput(body => $body) + +Creates list of users with given input array + + + +### Example +```perl +use Data::Dumper; + +my $api = ::UserApi->new(); +my $body = (::Object::\Swagger\Client\Model\User[]->new()); # [\Swagger\Client\Model\User[]] List of user object + +eval { + $api->createUsersWithListInput(body => $body); +}; +if ($@) { + warn "Exception when calling UserApi->createUsersWithListInput: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **deleteUser** +> deleteUser(username => $username) + +Delete user + +This can only be done by the logged in user. + +### Example +```perl +use Data::Dumper; + +# Configure HTTP basic authorization: test_http_basic +::Configuration::username = 'YOUR_USERNAME'; +::Configuration::password = 'YOUR_PASSWORD'; + +my $api = ::UserApi->new(); +my $username = username_example; # [string] The name that needs to be deleted + +eval { + $api->deleteUser(username => $username); +}; +if ($@) { + warn "Exception when calling UserApi->deleteUser: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +[test_http_basic](../README.md#test_http_basic) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getUserByName** +> \Swagger\Client\Model\User getUserByName(username => $username) + +Get user by user name + + + +### Example +```perl +use Data::Dumper; + +my $api = ::UserApi->new(); +my $username = username_example; # [string] The name that needs to be fetched. Use user1 for testing. + +eval { + my $result = $api->getUserByName(username => $username); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling UserApi->getUserByName: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**\Swagger\Client\Model\User**](User.md) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **loginUser** +> string loginUser(username => $username, password => $password) + +Logs user into the system + + + +### Example +```perl +use Data::Dumper; + +my $api = ::UserApi->new(); +my $username = username_example; # [string] The user name for login +my $password = password_example; # [string] The password for login in clear text + +eval { + my $result = $api->loginUser(username => $username, password => $password); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling UserApi->loginUser: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The user name for login | [optional] + **password** | **string**| The password for login in clear text | [optional] + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```perl +use Data::Dumper; + +my $api = ::UserApi->new(); + +eval { + $api->logoutUser(); +}; +if ($@) { + warn "Exception when calling UserApi->logoutUser: $@\n"; +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updateUser** +> updateUser(username => $username, body => $body) + +Updated user + +This can only be done by the logged in user. + +### Example +```perl +use Data::Dumper; + +my $api = ::UserApi->new(); +my $username = username_example; # [string] name that need to be deleted +my $body = ::Object::\Swagger\Client\Model\User->new(); # [\Swagger\Client\Model\User] Updated user object + +eval { + $api->updateUser(username => $username, body => $body); +}; +if ($@) { + warn "Exception when calling UserApi->updateUser: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| name that need to be deleted | + **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Updated user object | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + 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 298cc1bba50..259581ee2f5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -397,6 +397,11 @@ class UserApi $httpBody = $formParams; // for HTTP post (form) } + // this endpoint requires HTTP basic authentication + if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) { + $headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword()); + } + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( From df8d4fd8b8ff02296040d463bb9860be1a918448 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 14 Mar 2016 21:43:53 +0800 Subject: [PATCH 04/23] remove releaseVersion (duplicated with packageVersion) --- .../java/io/swagger/codegen/cmd/Generate.java | 7 ------- .../io/swagger/codegen/CodegenConfig.java | 4 ---- .../io/swagger/codegen/CodegenConstants.java | 3 --- .../io/swagger/codegen/DefaultCodegen.java | 20 +------------------ .../codegen/config/CodegenConfigurator.java | 11 ---------- pom.xml | 2 +- 6 files changed, 2 insertions(+), 45 deletions(-) diff --git a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java index 064e4b9520f..c44088473e6 100644 --- a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java +++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java @@ -115,9 +115,6 @@ public class Generate implements Runnable { @Option(name = {"--release-note"}, title = "release note", description = CodegenConstants.RELEASE_NOTE_DESC) private String releaseNote; - @Option(name = {"--release-version"}, title = "release version", description = CodegenConstants.RELEASE_VERSION_DESC) - private String releaseVersion; - @Option(name = {"--http-user-agent"}, title = "http user agent", description = CodegenConstants.HTTP_USER_AGENT) private String httpUserAgent; @@ -210,10 +207,6 @@ public class Generate implements Runnable { configurator.setReleaseNote(releaseNote); } - if (isNotEmpty(releaseVersion)) { - configurator.setReleaseVersion(releaseVersion); - } - if (isNotEmpty(httpUserAgent)) { configurator.setHttpUserAgent(httpUserAgent); } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java index 4d829232b07..3dc90472247 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConfig.java @@ -180,10 +180,6 @@ public interface CodegenConfig { String getReleaseNote(); - void setReleaseVersion(String releaseVersion); - - String getReleaseVersion(); - void setHttpUserAgent(String httpUserAgent); String getHttpUserAgent(); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java index 0cf31d081f9..a43c8f8c986 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java @@ -100,9 +100,6 @@ public class CodegenConstants { public static final String RELEASE_NOTE = "releaseNote"; public static final String RELEASE_NOTE_DESC = "Release note, default to 'Minor update'."; - public static final String RELEASE_VERSION = "releaseVersion"; - public static final String RELEASE_VERSION_DESC= "Release version, e.g. 1.2.5, default to 0.1.0."; - public static final String HTTP_USER_AGENT = "httpUserAgent"; public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'Swagger-Codegen/{releaseVersion}}/{language}'"; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 649212735d3..65ed6a456ef 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -83,7 +83,7 @@ public class DefaultCodegen { protected String library; protected Boolean sortParamsByRequiredFlag = true; protected Boolean ensureUniqueParams = true; - protected String gitUserId, gitRepoId, releaseNote, releaseVersion; + protected String gitUserId, gitRepoId, releaseNote; protected String httpUserAgent; public List cliOptions() { @@ -2414,24 +2414,6 @@ public class DefaultCodegen { return releaseNote; } - /** - * Set release version. - * - * @param releaseVersion Release version - */ - public void setReleaseVersion(String releaseVersion) { - this.releaseVersion = releaseVersion; - } - - /** - * Release version - * - * @return Release version - */ - public String getReleaseVersion() { - return releaseVersion; - } - /** * Set HTTP user agent. * diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java index b94ca5f2e18..98c57ab341a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java @@ -63,7 +63,6 @@ public class CodegenConfigurator { private String gitUserId="YOUR_GIT_USR_ID"; private String gitRepoId="YOUR_GIT_REPO_ID"; private String releaseNote="Minor update"; - private String releaseVersion="0.1.0"; private String httpUserAgent; private final Map dynamicProperties = new HashMap(); //the map that holds the JsonAnySetter/JsonAnyGetter values @@ -327,15 +326,6 @@ public class CodegenConfigurator { return this; } - public String getReleaseVersion() { - return releaseVersion; - } - - public CodegenConfigurator setReleaseVersion(String releaseVersion) { - this.releaseVersion = releaseVersion; - return this; - } - public String getHttpUserAgent() { return httpUserAgent; } @@ -374,7 +364,6 @@ public class CodegenConfigurator { checkAndSetAdditionalProperty(modelNameSuffix, CodegenConstants.MODEL_NAME_SUFFIX); checkAndSetAdditionalProperty(gitUserId, CodegenConstants.GIT_USER_ID); checkAndSetAdditionalProperty(gitRepoId, CodegenConstants.GIT_REPO_ID); - checkAndSetAdditionalProperty(releaseVersion, CodegenConstants.RELEASE_VERSION); checkAndSetAdditionalProperty(releaseNote, CodegenConstants.RELEASE_NOTE); checkAndSetAdditionalProperty(httpUserAgent, CodegenConstants.HTTP_USER_AGENT); diff --git a/pom.xml b/pom.xml index 3519ce9f0cb..bc0b67c0e1d 100644 --- a/pom.xml +++ b/pom.xml @@ -549,7 +549,7 @@ 1.0.18-SNAPSHOT 2.11.1 2.3.4 - 1.5.7 + 1.5.8 2.4 1.2 4.8.1 From e10c28596cf555085bf26448d8059a94073f8d57 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 14 Mar 2016 21:57:51 +0800 Subject: [PATCH 05/23] update user-agent for Ruby --- .../java/io/swagger/codegen/cmd/Generate.java | 2 +- .../io/swagger/codegen/CodegenConstants.java | 2 +- .../main/resources/ruby/api_client.mustache | 2 +- samples/client/petstore/ruby/README.md | 44 +++++++++---------- .../petstore/ruby/docs/InlineResponse200.md | 6 +-- samples/client/petstore/ruby/docs/PetApi.md | 24 +++++----- samples/client/petstore/ruby/docs/StoreApi.md | 12 ++--- samples/client/petstore/ruby/docs/UserApi.md | 18 -------- .../petstore/ruby/lib/petstore/api_client.rb | 2 +- .../ruby/lib/petstore/configuration.rb | 7 +++ .../spec/models/inline_response_200_spec.rb | 26 +++++------ 11 files changed, 67 insertions(+), 78 deletions(-) diff --git a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java index c44088473e6..8c7beab502b 100644 --- a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java +++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java @@ -115,7 +115,7 @@ public class Generate implements Runnable { @Option(name = {"--release-note"}, title = "release note", description = CodegenConstants.RELEASE_NOTE_DESC) private String releaseNote; - @Option(name = {"--http-user-agent"}, title = "http user agent", description = CodegenConstants.HTTP_USER_AGENT) + @Option(name = {"--http-user-agent"}, title = "http user agent", description = CodegenConstants.HTTP_USER_AGENT_DESC) private String httpUserAgent; @Override diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java index a43c8f8c986..1d97fe829b8 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java @@ -101,6 +101,6 @@ public class CodegenConstants { public static final String RELEASE_NOTE_DESC = "Release note, default to 'Minor update'."; public static final String HTTP_USER_AGENT = "httpUserAgent"; - public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'Swagger-Codegen/{releaseVersion}}/{language}'"; + public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'Swagger-Codegen/{packageVersion}}/{language}'"; } diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache index d13ad44e5a2..e6e9ccc7fd6 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache @@ -21,7 +21,7 @@ module {{moduleName}} def initialize(config = Configuration.default) @config = config - @user_agent = "ruby-swagger-#{VERSION}" + @user_agent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/#{VERSION}/ruby{{/httpUserAgent}}" @default_headers = { 'Content-Type' => "application/json", 'User-Agent' => @user_agent diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index f708fabd397..7cbfdadfc67 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -6,7 +6,7 @@ Version: 1.0.0 Automatically generated by the Ruby Swagger Codegen project: -- Build date: 2016-03-14T15:33:44.953+08:00 +- Build date: 2016-03-14T21:56:19.858+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -119,25 +119,10 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: --- write:pets: modify pets in your account --- read:pets: read your pets - -### test_api_client_id +### test_api_key_header - **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -### test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret +- **API key parameter name**: test_api_key_header - **Location**: HTTP header ### api_key @@ -150,15 +135,30 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication +### test_api_client_secret + +- **Type**: API key +- **API key parameter name**: x-test_api_client_secret +- **Location**: HTTP header + +### test_api_client_id + +- **Type**: API key +- **API key parameter name**: x-test_api_client_id +- **Location**: HTTP header + ### test_api_key_query - **Type**: API key - **API key parameter name**: test_api_key_query - **Location**: URL query string -### test_api_key_header +### petstore_auth -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header +- **Type**: OAuth +- **Flow**: implicit +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: +-- write:pets: modify pets in your account +-- read:pets: read your pets diff --git a/samples/client/petstore/ruby/docs/InlineResponse200.md b/samples/client/petstore/ruby/docs/InlineResponse200.md index d06f729f2f8..c3b0d978c07 100644 --- a/samples/client/petstore/ruby/docs/InlineResponse200.md +++ b/samples/client/petstore/ruby/docs/InlineResponse200.md @@ -3,11 +3,11 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**photo_urls** | **Array<String>** | | [optional] -**name** | **String** | | [optional] +**tags** | [**Array<Tag>**](Tag.md) | | [optional] **id** | **Integer** | | **category** | **Object** | | [optional] -**tags** | [**Array<Tag>**](Tag.md) | | [optional] **status** | **String** | pet status in the store | [optional] +**name** | **String** | | [optional] +**photo_urls** | **Array<String>** | | [optional] diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md index d1ce71a0e06..8dd272ccd37 100644 --- a/samples/client/petstore/ruby/docs/PetApi.md +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -284,13 +284,13 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro require 'petstore' Petstore.configure do |config| - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = "YOUR ACCESS TOKEN" - # Configure API key authorization: api_key config.api_key['api_key'] = "YOUR API KEY" # Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil) #config.api_key_prefix['api_key'] = "Token" + + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = "YOUR ACCESS TOKEN" end api = Petstore::PetApi.new @@ -318,7 +318,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) ### HTTP reuqest headers @@ -339,13 +339,13 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro require 'petstore' Petstore.configure do |config| - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = "YOUR ACCESS TOKEN" - # Configure API key authorization: api_key config.api_key['api_key'] = "YOUR API KEY" # Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil) #config.api_key_prefix['api_key'] = "Token" + + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = "YOUR ACCESS TOKEN" end api = Petstore::PetApi.new @@ -373,7 +373,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) ### HTTP reuqest headers @@ -394,13 +394,13 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro require 'petstore' Petstore.configure do |config| - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = "YOUR ACCESS TOKEN" - # Configure API key authorization: api_key config.api_key['api_key'] = "YOUR API KEY" # Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil) #config.api_key_prefix['api_key'] = "Token" + + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = "YOUR ACCESS TOKEN" end api = Petstore::PetApi.new @@ -428,7 +428,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) ### HTTP reuqest headers diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index f3bab7e3d69..0b38f5b6fed 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -218,15 +218,15 @@ For valid response try integer IDs with value <= 5 or > 10. Other values w require 'petstore' Petstore.configure do |config| - # Configure API key authorization: test_api_key_query - config.api_key['test_api_key_query'] = "YOUR API KEY" - # Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil) - #config.api_key_prefix['test_api_key_query'] = "Token" - # Configure API key authorization: test_api_key_header config.api_key['test_api_key_header'] = "YOUR API KEY" # Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil) #config.api_key_prefix['test_api_key_header'] = "Token" + + # Configure API key authorization: test_api_key_query + config.api_key['test_api_key_query'] = "YOUR API KEY" + # Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil) + #config.api_key_prefix['test_api_key_query'] = "Token" end api = Petstore::StoreApi.new @@ -254,7 +254,7 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header) +[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) ### HTTP reuqest headers diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index c629e696410..284c5e3a314 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -23,8 +23,6 @@ This can only be done by the logged in user. ### Example ```ruby -require 'petstore' - api = Petstore::UserApi.new opts = { @@ -68,8 +66,6 @@ Creates list of users with given input array ### Example ```ruby -require 'petstore' - api = Petstore::UserApi.new opts = { @@ -113,8 +109,6 @@ Creates list of users with given input array ### Example ```ruby -require 'petstore' - api = Petstore::UserApi.new opts = { @@ -158,8 +152,6 @@ This can only be done by the logged in user. ### Example ```ruby -require 'petstore' - Petstore.configure do |config| # Configure HTTP basic authorization: test_http_basic config.username = 'YOUR USERNAME' @@ -208,8 +200,6 @@ Get user by user name ### Example ```ruby -require 'petstore' - api = Petstore::UserApi.new username = "username_example" # [String] The name that needs to be fetched. Use user1 for testing. @@ -217,7 +207,6 @@ username = "username_example" # [String] The name that needs to be fetched. Use begin result = api.get_user_by_name(username) - p result rescue Petstore::ApiError => e puts "Exception when calling get_user_by_name: #{e}" end @@ -253,8 +242,6 @@ Logs user into the system ### Example ```ruby -require 'petstore' - api = Petstore::UserApi.new opts = { @@ -264,7 +251,6 @@ opts = { begin result = api.login_user(opts) - p result rescue Petstore::ApiError => e puts "Exception when calling login_user: #{e}" end @@ -301,8 +287,6 @@ Logs out current logged in user session ### Example ```ruby -require 'petstore' - api = Petstore::UserApi.new begin @@ -339,8 +323,6 @@ This can only be done by the logged in user. ### Example ```ruby -require 'petstore' - api = Petstore::UserApi.new username = "username_example" # [String] name that need to be deleted diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index bb99e08be70..7ec9de18a3e 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -33,7 +33,7 @@ module Petstore def initialize(config = Configuration.default) @config = config - @user_agent = "ruby-swagger-#{VERSION}" + @user_agent = "Swagger-Codegen/#{VERSION}/ruby" @default_headers = { 'Content-Type' => "application/json", 'User-Agent' => @user_agent diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index a5c37d54e9c..94a1b566a1e 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -171,6 +171,13 @@ module Petstore key: 'x-test_api_client_id', value: api_key_with_prefix('x-test_api_client_id') }, + 'test_http_basic' => + { + type: 'basic', + in: 'header', + key: 'Authorization', + value: basic_auth_token + }, 'test_api_client_secret' => { type: 'api_key', diff --git a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb index 241a2ded1d1..858b6504908 100644 --- a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb +++ b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb @@ -36,17 +36,7 @@ describe 'InlineResponse200' do @instance.should be_a(Petstore::InlineResponse200) end end - describe 'test attribute "photo_urls"' do - it 'should work' do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - describe 'test attribute "name"' do + describe 'test attribute "tags"' do it 'should work' do # assertion here # should be_a() @@ -76,7 +66,7 @@ describe 'InlineResponse200' do end end - describe 'test attribute "tags"' do + describe 'test attribute "status"' do it 'should work' do # assertion here # should be_a() @@ -86,7 +76,17 @@ describe 'InlineResponse200' do end end - describe 'test attribute "status"' do + describe 'test attribute "name"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "photo_urls"' do it 'should work' do # assertion here # should be_a() From be7a49385f0b54e1f04201eb968ee650b46032f7 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 14 Mar 2016 22:26:11 +0800 Subject: [PATCH 06/23] set default user default for ruby, php, python, java --- .../main/resources/Java/ApiClient.mustache | 2 +- .../Java/libraries/jersey2/ApiClient.mustache | 2 +- .../libraries/okhttp-gson/ApiClient.mustache | 2 +- .../main/resources/php/configuration.mustache | 2 +- .../main/resources/python/api_client.mustache | 2 +- .../main/resources/ruby/api_client.mustache | 2 +- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../java/io/swagger/client/api/StoreApi.java | 2 +- .../java/io/swagger/client/api/UserApi.java | 4 +- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../io/swagger/client/auth/HttpBasicAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../io/swagger/client/model/Category.java | 2 +- .../client/model/InlineResponse200.java | 2 +- .../io/swagger/client/model/ModelReturn.java | 2 +- .../java/io/swagger/client/model/Name.java | 2 +- .../java/io/swagger/client/model/Order.java | 2 +- .../java/io/swagger/client/model/Pet.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../java/io/swagger/client/model/Tag.java | 2 +- .../java/io/swagger/client/model/User.java | 2 +- .../io/swagger/client/FormAwareEncoder.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 128 +- .../java/io/swagger/client/api/StoreApi.java | 40 +- .../java/io/swagger/client/api/UserApi.java | 54 +- .../io/swagger/client/model/Category.java | 2 +- .../client/model/InlineResponse200.java | 113 +- .../java/io/swagger/client/model/Order.java | 2 +- .../java/io/swagger/client/model/Pet.java | 2 +- .../java/io/swagger/client/model/Tag.java | 2 +- .../java/io/swagger/client/model/User.java | 2 +- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/JSON.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 456 +++---- .../java/io/swagger/client/api/StoreApi.java | 190 +-- .../java/io/swagger/client/api/UserApi.java | 190 +-- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../io/swagger/client/auth/HttpBasicAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../io/swagger/client/model/Category.java | 2 +- .../client/model/InlineResponse200.java | 113 +- .../java/io/swagger/client/model/Order.java | 2 +- .../java/io/swagger/client/model/Pet.java | 2 +- .../java/io/swagger/client/model/Tag.java | 2 +- .../java/io/swagger/client/model/User.java | 2 +- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 1046 ++++++++--------- .../java/io/swagger/client/api/StoreApi.java | 424 +++---- .../java/io/swagger/client/api/UserApi.java | 424 +++---- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../client/model/InlineResponse200.java | 95 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 258 ++-- .../java/io/swagger/client/api/StoreApi.java | 76 +- .../java/io/swagger/client/api/UserApi.java | 104 +- .../client/model/InlineResponse200.java | 95 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 130 +- .../java/io/swagger/client/api/StoreApi.java | 40 +- .../java/io/swagger/client/api/UserApi.java | 52 +- .../client/model/InlineResponse200.java | 84 +- .../php/SwaggerClient-php/lib/Api/UserApi.php | 5 + .../SwaggerClient-php/lib/Configuration.php | 2 +- .../python/swagger_client/api_client.py | 2 +- .../python/swagger_client/apis/user_api.py | 2 +- .../python/swagger_client/configuration.py | 7 + 78 files changed, 2285 insertions(+), 1953 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache index 79da18933aa..4c79216bc55 100644 --- a/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache @@ -71,7 +71,7 @@ public class ApiClient { dateFormat = ApiClient.buildDefaultDateFormat(); // Set default User-Agent. - setUserAgent("Java-Swagger"); + setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/java{{/httpUserAgent}}"); // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/ApiClient.mustache index 66acc3811d2..58bab66e13d 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/ApiClient.mustache @@ -80,7 +80,7 @@ public class ApiClient { this.json.setDateFormat((DateFormat) dateFormat.clone()); // Set default User-Agent. - setUserAgent("Java-Swagger"); + setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/java{{/httpUserAgent}}"); // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 34b0e4b33b2..4c8e304ed97 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -141,7 +141,7 @@ public class ApiClient { this.lenientDatetimeFormat = true; // Set default User-Agent. - setUserAgent("Java-Swagger"); + setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/java{{/httpUserAgent}}"); // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}} diff --git a/modules/swagger-codegen/src/main/resources/php/configuration.mustache b/modules/swagger-codegen/src/main/resources/php/configuration.mustache index 8fa5e1cb1f0..0062fa8c25f 100644 --- a/modules/swagger-codegen/src/main/resources/php/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/php/configuration.mustache @@ -110,7 +110,7 @@ class Configuration * * @var string */ - protected $userAgent = "PHP-Swagger/{{artifactVersion}}"; + protected $userAgent = "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/php{{/httpUserAgent}}"; /** * Debug switch (default set to false) diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 7aac36e1a20..98fee823591 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -81,7 +81,7 @@ class ApiClient(object): self.host = host self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Python-Swagger/{{packageVersion}}' + self.user_agent = '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/python{{/httpUserAgent}}' @property def user_agent(self): diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache index e6e9ccc7fd6..520a50b76ca 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache @@ -21,7 +21,7 @@ module {{moduleName}} def initialize(config = Configuration.default) @config = config - @user_agent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/#{VERSION}/ruby{{/httpUserAgent}}" + @user_agent = "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/#{VERSION}/ruby{{/httpUserAgent}}" @default_headers = { 'Content-Type' => "application/json", 'User-Agent' => @user_agent diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java index 916ad909680..a88cef3d037 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java index f87f88e4f8e..6f513a2e052 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java index 69686ad2545..b764ea424d8 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java index 9d5225846de..1220f1ef444 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java index f6d6ae1b212..25e282c8b3a 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java @@ -16,7 +16,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class PetApi { private ApiClient apiClient; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java index 482023831a4..aa2e2c50f17 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/StoreApi.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class StoreApi { private ApiClient apiClient; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/UserApi.java index 45f8deaae8c..5198392967b 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/UserApi.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class UserApi { private ApiClient apiClient; @@ -194,7 +194,7 @@ public class UserApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] { "test_http_basic" }; apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 24864e6e904..8c16ac9e5f6 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 97bd3c96e78..953950ca2e5 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -9,7 +9,7 @@ import java.util.List; import java.io.UnsupportedEncodingException; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java index 701eaa35059..3c0e507059c 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Category.java index 3bb895461e8..f3c3c8f766c 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/InlineResponse200.java index cf2f2e8b4f7..362e6933a12 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -13,7 +13,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class InlineResponse200 { private List tags = new ArrayList(); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelReturn.java index a5376d98f45..7dd6f5afe6d 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelReturn.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class ModelReturn { private Integer _return = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java index 92e6263c62a..592222b44de 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class Name { private Integer name = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java index 7c6d7ea7486..0cf830205e7 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java @@ -11,7 +11,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class Order { private Long id = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Pet.java index 6149cfca76a..e357a46d2aa 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Pet.java @@ -14,7 +14,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/SpecialModelName.java index 7d63da4c2f1..6f6a7e91b7d 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Tag.java index d870b658ca5..d7114bd9237 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/User.java index fb441d1ebb8..83491081d00 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-12T17:08:42.639+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:47.322+08:00") public class User { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java index 40f6af65150..f8c7170f44e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java @@ -14,7 +14,7 @@ import feign.codec.EncodeException; import feign.codec.Encoder; import feign.RequestTemplate; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public class FormAwareEncoder implements Encoder { public static final String UTF_8 = "utf-8"; private static final String LINE_FEED = "\r\n"; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java index a7299767d3f..88aff61bf68 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index 1ef43cc376d..70ce18f0569 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -3,8 +3,8 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.InlineResponse200; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; @@ -12,23 +12,10 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:41.120+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public interface PetApi extends ApiClient.Api { - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - */ - @RequestLine("PUT /pet") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - void updatePet(Pet body); - /** * Add a new pet to the store * @@ -42,6 +29,34 @@ public interface PetApi extends ApiClient.Api { }) void addPet(Pet body); + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param body Pet object in the form of byte array + * @return void + */ + @RequestLine("POST /pet?testing_byte_array=true") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + void addPetUsingByteArray(byte[] body); + + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + * @return void + */ + @RequestLine("DELETE /pet/{petId}") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + "apiKey: {apiKey}" + }) + void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -81,51 +96,6 @@ public interface PetApi extends ApiClient.Api { }) Pet getPetById(@Param("petId") Long petId); - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet - * @return void - */ - @RequestLine("POST /pet/{petId}") - @Headers({ - "Content-type: application/x-www-form-urlencoded", - "Accepts: application/json", - }) - void updatePetWithForm(@Param("petId") String petId, @Param("name") String name, @Param("status") String status); - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - * @return void - */ - @RequestLine("DELETE /pet/{petId}") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - "apiKey: {apiKey}" - }) - void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - * @return void - */ - @RequestLine("POST /pet/{petId}/uploadImage") - @Headers({ - "Content-type: multipart/form-data", - "Accepts: application/json", - }) - void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); - /** * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -153,16 +123,46 @@ public interface PetApi extends ApiClient.Api { byte[] petPetIdtestingByteArraytrueGet(@Param("petId") Long petId); /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * Update an existing pet * - * @param body Pet object in the form of byte array + * @param body Pet object that needs to be added to the store * @return void */ - @RequestLine("POST /pet?testing_byte_array=true") + @RequestLine("PUT /pet") @Headers({ "Content-type: application/json", "Accepts: application/json", }) - void addPetUsingByteArray(byte[] body); + void updatePet(Pet body); + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @return void + */ + @RequestLine("POST /pet/{petId}") + @Headers({ + "Content-type: application/x-www-form-urlencoded", + "Accepts: application/json", + }) + void updatePetWithForm(@Param("petId") String petId, @Param("name") String name, @Param("status") String status); + + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @return void + */ + @RequestLine("POST /pet/{petId}/uploadImage") + @Headers({ + "Content-type: multipart/form-data", + "Accepts: application/json", + }) + void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index cb70916ae6b..c36d85e0b5a 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -10,10 +10,23 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:41.120+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public interface StoreApi extends ApiClient.Api { + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return void + */ + @RequestLine("DELETE /store/order/{orderId}") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + void deleteOrder(@Param("orderId") String orderId); + /** * Finds orders by status * A single status value can be provided as a string @@ -51,19 +64,6 @@ public interface StoreApi extends ApiClient.Api { }) Object getInventoryInObject(); - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - */ - @RequestLine("POST /store/order") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - Order placeOrder(Order body); - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -78,16 +78,16 @@ public interface StoreApi extends ApiClient.Api { Order getOrderById(@Param("orderId") String orderId); /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void + * Place an order for a pet + * + * @param body order placed for purchasing the pet + * @return Order */ - @RequestLine("DELETE /store/order/{orderId}") + @RequestLine("POST /store/order") @Headers({ "Content-type: application/json", "Accepts: application/json", }) - void deleteOrder(@Param("orderId") String orderId); + Order placeOrder(Order body); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index e6fec19f35c..082e9af7484 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public interface UserApi extends ApiClient.Api { @@ -53,6 +53,32 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithListInput(List body); + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return void + */ + @RequestLine("DELETE /user/{username}") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + void deleteUser(@Param("username") String username); + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + */ + @RequestLine("GET /user/{username}") + @Headers({ + "Content-type: application/json", + "Accepts: application/json", + }) + User getUserByName(@Param("username") String username); + /** * Logs user into the system * @@ -79,19 +105,6 @@ public interface UserApi extends ApiClient.Api { }) void logoutUser(); - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - */ - @RequestLine("GET /user/{username}") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - User getUserByName(@Param("username") String username); - /** * Updated user * This can only be done by the logged in user. @@ -106,17 +119,4 @@ public interface UserApi extends ApiClient.Api { }) void updateUser(@Param("username") String username, User body); - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - */ - @RequestLine("DELETE /user/{username}") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - void deleteUser(@Param("username") String username); - } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index 05753abc4bf..ca030ff6c48 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:32:23.465+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/InlineResponse200.java index 3cdf734a806..571e95aac8f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -2,35 +2,62 @@ package io.swagger.client.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Tag; +import java.util.ArrayList; +import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:41.120+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public class InlineResponse200 { - private String name = null; + private List tags = new ArrayList(); private Long id = null; private Object category = null; + + public enum StatusEnum { + AVAILABLE("available"), + PENDING("pending"), + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + } + + private StatusEnum status = null; + private String name = null; + private List photoUrls = new ArrayList(); + /** **/ - public InlineResponse200 name(String name) { - this.name = name; + public InlineResponse200 tags(List tags) { + this.tags = tags; return this; } - @ApiModelProperty(example = "doggie", value = "") - @JsonProperty("name") - public String getName() { - return name; + @ApiModelProperty(example = "null", value = "") + @JsonProperty("tags") + public List getTags() { + return tags; } - public void setName(String name) { - this.name = name; + public void setTags(List tags) { + this.tags = tags; } @@ -68,6 +95,58 @@ public class InlineResponse200 { } + /** + * pet status in the store + **/ + public InlineResponse200 status(StatusEnum status) { + this.status = status; + return this; + } + + @ApiModelProperty(example = "null", value = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + + /** + **/ + public InlineResponse200 name(String name) { + this.name = name; + return this; + } + + @ApiModelProperty(example = "doggie", value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + /** + **/ + public InlineResponse200 photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + @Override public boolean equals(java.lang.Object o) { @@ -78,14 +157,17 @@ public class InlineResponse200 { return false; } InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.name, inlineResponse200.name) && + return Objects.equals(this.tags, inlineResponse200.tags) && Objects.equals(this.id, inlineResponse200.id) && - Objects.equals(this.category, inlineResponse200.category); + Objects.equals(this.category, inlineResponse200.category) && + Objects.equals(this.status, inlineResponse200.status) && + Objects.equals(this.name, inlineResponse200.name) && + Objects.equals(this.photoUrls, inlineResponse200.photoUrls); } @Override public int hashCode() { - return Objects.hash(name, id, category); + return Objects.hash(tags, id, category, status, name, photoUrls); } @Override @@ -93,9 +175,12 @@ public class InlineResponse200 { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index a82b360d4fb..a6ae8c7aea8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -11,7 +11,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:32:23.465+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public class Order { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index 9cdfabd89dd..af5ed59eba3 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -14,7 +14,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:32:23.465+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index 497f1c8424d..30263bf28ae 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:32:23.465+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index 75039e3f237..b3c1d22d367 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:32:23.465+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00") public class User { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java index a5793c1d0de..2f7ef6e3286 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java index c316be8c331..b06f6a4f6a4 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java index 0bd23b63091..ff3a5cb782a 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java @@ -8,7 +8,7 @@ import java.text.DateFormat; import javax.ws.rs.ext.ContextResolver; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class JSON implements ContextResolver { private ObjectMapper mapper; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java index 69e856d15fb..a83256c3b3d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java index 98258bfaf15..513c655bd4d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java index e661539eaba..6299c79e19b 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java @@ -8,15 +8,15 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.InlineResponse200; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:39.601+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class PetApi { private ApiClient apiClient; @@ -37,46 +37,6 @@ public class PetApi { } - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @throws ApiException if fails to make API call - */ - public void updatePet(Pet body) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/pet".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - - apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - - } - /** * Add a new pet to the store * @@ -117,6 +77,95 @@ public class PetApi { } + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param body Pet object in the form of byte array + * @throws ApiException if fails to make API call + */ + public void addPetUsingByteArray(byte[] body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + * @throws ApiException if fails to make API call + */ + public void deletePet(Long petId, String apiKey) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + if (apiKey != null) + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -245,7 +294,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; GenericType localVarReturnType = new GenericType() {}; @@ -253,6 +302,142 @@ public class PetApi { } + /** + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return InlineResponse200 + * @throws ApiException if fails to make API call + */ + public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + + } + + /** + * Fake endpoint to test byte array return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return byte[] + * @throws ApiException if fails to make API call + */ + public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + * @throws ApiException if fails to make API call + */ + public void updatePet(Pet body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + + } + /** * Updates a pet in the store with form data * @@ -305,55 +490,6 @@ public class PetApi { } - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - * @throws ApiException if fails to make API call - */ - public void deletePet(Long petId, String apiKey) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - if (apiKey != null) - localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - - } - /** * uploads an image * @@ -402,142 +538,6 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - - } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return InlineResponse200 - * @throws ApiException if fails to make API call - */ - public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; - - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return byte[] - * @throws ApiException if fails to make API call - */ - public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; - - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - * @throws ApiException if fails to make API call - */ - public void addPetUsingByteArray(byte[] body) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/StoreApi.java index 73801be33da..a80e0f4ee63 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/StoreApi.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:39.601+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class StoreApi { private ApiClient apiClient; @@ -35,6 +35,52 @@ public class StoreApi { } + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @throws ApiException if fails to make API call + */ + public void deleteOrder(String orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + // create path and map variables + String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + + } + /** * Finds orders by status * A single status value can be provided as a string @@ -161,6 +207,54 @@ public class StoreApi { } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @return Order + * @throws ApiException if fails to make API call + */ + public Order getOrderById(String orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + // create path and map variables + String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" }; + + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + + } + /** * Place an order for a pet * @@ -203,98 +297,4 @@ public class StoreApi { } - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws ApiException if fails to make API call - */ - public Order getOrderById(String orderId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); - } - - // create path and map variables - String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "test_api_key_query", "test_api_key_header" }; - - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @throws ApiException if fails to make API call - */ - public void deleteOrder(String orderId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); - } - - // create path and map variables - String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - - } - } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/UserApi.java index 267c1396285..921fefc5b1e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/UserApi.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-29T12:55:37.248+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class UserApi { private ApiClient apiClient; @@ -155,6 +155,100 @@ public class UserApi { } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @throws ApiException if fails to make API call + */ + public void deleteUser(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "test_http_basic" }; + + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + * @throws ApiException if fails to make API call + */ + public User getUserByName(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + + } + /** * Logs user into the system * @@ -241,54 +335,6 @@ public class UserApi { } - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws ApiException if fails to make API call - */ - public User getUserByName(String username) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); - } - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - - } - /** * Updated user * This can only be done by the logged in user. @@ -336,50 +382,4 @@ public class UserApi { } - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @throws ApiException if fails to make API call - */ - public void deleteUser(String username) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); - } - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - - apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - - } - } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 36168ed506f..4687d6782e1 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index cfc36fc4777..0b20480ec95 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -9,7 +9,7 @@ import java.util.List; import java.io.UnsupportedEncodingException; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java index 4586e3f1879..15a655f826c 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java index cb9ca56b44f..0a81b468c6e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:34:25.436+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/InlineResponse200.java index a966f51c800..36019aa9c4b 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -2,35 +2,62 @@ package io.swagger.client.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Tag; +import java.util.ArrayList; +import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:39.601+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class InlineResponse200 { - private String name = null; + private List tags = new ArrayList(); private Long id = null; private Object category = null; + + public enum StatusEnum { + AVAILABLE("available"), + PENDING("pending"), + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + } + + private StatusEnum status = null; + private String name = null; + private List photoUrls = new ArrayList(); + /** **/ - public InlineResponse200 name(String name) { - this.name = name; + public InlineResponse200 tags(List tags) { + this.tags = tags; return this; } - @ApiModelProperty(example = "doggie", value = "") - @JsonProperty("name") - public String getName() { - return name; + @ApiModelProperty(example = "null", value = "") + @JsonProperty("tags") + public List getTags() { + return tags; } - public void setName(String name) { - this.name = name; + public void setTags(List tags) { + this.tags = tags; } @@ -68,6 +95,58 @@ public class InlineResponse200 { } + /** + * pet status in the store + **/ + public InlineResponse200 status(StatusEnum status) { + this.status = status; + return this; + } + + @ApiModelProperty(example = "null", value = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + + /** + **/ + public InlineResponse200 name(String name) { + this.name = name; + return this; + } + + @ApiModelProperty(example = "doggie", value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + /** + **/ + public InlineResponse200 photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + @Override public boolean equals(java.lang.Object o) { @@ -78,14 +157,17 @@ public class InlineResponse200 { return false; } InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.name, inlineResponse200.name) && + return Objects.equals(this.tags, inlineResponse200.tags) && Objects.equals(this.id, inlineResponse200.id) && - Objects.equals(this.category, inlineResponse200.category); + Objects.equals(this.category, inlineResponse200.category) && + Objects.equals(this.status, inlineResponse200.status) && + Objects.equals(this.name, inlineResponse200.name) && + Objects.equals(this.photoUrls, inlineResponse200.photoUrls); } @Override public int hashCode() { - return Objects.hash(name, id, category); + return Objects.hash(tags, id, category, status, name, photoUrls); } @Override @@ -93,9 +175,12 @@ public class InlineResponse200 { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java index 3f29f00fab3..943ddd37306 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java @@ -11,7 +11,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:34:25.436+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class Order { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java index 7f3418d5bd9..1c434aa687d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java @@ -14,7 +14,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:34:25.436+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java index 76e9f52750a..437b42c44be 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:34:25.436+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java index dd91724f652..f6299149305 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-22T15:34:25.436+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:48.808+08:00") public class User { private Long id = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 5355f1a187e..529f9fff8dd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-15T18:20:42.151+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:51.831+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index 6be94b99493..c4c80febb52 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-15T18:20:42.151+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:51.831+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index 5017f33d152..86d8f1de128 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-15T18:20:42.151+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:51.831+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index 9e910ae1b10..f9f52549100 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-15T18:20:42.151+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:51.831+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index df64a903099..213970be003 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -18,8 +18,8 @@ import com.squareup.okhttp.Response; import java.io.IOException; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.InlineResponse200; +import java.io.File; import java.lang.reflect.Type; import java.util.ArrayList; @@ -47,104 +47,6 @@ public class PetApi { } - /* Build call for updatePet */ - private Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - - // create path and map variables - String localVarPath = "/pet".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void updatePet(Pet body) throws ApiException { - updatePetWithHttpInfo(body); - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { - Call call = updatePetCall(body, null, null); - return apiClient.execute(call); - } - - /** - * Update an existing pet (asynchronously) - * - * @param body Pet object that needs to be added to the store - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = updatePetCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for addPet */ private Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; @@ -243,6 +145,213 @@ public class PetApi { return call; } + /* Build call for addPetUsingByteArray */ + private Call addPetUsingByteArrayCall(byte[] body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + + // create path and map variables + String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param body Pet object in the form of byte array + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void addPetUsingByteArray(byte[] body) throws ApiException { + addPetUsingByteArrayWithHttpInfo(body); + } + + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param body Pet object in the form of byte array + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse addPetUsingByteArrayWithHttpInfo(byte[] body) throws ApiException { + Call call = addPetUsingByteArrayCall(body, null, null); + return apiClient.execute(call); + } + + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store (asynchronously) + * + * @param body Pet object in the form of byte array + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call addPetUsingByteArrayAsync(byte[] body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = addPetUsingByteArrayCall(body, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /* Build call for deletePet */ + private Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + if (apiKey != null) + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deletePet(Long petId, String apiKey) throws ApiException { + deletePetWithHttpInfo(petId, apiKey); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { + Call call = deletePetCall(petId, apiKey, null, null); + return apiClient.execute(call); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete + * @param apiKey + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for findPetsByStatus */ private Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -495,7 +604,7 @@ public class PetApi { }); } - String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @@ -559,6 +668,320 @@ public class PetApi { return call; } + /* Build call for getPetByIdInObject */ + private Call getPetByIdInObjectCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetByIdInObject(Async)"); + } + + + // create path and map variables + String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return InlineResponse200 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException { + ApiResponse resp = getPetByIdInObjectWithHttpInfo(petId); + return resp.getData(); + } + + /** + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getPetByIdInObjectWithHttpInfo(Long petId) throws ApiException { + Call call = getPetByIdInObjectCall(petId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' (asynchronously) + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getPetByIdInObjectAsync(Long petId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getPetByIdInObjectCall(petId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /* Build call for petPetIdtestingByteArraytrueGet */ + private Call petPetIdtestingByteArraytrueGetCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet(Async)"); + } + + + // create path and map variables + String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Fake endpoint to test byte array return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return byte[] + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException { + ApiResponse resp = petPetIdtestingByteArraytrueGetWithHttpInfo(petId); + return resp.getData(); + } + + /** + * Fake endpoint to test byte array return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse petPetIdtestingByteArraytrueGetWithHttpInfo(Long petId) throws ApiException { + Call call = petPetIdtestingByteArraytrueGetCall(petId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Fake endpoint to test byte array return by 'Find pet by ID' (asynchronously) + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call petPetIdtestingByteArraytrueGetAsync(Long petId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = petPetIdtestingByteArraytrueGetCall(petId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /* Build call for updatePet */ + private Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + + // create path and map variables + String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void updatePet(Pet body) throws ApiException { + updatePetWithHttpInfo(body); + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { + Call call = updatePetCall(body, null, null); + return apiClient.execute(call); + } + + /** + * Update an existing pet (asynchronously) + * + * @param body Pet object that needs to be added to the store + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = updatePetCall(body, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for updatePetWithForm */ private Call updatePetWithFormCall(String petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -673,115 +1096,6 @@ public class PetApi { return call; } - /* Build call for deletePet */ - private Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - if (apiKey != null) - localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deletePet(Long petId, String apiKey) throws ApiException { - deletePetWithHttpInfo(petId, apiKey); - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - Call call = deletePetCall(petId, apiKey, null, null); - return apiClient.execute(call); - } - - /** - * Deletes a pet (asynchronously) - * - * @param petId Pet id to delete - * @param apiKey - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for uploadFile */ private Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -896,318 +1210,4 @@ public class PetApi { return call; } - /* Build call for getPetByIdInObject */ - private Call getPetByIdInObjectCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling getPetByIdInObject(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return InlineResponse200 - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException { - ApiResponse resp = getPetByIdInObjectWithHttpInfo(petId); - return resp.getData(); - } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getPetByIdInObjectWithHttpInfo(Long petId) throws ApiException { - Call call = getPetByIdInObjectCall(petId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' (asynchronously) - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getPetByIdInObjectAsync(Long petId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = getPetByIdInObjectCall(petId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - - /* Build call for petPetIdtestingByteArraytrueGet */ - private Call petPetIdtestingByteArraytrueGetCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return byte[] - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException { - ApiResponse resp = petPetIdtestingByteArraytrueGetWithHttpInfo(petId); - return resp.getData(); - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse petPetIdtestingByteArraytrueGetWithHttpInfo(Long petId) throws ApiException { - Call call = petPetIdtestingByteArraytrueGetCall(petId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' (asynchronously) - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call petPetIdtestingByteArraytrueGetAsync(Long petId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = petPetIdtestingByteArraytrueGetCall(petId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - - /* Build call for addPetUsingByteArray */ - private Call addPetUsingByteArrayCall(byte[] body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - - // create path and map variables - String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void addPetUsingByteArray(byte[] body) throws ApiException { - addPetUsingByteArrayWithHttpInfo(body); - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse addPetUsingByteArrayWithHttpInfo(byte[] body) throws ApiException { - Call call = addPetUsingByteArrayCall(body, null, null); - return apiClient.execute(call); - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store (asynchronously) - * - * @param body Pet object in the form of byte array - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call addPetUsingByteArrayAsync(byte[] body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = addPetUsingByteArrayCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java index 7625fae65b9..7c26c285dd1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java @@ -45,6 +45,110 @@ public class StoreApi { } + /* Build call for deleteOrder */ + private Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + + // create path and map variables + String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteOrder(String orderId) throws ApiException { + deleteOrderWithHttpInfo(orderId); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { + Call call = deleteOrderCall(orderId, null, null); + return apiClient.execute(call); + } + + /** + * Delete purchase order by ID (asynchronously) + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for findOrdersByStatus */ private Call findOrdersByStatusCall(String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -347,6 +451,114 @@ public class StoreApi { return call; } + /* Build call for getOrderById */ + private Call getOrderByIdCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + + // create path and map variables + String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Order getOrderById(String orderId) throws ApiException { + ApiResponse resp = getOrderByIdWithHttpInfo(orderId); + return resp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getOrderByIdWithHttpInfo(String orderId) throws ApiException { + Call call = getOrderByIdCall(orderId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getOrderByIdAsync(String orderId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /* Build call for placeOrder */ private Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; @@ -449,216 +661,4 @@ public class StoreApi { return call; } - /* Build call for getOrderById */ - private Call getOrderByIdCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); - } - - - // create path and map variables - String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "test_api_key_query", "test_api_key_header" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public Order getOrderById(String orderId) throws ApiException { - ApiResponse resp = getOrderByIdWithHttpInfo(orderId); - return resp.getData(); - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getOrderByIdWithHttpInfo(String orderId) throws ApiException { - Call call = getOrderByIdCall(orderId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Find purchase order by ID (asynchronously) - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getOrderByIdAsync(String orderId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - - /* Build call for deleteOrder */ - private Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); - } - - - // create path and map variables - String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteOrder(String orderId) throws ApiException { - deleteOrderWithHttpInfo(orderId); - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - Call call = deleteOrderCall(orderId, null, null); - return apiClient.execute(call); - } - - /** - * Delete purchase order by ID (asynchronously) - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java index 57b3550c1af..64059481018 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java @@ -339,6 +339,218 @@ public class UserApi { return call; } + /* Build call for deleteUser */ + private Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "test_http_basic" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteUser(String username) throws ApiException { + deleteUserWithHttpInfo(username); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { + Call call = deleteUserCall(username, null, null); + return apiClient.execute(call); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deleteUserCall(username, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /* Build call for getUserByName */ + private Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/xml" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public User getUserByName(String username) throws ApiException { + ApiResponse resp = getUserByNameWithHttpInfo(username); + return resp.getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return ApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { + Call call = getUserByNameCall(username, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getUserByNameCall(username, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /* Build call for loginUser */ private Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -543,114 +755,6 @@ public class UserApi { return call; } - /* Build call for getUserByName */ - private Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); - } - - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public User getUserByName(String username) throws ApiException { - ApiResponse resp = getUserByNameWithHttpInfo(username); - return resp.getData(); - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - Call call = getUserByNameCall(username, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Get user by user name (asynchronously) - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = getUserByNameCall(username, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for updateUser */ private Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; @@ -758,108 +862,4 @@ public class UserApi { return call; } - /* Build call for deleteUser */ - private Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); - } - - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteUser(String username) throws ApiException { - deleteUserWithHttpInfo(username); - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - Call call = deleteUserCall(username, null, null); - return apiClient.execute(call); - } - - /** - * Delete user (asynchronously) - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = deleteUserCall(username, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index b8b1e69d7ff..491c9ec75b8 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-15T18:20:42.151+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:51.831+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index bdfa1d9563f..03e1e10cce1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-15T18:20:42.151+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:51.831+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/InlineResponse200.java index 2093866e063..7c2e9e6544e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -3,6 +3,9 @@ package io.swagger.client.model; import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Tag; +import java.util.ArrayList; +import java.util.List; import com.google.gson.annotations.SerializedName; @@ -12,8 +15,8 @@ import com.google.gson.annotations.SerializedName; @ApiModel(description = "") public class InlineResponse200 { - @SerializedName("name") - private String name = null; + @SerializedName("tags") + private List tags = new ArrayList(); @SerializedName("id") private Long id = null; @@ -22,15 +25,47 @@ public class InlineResponse200 { private Object category = null; +public enum StatusEnum { + @SerializedName("available") + AVAILABLE("available"), + + @SerializedName("pending") + PENDING("pending"), + + @SerializedName("sold") + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } +} + + @SerializedName("status") + private StatusEnum status = null; + + @SerializedName("name") + private String name = null; + + @SerializedName("photoUrls") + private List photoUrls = new ArrayList(); + + /** **/ @ApiModelProperty(value = "") - public String getName() { - return name; + public List getTags() { + return tags; } - public void setName(String name) { - this.name = name; + public void setTags(List tags) { + this.tags = tags; } @@ -56,6 +91,40 @@ public class InlineResponse200 { } + /** + * pet status in the store + **/ + @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + + /** + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + /** + **/ + @ApiModelProperty(value = "") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + @Override public boolean equals(Object o) { @@ -66,14 +135,17 @@ public class InlineResponse200 { return false; } InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.name, inlineResponse200.name) && + return Objects.equals(this.tags, inlineResponse200.tags) && Objects.equals(this.id, inlineResponse200.id) && - Objects.equals(this.category, inlineResponse200.category); + Objects.equals(this.category, inlineResponse200.category) && + Objects.equals(this.status, inlineResponse200.status) && + Objects.equals(this.name, inlineResponse200.name) && + Objects.equals(this.photoUrls, inlineResponse200.photoUrls); } @Override public int hashCode() { - return Objects.hash(name, id, category); + return Objects.hash(tags, id, category, status, name, photoUrls); } @Override @@ -81,9 +153,12 @@ public class InlineResponse200 { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java index de61255cb25..0eec085e2a4 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-05T14:39:21.255+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:53.252+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java index af1172aa9db..08034d5c073 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java @@ -7,8 +7,8 @@ import retrofit.http.*; import retrofit.mime.*; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.InlineResponse200; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; @@ -17,32 +17,6 @@ import java.util.Map; public interface PetApi { - /** - * Update an existing pet - * Sync method - * - * @param body Pet object that needs to be added to the store - * @return Void - */ - - @PUT("/pet") - Void updatePet( - @Body Pet body - ); - - /** - * Update an existing pet - * Async method - * @param body Pet object that needs to be added to the store - * @param cb callback method - * @return void - */ - - @PUT("/pet") - void updatePet( - @Body Pet body, Callback cb - ); - /** * Add a new pet to the store * Sync method @@ -69,6 +43,60 @@ public interface PetApi { @Body Pet body, Callback cb ); + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * Sync method + * + * @param body Pet object in the form of byte array + * @return Void + */ + + @POST("/pet?testing_byte_array=true") + Void addPetUsingByteArray( + @Body byte[] body + ); + + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * Async method + * @param body Pet object in the form of byte array + * @param cb callback method + * @return void + */ + + @POST("/pet?testing_byte_array=true") + void addPetUsingByteArray( + @Body byte[] body, Callback cb + ); + + /** + * Deletes a pet + * Sync method + * + * @param petId Pet id to delete + * @param apiKey + * @return Void + */ + + @DELETE("/pet/{petId}") + Void deletePet( + @Path("petId") Long petId, @Header("api_key") String apiKey + ); + + /** + * Deletes a pet + * Async method + * @param petId Pet id to delete + * @param apiKey + * @param cb callback method + * @return void + */ + + @DELETE("/pet/{petId}") + void deletePet( + @Path("petId") Long petId, @Header("api_key") String apiKey, Callback cb + ); + /** * Finds Pets by status * Sync method @@ -147,98 +175,6 @@ public interface PetApi { @Path("petId") Long petId, Callback cb ); - /** - * Updates a pet in the store with form data - * Sync method - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet - * @return Void - */ - - @FormUrlEncoded - @POST("/pet/{petId}") - Void updatePetWithForm( - @Path("petId") String petId, @Field("name") String name, @Field("status") String status - ); - - /** - * Updates a pet in the store with form data - * Async method - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet - * @param cb callback method - * @return void - */ - - @FormUrlEncoded - @POST("/pet/{petId}") - void updatePetWithForm( - @Path("petId") String petId, @Field("name") String name, @Field("status") String status, Callback cb - ); - - /** - * Deletes a pet - * Sync method - * - * @param petId Pet id to delete - * @param apiKey - * @return Void - */ - - @DELETE("/pet/{petId}") - Void deletePet( - @Path("petId") Long petId, @Header("api_key") String apiKey - ); - - /** - * Deletes a pet - * Async method - * @param petId Pet id to delete - * @param apiKey - * @param cb callback method - * @return void - */ - - @DELETE("/pet/{petId}") - void deletePet( - @Path("petId") Long petId, @Header("api_key") String apiKey, Callback cb - ); - - /** - * uploads an image - * Sync method - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - * @return Void - */ - - @Multipart - @POST("/pet/{petId}/uploadImage") - Void uploadFile( - @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file - ); - - /** - * uploads an image - * Async method - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - * @param cb callback method - * @return void - */ - - @Multipart - @POST("/pet/{petId}/uploadImage") - void uploadFile( - @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file, Callback cb - ); - /** * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' * Sync method @@ -292,29 +228,93 @@ public interface PetApi { ); /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * Update an existing pet * Sync method * - * @param body Pet object in the form of byte array + * @param body Pet object that needs to be added to the store * @return Void */ - @POST("/pet?testing_byte_array=true") - Void addPetUsingByteArray( - @Body byte[] body + @PUT("/pet") + Void updatePet( + @Body Pet body ); /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * Update an existing pet * Async method - * @param body Pet object in the form of byte array + * @param body Pet object that needs to be added to the store * @param cb callback method * @return void */ - @POST("/pet?testing_byte_array=true") - void addPetUsingByteArray( - @Body byte[] body, Callback cb + @PUT("/pet") + void updatePet( + @Body Pet body, Callback cb + ); + + /** + * Updates a pet in the store with form data + * Sync method + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @return Void + */ + + @FormUrlEncoded + @POST("/pet/{petId}") + Void updatePetWithForm( + @Path("petId") String petId, @Field("name") String name, @Field("status") String status + ); + + /** + * Updates a pet in the store with form data + * Async method + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @param cb callback method + * @return void + */ + + @FormUrlEncoded + @POST("/pet/{petId}") + void updatePetWithForm( + @Path("petId") String petId, @Field("name") String name, @Field("status") String status, Callback cb + ); + + /** + * uploads an image + * Sync method + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @return Void + */ + + @Multipart + @POST("/pet/{petId}/uploadImage") + Void uploadFile( + @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file + ); + + /** + * uploads an image + * Async method + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @param cb callback method + * @return void + */ + + @Multipart + @POST("/pet/{petId}/uploadImage") + void uploadFile( + @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file, Callback cb ); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/StoreApi.java index d68906ca95d..71fd1e8f8e6 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/StoreApi.java @@ -15,6 +15,32 @@ import java.util.Map; public interface StoreApi { + /** + * Delete purchase order by ID + * Sync method + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return Void + */ + + @DELETE("/store/order/{orderId}") + Void deleteOrder( + @Path("orderId") String orderId + ); + + /** + * Delete purchase order by ID + * Async method + * @param orderId ID of the order that needs to be deleted + * @param cb callback method + * @return void + */ + + @DELETE("/store/order/{orderId}") + void deleteOrder( + @Path("orderId") String orderId, Callback cb + ); + /** * Finds orders by status * Sync method @@ -87,32 +113,6 @@ public interface StoreApi { Callback cb ); - /** - * Place an order for a pet - * Sync method - * - * @param body order placed for purchasing the pet - * @return Order - */ - - @POST("/store/order") - Order placeOrder( - @Body Order body - ); - - /** - * Place an order for a pet - * Async method - * @param body order placed for purchasing the pet - * @param cb callback method - * @return void - */ - - @POST("/store/order") - void placeOrder( - @Body Order body, Callback cb - ); - /** * Find purchase order by ID * Sync method @@ -140,29 +140,29 @@ public interface StoreApi { ); /** - * Delete purchase order by ID + * Place an order for a pet * Sync method - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return Void + * + * @param body order placed for purchasing the pet + * @return Order */ - @DELETE("/store/order/{orderId}") - Void deleteOrder( - @Path("orderId") String orderId + @POST("/store/order") + Order placeOrder( + @Body Order body ); /** - * Delete purchase order by ID + * Place an order for a pet * Async method - * @param orderId ID of the order that needs to be deleted + * @param body order placed for purchasing the pet * @param cb callback method * @return void */ - @DELETE("/store/order/{orderId}") - void deleteOrder( - @Path("orderId") String orderId, Callback cb + @POST("/store/order") + void placeOrder( + @Body Order body, Callback cb ); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/UserApi.java index 519ae4a14f4..d72ac537669 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/UserApi.java @@ -93,6 +93,58 @@ public interface UserApi { @Body List body, Callback cb ); + /** + * Delete user + * Sync method + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return Void + */ + + @DELETE("/user/{username}") + Void deleteUser( + @Path("username") String username + ); + + /** + * Delete user + * Async method + * @param username The name that needs to be deleted + * @param cb callback method + * @return void + */ + + @DELETE("/user/{username}") + void deleteUser( + @Path("username") String username, Callback cb + ); + + /** + * Get user by user name + * Sync method + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + */ + + @GET("/user/{username}") + User getUserByName( + @Path("username") String username + ); + + /** + * Get user by user name + * Async method + * @param username The name that needs to be fetched. Use user1 for testing. + * @param cb callback method + * @return void + */ + + @GET("/user/{username}") + void getUserByName( + @Path("username") String username, Callback cb + ); + /** * Logs user into the system * Sync method @@ -144,32 +196,6 @@ public interface UserApi { Callback cb ); - /** - * Get user by user name - * Sync method - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - */ - - @GET("/user/{username}") - User getUserByName( - @Path("username") String username - ); - - /** - * Get user by user name - * Async method - * @param username The name that needs to be fetched. Use user1 for testing. - * @param cb callback method - * @return void - */ - - @GET("/user/{username}") - void getUserByName( - @Path("username") String username, Callback cb - ); - /** * Updated user * Sync method @@ -198,30 +224,4 @@ public interface UserApi { @Path("username") String username, @Body User body, Callback cb ); - /** - * Delete user - * Sync method - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return Void - */ - - @DELETE("/user/{username}") - Void deleteUser( - @Path("username") String username - ); - - /** - * Delete user - * Async method - * @param username The name that needs to be deleted - * @param cb callback method - * @return void - */ - - @DELETE("/user/{username}") - void deleteUser( - @Path("username") String username, Callback cb - ); - } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/InlineResponse200.java index 41e49b9cd3c..4082b25c85c 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -3,6 +3,9 @@ package io.swagger.client.model; import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Tag; +import java.util.ArrayList; +import java.util.List; import com.google.gson.annotations.SerializedName; @@ -12,8 +15,8 @@ import com.google.gson.annotations.SerializedName; @ApiModel(description = "") public class InlineResponse200 { - @SerializedName("name") - private String name = null; + @SerializedName("tags") + private List tags = new ArrayList(); @SerializedName("id") private Long id = null; @@ -22,15 +25,47 @@ public class InlineResponse200 { private Object category = null; +public enum StatusEnum { + @SerializedName("available") + AVAILABLE("available"), + + @SerializedName("pending") + PENDING("pending"), + + @SerializedName("sold") + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } +} + + @SerializedName("status") + private StatusEnum status = null; + + @SerializedName("name") + private String name = null; + + @SerializedName("photoUrls") + private List photoUrls = new ArrayList(); + + /** **/ @ApiModelProperty(value = "") - public String getName() { - return name; + public List getTags() { + return tags; } - public void setName(String name) { - this.name = name; + public void setTags(List tags) { + this.tags = tags; } @@ -56,6 +91,40 @@ public class InlineResponse200 { } + /** + * pet status in the store + **/ + @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + + /** + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + /** + **/ + @ApiModelProperty(value = "") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + @Override public boolean equals(Object o) { @@ -66,14 +135,17 @@ public class InlineResponse200 { return false; } InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(name, inlineResponse200.name) && + return Objects.equals(tags, inlineResponse200.tags) && Objects.equals(id, inlineResponse200.id) && - Objects.equals(category, inlineResponse200.category); + Objects.equals(category, inlineResponse200.category) && + Objects.equals(status, inlineResponse200.status) && + Objects.equals(name, inlineResponse200.name) && + Objects.equals(photoUrls, inlineResponse200.photoUrls); } @Override public int hashCode() { - return Objects.hash(name, id, category); + return Objects.hash(tags, id, category, status, name, photoUrls); } @Override @@ -81,9 +153,12 @@ public class InlineResponse200 { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java index 02507269968..d7254df29fc 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-07T09:02:50.804Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:54.660+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java index f7e5f15a424..f3a541027c6 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java @@ -9,8 +9,8 @@ import retrofit2.http.*; import okhttp3.RequestBody; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.InlineResponse200; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; @@ -19,19 +19,6 @@ import java.util.Map; public interface PetApi { - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return Call - */ - - @PUT("pet") - Call updatePet( - @Body Pet body - ); - - /** * Add a new pet to the store * @@ -45,6 +32,33 @@ public interface PetApi { ); + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param body Pet object in the form of byte array + * @return Call + */ + + @POST("pet?testing_byte_array=true") + Call addPetUsingByteArray( + @Body byte[] body + ); + + + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + * @return Call + */ + + @DELETE("pet/{petId}") + Call deletePet( + @Path("petId") Long petId, @Header("api_key") String apiKey + ); + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -84,52 +98,6 @@ public interface PetApi { ); - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet - * @return Call - */ - - @FormUrlEncoded - @POST("pet/{petId}") - Call updatePetWithForm( - @Path("petId") String petId, @Field("name") String name, @Field("status") String status - ); - - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - * @return Call - */ - - @DELETE("pet/{petId}") - Call deletePet( - @Path("petId") Long petId, @Header("api_key") String apiKey - ); - - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - * @return Call - */ - - @Multipart - @POST("pet/{petId}/uploadImage") - Call uploadFile( - @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file\"; filename=\"file\"") RequestBody file - ); - - /** * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -157,15 +125,47 @@ public interface PetApi { /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * Update an existing pet * - * @param body Pet object in the form of byte array + * @param body Pet object that needs to be added to the store * @return Call */ - @POST("pet?testing_byte_array=true") - Call addPetUsingByteArray( - @Body byte[] body + @PUT("pet") + Call updatePet( + @Body Pet body + ); + + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @return Call + */ + + @FormUrlEncoded + @POST("pet/{petId}") + Call updatePetWithForm( + @Path("petId") String petId, @Field("name") String name, @Field("status") String status + ); + + + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @return Call + */ + + @Multipart + @POST("pet/{petId}/uploadImage") + Call uploadFile( + @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file\"; filename=\"file\"") RequestBody file ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java index f23b71a2e19..9883db98e4a 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java @@ -17,6 +17,19 @@ import java.util.Map; public interface StoreApi { + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return Call + */ + + @DELETE("store/order/{orderId}") + Call deleteOrder( + @Path("orderId") String orderId + ); + + /** * Finds orders by status * A single status value can be provided as a string @@ -52,19 +65,6 @@ public interface StoreApi { - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Call - */ - - @POST("store/order") - Call placeOrder( - @Body Order body - ); - - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -79,15 +79,15 @@ public interface StoreApi { /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return Call + * Place an order for a pet + * + * @param body order placed for purchasing the pet + * @return Call */ - @DELETE("store/order/{orderId}") - Call deleteOrder( - @Path("orderId") String orderId + @POST("store/order") + Call placeOrder( + @Body Order body ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java index 61d3101843a..f929ef1a38e 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java @@ -56,6 +56,32 @@ public interface UserApi { ); + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return Call + */ + + @DELETE("user/{username}") + Call deleteUser( + @Path("username") String username + ); + + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return Call + */ + + @GET("user/{username}") + Call getUserByName( + @Path("username") String username + ); + + /** * Logs user into the system * @@ -81,19 +107,6 @@ public interface UserApi { - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return Call - */ - - @GET("user/{username}") - Call getUserByName( - @Path("username") String username - ); - - /** * Updated user * This can only be done by the logged in user. @@ -108,17 +121,4 @@ public interface UserApi { ); - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return Call - */ - - @DELETE("user/{username}") - Call deleteUser( - @Path("username") String username - ); - - } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/InlineResponse200.java index d687ab7d83c..4082b25c85c 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -15,11 +15,8 @@ import com.google.gson.annotations.SerializedName; @ApiModel(description = "") public class InlineResponse200 { - @SerializedName("photoUrls") - private List photoUrls = new ArrayList(); - - @SerializedName("name") - private String name = null; + @SerializedName("tags") + private List tags = new ArrayList(); @SerializedName("id") private Long id = null; @@ -27,9 +24,6 @@ public class InlineResponse200 { @SerializedName("category") private Object category = null; - @SerializedName("tags") - private List tags = new ArrayList(); - public enum StatusEnum { @SerializedName("available") @@ -56,27 +50,22 @@ public enum StatusEnum { @SerializedName("status") private StatusEnum status = null; + @SerializedName("name") + private String name = null; + + @SerializedName("photoUrls") + private List photoUrls = new ArrayList(); + /** **/ @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; + public List getTags() { + return tags; } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; + public void setTags(List tags) { + this.tags = tags; } @@ -102,17 +91,6 @@ public enum StatusEnum { } - /** - **/ - @ApiModelProperty(value = "") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - /** * pet status in the store **/ @@ -125,6 +103,28 @@ public enum StatusEnum { } + /** + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + /** + **/ + @ApiModelProperty(value = "") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + @Override public boolean equals(Object o) { @@ -135,17 +135,17 @@ public enum StatusEnum { return false; } InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(photoUrls, inlineResponse200.photoUrls) && - Objects.equals(name, inlineResponse200.name) && + return Objects.equals(tags, inlineResponse200.tags) && Objects.equals(id, inlineResponse200.id) && Objects.equals(category, inlineResponse200.category) && - Objects.equals(tags, inlineResponse200.tags) && - Objects.equals(status, inlineResponse200.status); + Objects.equals(status, inlineResponse200.status) && + Objects.equals(name, inlineResponse200.name) && + Objects.equals(photoUrls, inlineResponse200.photoUrls); } @Override public int hashCode() { - return Objects.hash(photoUrls, name, id, category, tags, status); + return Objects.hash(tags, id, category, status, name, photoUrls); } @Override @@ -153,12 +153,12 @@ public enum StatusEnum { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); sb.append("}"); return sb.toString(); } 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 298cc1bba50..259581ee2f5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -397,6 +397,11 @@ class UserApi $httpBody = $formParams; // for HTTP post (form) } + // this endpoint requires HTTP basic authentication + if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) { + $headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword()); + } + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php b/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php index 108092f91b1..9da9c7edac0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php @@ -110,7 +110,7 @@ class Configuration * * @var string */ - protected $userAgent = "PHP-Swagger/1.0.0"; + protected $userAgent = "Swagger-Codegen/1.0.0/php"; /** * Debug switch (default set to false) diff --git a/samples/client/petstore/python/swagger_client/api_client.py b/samples/client/petstore/python/swagger_client/api_client.py index 7e8c7a0e266..e598115e319 100644 --- a/samples/client/petstore/python/swagger_client/api_client.py +++ b/samples/client/petstore/python/swagger_client/api_client.py @@ -81,7 +81,7 @@ class ApiClient(object): self.host = host self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Python-Swagger/1.0.0' + self.user_agent = 'Swagger-Codegen/1.0.0/python' @property def user_agent(self): diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/swagger_client/apis/user_api.py index 0d519da1e28..07d976b0bf5 100644 --- a/samples/client/petstore/python/swagger_client/apis/user_api.py +++ b/samples/client/petstore/python/swagger_client/apis/user_api.py @@ -330,7 +330,7 @@ class UserApi(object): select_header_content_type([]) # Authentication setting - auth_settings = [] + auth_settings = ['test_http_basic'] response = self.api_client.call_api(resource_path, 'DELETE', path_params, diff --git a/samples/client/petstore/python/swagger_client/configuration.py b/samples/client/petstore/python/swagger_client/configuration.py index 1a25cff0c58..8f66e4428c5 100644 --- a/samples/client/petstore/python/swagger_client/configuration.py +++ b/samples/client/petstore/python/swagger_client/configuration.py @@ -231,6 +231,13 @@ class Configuration(object): 'key': 'api_key', 'value': self.get_api_key_with_prefix('api_key') }, + 'test_http_basic': + { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + }, 'test_api_client_secret': { 'type': 'api_key', From 1936af2cab72d37ed610b52ee7eb3db0a790afcc Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 14 Mar 2016 23:26:26 +0800 Subject: [PATCH 07/23] update android user agent --- .../resources/android/apiInvoker.mustache | 2 +- .../libraries/volley/apiInvoker.mustache | 2 +- .../java/io/swagger/client/ApiInvoker.java | 2 +- .../java/io/swagger/client/ApiInvoker.java | 36 +- .../main/java/io/swagger/client/JsonUtil.java | 64 +- .../java/io/swagger/client/api/PetApi.java | 1251 +++++++++-------- .../java/io/swagger/client/api/StoreApi.java | 707 ++++++---- .../java/io/swagger/client/api/UserApi.java | 574 ++++---- 8 files changed, 1478 insertions(+), 1160 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/android/apiInvoker.mustache b/modules/swagger-codegen/src/main/resources/android/apiInvoker.mustache index 1f6d77a071c..a2df0ea9b7c 100644 --- a/modules/swagger-codegen/src/main/resources/android/apiInvoker.mustache +++ b/modules/swagger-codegen/src/main/resources/android/apiInvoker.mustache @@ -83,7 +83,7 @@ public class ApiInvoker { DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); // Set default User-Agent. - setUserAgent("Android-Java-Swagger"); + setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/android{{/httpUserAgent}}"); } public static void setUserAgent(String userAgent) { diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache index 2a04c1c86b1..4369613449d 100644 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache @@ -185,7 +185,7 @@ public class ApiInvoker { public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) { INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout); - setUserAgent("Android-Volley-Swagger"); + setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/android{{/httpUserAgent}}"); // Setup authentications (key: authentication name, value: authentication). INSTANCE.authentications = new HashMap(); diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/ApiInvoker.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/ApiInvoker.java index 5eddeb6b9e9..ecb787006dd 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/ApiInvoker.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/ApiInvoker.java @@ -83,7 +83,7 @@ public class ApiInvoker { DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); // Set default User-Agent. - setUserAgent("Android-Java-Swagger"); + setUserAgent("Swagger-Codegen/1.0.0/android"); } public static void setUserAgent(String userAgent) { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java index 0f3dfdc3c55..86a0d6cb2d5 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java @@ -185,25 +185,13 @@ public class ApiInvoker { public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) { INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout); - setUserAgent("Android-Volley-Swagger"); + setUserAgent("Swagger-Codegen/1.0.0/android"); // Setup authentications (key: authentication name, value: authentication). INSTANCE.authentications = new HashMap(); - - - INSTANCE.authentications.put("petstore_auth", new OAuth()); - - - - INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); - - - - - - INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); + INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); @@ -215,15 +203,33 @@ public class ApiInvoker { + + INSTANCE.authentications.put("test_http_basic", new HttpBasicAuth()); + + + + + INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); + + + + + + INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); + + + + + INSTANCE.authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); - INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); + INSTANCE.authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java index 8a45f846f19..1335ccd320f 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java @@ -35,24 +35,40 @@ public class JsonUtil { public static Type getListTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); + if ("Category".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + + if ("InlineResponse200".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + + if ("ModelReturn".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + + if ("Name".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + if ("Order".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } - if ("User".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); + if ("Pet".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); } - if ("Category".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); + if ("SpecialModelName".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); } if ("Tag".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } - if ("Pet".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); + if ("User".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); } return new TypeToken>(){}.getType(); @@ -61,26 +77,42 @@ public class JsonUtil { public static Type getTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); - if ("Order".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("User".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - if ("Category".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } - if ("Tag".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); + if ("InlineResponse200".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + + if ("ModelReturn".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + + if ("Name".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + + if ("Order".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); } if ("Pet".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } + if ("SpecialModelName".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + + if ("Tag".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + + if ("User".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + return new TypeToken(){}.getType(); } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java index e63cd564899..b0a72ab7d8a 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java @@ -12,6 +12,7 @@ import com.android.volley.Response; import com.android.volley.VolleyError; import io.swagger.client.model.Pet; +import io.swagger.client.model.InlineResponse200; import java.io.File; import org.apache.http.HttpEntity; @@ -45,135 +46,6 @@ public class PetApi { } - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - */ - public void updatePet (Pet body) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/pet".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - "application/json","application/xml" - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "petstore_auth" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return ; - } else { - return ; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - */ - public void updatePet (Pet body, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = body; - - - - // create path and map variables - String path = "/pet".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - "application/json","application/xml" - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "petstore_auth" }; - - try { - apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - - - responseListener.onResponse(localVarResponse); - - - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - /** * Add a new pet to the store * @@ -303,6 +175,281 @@ public class PetApi { } } + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param body Pet object in the form of byte array + * @return void + */ + public void addPetUsingByteArray (byte[] body) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = body; + + + // create path and map variables + String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + "application/json","application/xml" + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "petstore_auth" }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return ; + } else { + return ; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param body Pet object in the form of byte array + */ + public void addPetUsingByteArray (byte[] body, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = body; + + + + // create path and map variables + String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + "application/json","application/xml" + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "petstore_auth" }; + + try { + apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + + responseListener.onResponse(localVarResponse); + + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + * @return void + */ + public void deletePet (Long petId, String apiKey) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling deletePet", + new ApiException(400, "Missing the required parameter 'petId' when calling deletePet")); + } + + + // create path and map variables + String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + headerParams.put("api_key", ApiInvoker.parameterToString(apiKey)); + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "petstore_auth" }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return ; + } else { + return ; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete * @param apiKey + */ + public void deletePet (Long petId, String apiKey, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = null; + + + // verify the required parameter 'petId' is set + if (petId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling deletePet", + new ApiException(400, "Missing the required parameter 'petId' when calling deletePet")); + } + + + // create path and map variables + String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + headerParams.put("api_key", ApiInvoker.parameterToString(apiKey)); + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "petstore_auth" }; + + try { + apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + + responseListener.onResponse(localVarResponse); + + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -626,7 +773,7 @@ public class PetApi { } - String[] authNames = new String[] { "petstore_auth", "api_key" }; + String[] authNames = new String[] { "api_key", "petstore_auth" }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -696,7 +843,7 @@ public class PetApi { } - String[] authNames = new String[] { "petstore_auth", "api_key" }; + String[] authNames = new String[] { "api_key", "petstore_auth" }; try { apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, @@ -725,6 +872,427 @@ public class PetApi { } } + /** + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return InlineResponse200 + */ + public InlineResponse200 getPetByIdInObject (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling getPetByIdInObject", + new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject")); + } + + + // create path and map variables + String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "api_key", "petstore_auth" }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return (InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class); + } else { + return null; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + */ + public void getPetByIdInObject (Long petId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = null; + + + // verify the required parameter 'petId' is set + if (petId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling getPetByIdInObject", + new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject")); + } + + + // create path and map variables + String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "api_key", "petstore_auth" }; + + try { + apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + try { + responseListener.onResponse((InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class)); + + + + } catch (ApiException exception) { + errorListener.onErrorResponse(new VolleyError(exception)); + } + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + + /** + * Fake endpoint to test byte array return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return byte[] + */ + public byte[] petPetIdtestingByteArraytrueGet (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet", + new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet")); + } + + + // create path and map variables + String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "api_key", "petstore_auth" }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return (byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class); + } else { + return null; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Fake endpoint to test byte array return by 'Find pet by ID' + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + */ + public void petPetIdtestingByteArraytrueGet (Long petId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = null; + + + // verify the required parameter 'petId' is set + if (petId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet", + new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet")); + } + + + // create path and map variables + String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "api_key", "petstore_auth" }; + + try { + apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + try { + responseListener.onResponse((byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class)); + + + + } catch (ApiException exception) { + errorListener.onErrorResponse(new VolleyError(exception)); + } + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + * @return void + */ + public void updatePet (Pet body) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = body; + + + // create path and map variables + String path = "/pet".replaceAll("\\{format\\}","json"); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + "application/json","application/xml" + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "petstore_auth" }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return ; + } else { + return ; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + */ + public void updatePet (Pet body, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = body; + + + + // create path and map variables + String path = "/pet".replaceAll("\\{format\\}","json"); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + "application/json","application/xml" + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "petstore_auth" }; + + try { + apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + + responseListener.onResponse(localVarResponse); + + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + /** * Updates a pet in the store with form data * @@ -888,152 +1456,6 @@ public class PetApi { } } - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - * @return void - */ - public void deletePet (Long petId, String apiKey) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling deletePet", - new ApiException(400, "Missing the required parameter 'petId' when calling deletePet")); - } - - - // create path and map variables - String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - headerParams.put("api_key", ApiInvoker.parameterToString(apiKey)); - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "petstore_auth" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return ; - } else { - return ; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete * @param apiKey - */ - public void deletePet (Long petId, String apiKey, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - // verify the required parameter 'petId' is set - if (petId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling deletePet", - new ApiException(400, "Missing the required parameter 'petId' when calling deletePet")); - } - - - // create path and map variables - String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - headerParams.put("api_key", ApiInvoker.parameterToString(apiKey)); - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "petstore_auth" }; - - try { - apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - - - responseListener.onResponse(localVarResponse); - - - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - /** * uploads an image * @@ -1197,279 +1619,4 @@ public class PetApi { } } - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return byte[] - */ - public byte[] petPetIdtestingByteArraytrueGet (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet", - new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet")); - } - - - // create path and map variables - String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "petstore_auth", "api_key" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return (byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class); - } else { - return null; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - */ - public void petPetIdtestingByteArraytrueGet (Long petId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - // verify the required parameter 'petId' is set - if (petId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet", - new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet")); - } - - - // create path and map variables - String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "petstore_auth", "api_key" }; - - try { - apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - - try { - responseListener.onResponse((byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class)); - - - - } catch (ApiException exception) { - errorListener.onErrorResponse(new VolleyError(exception)); - } - - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - * @return void - */ - public void addPetUsingByteArray (byte[] body) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - "application/json","application/xml" - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "petstore_auth" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return ; - } else { - return ; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - */ - public void addPetUsingByteArray (byte[] body, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = body; - - - - // create path and map variables - String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - "application/json","application/xml" - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "petstore_auth" }; - - try { - apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - - - responseListener.onResponse(localVarResponse); - - - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java index 91f04502598..e0aa403200a 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java @@ -45,6 +45,147 @@ public class StoreApi { } + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return void + */ + public void deleteOrder (String orderId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling deleteOrder", + new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder")); + } + + + // create path and map variables + String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return ; + } else { + return ; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + */ + public void deleteOrder (String orderId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = null; + + + // verify the required parameter 'orderId' is set + if (orderId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling deleteOrder", + new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder")); + } + + + // create path and map variables + String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { }; + + try { + apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + + responseListener.onResponse(localVarResponse); + + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + /** * Finds orders by status * A single status value can be provided as a string @@ -300,6 +441,285 @@ public class StoreApi { + } catch (ApiException exception) { + errorListener.onErrorResponse(new VolleyError(exception)); + } + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + + /** + * Fake endpoint to test arbitrary object return by 'Get inventory' + * Returns an arbitrary object which is actually a map of status codes to quantities + * @return Object + */ + public Object getInventoryInObject () throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = null; + + + // create path and map variables + String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "api_key" }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return (Object) ApiInvoker.deserialize(localVarResponse, "", Object.class); + } else { + return null; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Fake endpoint to test arbitrary object return by 'Get inventory' + * Returns an arbitrary object which is actually a map of status codes to quantities + + */ + public void getInventoryInObject (final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = null; + + + + // create path and map variables + String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "api_key" }; + + try { + apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + try { + responseListener.onResponse((Object) ApiInvoker.deserialize(localVarResponse, "", Object.class)); + + + + } catch (ApiException exception) { + errorListener.onErrorResponse(new VolleyError(exception)); + } + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @return Order + */ + public Order getOrderById (String orderId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling getOrderById", + new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById")); + } + + + // create path and map variables + String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "test_api_key_header", "test_api_key_query" }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return (Order) ApiInvoker.deserialize(localVarResponse, "", Order.class); + } else { + return null; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + */ + public void getOrderById (String orderId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = null; + + + // verify the required parameter 'orderId' is set + if (orderId == null) { + VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling getOrderById", + new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById")); + } + + + // create path and map variables + String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "test_api_key_header", "test_api_key_query" }; + + try { + apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + try { + responseListener.onResponse((Order) ApiInvoker.deserialize(localVarResponse, "", Order.class)); + + + } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } @@ -450,291 +870,4 @@ public class StoreApi { } } - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - */ - public Order getOrderById (String orderId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling getOrderById", - new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById")); - } - - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return (Order) ApiInvoker.deserialize(localVarResponse, "", Order.class); - } else { - return null; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - */ - public void getOrderById (String orderId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - // verify the required parameter 'orderId' is set - if (orderId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling getOrderById", - new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById")); - } - - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" }; - - try { - apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - - try { - responseListener.onResponse((Order) ApiInvoker.deserialize(localVarResponse, "", Order.class)); - - - - } catch (ApiException exception) { - errorListener.onErrorResponse(new VolleyError(exception)); - } - - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - */ - public void deleteOrder (String orderId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling deleteOrder", - new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder")); - } - - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return ; - } else { - return ; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - */ - public void deleteOrder (String orderId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - // verify the required parameter 'orderId' is set - if (orderId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling deleteOrder", - new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder")); - } - - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { }; - - try { - apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - - - responseListener.onResponse(localVarResponse); - - - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java index 9e7ce84b6f7..0938e600dd2 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java @@ -432,6 +432,293 @@ public class UserApi { } } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return void + */ + public void deleteUser (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + VolleyError error = new VolleyError("Missing the required parameter 'username' when calling deleteUser", + new ApiException(400, "Missing the required parameter 'username' when calling deleteUser")); + } + + + // create path and map variables + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "test_http_basic" }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return ; + } else { + return ; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + */ + public void deleteUser (String username, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = null; + + + // verify the required parameter 'username' is set + if (username == null) { + VolleyError error = new VolleyError("Missing the required parameter 'username' when calling deleteUser", + new ApiException(400, "Missing the required parameter 'username' when calling deleteUser")); + } + + + // create path and map variables + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { "test_http_basic" }; + + try { + apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + + responseListener.onResponse(localVarResponse); + + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + */ + public User getUserByName (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException { + Object postBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + VolleyError error = new VolleyError("Missing the required parameter 'username' when calling getUserByName", + new ApiException(400, "Missing the required parameter 'username' when calling getUserByName")); + } + + + // create path and map variables + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { }; + + try { + String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); + if(localVarResponse != null){ + return (User) ApiInvoker.deserialize(localVarResponse, "", User.class); + } else { + return null; + } + } catch (ApiException ex) { + throw ex; + } catch (InterruptedException ex) { + throw ex; + } catch (ExecutionException ex) { + if(ex.getCause() instanceof VolleyError) { + throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + } + throw ex; + } catch (TimeoutException ex) { + throw ex; + } + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public void getUserByName (String username, final Response.Listener responseListener, final Response.ErrorListener errorListener) { + Object postBody = null; + + + // verify the required parameter 'username' is set + if (username == null) { + VolleyError error = new VolleyError("Missing the required parameter 'username' when calling getUserByName", + new ApiException(400, "Missing the required parameter 'username' when calling getUserByName")); + } + + + // create path and map variables + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + + // query params + List queryParams = new ArrayList(); + // header params + Map headerParams = new HashMap(); + // form params + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if (contentType.startsWith("multipart/form-data")) { + // file uploading + MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); + + + HttpEntity httpEntity = localVarBuilder.build(); + postBody = httpEntity; + } else { + // normal form params + + } + + String[] authNames = new String[] { }; + + try { + apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, + new Response.Listener() { + @Override + public void onResponse(String localVarResponse) { + + try { + responseListener.onResponse((User) ApiInvoker.deserialize(localVarResponse, "", User.class)); + + + + } catch (ApiException exception) { + errorListener.onErrorResponse(new VolleyError(exception)); + } + + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + errorListener.onErrorResponse(error); + } + }); + } catch (ApiException ex) { + errorListener.onErrorResponse(new VolleyError(ex)); + } + } + /** * Logs user into the system * @@ -703,152 +990,6 @@ public class UserApi { } } - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - */ - public User getUserByName (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - VolleyError error = new VolleyError("Missing the required parameter 'username' when calling getUserByName", - new ApiException(400, "Missing the required parameter 'username' when calling getUserByName")); - } - - - // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return (User) ApiInvoker.deserialize(localVarResponse, "", User.class); - } else { - return null; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - */ - public void getUserByName (String username, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - // verify the required parameter 'username' is set - if (username == null) { - VolleyError error = new VolleyError("Missing the required parameter 'username' when calling getUserByName", - new ApiException(400, "Missing the required parameter 'username' when calling getUserByName")); - } - - - // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { }; - - try { - apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - - try { - responseListener.onResponse((User) ApiInvoker.deserialize(localVarResponse, "", User.class)); - - - - } catch (ApiException exception) { - errorListener.onErrorResponse(new VolleyError(exception)); - } - - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - /** * Updated user * This can only be done by the logged in user. @@ -991,145 +1132,4 @@ public class UserApi { } } - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - */ - public void deleteUser (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - VolleyError error = new VolleyError("Missing the required parameter 'username' when calling deleteUser", - new ApiException(400, "Missing the required parameter 'username' when calling deleteUser")); - } - - - // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return ; - } else { - return ; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - */ - public void deleteUser (String username, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - // verify the required parameter 'username' is set - if (username == null) { - VolleyError error = new VolleyError("Missing the required parameter 'username' when calling deleteUser", - new ApiException(400, "Missing the required parameter 'username' when calling deleteUser")); - } - - - // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - - } - - String[] authNames = new String[] { }; - - try { - apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - - - responseListener.onResponse(localVarResponse); - - - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - } From 6d2649de00983984da8bd63bdb31a0eb44d84961 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 15 Mar 2016 10:27:53 +0800 Subject: [PATCH 08/23] fix http user agent in C# --- .../main/resources/csharp/ApiClient.mustache | 8 +++++--- .../resources/csharp/Configuration.mustache | 6 +++--- .../main/csharp/IO/Swagger/Client/ApiClient.cs | 8 +++++--- .../csharp/IO/Swagger/Client/Configuration.cs | 6 +++--- .../SwaggerClientTest.userprefs | 14 ++++++++++++-- .../csharp/SwaggerClientTest/TestPet.cs | 2 +- ...rClientTest.csproj.FilesWrittenAbsolute.txt | 18 +++++++++--------- 7 files changed, 38 insertions(+), 24 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache index 9f787003967..f359e07fcb1 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache @@ -85,9 +85,6 @@ namespace {{packageName}}.Client { var request = new RestRequest(path, method); - // add user agent header - request.AddHeader("User-Agent", Configuration.HttpUserAgent); - // add path parameter, if any foreach(var param in pathParams) request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment); @@ -146,6 +143,11 @@ namespace {{packageName}}.Client path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); + // set timeout + RestClient.Timeout = Configuration.Timeout; + // set user agent + RestClient.UserAgent = Configuration.UserAgent; + var response = RestClient.Execute(request); return (Object) response; } diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache index f9f4f5e76da..c9636d2ffda 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache @@ -35,7 +35,7 @@ namespace {{packageName}}.Client string tempFolderPath = null, string dateTimeFormat = null, int timeout = 100000, - string httpUserAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}" + string userAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}" ) { setApiClientUsingDefault(apiClient); @@ -43,7 +43,7 @@ namespace {{packageName}}.Client Username = username; Password = password; AccessToken = accessToken; - HttpUserAgent = httpUserAgent; + UserAgent = userAgent; if (defaultHeader != null) DefaultHeader = defaultHeader; @@ -152,7 +152,7 @@ namespace {{packageName}}.Client /// Gets or sets the HTTP user agent. /// /// Http user agent. - public String HttpUserAgent { get; set; } + public String UserAgent { get; set; } /// /// Gets or sets the username (HTTP basic authentication). diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs index d6e425b2c79..e3de155b82f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs @@ -85,9 +85,6 @@ namespace IO.Swagger.Client { var request = new RestRequest(path, method); - // add user agent header - request.AddHeader("User-Agent", Configuration.HttpUserAgent); - // add path parameter, if any foreach(var param in pathParams) request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment); @@ -146,6 +143,11 @@ namespace IO.Swagger.Client path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); + // set timeout + RestClient.Timeout = Configuration.Timeout; + // set user agent + RestClient.UserAgent = Configuration.UserAgent; + var response = RestClient.Execute(request); return (Object) response; } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs index 16573f26ea6..3e9ea2c036c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs @@ -35,7 +35,7 @@ namespace IO.Swagger.Client string tempFolderPath = null, string dateTimeFormat = null, int timeout = 100000, - string httpUserAgent = "Swagger-Codegen/1.0.0/csharp" + string userAgent = "Swagger-Codegen/1.0.0/csharp" ) { setApiClientUsingDefault(apiClient); @@ -43,7 +43,7 @@ namespace IO.Swagger.Client Username = username; Password = password; AccessToken = accessToken; - HttpUserAgent = httpUserAgent; + UserAgent = userAgent; if (defaultHeader != null) DefaultHeader = defaultHeader; @@ -152,7 +152,7 @@ namespace IO.Swagger.Client /// Gets or sets the HTTP user agent. /// /// Http user agent. - public String HttpUserAgent { get; set; } + public String UserAgent { get; set; } /// /// Gets or sets the username (HTTP basic authentication). diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index f0ef77536dc..316238420d2 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -2,13 +2,23 @@ - + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs index 5c30360ee0f..0b04ca72b05 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs @@ -136,7 +136,7 @@ namespace SwaggerClientTest.TestPet public void TestGetPetById () { // set timeout to 10 seconds - Configuration c1 = new Configuration (timeout: 10000); + Configuration c1 = new Configuration (timeout: 10000, userAgent: "TEST_USER_AGENT"); PetApi petApi = new PetApi (c1); Pet response = petApi.GetPetById (petId); diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt index 323cad108c6..f115c595d6a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt +++ b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt @@ -1,9 +1,9 @@ -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll +/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll From 65b78f7ffeccaeb8cb29c52e74ef9ef7b14e66e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Tue, 15 Mar 2016 06:46:51 +0100 Subject: [PATCH 09/23] Handle empty date-time gracefully Some API's return an invalid, empty string as a date-time property. DateTime::__construct() will return the current time for empty input which is probably not what is meant. The invalid empty string is probably to be interpreted as a missing field/value. Let's handle this graceful. --- .../src/main/resources/php/ObjectSerializer.mustache | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache index dc1d87a3afe..e14161cd3d3 100644 --- a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache @@ -245,7 +245,17 @@ class ObjectSerializer settype($data, 'array'); $deserialized = $data; } elseif ($class === '\DateTime') { - $deserialized = new \DateTime($data); + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + $deserialized = new \DateTime($data); + } else { + $deserialized = null; + } } elseif (in_array($class, array({{&primitives}}))) { settype($data, $class); $deserialized = $data; From fb5f7716dbd7dd4e5424d6a5b3735bd4f759f4a1 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 15 Mar 2016 21:42:25 +0800 Subject: [PATCH 10/23] add petstore (full) yml file --- .../src/test/resources/2_0/petstore_full.yml | 576 ++++++++++++++++++ 1 file changed, 576 insertions(+) create mode 100644 modules/swagger-codegen/src/test/resources/2_0/petstore_full.yml diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore_full.yml b/modules/swagger-codegen/src/test/resources/2_0/petstore_full.yml new file mode 100644 index 00000000000..cbfae8e4c45 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore_full.yml @@ -0,0 +1,576 @@ +swagger: "2.0" +info: + description: | + This is a sample server Petstore server. + + [Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net. + + For this sample, you can use the api key `special-key` to test the authorization filters + version: "1.0.0" + title: Swagger Petstore + termsOfService: http://helloreverb.com/terms/ + contact: + name: apiteam@swagger.io + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html +host: petstore.swagger.io +basePath: /v2 +schemes: + - http +paths: + /pets: + post: + tags: + - pet + summary: Add a new pet to the store + description: "" + operationId: addPet + consumes: + - application/json + - application/xml + produces: + - application/json + - application/xml + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: false + schema: + $ref: "#/definitions/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write_pets + - read_pets + put: + tags: + - pet + summary: Update an existing pet + description: "" + operationId: updatePet + consumes: + - application/json + - application/xml + produces: + - application/json + - application/xml + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: false + schema: + $ref: "#/definitions/Pet" + responses: + "405": + description: Validation exception + "404": + description: Pet not found + "400": + description: Invalid ID supplied + security: + - petstore_auth: + - write_pets + - read_pets + /pets/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma seperated strings + operationId: findPetsByStatus + produces: + - application/json + - application/xml + parameters: + - in: query + name: status + description: Status values that need to be considered for filter + required: false + type: array + items: + type: string + collectionFormat: multi + responses: + "200": + description: successful operation + schema: + type: array + items: + $ref: "#/definitions/Pet" + "400": + description: Invalid status value + security: + - petstore_auth: + - write_pets + - read_pets + /pets/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + produces: + - application/json + - application/xml + parameters: + - in: query + name: tags + description: Tags to filter by + required: false + type: array + items: + type: string + collectionFormat: multi + responses: + "200": + description: successful operation + schema: + type: array + items: + $ref: "#/definitions/Pet" + "400": + description: Invalid tag value + security: + - petstore_auth: + - write_pets + - read_pets + /pets/{petId}: + get: + tags: + - pet + summary: Find pet by ID + description: Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + operationId: getPetById + produces: + - application/json + - application/xml + parameters: + - in: path + name: petId + description: ID of pet that needs to be fetched + required: true + type: integer + format: int64 + responses: + "404": + description: Pet not found + "200": + description: successful operation + schema: + $ref: "#/definitions/Pet" + "400": + description: Invalid ID supplied + security: + - api_key: [] + - petstore_auth: + - write_pets + - read_pets + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: "" + operationId: updatePetWithForm + consumes: + - application/x-www-form-urlencoded + produces: + - application/json + - application/xml + parameters: + - in: path + name: petId + description: ID of pet that needs to be updated + required: true + type: string + - in: formData + name: name + description: Updated name of the pet + required: true + type: string + - in: formData + name: status + description: Updated status of the pet + required: true + type: string + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write_pets + - read_pets + delete: + tags: + - pet + summary: Deletes a pet + description: "" + operationId: deletePet + produces: + - application/json + - application/xml + parameters: + - in: header + name: api_key + description: "" + required: true + type: string + - in: path + name: petId + description: Pet id to delete + required: true + type: integer + format: int64 + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write_pets + - read_pets + /stores/order: + post: + tags: + - store + summary: Place an order for a pet + description: "" + operationId: placeOrder + produces: + - application/json + - application/xml + parameters: + - in: body + name: body + description: order placed for purchasing the pet + required: false + schema: + $ref: "#/definitions/Order" + responses: + "200": + description: successful operation + schema: + $ref: "#/definitions/Order" + "400": + description: Invalid Order + /stores/order/{orderId}: + get: + tags: + - store + summary: Find purchase order by ID + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + produces: + - application/json + - application/xml + parameters: + - in: path + name: orderId + description: ID of pet that needs to be fetched + required: true + type: string + responses: + "404": + description: Order not found + "200": + description: successful operation + schema: + $ref: "#/definitions/Order" + "400": + description: Invalid ID supplied + delete: + tags: + - store + summary: Delete purchase order by ID + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + produces: + - application/json + - application/xml + parameters: + - in: path + name: orderId + description: ID of the order that needs to be deleted + required: true + type: string + responses: + "404": + description: Order not found + "400": + description: Invalid ID supplied + /users: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + produces: + - application/json + - application/xml + parameters: + - in: body + name: body + description: Created user object + required: false + schema: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /users/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithArrayInput + produces: + - application/json + - application/xml + parameters: + - in: body + name: body + description: List of user object + required: false + schema: + type: array + items: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /users/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithListInput + produces: + - application/json + - application/xml + parameters: + - in: body + name: body + description: List of user object + required: false + schema: + type: array + items: + $ref: "#/definitions/User" + responses: + default: + description: successful operation + /users/login: + get: + tags: + - user + summary: Logs user into the system + description: "" + operationId: loginUser + produces: + - application/json + - application/xml + parameters: + - in: query + name: username + description: The user name for login + required: false + type: string + - in: query + name: password + description: The password for login in clear text + required: false + type: string + responses: + "200": + description: successful operation + schema: + type: string + "400": + description: Invalid username/password supplied + /users/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: "" + operationId: logoutUser + produces: + - application/json + - application/xml + responses: + default: + description: successful operation + /users/{username}: + get: + tags: + - user + summary: Get user by user name + description: "" + operationId: getUserByName + produces: + - application/json + - application/xml + parameters: + - in: path + name: username + description: The name that needs to be fetched. Use user1 for testing. + required: true + type: string + responses: + "404": + description: User not found + "200": + description: successful operation + schema: + $ref: "#/definitions/User" + "400": + description: Invalid username supplied + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + produces: + - application/json + - application/xml + parameters: + - in: path + name: username + description: name that need to be deleted + required: true + type: string + - in: body + name: body + description: Updated user object + required: false + schema: + $ref: "#/definitions/User" + responses: + "404": + description: User not found + "400": + description: Invalid user supplied + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + produces: + - application/json + - application/xml + parameters: + - in: path + name: username + description: The name that needs to be deleted + required: true + type: string + responses: + "404": + description: User not found + "400": + description: Invalid username supplied +securityDefinitions: + api_key: + type: apiKey + name: api_key + in: header + petstore_auth: + type: oauth2 + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + flow: implicit + scopes: + write_pets: modify pets in your account + read_pets: read your pets +definitions: + User: + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Pet: + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: "#/definitions/Category" + name: + type: string + example: doggie + photoUrls: + type: array + items: + type: string + tags: + type: array + items: + $ref: "#/definitions/Tag" + status: + type: string + description: pet status in the store + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + complete: + type: boolean \ No newline at end of file From ed224d4c09ba805e1b2a65cb95cde227345854eb Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 15 Mar 2016 15:58:55 -0700 Subject: [PATCH 11/23] updated inflector templates --- .../main/resources/JavaInflector/inflector.mustache | 3 +++ .../src/main/resources/JavaInflector/pom.mustache | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaInflector/inflector.mustache b/modules/swagger-codegen/src/main/resources/JavaInflector/inflector.mustache index c61fa2054b8..87fc5581316 100644 --- a/modules/swagger-codegen/src/main/resources/JavaInflector/inflector.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaInflector/inflector.mustache @@ -2,8 +2,11 @@ controllerPackage: {{invokerPackage}} modelPackage: {{modelPackage}} swaggerUrl: ./src/main/swagger/swagger.yaml modelMappings: + # to enable explicit mappings, use this syntax: + DefinitionFromSwaggerSpecification: fully.qualified.path.to.Model {{#models}}{{#model}}{{classname}} : {{modelPackage}}.{{classname}}{{/model}} {{/models}} + entityProcessors: - json - xml diff --git a/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache index 8cb21465b33..d79fec75123 100644 --- a/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache @@ -78,12 +78,21 @@ io.swagger swagger-inflector - 1.0.2 + ${swagger-inflector-version} + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + 1.0.0 - 1.5.7 + 1.0.4-SNAPSHOT 9.2.9.v20150224 1.0.1 4.8.2 From 5df69fd71edc82807505eb640000b0088280f502 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 15 Mar 2016 16:06:37 -0700 Subject: [PATCH 12/23] updated to work around https://github.com/swagger-api/swagger-core/issues/1714 --- modules/swagger-generator/src/main/webapp/WEB-INF/web.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-generator/src/main/webapp/WEB-INF/web.xml b/modules/swagger-generator/src/main/webapp/WEB-INF/web.xml index 514cfab4435..904e0e34fb0 100644 --- a/modules/swagger-generator/src/main/webapp/WEB-INF/web.xml +++ b/modules/swagger-generator/src/main/webapp/WEB-INF/web.xml @@ -18,7 +18,7 @@ io.swagger.online.ExceptionWriter, io.swagger.generator.util.JacksonJsonProvider, - io.swagger.jersey.listing.ApiListingResourceJSON, + io.swagger.jaxrs.listing.ApiListingResource, io.swagger.jersey.listing.JerseyApiDeclarationProvider, io.swagger.jersey.listing.JerseyResourceListingProvider From ab41214f0686938a0d74d2741c3dc2cdc232559a Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 10 Mar 2016 10:15:25 +0800 Subject: [PATCH 13/23] fix error with resteasy --- .../JavaJaxRS/resteasy/model.mustache | 1 + .../src/main/csharp/IO/Swagger/Model/Name.cs | 1 - .../gen/java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/gen/java/io/swagger/api/PetApi.java | 120 ++++++++--------- .../java/io/swagger/api/PetApiService.java | 23 ++-- .../api/PettestingByteArraytrueApi.java | 7 +- .../PettestingByteArraytrueApiService.java | 5 +- .../src/gen/java/io/swagger/api/StoreApi.java | 76 ++++++----- .../java/io/swagger/api/StoreApiService.java | 17 ++- .../gen/java/io/swagger/api/StringUtil.java | 2 +- .../src/gen/java/io/swagger/api/UserApi.java | 80 +++++------ .../java/io/swagger/api/UserApiService.java | 19 ++- .../gen/java/io/swagger/model/Category.java | 7 +- .../src/gen/java/io/swagger/model/Order.java | 7 +- .../src/gen/java/io/swagger/model/Pet.java | 9 +- .../src/gen/java/io/swagger/model/Tag.java | 7 +- .../src/gen/java/io/swagger/model/User.java | 7 +- .../swagger/api/impl/PetApiServiceImpl.java | 125 +++++++++--------- .../swagger/api/impl/StoreApiServiceImpl.java | 66 +++++---- .../swagger/api/impl/UserApiServiceImpl.java | 106 +++++++-------- 23 files changed, 330 insertions(+), 363 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/model.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/model.mustache index b9512d2b83c..85d815a79c6 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/model.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/model.mustache @@ -1,6 +1,7 @@ package {{package}}; import java.util.Objects; +import java.util.ArrayList; {{#imports}}import {{import}}; {{/imports}} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs index 3c8ccadcedd..b4f46172480 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs @@ -46,7 +46,6 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Name {\n"); sb.Append(" _Name: ").Append(_Name).Append("\n"); - sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java index 98c42b54565..857aa9ebe7d 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java index 80cf57bb0b3..6f5e1e36cc3 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class ApiOriginFilter implements javax.servlet.Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java index 06f9706c04b..74575cbd3fe 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java index 6b3581fa559..9f2a8cefe3d 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java index c87f9f8e25f..3cbe8eb1325 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java @@ -5,9 +5,9 @@ import io.swagger.api.PetApiService; import io.swagger.api.factories.PetApiServiceFactory; import io.swagger.model.Pet; +import io.swagger.model.InlineResponse200; import java.io.File; - import java.util.List; import io.swagger.api.NotFoundException; @@ -22,21 +22,10 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class PetApi { private final PetApiService delegate = PetApiServiceFactory.getPetApi(); - - @PUT - - @Consumes({ "application/json", "application/xml" }) - @Produces({ "application/json", "application/xml" }) - public Response updatePet( Pet body,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.updatePet(body,securityContext); - } - @POST @Consumes({ "application/json", "application/xml" }) @@ -45,43 +34,6 @@ public class PetApi { throws NotFoundException { return delegate.addPet(body,securityContext); } - - @GET - @Path("/findByStatus") - - @Produces({ "application/json", "application/xml" }) - public Response findPetsByStatus( @QueryParam("status") List status,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.findPetsByStatus(status,securityContext); - } - - @GET - @Path("/findByTags") - - @Produces({ "application/json", "application/xml" }) - public Response findPetsByTags( @QueryParam("tags") List tags,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.findPetsByTags(tags,securityContext); - } - - @GET - @Path("/{petId}") - - @Produces({ "application/json", "application/xml" }) - public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.getPetById(petId,securityContext); - } - - @POST - @Path("/{petId}") - @Consumes({ "application/x-www-form-urlencoded" }) - @Produces({ "application/json", "application/xml" }) - public Response updatePetWithForm( @PathParam("petId") String petId,@FormParam("name") String name,@FormParam("status") String status,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.updatePetWithForm(petId,name,status,securityContext); - } - @DELETE @Path("/{petId}") @@ -90,7 +42,62 @@ public class PetApi { throws NotFoundException { return delegate.deletePet(petId,apiKey,securityContext); } - + @GET + @Path("/findByStatus") + + @Produces({ "application/json", "application/xml" }) + public Response findPetsByStatus( @QueryParam("status") List status,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findPetsByStatus(status,securityContext); + } + @GET + @Path("/findByTags") + + @Produces({ "application/json", "application/xml" }) + public Response findPetsByTags( @QueryParam("tags") List tags,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findPetsByTags(tags,securityContext); + } + @GET + @Path("/{petId}") + + @Produces({ "application/json", "application/xml" }) + public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getPetById(petId,securityContext); + } + @GET + @Path("/{petId}?response=inline_arbitrary_object") + + @Produces({ "application/json", "application/xml" }) + public Response getPetByIdInObject( @PathParam("petId") Long petId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getPetByIdInObject(petId,securityContext); + } + @GET + @Path("/{petId}?testing_byte_array=true") + + @Produces({ "application/json", "application/xml" }) + public Response petPetIdtestingByteArraytrueGet( @PathParam("petId") Long petId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.petPetIdtestingByteArraytrueGet(petId,securityContext); + } + @PUT + + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/json", "application/xml" }) + public Response updatePet( Pet body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updatePet(body,securityContext); + } + @POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @Produces({ "application/json", "application/xml" }) + public Response updatePetWithForm( @PathParam("petId") String petId,@FormParam("name") String name,@FormParam("status") String status,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updatePetWithForm(petId,name,status,securityContext); + } @POST @Path("/{petId}/uploadImage") @Consumes({ "multipart/form-data" }) @@ -99,15 +106,4 @@ public class PetApi { throws NotFoundException { return delegate.uploadFile(input,petId,securityContext); } - - @GET - @Path("/{petId}?testing_byte_array=true") - - @Produces({ "application/json", "application/xml" }) - public Response getPetByIdWithByteArray( @PathParam("petId") Long petId,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.getPetByIdWithByteArray(petId,securityContext); - } - } - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java index 485ef63212a..20930f960fb 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java @@ -6,9 +6,9 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; import io.swagger.model.Pet; +import io.swagger.model.InlineResponse200; import java.io.File; - import java.util.List; import io.swagger.api.NotFoundException; @@ -17,14 +17,13 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public abstract class PetApiService { - public abstract Response updatePet(Pet body,SecurityContext securityContext) + public abstract Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException; - public abstract Response addPet(Pet body,SecurityContext securityContext) + public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByStatus(List status,SecurityContext securityContext) @@ -36,17 +35,19 @@ public abstract class PetApiService { public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException; - public abstract Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext) + public abstract Response getPetByIdInObject(Long petId,SecurityContext securityContext) throws NotFoundException; - public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) + public abstract Response petPetIdtestingByteArraytrueGet(Long petId,SecurityContext securityContext) + throws NotFoundException; + + public abstract Response updatePet(Pet body,SecurityContext securityContext) + throws NotFoundException; + + public abstract Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext) throws NotFoundException; public abstract Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext) throws NotFoundException; - public abstract Response getPetByIdWithByteArray(Long petId,SecurityContext securityContext) - throws NotFoundException; - } - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java index e85fcfbe42c..e79018599ef 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java @@ -5,7 +5,6 @@ import io.swagger.api.PettestingByteArraytrueApiService; import io.swagger.api.factories.PettestingByteArraytrueApiServiceFactory; - import java.util.List; import io.swagger.api.NotFoundException; @@ -19,12 +18,10 @@ import javax.ws.rs.*; @Path("/pet?testing_byte_array=true") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class PettestingByteArraytrueApi { private final PettestingByteArraytrueApiService delegate = PettestingByteArraytrueApiServiceFactory.getPettestingByteArraytrueApi(); - @POST @Consumes({ "application/json", "application/xml" }) @@ -33,6 +30,4 @@ public class PettestingByteArraytrueApi { throws NotFoundException { return delegate.addPetUsingByteArray(body,securityContext); } - } - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java index 553cf5743e4..d2aaa82cb2d 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java @@ -5,7 +5,6 @@ import io.swagger.model.*; - import java.util.List; import io.swagger.api.NotFoundException; @@ -14,12 +13,10 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public abstract class PettestingByteArraytrueApiService { public abstract Response addPetUsingByteArray(byte[] body,SecurityContext securityContext) throws NotFoundException; } - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java index 52f513318c8..906babad922 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java @@ -4,9 +4,8 @@ import io.swagger.model.*; import io.swagger.api.StoreApiService; import io.swagger.api.factories.StoreApiServiceFactory; -import java.util.Map; import io.swagger.model.Order; - +import java.util.Map; import java.util.List; import io.swagger.api.NotFoundException; @@ -21,39 +20,10 @@ import javax.ws.rs.*; @Path("/store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class StoreApi { private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi(); - - @GET - @Path("/inventory") - - @Produces({ "application/json", "application/xml" }) - public Response getInventory(@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.getInventory(securityContext); - } - - @POST - @Path("/order") - - @Produces({ "application/json", "application/xml" }) - public Response placeOrder( Order body,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.placeOrder(body,securityContext); - } - - @GET - @Path("/order/{orderId}") - - @Produces({ "application/json", "application/xml" }) - public Response getOrderById( @PathParam("orderId") String orderId,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.getOrderById(orderId,securityContext); - } - @DELETE @Path("/order/{orderId}") @@ -62,6 +32,44 @@ public class StoreApi { throws NotFoundException { return delegate.deleteOrder(orderId,securityContext); } - + @GET + @Path("/findByStatus") + + @Produces({ "application/json", "application/xml" }) + public Response findOrdersByStatus( @QueryParam("status") String status,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findOrdersByStatus(status,securityContext); + } + @GET + @Path("/inventory") + + @Produces({ "application/json", "application/xml" }) + public Response getInventory(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getInventory(securityContext); + } + @GET + @Path("/inventory?response=arbitrary_object") + + @Produces({ "application/json", "application/xml" }) + public Response getInventoryInObject(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getInventoryInObject(securityContext); + } + @GET + @Path("/order/{orderId}") + + @Produces({ "application/json", "application/xml" }) + public Response getOrderById( @PathParam("orderId") String orderId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getOrderById(orderId,securityContext); + } + @POST + @Path("/order") + + @Produces({ "application/json", "application/xml" }) + public Response placeOrder( Order body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.placeOrder(body,securityContext); + } } - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java index f0857c1cab6..fd52b687727 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java @@ -4,9 +4,8 @@ import io.swagger.api.*; import io.swagger.model.*; -import java.util.Map; import io.swagger.model.Order; - +import java.util.Map; import java.util.List; import io.swagger.api.NotFoundException; @@ -16,21 +15,25 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public abstract class StoreApiService { + public abstract Response deleteOrder(String orderId,SecurityContext securityContext) + throws NotFoundException; + + public abstract Response findOrdersByStatus(String status,SecurityContext securityContext) + throws NotFoundException; + public abstract Response getInventory(SecurityContext securityContext) throws NotFoundException; - public abstract Response placeOrder(Order body,SecurityContext securityContext) + public abstract Response getInventoryInObject(SecurityContext securityContext) throws NotFoundException; public abstract Response getOrderById(String orderId,SecurityContext securityContext) throws NotFoundException; - public abstract Response deleteOrder(String orderId,SecurityContext securityContext) + public abstract Response placeOrder(Order body,SecurityContext securityContext) throws NotFoundException; } - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java index 2747ff81082..19649972e2b 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java index 2841e06a7d7..181ece818a1 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java @@ -5,8 +5,7 @@ import io.swagger.api.UserApiService; import io.swagger.api.factories.UserApiServiceFactory; import io.swagger.model.User; -import java.util.*; - +import java.util.List; import java.util.List; import io.swagger.api.NotFoundException; @@ -21,12 +20,10 @@ import javax.ws.rs.*; @Path("/user") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class UserApi { private final UserApiService delegate = UserApiServiceFactory.getUserApi(); - @POST @@ -35,7 +32,6 @@ public class UserApi { throws NotFoundException { return delegate.createUser(body,securityContext); } - @POST @Path("/createWithArray") @@ -44,7 +40,6 @@ public class UserApi { throws NotFoundException { return delegate.createUsersWithArrayInput(body,securityContext); } - @POST @Path("/createWithList") @@ -53,43 +48,6 @@ public class UserApi { throws NotFoundException { return delegate.createUsersWithListInput(body,securityContext); } - - @GET - @Path("/login") - - @Produces({ "application/json", "application/xml" }) - public Response loginUser( @QueryParam("username") String username, @QueryParam("password") String password,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.loginUser(username,password,securityContext); - } - - @GET - @Path("/logout") - - @Produces({ "application/json", "application/xml" }) - public Response logoutUser(@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.logoutUser(securityContext); - } - - @GET - @Path("/{username}") - - @Produces({ "application/json", "application/xml" }) - public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.getUserByName(username,securityContext); - } - - @PUT - @Path("/{username}") - - @Produces({ "application/json", "application/xml" }) - public Response updateUser( @PathParam("username") String username, User body,@Context SecurityContext securityContext) - throws NotFoundException { - return delegate.updateUser(username,body,securityContext); - } - @DELETE @Path("/{username}") @@ -98,6 +56,36 @@ public class UserApi { throws NotFoundException { return delegate.deleteUser(username,securityContext); } - + @GET + @Path("/{username}") + + @Produces({ "application/json", "application/xml" }) + public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getUserByName(username,securityContext); + } + @GET + @Path("/login") + + @Produces({ "application/json", "application/xml" }) + public Response loginUser( @QueryParam("username") String username, @QueryParam("password") String password,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.loginUser(username,password,securityContext); + } + @GET + @Path("/logout") + + @Produces({ "application/json", "application/xml" }) + public Response logoutUser(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.logoutUser(securityContext); + } + @PUT + @Path("/{username}") + + @Produces({ "application/json", "application/xml" }) + public Response updateUser( @PathParam("username") String username, User body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updateUser(username,body,securityContext); + } } - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java index 09ac506294a..b52aeb6e824 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java @@ -5,8 +5,7 @@ import io.swagger.model.*; import io.swagger.model.User; -import java.util.*; - +import java.util.List; import java.util.List; import io.swagger.api.NotFoundException; @@ -16,8 +15,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") - +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public abstract class UserApiService { public abstract Response createUser(User body,SecurityContext securityContext) @@ -29,20 +27,19 @@ public abstract class UserApiService { public abstract Response createUsersWithListInput(List body,SecurityContext securityContext) throws NotFoundException; + public abstract Response deleteUser(String username,SecurityContext securityContext) + throws NotFoundException; + + public abstract Response getUserByName(String username,SecurityContext securityContext) + throws NotFoundException; + public abstract Response loginUser(String username,String password,SecurityContext securityContext) throws NotFoundException; public abstract Response logoutUser(SecurityContext securityContext) throws NotFoundException; - public abstract Response getUserByName(String username,SecurityContext securityContext) - throws NotFoundException; - public abstract Response updateUser(String username,User body,SecurityContext securityContext) throws NotFoundException; - public abstract Response deleteUser(String username,SecurityContext securityContext) - throws NotFoundException; - } - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java index 473b212ab2e..095f0de76d9 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java @@ -1,15 +1,14 @@ package io.swagger.model; import java.util.Objects; +import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class Category { private Long id = null; @@ -82,5 +81,3 @@ public class Category { } } - - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java index acd23dfd33c..6bc4b84a511 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java @@ -1,6 +1,7 @@ package io.swagger.model; import java.util.Objects; +import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import java.util.Date; @@ -8,9 +9,7 @@ import java.util.Date; - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class Order { private Long id = null; @@ -164,5 +163,3 @@ public class Order { } } - - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java index efc60c75bbe..6808a3f477e 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java @@ -1,18 +1,17 @@ package io.swagger.model; import java.util.Objects; +import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.model.Category; import io.swagger.model.Tag; -import java.util.*; +import java.util.List; - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class Pet { private Long id = null; @@ -166,5 +165,3 @@ public class Pet { } } - - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java index e3756279b4d..41ee776bbd7 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java @@ -1,15 +1,14 @@ package io.swagger.model; import java.util.Objects; +import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class Tag { private Long id = null; @@ -82,5 +81,3 @@ public class Tag { } } - - diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java index 1df990a8163..71f1f95d885 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java @@ -1,15 +1,14 @@ package io.swagger.model; import java.util.Objects; +import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") public class User { private Long id = null; @@ -173,5 +172,3 @@ public class User { } } - - diff --git a/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java index 9657e9b17cc..1e4b479b32f 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java @@ -20,69 +20,66 @@ import javax.ws.rs.core.SecurityContext; @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") public class PetApiServiceImpl extends PetApiService { - - @Override - public Response updatePet(Pet body,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response addPet(Pet body,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response findPetsByStatus(List status,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response findPetsByTags(List tags,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response getPetById(Long petId,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response deletePet(Long petId,String apiKey,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response getPetByIdWithByteArray(Long petId,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - + + @Override + public Response updatePet(Pet body,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response findPetsByStatus(List status,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response findPetsByTags(List tags,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response getPetByIdInObject(Long petId,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response petPetIdtestingByteArraytrueGet(Long petId,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + } diff --git a/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java index f8538681c49..0bb503589cb 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java @@ -19,34 +19,42 @@ import javax.ws.rs.core.SecurityContext; @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") public class StoreApiServiceImpl extends StoreApiService { - - @Override - public Response getInventory(SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response placeOrder(Order body,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response getOrderById(String orderId,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response deleteOrder(String orderId,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - + + @Override + public Response getInventory(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response getInventoryInObject(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response placeOrder(Order body,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response getOrderById(String orderId,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response deleteOrder(String orderId,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response findOrdersByStatus(String status, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + } diff --git a/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java index 2640ecd3121..e2d9acb67ba 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java @@ -19,62 +19,54 @@ import javax.ws.rs.core.SecurityContext; @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-02-04T01:58:20.368+07:00") public class UserApiServiceImpl extends UserApiService { - - @Override - public Response createUser(User body,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response createUsersWithArrayInput(List body,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response createUsersWithListInput(List body,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response loginUser(String username,String password,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response logoutUser(SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response getUserByName(String username,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response updateUser(String username,User body,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - - @Override - public Response deleteUser(String username,SecurityContext securityContext) - throws NotFoundException { - // do some magic! - return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); - } - + + @Override + public Response createUser(User body,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response createUsersWithArrayInput(List body,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response createUsersWithListInput(List body,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response loginUser(String username,String password,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response logoutUser(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response getUserByName(String username,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response updateUser(String username,User body,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + + @Override + public Response deleteUser(String username,SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + } From 57c493b3343af54c716acbceab1f9a3f558dcf97 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 10 Mar 2016 10:26:38 +0800 Subject: [PATCH 14/23] add jaxrs-resteasy to ci test --- pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index bc0b67c0e1d..f7342ca3140 100644 --- a/pom.xml +++ b/pom.xml @@ -414,6 +414,18 @@ samples/client/petstore/swift/SwaggerClientTests + + jaxrs-resteasy-server + + + env + java + + + + samples/server/petstore/jaxrs-resteasy + + jaxrs-server @@ -473,6 +485,7 @@ samples/server/petstore/spring-mvc samples/client/petstore/ruby samples/server/petstore/jaxrs + samples/server/petstore/jaxrs-resteasy From dc767d0475f71309798731af08064ee0eb757c6a Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 10 Mar 2016 11:01:34 +0800 Subject: [PATCH 15/23] add new files for resteasy --- .../src/gen/java/io/swagger/api/ApiException.java | 2 +- .../src/gen/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../src/gen/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../src/gen/java/io/swagger/api/NotFoundException.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java | 2 +- .../src/gen/java/io/swagger/api/PetApiService.java | 2 +- .../src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java | 2 +- .../java/io/swagger/api/PettestingByteArraytrueApiService.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java | 2 +- .../src/gen/java/io/swagger/api/StoreApiService.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java | 2 +- .../src/gen/java/io/swagger/api/UserApiService.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java | 2 +- .../src/gen/java/io/swagger/model/InlineResponse200.java | 2 +- .../src/gen/java/io/swagger/model/ModelReturn.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java | 2 +- .../src/gen/java/io/swagger/model/SpecialModelName.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/User.java | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java index 857aa9ebe7d..347021d8b63 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java index 6f5e1e36cc3..bfecaff9d1f 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class ApiOriginFilter implements javax.servlet.Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java index 74575cbd3fe..c4c7f1d503d 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java index 9f2a8cefe3d..f4a082d601a 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java index 3cbe8eb1325..723e80a416f 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java @@ -22,7 +22,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class PetApi { private final PetApiService delegate = PetApiServiceFactory.getPetApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java index 20930f960fb..e712ab13b7a 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java @@ -17,7 +17,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public abstract class PetApiService { public abstract Response addPet(Pet body,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java index e79018599ef..7301b41f416 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java @@ -18,7 +18,7 @@ import javax.ws.rs.*; @Path("/pet?testing_byte_array=true") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class PettestingByteArraytrueApi { private final PettestingByteArraytrueApiService delegate = PettestingByteArraytrueApiServiceFactory.getPettestingByteArraytrueApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java index d2aaa82cb2d..e02378f9ec0 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java @@ -13,7 +13,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public abstract class PettestingByteArraytrueApiService { public abstract Response addPetUsingByteArray(byte[] body,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java index 906babad922..a2b5ce93c57 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java @@ -20,7 +20,7 @@ import javax.ws.rs.*; @Path("/store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class StoreApi { private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java index fd52b687727..466a06feb84 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java @@ -15,7 +15,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public abstract class StoreApiService { public abstract Response deleteOrder(String orderId,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java index 19649972e2b..6cd98ae1d4a 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java index 181ece818a1..c59236f6184 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java @@ -20,7 +20,7 @@ import javax.ws.rs.*; @Path("/user") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class UserApi { private final UserApiService delegate = UserApiServiceFactory.getUserApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java index b52aeb6e824..990f468f994 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java @@ -15,7 +15,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public abstract class UserApiService { public abstract Response createUser(User body,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java index 095f0de76d9..06d1c041a31 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/InlineResponse200.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/InlineResponse200.java index 2af6a058619..109fcb9d343 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/InlineResponse200.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/InlineResponse200.java @@ -10,7 +10,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class InlineResponse200 { private List tags = new ArrayList(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelReturn.java index 3f9e3a959a9..b98afc88051 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelReturn.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class ModelReturn { private Integer _return = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java index 6bc4b84a511..d2570b72cf3 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java @@ -9,7 +9,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java index 6808a3f477e..527dff52897 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java @@ -11,7 +11,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/SpecialModelName.java index 6b7efddd73b..90ecb450590 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/SpecialModelName.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java index 41ee776bbd7..82f7d049c2a 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java index 71f1f95d885..89db1c180af 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T09:43:22.889+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") public class User { private Long id = null; From c7460821715d12f5dbf77a080718dc831df571e4 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 16 Mar 2016 14:28:13 +0800 Subject: [PATCH 16/23] update jaxrs sample --- .../src/gen/java/io/swagger/api/ApiException.java | 2 +- .../src/gen/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../src/gen/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../src/gen/java/io/swagger/api/NotFoundException.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java | 2 +- .../src/gen/java/io/swagger/api/PetApiService.java | 2 +- .../src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java | 2 +- .../java/io/swagger/api/PettestingByteArraytrueApiService.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java | 2 +- .../src/gen/java/io/swagger/api/StoreApiService.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java | 2 +- .../src/gen/java/io/swagger/api/UserApiService.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java | 2 +- .../src/gen/java/io/swagger/model/InlineResponse200.java | 2 +- .../src/gen/java/io/swagger/model/ModelReturn.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java | 2 +- .../src/gen/java/io/swagger/model/SpecialModelName.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java | 2 +- .../jaxrs-resteasy/src/gen/java/io/swagger/model/User.java | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java index 347021d8b63..bfeaf6571ad 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java index bfecaff9d1f..419f9ebab09 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class ApiOriginFilter implements javax.servlet.Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java index c4c7f1d503d..2e00645c336 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java index f4a082d601a..52d5224b7eb 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java index 723e80a416f..10d335c19bd 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApi.java @@ -22,7 +22,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; @Path("/pet") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class PetApi { private final PetApiService delegate = PetApiServiceFactory.getPetApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java index e712ab13b7a..47ed65af8ab 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PetApiService.java @@ -17,7 +17,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public abstract class PetApiService { public abstract Response addPet(Pet body,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java index 7301b41f416..8c742e89268 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java @@ -18,7 +18,7 @@ import javax.ws.rs.*; @Path("/pet?testing_byte_array=true") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class PettestingByteArraytrueApi { private final PettestingByteArraytrueApiService delegate = PettestingByteArraytrueApiServiceFactory.getPettestingByteArraytrueApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java index e02378f9ec0..08186045b71 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java @@ -13,7 +13,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public abstract class PettestingByteArraytrueApiService { public abstract Response addPetUsingByteArray(byte[] body,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java index a2b5ce93c57..945b73e32f3 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApi.java @@ -20,7 +20,7 @@ import javax.ws.rs.*; @Path("/store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class StoreApi { private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java index 466a06feb84..61ad4fd923b 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StoreApiService.java @@ -15,7 +15,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public abstract class StoreApiService { public abstract Response deleteOrder(String orderId,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java index 6cd98ae1d4a..87d9317396e 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java index c59236f6184..be7af49cefa 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApi.java @@ -20,7 +20,7 @@ import javax.ws.rs.*; @Path("/user") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class UserApi { private final UserApiService delegate = UserApiServiceFactory.getUserApi(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java index 990f468f994..d28f14c07c0 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/api/UserApiService.java @@ -15,7 +15,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public abstract class UserApiService { public abstract Response createUser(User body,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java index 06d1c041a31..3786c816887 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/InlineResponse200.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/InlineResponse200.java index 109fcb9d343..408a4ccdb0e 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/InlineResponse200.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/InlineResponse200.java @@ -10,7 +10,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class InlineResponse200 { private List tags = new ArrayList(); diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelReturn.java index b98afc88051..a7ab3bb3df6 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelReturn.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class ModelReturn { private Integer _return = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java index d2570b72cf3..1d40f9c3359 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java @@ -9,7 +9,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java index 527dff52897..51f31e982ef 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java @@ -11,7 +11,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/SpecialModelName.java index 90ecb450590..f5c2edcb253 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/SpecialModelName.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java index 82f7d049c2a..9f231bfabcd 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java index 89db1c180af..16b2b78a9f3 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-10T11:00:42.854+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00") public class User { private Long id = null; From 7b31dabe77ba01de1dc448d3a30730985f34b77c Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 16 Mar 2016 14:58:19 +0800 Subject: [PATCH 17/23] fix perl, ruby auth doc in readme --- .../src/main/resources/perl/README.mustache | 2 +- .../src/main/resources/ruby/README.mustache | 2 +- samples/client/petstore/perl/README.md | 6 +- .../perl/lib/WWW/SwaggerClient/Role.pm | 4 +- samples/client/petstore/ruby/README.md | 6 +- samples/client/petstore/ruby/docs/UserApi.md | 18 ++++++ samples/client/petstore/ruby/git_push.sh | 6 +- .../petstore/ruby/lib/petstore/api/pet_api.rb | 6 +- .../ruby/lib/petstore/api/store_api.rb | 2 +- .../ruby/lib/petstore/configuration.rb | 49 ++++++-------- .../petstore/models/inline_response_200.rb | 64 +++++++++---------- 11 files changed, 88 insertions(+), 77 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/perl/README.mustache b/modules/swagger-codegen/src/main/resources/perl/README.mustache index c2a0f8f3f2b..771dd76b8b1 100644 --- a/modules/swagger-codegen/src/main/resources/perl/README.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/README.mustache @@ -260,7 +260,7 @@ Class | Method | HTTP request | Description - **Flow**: {{{flow}}} - **Authorizatoin URL**: {{{authorizationUrl}}} - **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} {{/scopes}} {{/isOAuth}} diff --git a/modules/swagger-codegen/src/main/resources/ruby/README.mustache b/modules/swagger-codegen/src/main/resources/ruby/README.mustache index c9a21277c77..d55fe28ad25 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/README.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/README.mustache @@ -100,7 +100,7 @@ Class | Method | HTTP request | Description - **Flow**: {{flow}} - **Authorizatoin URL**: {{authorizationUrl}} - **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}}-- {{scope}}: {{description}} +{{#scopes}} - {{scope}}: {{description}} {{/scopes}} {{/isOAuth}} diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 3758d282ddd..3f87edd1ec5 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -8,7 +8,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore Automatically generated by the Perl Swagger Codegen project: -- Build date: 2016-03-13T22:43:11.863+08:00 +- Build date: 2016-03-16T14:57:20.078+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen - Codegen version: @@ -329,8 +329,8 @@ Class | Method | HTTP request | Description - **Flow**: implicit - **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets + - **write:pets**: modify pets in your account + - **read:pets**: read your pets diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index ab84d287c40..99a175ea451 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -37,7 +37,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-03-13T22:43:11.863+08:00', + generated_date => '2016-03-16T14:57:20.078+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-03-13T22:43:11.863+08:00 +=item Build date: 2016-03-16T14:57:20.078+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 7cbfdadfc67..bb77c31c8ea 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -6,7 +6,7 @@ Version: 1.0.0 Automatically generated by the Ruby Swagger Codegen project: -- Build date: 2016-03-14T21:56:19.858+08:00 +- Build date: 2016-03-16T14:58:08.710+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -159,6 +159,6 @@ Class | Method | HTTP request | Description - **Flow**: implicit - **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: --- write:pets: modify pets in your account --- read:pets: read your pets + - write:pets: modify pets in your account + - read:pets: read your pets diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index 284c5e3a314..c629e696410 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -23,6 +23,8 @@ This can only be done by the logged in user. ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new opts = { @@ -66,6 +68,8 @@ Creates list of users with given input array ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new opts = { @@ -109,6 +113,8 @@ Creates list of users with given input array ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new opts = { @@ -152,6 +158,8 @@ This can only be done by the logged in user. ### Example ```ruby +require 'petstore' + Petstore.configure do |config| # Configure HTTP basic authorization: test_http_basic config.username = 'YOUR USERNAME' @@ -200,6 +208,8 @@ Get user by user name ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new username = "username_example" # [String] The name that needs to be fetched. Use user1 for testing. @@ -207,6 +217,7 @@ username = "username_example" # [String] The name that needs to be fetched. Use begin result = api.get_user_by_name(username) + p result rescue Petstore::ApiError => e puts "Exception when calling get_user_by_name: #{e}" end @@ -242,6 +253,8 @@ Logs user into the system ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new opts = { @@ -251,6 +264,7 @@ opts = { begin result = api.login_user(opts) + p result rescue Petstore::ApiError => e puts "Exception when calling login_user: #{e}" end @@ -287,6 +301,8 @@ Logs out current logged in user session ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new begin @@ -323,6 +339,8 @@ This can only be done by the logged in user. ### Example ```ruby +require 'petstore' + api = Petstore::UserApi.new username = "username_example" # [String] name that need to be deleted diff --git a/samples/client/petstore/ruby/git_push.sh b/samples/client/petstore/ruby/git_push.sh index 6ca091b49d9..1a36388db02 100644 --- a/samples/client/petstore/ruby/git_push.sh +++ b/samples/client/petstore/ruby/git_push.sh @@ -8,17 +8,17 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="" + git_user_id="YOUR_GIT_USR_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="" + git_repo_id="YOUR_GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi if [ "$release_note" = "" ]; then - release_note="" + release_note="Minor update" echo "[INFO] No command line input provided. Set \$release_note to $release_note" fi diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index 4a5d45d766c..29f631a983e 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -360,7 +360,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['petstore_auth', 'api_key'] + auth_names = ['api_key', 'petstore_auth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, @@ -420,7 +420,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['petstore_auth', 'api_key'] + auth_names = ['api_key', 'petstore_auth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, @@ -480,7 +480,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['petstore_auth', 'api_key'] + auth_names = ['api_key', 'petstore_auth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index 7bdfd013bf6..11bdfaadf62 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -301,7 +301,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['test_api_key_query', 'test_api_key_header'] + auth_names = ['test_api_key_header', 'test_api_key_query'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 94a1b566a1e..5125ebe5960 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -157,33 +157,12 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { - 'petstore_auth' => - { - type: 'oauth2', - in: 'header', - key: 'Authorization', - value: "Bearer #{access_token}" - }, - 'test_api_client_id' => + 'test_api_key_header' => { type: 'api_key', in: 'header', - key: 'x-test_api_client_id', - value: api_key_with_prefix('x-test_api_client_id') - }, - 'test_http_basic' => - { - type: 'basic', - in: 'header', - key: 'Authorization', - value: basic_auth_token - }, - 'test_api_client_secret' => - { - type: 'api_key', - in: 'header', - key: 'x-test_api_client_secret', - value: api_key_with_prefix('x-test_api_client_secret') + key: 'test_api_key_header', + value: api_key_with_prefix('test_api_key_header') }, 'api_key' => { @@ -199,6 +178,20 @@ module Petstore key: 'Authorization', value: basic_auth_token }, + 'test_api_client_secret' => + { + type: 'api_key', + in: 'header', + key: 'x-test_api_client_secret', + value: api_key_with_prefix('x-test_api_client_secret') + }, + 'test_api_client_id' => + { + type: 'api_key', + in: 'header', + key: 'x-test_api_client_id', + value: api_key_with_prefix('x-test_api_client_id') + }, 'test_api_key_query' => { type: 'api_key', @@ -206,12 +199,12 @@ module Petstore key: 'test_api_key_query', value: api_key_with_prefix('test_api_key_query') }, - 'test_api_key_header' => + 'petstore_auth' => { - type: 'api_key', + type: 'oauth2', in: 'header', - key: 'test_api_key_header', - value: api_key_with_prefix('test_api_key_header') + key: 'Authorization', + value: "Bearer #{access_token}" }, } end diff --git a/samples/client/petstore/ruby/lib/petstore/models/inline_response_200.rb b/samples/client/petstore/ruby/lib/petstore/models/inline_response_200.rb index a793250e45b..190170f18eb 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/inline_response_200.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/inline_response_200.rb @@ -18,34 +18,34 @@ require 'date' module Petstore class InlineResponse200 - attr_accessor :photo_urls - - attr_accessor :name + attr_accessor :tags attr_accessor :id attr_accessor :category - attr_accessor :tags - # pet status in the store attr_accessor :status + attr_accessor :name + + attr_accessor :photo_urls + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'photo_urls' => :'photoUrls', - - :'name' => :'name', + :'tags' => :'tags', :'id' => :'id', :'category' => :'category', - :'tags' => :'tags', + :'status' => :'status', - :'status' => :'status' + :'name' => :'name', + + :'photo_urls' => :'photoUrls' } end @@ -53,12 +53,12 @@ module Petstore # Attribute type mapping. def self.swagger_types { - :'photo_urls' => :'Array', - :'name' => :'String', + :'tags' => :'Array', :'id' => :'Integer', :'category' => :'Object', - :'tags' => :'Array', - :'status' => :'String' + :'status' => :'String', + :'name' => :'String', + :'photo_urls' => :'Array' } end @@ -70,16 +70,12 @@ module Petstore attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} - if attributes[:'photoUrls'] - if (value = attributes[:'photoUrls']).is_a?(Array) - self.photo_urls = value + if attributes[:'tags'] + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value end end - if attributes[:'name'] - self.name = attributes[:'name'] - end - if attributes[:'id'] self.id = attributes[:'id'] end @@ -88,16 +84,20 @@ module Petstore self.category = attributes[:'category'] end - if attributes[:'tags'] - if (value = attributes[:'tags']).is_a?(Array) - self.tags = value - end - end - if attributes[:'status'] self.status = attributes[:'status'] end + if attributes[:'name'] + self.name = attributes[:'name'] + end + + if attributes[:'photoUrls'] + if (value = attributes[:'photoUrls']).is_a?(Array) + self.photo_urls = value + end + end + end # Custom attribute writer method checking allowed values (enum). @@ -113,12 +113,12 @@ module Petstore def ==(o) return true if self.equal?(o) self.class == o.class && - photo_urls == o.photo_urls && - name == o.name && + tags == o.tags && id == o.id && category == o.category && - tags == o.tags && - status == o.status + status == o.status && + name == o.name && + photo_urls == o.photo_urls end # @see the `==` method @@ -128,7 +128,7 @@ module Petstore # Calculate hash code according to all attributes. def hash - [photo_urls, name, id, category, tags, status].hash + [tags, id, category, status, name, photo_urls].hash end # build the object from hash From c101c1204ec19ddb6d05c7bb5387b8d95942ed42 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 16 Mar 2016 16:14:04 +0800 Subject: [PATCH 18/23] add php documentation --- .../io/swagger/codegen/CodegenOperation.java | 1 + .../io/swagger/codegen/DefaultCodegen.java | 2 +- .../codegen/languages/PhpClientCodegen.java | 10 +- .../src/main/resources/php/README.mustache | 2 +- .../src/main/resources/php/api_doc.mustache | 72 ++++ .../src/main/resources/php/model_doc.mustache | 11 + samples/client/petstore/perl/README.md | 2 +- .../perl/lib/WWW/SwaggerClient/Role.pm | 4 +- .../petstore/php/SwaggerClient-php/README.md | 97 +++++- .../php/SwaggerClient-php/composer.json | 2 +- .../php/SwaggerClient-php/docs/Category.md | 7 +- .../docs/InlineResponse200.md | 7 +- .../php/SwaggerClient-php/docs/ModelReturn.md | 7 +- .../php/SwaggerClient-php/docs/Name.md | 7 +- .../php/SwaggerClient-php/docs/Order.md | 7 +- .../php/SwaggerClient-php/docs/Pet.md | 7 +- .../php/SwaggerClient-php/docs/PetApi.md | 326 +++++++++--------- .../docs/SpecialModelName.md | 7 +- .../php/SwaggerClient-php/docs/StoreApi.md | 199 +++++------ .../php/SwaggerClient-php/docs/Tag.md | 7 +- .../php/SwaggerClient-php/docs/User.md | 7 +- .../php/SwaggerClient-php/docs/UserApi.md | 185 +++++----- .../lib/ObjectSerializer.php | 12 +- 23 files changed, 571 insertions(+), 417 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/php/api_doc.mustache create mode 100644 modules/swagger-codegen/src/main/resources/php/model_doc.mustache diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java index 956e906b44f..120465bca67 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java @@ -32,6 +32,7 @@ public class CodegenOperation { public ExternalDocs externalDocs; public Map vendorExtensions; public String nickname; // legacy support + public String operationIdLowerCase; // for mardown documentation /** * Check if there's at least one parameter diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 65ed6a456ef..86bb99598ec 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1575,7 +1575,6 @@ public class DefaultCodegen { // legacy support op.nickname = op.operationId; - if (op.allParams.size() > 0) { op.hasParams = true; } @@ -2075,6 +2074,7 @@ public class DefaultCodegen { LOGGER.warn("generated unique operationId `" + uniqueName + "`"); } co.operationId = uniqueName; + co.operationIdLowerCase = uniqueName.toLowerCase(); opList.add(co); co.baseName = tag; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index b8a891e4c66..e0dfe6cfb2a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -507,12 +507,12 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { type = p.dataType; } - if ("String".equals(type)) { + if ("String".equalsIgnoreCase(type)) { if (example == null) { example = p.paramName + "_example"; } example = "\"" + escapeText(example) + "\""; - } else if ("Integer".equals(type)) { + } else if ("Integer".equals(type) || "int".equals(type)) { if (example == null) { example = "56"; } @@ -533,15 +533,17 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { if (example == null) { example = "2013-10-20"; } - example = "new DateTime(\"" + escapeText(example) + "\")"; + example = "new \\DateTime(\"" + escapeText(example) + "\")"; } else if ("DateTime".equals(type)) { if (example == null) { example = "2013-10-20T19:20:30+01:00"; } - example = "new DateTime(\"" + escapeText(example) + "\")"; + example = "new \\DateTime(\"" + escapeText(example) + "\")"; } else if (!languageSpecificPrimitives.contains(type)) { // type is a model class, e.g. User example = "new " + type + "()"; + } else { + LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue"); } if (example == null) { diff --git a/modules/swagger-codegen/src/main/resources/php/README.mustache b/modules/swagger-codegen/src/main/resources/php/README.mustache index 00146f48944..12b78b3f7ed 100644 --- a/modules/swagger-codegen/src/main/resources/php/README.mustache +++ b/modules/swagger-codegen/src/main/resources/php/README.mustache @@ -46,7 +46,7 @@ All URIs are relative to *{{basePath}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{nickname}}**]({{apiDocPath}}{{classname}}.md#{{nickname}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ## Documentation For Models diff --git a/modules/swagger-codegen/src/main/resources/php/api_doc.mustache b/modules/swagger-codegen/src/main/resources/php/api_doc.mustache new file mode 100644 index 00000000000..a4377003803 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/php/api_doc.mustache @@ -0,0 +1,72 @@ +# {{invokerPackage}}\{{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Example +```php +setUsername('YOUR_USERNAME'); +{{{invokerPackage}}}::getDefaultConfiguration->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}} +// Configure API key authorization: {{{name}}} +{{{invokerPackage}}}::getDefaultConfiguration->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// {{{invokerPackage}}}::getDefaultConfiguration->setApiKeyPrefix('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} +// Configure OAuth2 access token for authorization: {{{name}}} +{{{invokerPackage}}}::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}} +{{/hasAuthMethods}} + +$api_instance = new {{invokerPackage}}\{{classname}}(); +{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} + +try { + {{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + print_r($result);{{/returnType}} +} catch (Exception $e) { + echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), "\n"; +} +?> +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP reuqest headers + + - **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/php/model_doc.mustache b/modules/swagger-codegen/src/main/resources/php/model_doc.mustache new file mode 100644 index 00000000000..569550df372 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/php/model_doc.mustache @@ -0,0 +1,11 @@ +{{#models}}{{#model}}# {{classname}} + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/vars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}}{{/models}} diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 3f87edd1ec5..772a3e556ff 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -8,7 +8,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore Automatically generated by the Perl Swagger Codegen project: -- Build date: 2016-03-16T14:57:20.078+08:00 +- Build date: 2016-03-16T15:35:49.140+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen - Codegen version: diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index 99a175ea451..83c93817626 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -37,7 +37,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-03-16T14:57:20.078+08:00', + generated_date => '2016-03-16T15:35:49.140+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-03-16T14:57:20.078+08:00 +=item Build date: 2016-03-16T15:35:49.140+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 0566cb0af39..4a0f064aada 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -14,11 +14,11 @@ You can install the bindings via [Composer](http://getcomposer.org/). Add this t "repositories": [ { "type": "git", - "url": "https://github.com/swagger/swagger-client.git" + "url": "https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git" } ], "require": { - "swagger/swagger-client": "*@dev" + "YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID": "*@dev" } } ``` @@ -40,6 +40,99 @@ composer install ./vendor/bin/phpunit lib/Tests ``` +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' +*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findordersbystatus) | **GET** /store/findByStatus | Finds orders by status +*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [Category](docs/Category.md) + - [InlineResponse200](docs/InlineResponse200.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation For Authorization + + +## test_api_key_header + +- **Type**: API key +- **API key parameter name**: test_api_key_header +- **Location**: HTTP header + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## test_http_basic + +- **Type**: HTTP basic authentication + +## test_api_client_secret + +- **Type**: API key +- **API key parameter name**: x-test_api_client_secret +- **Location**: HTTP header + +## test_api_client_id + +- **Type**: API key +- **API key parameter name**: x-test_api_client_id +- **Location**: HTTP header + +## test_api_key_query + +- **Type**: API key +- **API key parameter name**: test_api_key_query +- **Location**: URL query string + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + ## Author apiteam@swagger.io diff --git a/samples/client/petstore/php/SwaggerClient-php/composer.json b/samples/client/petstore/php/SwaggerClient-php/composer.json index 3b432d83b92..3889aee8a36 100644 --- a/samples/client/petstore/php/SwaggerClient-php/composer.json +++ b/samples/client/petstore/php/SwaggerClient-php/composer.json @@ -1,5 +1,5 @@ { - "name": "swagger/swagger-client", + "name": "YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID", "version": "1.0.0", "description": "", "keywords": [ diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Category.md b/samples/client/petstore/php/SwaggerClient-php/docs/Category.md index 1f57eb29678..80aef312e5e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Category.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Category.md @@ -1,9 +1,4 @@ -# ::Object::Category - -## Load the model package -```perl -use ::Object::Category; -``` +# Category ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md index 116f6808b07..1c0b9237453 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md @@ -1,9 +1,4 @@ -# ::Object::InlineResponse200 - -## Load the model package -```perl -use ::Object::InlineResponse200; -``` +# InlineResponse200 ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md b/samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md index 1d6a183fecb..9adb62e1e12 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/ModelReturn.md @@ -1,9 +1,4 @@ -# ::Object::ModelReturn - -## Load the model package -```perl -use ::Object::ModelReturn; -``` +# ModelReturn ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Name.md b/samples/client/petstore/php/SwaggerClient-php/docs/Name.md index 2c95721327a..b9842d31abf 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Name.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Name.md @@ -1,9 +1,4 @@ -# ::Object::Name - -## Load the model package -```perl -use ::Object::Name; -``` +# Name ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md index 79c68cff275..8932478b022 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md @@ -1,9 +1,4 @@ -# ::Object::Order - -## Load the model package -```perl -use ::Object::Order; -``` +# Order ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Pet.md b/samples/client/petstore/php/SwaggerClient-php/docs/Pet.md index a97841d399b..4525fe7d776 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Pet.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Pet.md @@ -1,9 +1,4 @@ -# ::Object::Pet - -## Load the model package -```perl -use ::Object::Pet; -``` +# Pet ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md index 946074e7687..db95061a841 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md @@ -1,9 +1,4 @@ -# ::PetApi - -## Load the API package -```perl -use ::Object::PetApi; -``` +# Swagger\Client\PetApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -23,28 +18,29 @@ Method | HTTP request | Description # **addPet** -> addPet(body => $body) +> addPet($body) Add a new pet to the store ### Example -```perl -use Data::Dumper; +```php +setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $body = ::Object::\Swagger\Client\Model\Pet->new(); # [\Swagger\Client\Model\Pet] Pet object that needs to be added to the store +$api_instance = new Swagger\Client\PetApi(); +$body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store -eval { - $api->addPet(body => $body); -}; -if ($@) { - warn "Exception when calling PetApi->addPet: $@\n"; +try { + $api_instance->addPet($body); +} catch (Exception $e) { + echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -69,28 +65,29 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **addPetUsingByteArray** -> addPetUsingByteArray(body => $body) +> addPetUsingByteArray($body) Fake endpoint to test byte array in body parameter for adding a new pet to the store ### Example -```perl -use Data::Dumper; +```php +setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $body = ::Object::string->new(); # [string] Pet object in the form of byte array +$api_instance = new Swagger\Client\PetApi(); +$body = "B"; // string | Pet object in the form of byte array -eval { - $api->addPetUsingByteArray(body => $body); -}; -if ($@) { - warn "Exception when calling PetApi->addPetUsingByteArray: $@\n"; +try { + $api_instance->addPetUsingByteArray($body); +} catch (Exception $e) { + echo 'Exception when calling PetApi->addPetUsingByteArray: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -115,29 +112,30 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **deletePet** -> deletePet(pet_id => $pet_id, api_key => $api_key) +> deletePet($pet_id, $api_key) Deletes a pet ### Example -```perl -use Data::Dumper; +```php +setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $pet_id = 789; # [int] Pet id to delete -my $api_key = api_key_example; # [string] +$api_instance = new Swagger\Client\PetApi(); +$pet_id = 789; // int | Pet id to delete +$api_key = "api_key_example"; // string | -eval { - $api->deletePet(pet_id => $pet_id, api_key => $api_key); -}; -if ($@) { - warn "Exception when calling PetApi->deletePet: $@\n"; +try { + $api_instance->deletePet($pet_id, $api_key); +} catch (Exception $e) { + echo 'Exception when calling PetApi->deletePet: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -163,29 +161,30 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **findPetsByStatus** -> \Swagger\Client\Model\Pet[] findPetsByStatus(status => $status) +> \Swagger\Client\Model\Pet[] findPetsByStatus($status) Finds Pets by status Multiple status values can be provided with comma separated strings ### Example -```perl -use Data::Dumper; +```php +setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $status = (array(available)); # [string[]] Status values that need to be considered for query +$api_instance = new Swagger\Client\PetApi(); +$status = array("available"); // string[] | Status values that need to be considered for query -eval { - my $result = $api->findPetsByStatus(status => $status); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->findPetsByStatus: $@\n"; +try { + $result = $api_instance->findPetsByStatus($status); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->findPetsByStatus: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -210,29 +209,30 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **findPetsByTags** -> \Swagger\Client\Model\Pet[] findPetsByTags(tags => $tags) +> \Swagger\Client\Model\Pet[] findPetsByTags($tags) Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. ### Example -```perl -use Data::Dumper; +```php +setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $tags = (nil); # [string[]] Tags to filter by +$api_instance = new Swagger\Client\PetApi(); +$tags = array("tags_example"); // string[] | Tags to filter by -eval { - my $result = $api->findPetsByTags(tags => $tags); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->findPetsByTags: $@\n"; +try { + $result = $api_instance->findPetsByTags($tags); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->findPetsByTags: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -257,33 +257,34 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **getPetById** -> \Swagger\Client\Model\Pet getPetById(pet_id => $pet_id) +> \Swagger\Client\Model\Pet getPetById($pet_id) Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example -```perl -use Data::Dumper; +```php +{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; -# Configure OAuth2 access token for authorization: petstore_auth -::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; +// Configure API key authorization: api_key +Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $pet_id = 789; # [int] ID of pet that needs to be fetched +$api_instance = new Swagger\Client\PetApi(); +$pet_id = 789; // int | ID of pet that needs to be fetched -eval { - my $result = $api->getPetById(pet_id => $pet_id); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->getPetById: $@\n"; +try { + $result = $api_instance->getPetById($pet_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->getPetById: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -308,33 +309,34 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **getPetByIdInObject** -> \Swagger\Client\Model\InlineResponse200 getPetByIdInObject(pet_id => $pet_id) +> \Swagger\Client\Model\InlineResponse200 getPetByIdInObject($pet_id) Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example -```perl -use Data::Dumper; +```php +{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; -# Configure OAuth2 access token for authorization: petstore_auth -::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; +// Configure API key authorization: api_key +Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $pet_id = 789; # [int] ID of pet that needs to be fetched +$api_instance = new Swagger\Client\PetApi(); +$pet_id = 789; // int | ID of pet that needs to be fetched -eval { - my $result = $api->getPetByIdInObject(pet_id => $pet_id); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->getPetByIdInObject: $@\n"; +try { + $result = $api_instance->getPetByIdInObject($pet_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->getPetByIdInObject: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -359,33 +361,34 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **petPetIdtestingByteArraytrueGet** -> string petPetIdtestingByteArraytrueGet(pet_id => $pet_id) +> string petPetIdtestingByteArraytrueGet($pet_id) Fake endpoint to test byte array return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example -```perl -use Data::Dumper; +```php +{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; -# Configure OAuth2 access token for authorization: petstore_auth -::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; +// Configure API key authorization: api_key +Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $pet_id = 789; # [int] ID of pet that needs to be fetched +$api_instance = new Swagger\Client\PetApi(); +$pet_id = 789; // int | ID of pet that needs to be fetched -eval { - my $result = $api->petPetIdtestingByteArraytrueGet(pet_id => $pet_id); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->petPetIdtestingByteArraytrueGet: $@\n"; +try { + $result = $api_instance->petPetIdtestingByteArraytrueGet($pet_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->petPetIdtestingByteArraytrueGet: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -410,28 +413,29 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **updatePet** -> updatePet(body => $body) +> updatePet($body) Update an existing pet ### Example -```perl -use Data::Dumper; +```php +setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $body = ::Object::\Swagger\Client\Model\Pet->new(); # [\Swagger\Client\Model\Pet] Pet object that needs to be added to the store +$api_instance = new Swagger\Client\PetApi(); +$body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store -eval { - $api->updatePet(body => $body); -}; -if ($@) { - warn "Exception when calling PetApi->updatePet: $@\n"; +try { + $api_instance->updatePet($body); +} catch (Exception $e) { + echo 'Exception when calling PetApi->updatePet: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -456,30 +460,31 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **updatePetWithForm** -> updatePetWithForm(pet_id => $pet_id, name => $name, status => $status) +> updatePetWithForm($pet_id, $name, $status) Updates a pet in the store with form data ### Example -```perl -use Data::Dumper; +```php +setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $pet_id = pet_id_example; # [string] ID of pet that needs to be updated -my $name = name_example; # [string] Updated name of the pet -my $status = status_example; # [string] Updated status of the pet +$api_instance = new Swagger\Client\PetApi(); +$pet_id = "pet_id_example"; // string | ID of pet that needs to be updated +$name = "name_example"; // string | Updated name of the pet +$status = "status_example"; // string | Updated status of the pet -eval { - $api->updatePetWithForm(pet_id => $pet_id, name => $name, status => $status); -}; -if ($@) { - warn "Exception when calling PetApi->updatePetWithForm: $@\n"; +try { + $api_instance->updatePetWithForm($pet_id, $name, $status); +} catch (Exception $e) { + echo 'Exception when calling PetApi->updatePetWithForm: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -506,30 +511,31 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **uploadFile** -> uploadFile(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file) +> uploadFile($pet_id, $additional_metadata, $file) uploads an image ### Example -```perl -use Data::Dumper; +```php +setAccessToken('YOUR_ACCESS_TOKEN'); -my $api = ::PetApi->new(); -my $pet_id = 789; # [int] ID of pet to update -my $additional_metadata = additional_metadata_example; # [string] Additional data to pass to server -my $file = new Swagger\Client\\SplFileObject(); # [\SplFileObject] file to upload +$api_instance = new Swagger\Client\PetApi(); +$pet_id = 789; // int | ID of pet to update +$additional_metadata = "additional_metadata_example"; // string | Additional data to pass to server +$file = new \SplFileObject(); // \SplFileObject | file to upload -eval { - $api->uploadFile(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); -}; -if ($@) { - warn "Exception when calling PetApi->uploadFile: $@\n"; +try { + $api_instance->uploadFile($pet_id, $additional_metadata, $file); +} catch (Exception $e) { + echo 'Exception when calling PetApi->uploadFile: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md b/samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md index d0775fc6a2f..022ee19169c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/SpecialModelName.md @@ -1,9 +1,4 @@ -# ::Object::SpecialModelName - -## Load the model package -```perl -use ::Object::SpecialModelName; -``` +# SpecialModelName ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md index f8d61015d5c..cc4a5600f04 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md @@ -1,9 +1,4 @@ -# ::StoreApi - -## Load the API package -```perl -use ::Object::StoreApi; -``` +# Swagger\Client\StoreApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -18,25 +13,26 @@ Method | HTTP request | Description # **deleteOrder** -> deleteOrder(order_id => $order_id) +> deleteOrder($order_id) Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors ### Example -```perl -use Data::Dumper; +```php +new(); -my $order_id = order_id_example; # [string] ID of the order that needs to be deleted +$api_instance = new Swagger\Client\StoreApi(); +$order_id = "order_id_example"; // string | ID of the order that needs to be deleted -eval { - $api->deleteOrder(order_id => $order_id); -}; -if ($@) { - warn "Exception when calling StoreApi->deleteOrder: $@\n"; +try { + $api_instance->deleteOrder($order_id); +} catch (Exception $e) { + echo 'Exception when calling StoreApi->deleteOrder: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -61,35 +57,36 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **findOrdersByStatus** -> \Swagger\Client\Model\Order[] findOrdersByStatus(status => $status) +> \Swagger\Client\Model\Order[] findOrdersByStatus($status) Finds orders by status A single status value can be provided as a string ### Example -```perl -use Data::Dumper; +```php +{'x-test_api_client_id'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; -# Configure API key authorization: test_api_client_secret -::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; +// Configure API key authorization: test_api_client_id +Swagger\Client::getDefaultConfiguration->setApiKey('x-test_api_client_id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('x-test_api_client_id', 'BEARER'); +// Configure API key authorization: test_api_client_secret +Swagger\Client::getDefaultConfiguration->setApiKey('x-test_api_client_secret', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('x-test_api_client_secret', 'BEARER'); -my $api = ::StoreApi->new(); -my $status = placed; # [string] Status value that needs to be considered for query +$api_instance = new Swagger\Client\StoreApi(); +$status = "placed"; // string | Status value that needs to be considered for query -eval { - my $result = $api->findOrdersByStatus(status => $status); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->findOrdersByStatus: $@\n"; +try { + $result = $api_instance->findOrdersByStatus($status); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StoreApi->findOrdersByStatus: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -121,23 +118,24 @@ Returns pet inventories by status Returns a map of status codes to quantities ### Example -```perl -use Data::Dumper; +```php +{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +// Configure API key authorization: api_key +Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); -my $api = ::StoreApi->new(); +$api_instance = new Swagger\Client\StoreApi(); -eval { - my $result = $api->getInventory(); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->getInventory: $@\n"; +try { + $result = $api_instance->getInventory(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StoreApi->getInventory: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -166,23 +164,24 @@ Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities ### Example -```perl -use Data::Dumper; +```php +{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +// Configure API key authorization: api_key +Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); -my $api = ::StoreApi->new(); +$api_instance = new Swagger\Client\StoreApi(); -eval { - my $result = $api->getInventoryInObject(); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->getInventoryInObject: $@\n"; +try { + $result = $api_instance->getInventoryInObject(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StoreApi->getInventoryInObject: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -204,35 +203,36 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **getOrderById** -> \Swagger\Client\Model\Order getOrderById(order_id => $order_id) +> \Swagger\Client\Model\Order getOrderById($order_id) Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions ### Example -```perl -use Data::Dumper; +```php +{'test_api_key_header'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'test_api_key_header'} = "BEARER"; -# Configure API key authorization: test_api_key_query -::Configuration::api_key->{'test_api_key_query'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'test_api_key_query'} = "BEARER"; +// Configure API key authorization: test_api_key_header +Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_header', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_header', 'BEARER'); +// Configure API key authorization: test_api_key_query +Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_query', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_query', 'BEARER'); -my $api = ::StoreApi->new(); -my $order_id = order_id_example; # [string] ID of pet that needs to be fetched +$api_instance = new Swagger\Client\StoreApi(); +$order_id = "order_id_example"; // string | ID of pet that needs to be fetched -eval { - my $result = $api->getOrderById(order_id => $order_id); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->getOrderById: $@\n"; +try { + $result = $api_instance->getOrderById($order_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StoreApi->getOrderById: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -257,35 +257,36 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **placeOrder** -> \Swagger\Client\Model\Order placeOrder(body => $body) +> \Swagger\Client\Model\Order placeOrder($body) Place an order for a pet ### Example -```perl -use Data::Dumper; +```php +{'x-test_api_client_id'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; -# Configure API key authorization: test_api_client_secret -::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; +// Configure API key authorization: test_api_client_id +Swagger\Client::getDefaultConfiguration->setApiKey('x-test_api_client_id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('x-test_api_client_id', 'BEARER'); +// Configure API key authorization: test_api_client_secret +Swagger\Client::getDefaultConfiguration->setApiKey('x-test_api_client_secret', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('x-test_api_client_secret', 'BEARER'); -my $api = ::StoreApi->new(); -my $body = ::Object::\Swagger\Client\Model\Order->new(); # [\Swagger\Client\Model\Order] order placed for purchasing the pet +$api_instance = new Swagger\Client\StoreApi(); +$body = new \Swagger\Client\Model\Order(); // \Swagger\Client\Model\Order | order placed for purchasing the pet -eval { - my $result = $api->placeOrder(body => $body); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->placeOrder: $@\n"; +try { + $result = $api_instance->placeOrder($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StoreApi->placeOrder: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Tag.md b/samples/client/petstore/php/SwaggerClient-php/docs/Tag.md index fe7f063852d..15ec3e0a91d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Tag.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Tag.md @@ -1,9 +1,4 @@ -# ::Object::Tag - -## Load the model package -```perl -use ::Object::Tag; -``` +# Tag ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/User.md b/samples/client/petstore/php/SwaggerClient-php/docs/User.md index 306021a79d0..ff278fd4889 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/User.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/User.md @@ -1,9 +1,4 @@ -# ::Object::User - -## Load the model package -```perl -use ::Object::User; -``` +# User ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md index 8de0f56fec4..45e49d3e9ab 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md @@ -1,9 +1,4 @@ -# ::UserApi - -## Load the API package -```perl -use ::Object::UserApi; -``` +# Swagger\Client\UserApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -20,25 +15,26 @@ Method | HTTP request | Description # **createUser** -> createUser(body => $body) +> createUser($body) Create user This can only be done by the logged in user. ### Example -```perl -use Data::Dumper; +```php +new(); -my $body = ::Object::\Swagger\Client\Model\User->new(); # [\Swagger\Client\Model\User] Created user object +$api_instance = new Swagger\Client\UserApi(); +$body = new \Swagger\Client\Model\User(); // \Swagger\Client\Model\User | Created user object -eval { - $api->createUser(body => $body); -}; -if ($@) { - warn "Exception when calling UserApi->createUser: $@\n"; +try { + $api_instance->createUser($body); +} catch (Exception $e) { + echo 'Exception when calling UserApi->createUser: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -63,25 +59,26 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **createUsersWithArrayInput** -> createUsersWithArrayInput(body => $body) +> createUsersWithArrayInput($body) Creates list of users with given input array ### Example -```perl -use Data::Dumper; +```php +new(); -my $body = (::Object::\Swagger\Client\Model\User[]->new()); # [\Swagger\Client\Model\User[]] List of user object +$api_instance = new Swagger\Client\UserApi(); +$body = array(new User()); // \Swagger\Client\Model\User[] | List of user object -eval { - $api->createUsersWithArrayInput(body => $body); -}; -if ($@) { - warn "Exception when calling UserApi->createUsersWithArrayInput: $@\n"; +try { + $api_instance->createUsersWithArrayInput($body); +} catch (Exception $e) { + echo 'Exception when calling UserApi->createUsersWithArrayInput: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -106,25 +103,26 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **createUsersWithListInput** -> createUsersWithListInput(body => $body) +> createUsersWithListInput($body) Creates list of users with given input array ### Example -```perl -use Data::Dumper; +```php +new(); -my $body = (::Object::\Swagger\Client\Model\User[]->new()); # [\Swagger\Client\Model\User[]] List of user object +$api_instance = new Swagger\Client\UserApi(); +$body = array(new User()); // \Swagger\Client\Model\User[] | List of user object -eval { - $api->createUsersWithListInput(body => $body); -}; -if ($@) { - warn "Exception when calling UserApi->createUsersWithListInput: $@\n"; +try { + $api_instance->createUsersWithListInput($body); +} catch (Exception $e) { + echo 'Exception when calling UserApi->createUsersWithListInput: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -149,29 +147,30 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **deleteUser** -> deleteUser(username => $username) +> deleteUser($username) Delete user This can only be done by the logged in user. ### Example -```perl -use Data::Dumper; +```php +setUsername('YOUR_USERNAME'); +Swagger\Client::getDefaultConfiguration->setPassword('YOUR_PASSWORD'); -my $api = ::UserApi->new(); -my $username = username_example; # [string] The name that needs to be deleted +$api_instance = new Swagger\Client\UserApi(); +$username = "username_example"; // string | The name that needs to be deleted -eval { - $api->deleteUser(username => $username); -}; -if ($@) { - warn "Exception when calling UserApi->deleteUser: $@\n"; +try { + $api_instance->deleteUser($username); +} catch (Exception $e) { + echo 'Exception when calling UserApi->deleteUser: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -196,26 +195,27 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **getUserByName** -> \Swagger\Client\Model\User getUserByName(username => $username) +> \Swagger\Client\Model\User getUserByName($username) Get user by user name ### Example -```perl -use Data::Dumper; +```php +new(); -my $username = username_example; # [string] The name that needs to be fetched. Use user1 for testing. +$api_instance = new Swagger\Client\UserApi(); +$username = "username_example"; // string | The name that needs to be fetched. Use user1 for testing. -eval { - my $result = $api->getUserByName(username => $username); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling UserApi->getUserByName: $@\n"; +try { + $result = $api_instance->getUserByName($username); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling UserApi->getUserByName: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -240,27 +240,28 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **loginUser** -> string loginUser(username => $username, password => $password) +> string loginUser($username, $password) Logs user into the system ### Example -```perl -use Data::Dumper; +```php +new(); -my $username = username_example; # [string] The user name for login -my $password = password_example; # [string] The password for login in clear text +$api_instance = new Swagger\Client\UserApi(); +$username = "username_example"; // string | The user name for login +$password = "password_example"; // string | The password for login in clear text -eval { - my $result = $api->loginUser(username => $username, password => $password); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling UserApi->loginUser: $@\n"; +try { + $result = $api_instance->loginUser($username, $password); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling UserApi->loginUser: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -293,17 +294,18 @@ Logs out current logged in user session ### Example -```perl -use Data::Dumper; +```php +new(); +$api_instance = new Swagger\Client\UserApi(); -eval { - $api->logoutUser(); -}; -if ($@) { - warn "Exception when calling UserApi->logoutUser: $@\n"; +try { + $api_instance->logoutUser(); +} catch (Exception $e) { + echo 'Exception when calling UserApi->logoutUser: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters @@ -325,26 +327,27 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **updateUser** -> updateUser(username => $username, body => $body) +> updateUser($username, $body) Updated user This can only be done by the logged in user. ### Example -```perl -use Data::Dumper; +```php +new(); -my $username = username_example; # [string] name that need to be deleted -my $body = ::Object::\Swagger\Client\Model\User->new(); # [\Swagger\Client\Model\User] Updated user object +$api_instance = new Swagger\Client\UserApi(); +$username = "username_example"; // string | name that need to be deleted +$body = new \Swagger\Client\Model\User(); // \Swagger\Client\Model\User | Updated user object -eval { - $api->updateUser(username => $username, body => $body); -}; -if ($@) { - warn "Exception when calling UserApi->updateUser: $@\n"; +try { + $api_instance->updateUser($username, $body); +} catch (Exception $e) { + echo 'Exception when calling UserApi->updateUser: ', $e->getMessage(), "\n"; } +?> ``` ### Parameters diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index 3ad09a2cd06..11c13201a3e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -245,7 +245,17 @@ class ObjectSerializer settype($data, 'array'); $deserialized = $data; } elseif ($class === '\DateTime') { - $deserialized = new \DateTime($data); + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + $deserialized = new \DateTime($data); + } else { + $deserialized = null; + } } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { settype($data, $class); $deserialized = $data; From 2eda3b16cfffe3940e0813b854e9cc588de72794 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 16 Mar 2016 16:25:32 +0800 Subject: [PATCH 19/23] fix file example --- .../swagger/codegen/languages/PhpClientCodegen.java | 12 ++++++------ .../petstore/php/SwaggerClient-php/docs/PetApi.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index e0dfe6cfb2a..6e82c3fc8f2 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -516,25 +516,25 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { if (example == null) { example = "56"; } - } else if ("Float".equals(type)) { + } else if ("Float".equalsIgnoreCase(type) || "Double".equalsIgnoreCase(type)) { if (example == null) { example = "3.4"; } - } else if ("BOOLEAN".equals(type)) { + } else if ("BOOLEAN".equalsIgnoreCase(type) || "bool".equalsIgnoreCase(type)) { if (example == null) { example = "True"; } - } else if ("File".equals(type)) { + } else if ("\\SplFileObject".equalsIgnoreCase(type)) { if (example == null) { example = "/path/to/file"; } - example = escapeText(example); - } else if ("Date".equals(type)) { + example = "\"" + escapeText(example) + "\""; + } else if ("Date".equalsIgnoreCase(type)) { if (example == null) { example = "2013-10-20"; } example = "new \\DateTime(\"" + escapeText(example) + "\")"; - } else if ("DateTime".equals(type)) { + } else if ("DateTime".equalsIgnoreCase(type)) { if (example == null) { example = "2013-10-20T19:20:30+01:00"; } diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md index db95061a841..3f37b7a4149 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md @@ -528,7 +528,7 @@ Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\PetApi(); $pet_id = 789; // int | ID of pet to update $additional_metadata = "additional_metadata_example"; // string | Additional data to pass to server -$file = new \SplFileObject(); // \SplFileObject | file to upload +$file = "/path/to/file.txt"; // \SplFileObject | file to upload try { $api_instance->uploadFile($pet_id, $additional_metadata, $file); From 38236126744eac9dc29798eb0313c3a58e9a1523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Wed, 16 Mar 2016 11:18:26 +0100 Subject: [PATCH 20/23] Use PHP's DateTime::ATOM for true ISO-8601 support Currently we use PHP's DateTime::ISO8601 for the date-time properties but according to http://php.net/manual/en/class.datetime.php#datetime.constants.iso8601 it is actually not compatible with ISO-8601. Instead we should use DateTime::ATOM. --- .../src/main/resources/php/ObjectSerializer.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache index e14161cd3d3..66fdbbf40c5 100644 --- a/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache @@ -57,7 +57,7 @@ class ObjectSerializer if (is_scalar($data) || null === $data) { $sanitized = $data; } elseif ($data instanceof \DateTime) { - $sanitized = $data->format(\DateTime::ISO8601); + $sanitized = $data->format(\DateTime::ATOM); } elseif (is_array($data)) { foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); @@ -172,7 +172,7 @@ class ObjectSerializer public function toString($value) { if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(\DateTime::ISO8601); + return $value->format(\DateTime::ATOM); } else { return $value; } From 55ef72d47e8937860fe952693dc3bc2c2d4256b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Wed, 16 Mar 2016 13:08:09 +0100 Subject: [PATCH 21/23] Regenerate PHP petstore sample --- .../petstore/php/SwaggerClient-php/README.md | 42 ++--- .../docs/InlineResponse200.md | 6 +- .../php/SwaggerClient-php/docs/PetApi.md | 18 +- .../php/SwaggerClient-php/docs/StoreApi.md | 10 +- .../php/SwaggerClient-php/git_push.sh | 52 ++++++ .../php/SwaggerClient-php/lib/Api/PetApi.php | 30 ++-- .../SwaggerClient-php/lib/Api/StoreApi.php | 8 +- .../lib/Model/InlineResponse200.php | 168 +++++++++--------- .../lib/ObjectSerializer.php | 6 +- 9 files changed, 196 insertions(+), 144 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/git_push.sh diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 4a0f064aada..1eb590fe4a2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -89,10 +89,25 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## test_api_key_header +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + +## test_api_client_id - **Type**: API key -- **API key parameter name**: test_api_key_header +- **API key parameter name**: x-test_api_client_id +- **Location**: HTTP header + +## test_api_client_secret + +- **Type**: API key +- **API key parameter name**: x-test_api_client_secret - **Location**: HTTP header ## api_key @@ -105,32 +120,17 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - -## test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - ## test_api_key_query - **Type**: API key - **API key parameter name**: test_api_key_query - **Location**: URL query string -## petstore_auth +## test_api_key_header -- **Type**: OAuth -- **Flow**: implicit -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets +- **Type**: API key +- **API key parameter name**: test_api_key_header +- **Location**: HTTP header ## Author diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md index 1c0b9237453..f24bffc16fa 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md @@ -3,12 +3,12 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional] +**photo_urls** | **string[]** | | [optional] +**name** | **string** | | [optional] **id** | **int** | | **category** | **object** | | [optional] +**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional] **status** | **string** | pet status in the store | [optional] -**name** | **string** | | [optional] -**photo_urls** | **string[]** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md index 3f37b7a4149..ab24be1f152 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md @@ -268,12 +268,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond setAccessToken('YOUR_ACCESS_TOKEN'); // Configure API key authorization: api_key Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); -// Configure OAuth2 access token for authorization: petstore_auth -Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\PetApi(); $pet_id = 789; // int | ID of pet that needs to be fetched @@ -299,7 +299,7 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) ### HTTP reuqest headers @@ -320,12 +320,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond setAccessToken('YOUR_ACCESS_TOKEN'); // Configure API key authorization: api_key Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); -// Configure OAuth2 access token for authorization: petstore_auth -Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\PetApi(); $pet_id = 789; // int | ID of pet that needs to be fetched @@ -351,7 +351,7 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) ### HTTP reuqest headers @@ -372,12 +372,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond setAccessToken('YOUR_ACCESS_TOKEN'); // Configure API key authorization: api_key Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); -// Configure OAuth2 access token for authorization: petstore_auth -Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\PetApi(); $pet_id = 789; // int | ID of pet that needs to be fetched @@ -403,7 +403,7 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) ### HTTP reuqest headers diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md index cc4a5600f04..a33154ee754 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md @@ -214,14 +214,14 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge setApiKey('test_api_key_header', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_header', 'BEARER'); // Configure API key authorization: test_api_key_query Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_query', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_query', 'BEARER'); +// Configure API key authorization: test_api_key_header +Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_header', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_header', 'BEARER'); $api_instance = new Swagger\Client\StoreApi(); $order_id = "order_id_example"; // string | ID of pet that needs to be fetched @@ -247,7 +247,7 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) +[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header) ### HTTP reuqest headers diff --git a/samples/client/petstore/php/SwaggerClient-php/git_push.sh b/samples/client/petstore/php/SwaggerClient-php/git_push.sh new file mode 100644 index 00000000000..1a36388db02 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="YOUR_GIT_USR_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="YOUR_GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + 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 b3bf40d11e0..9dd27601909 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -618,6 +618,11 @@ class PetApi $httpBody = $formParams; // for HTTP post (form) } + // this endpoint requires OAuth (access token) + if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { + $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); + } + // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); if (strlen($apiKey) !== 0) { @@ -625,11 +630,6 @@ class PetApi } - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( @@ -725,6 +725,11 @@ class PetApi $httpBody = $formParams; // for HTTP post (form) } + // this endpoint requires OAuth (access token) + if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { + $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); + } + // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); if (strlen($apiKey) !== 0) { @@ -732,11 +737,6 @@ class PetApi } - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( @@ -832,6 +832,11 @@ class PetApi $httpBody = $formParams; // for HTTP post (form) } + // this endpoint requires OAuth (access token) + if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { + $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); + } + // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); if (strlen($apiKey) !== 0) { @@ -839,11 +844,6 @@ class PetApi } - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( 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 91dc0cde444..df8d1a4961f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -525,16 +525,16 @@ class StoreApi } // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header'); + $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query'); if (strlen($apiKey) !== 0) { - $headerParams['test_api_key_header'] = $apiKey; + $queryParams['test_api_key_query'] = $apiKey; } // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query'); + $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header'); if (strlen($apiKey) !== 0) { - $queryParams['test_api_key_query'] = $apiKey; + $headerParams['test_api_key_header'] = $apiKey; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php index 321f400d0f4..87b9854efb7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -51,12 +51,12 @@ class InlineResponse200 implements ArrayAccess * @var string[] */ static $swaggerTypes = array( - 'tags' => '\Swagger\Client\Model\Tag[]', + 'photo_urls' => 'string[]', + 'name' => 'string', 'id' => 'int', 'category' => 'object', - 'status' => 'string', - 'name' => 'string', - 'photo_urls' => 'string[]' + 'tags' => '\Swagger\Client\Model\Tag[]', + 'status' => 'string' ); /** @@ -64,12 +64,12 @@ class InlineResponse200 implements ArrayAccess * @var string[] */ static $attributeMap = array( - 'tags' => 'tags', + 'photo_urls' => 'photoUrls', + 'name' => 'name', 'id' => 'id', 'category' => 'category', - 'status' => 'status', - 'name' => 'name', - 'photo_urls' => 'photoUrls' + 'tags' => 'tags', + 'status' => 'status' ); /** @@ -77,12 +77,12 @@ class InlineResponse200 implements ArrayAccess * @var string[] */ static $setters = array( - 'tags' => 'setTags', + 'photo_urls' => 'setPhotoUrls', + 'name' => 'setName', 'id' => 'setId', 'category' => 'setCategory', - 'status' => 'setStatus', - 'name' => 'setName', - 'photo_urls' => 'setPhotoUrls' + 'tags' => 'setTags', + 'status' => 'setStatus' ); /** @@ -90,20 +90,26 @@ class InlineResponse200 implements ArrayAccess * @var string[] */ static $getters = array( - 'tags' => 'getTags', + 'photo_urls' => 'getPhotoUrls', + 'name' => 'getName', 'id' => 'getId', 'category' => 'getCategory', - 'status' => 'getStatus', - 'name' => 'getName', - 'photo_urls' => 'getPhotoUrls' + 'tags' => 'getTags', + 'status' => 'getStatus' ); /** - * $tags - * @var \Swagger\Client\Model\Tag[] + * $photo_urls + * @var string[] */ - protected $tags; + protected $photo_urls; + + /** + * $name + * @var string + */ + protected $name; /** * $id @@ -117,24 +123,18 @@ class InlineResponse200 implements ArrayAccess */ protected $category; + /** + * $tags + * @var \Swagger\Client\Model\Tag[] + */ + protected $tags; + /** * $status pet status in the store * @var string */ protected $status; - /** - * $name - * @var string - */ - protected $name; - - /** - * $photo_urls - * @var string[] - */ - protected $photo_urls; - /** * Constructor @@ -143,33 +143,54 @@ class InlineResponse200 implements ArrayAccess public function __construct(array $data = null) { if ($data != null) { - $this->tags = $data["tags"]; + $this->photo_urls = $data["photo_urls"]; + $this->name = $data["name"]; $this->id = $data["id"]; $this->category = $data["category"]; + $this->tags = $data["tags"]; $this->status = $data["status"]; - $this->name = $data["name"]; - $this->photo_urls = $data["photo_urls"]; } } /** - * Gets tags - * @return \Swagger\Client\Model\Tag[] + * Gets photo_urls + * @return string[] */ - public function getTags() + public function getPhotoUrls() { - return $this->tags; + return $this->photo_urls; } /** - * Sets tags - * @param \Swagger\Client\Model\Tag[] $tags + * Sets photo_urls + * @param string[] $photo_urls * @return $this */ - public function setTags($tags) + public function setPhotoUrls($photo_urls) { - $this->tags = $tags; + $this->photo_urls = $photo_urls; + return $this; + } + + /** + * Gets name + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Sets name + * @param string $name + * @return $this + */ + public function setName($name) + { + + $this->name = $name; return $this; } @@ -215,6 +236,27 @@ class InlineResponse200 implements ArrayAccess return $this; } + /** + * Gets tags + * @return \Swagger\Client\Model\Tag[] + */ + public function getTags() + { + return $this->tags; + } + + /** + * Sets tags + * @param \Swagger\Client\Model\Tag[] $tags + * @return $this + */ + public function setTags($tags) + { + + $this->tags = $tags; + return $this; + } + /** * Gets status * @return string @@ -239,48 +281,6 @@ class InlineResponse200 implements ArrayAccess return $this; } - /** - * Gets name - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Sets name - * @param string $name - * @return $this - */ - public function setName($name) - { - - $this->name = $name; - return $this; - } - - /** - * Gets photo_urls - * @return string[] - */ - public function getPhotoUrls() - { - return $this->photo_urls; - } - - /** - * Sets photo_urls - * @param string[] $photo_urls - * @return $this - */ - public function setPhotoUrls($photo_urls) - { - - $this->photo_urls = $photo_urls; - return $this; - } - /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index 11c13201a3e..c52735a3e77 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -57,7 +57,7 @@ class ObjectSerializer if (is_scalar($data) || null === $data) { $sanitized = $data; } elseif ($data instanceof \DateTime) { - $sanitized = $data->format(\DateTime::ISO8601); + $sanitized = $data->format(\DateTime::ATOM); } elseif (is_array($data)) { foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); @@ -172,7 +172,7 @@ class ObjectSerializer public function toString($value) { if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(\DateTime::ISO8601); + return $value->format(\DateTime::ATOM); } else { return $value; } @@ -256,7 +256,7 @@ class ObjectSerializer } else { $deserialized = null; } - } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { + } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { settype($data, $class); $deserialized = $data; } elseif ($class === '\SplFileObject') { From 4b5a0a4872a4c4590cc6090c1d7d799557225ca3 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 16 Mar 2016 23:10:59 +0800 Subject: [PATCH 22/23] beter handling of model name starting with number --- .../codegen/languages/PhpClientCodegen.java | 6 + .../src/test/resources/2_0/petstore.json | 14 +- .../petstore/php/SwaggerClient-php/README.md | 43 ++--- .../docs/InlineResponse200.md | 6 +- .../php/SwaggerClient-php/docs/PetApi.md | 18 +- .../php/SwaggerClient-php/docs/StoreApi.md | 10 +- .../php/SwaggerClient-php/lib/Api/PetApi.php | 30 +-- .../SwaggerClient-php/lib/Api/StoreApi.php | 8 +- .../lib/Model/InlineResponse200.php | 168 ++++++++--------- .../lib/Model/Model200Response.php | 174 ++++++++++++++++++ .../lib/ObjectSerializer.php | 2 +- 11 files changed, 336 insertions(+), 143 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index 6e82c3fc8f2..7716e842f42 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -407,6 +407,12 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { name = "model_" + name; // e.g. return => ModelReturn (after camelize) } + // model name starts with number + if (name.matches("^\\d.*")) { + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) + } + // add prefix and/or suffic only if name does not start wth \ (e.g. \DateTime) if (!name.matches("^\\\\.*")) { name = modelNamePrefix + name + modelNameSuffix; diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.json b/modules/swagger-codegen/src/test/resources/2_0/petstore.json index 284fef7eb1d..5053fdaa8e3 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -1313,7 +1313,19 @@ } }, "Name": { - "descripton": "Model for testing reserved words", + "descripton": "Model for testing model name same as property name", + "properties": { + "name": { + "type": "integer", + "format": "int32" + } + }, + "xml": { + "name": "Name" + } + }, + "200_response": { + "descripton": "Model for testing model name starting with number", "properties": { "name": { "type": "integer", diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 1eb590fe4a2..ad2d507949f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -77,6 +77,7 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [InlineResponse200](docs/InlineResponse200.md) + - [Model200Response](docs/Model200Response.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) - [Order](docs/Order.md) @@ -89,25 +90,10 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - -## test_api_client_id +## test_api_key_header - **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -## test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret +- **API key parameter name**: test_api_key_header - **Location**: HTTP header ## api_key @@ -120,17 +106,32 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication +## test_api_client_secret + +- **Type**: API key +- **API key parameter name**: x-test_api_client_secret +- **Location**: HTTP header + +## test_api_client_id + +- **Type**: API key +- **API key parameter name**: x-test_api_client_id +- **Location**: HTTP header + ## test_api_key_query - **Type**: API key - **API key parameter name**: test_api_key_query - **Location**: URL query string -## test_api_key_header +## petstore_auth -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header +- **Type**: OAuth +- **Flow**: implicit +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets ## Author diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md index f24bffc16fa..1c0b9237453 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md @@ -3,12 +3,12 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**photo_urls** | **string[]** | | [optional] -**name** | **string** | | [optional] +**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional] **id** | **int** | | **category** | **object** | | [optional] -**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional] **status** | **string** | pet status in the store | [optional] +**name** | **string** | | [optional] +**photo_urls** | **string[]** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md index ab24be1f152..3f37b7a4149 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md @@ -268,12 +268,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond setAccessToken('YOUR_ACCESS_TOKEN'); // Configure API key authorization: api_key Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\PetApi(); $pet_id = 789; // int | ID of pet that needs to be fetched @@ -299,7 +299,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) ### HTTP reuqest headers @@ -320,12 +320,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond setAccessToken('YOUR_ACCESS_TOKEN'); // Configure API key authorization: api_key Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\PetApi(); $pet_id = 789; // int | ID of pet that needs to be fetched @@ -351,7 +351,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) ### HTTP reuqest headers @@ -372,12 +372,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond setAccessToken('YOUR_ACCESS_TOKEN'); // Configure API key authorization: api_key Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\PetApi(); $pet_id = 789; // int | ID of pet that needs to be fetched @@ -403,7 +403,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) ### HTTP reuqest headers diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md index a33154ee754..cc4a5600f04 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md @@ -214,14 +214,14 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge setApiKey('test_api_key_query', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_query', 'BEARER'); // Configure API key authorization: test_api_key_header Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_header', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_header', 'BEARER'); +// Configure API key authorization: test_api_key_query +Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_query', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_query', 'BEARER'); $api_instance = new Swagger\Client\StoreApi(); $order_id = "order_id_example"; // string | ID of pet that needs to be fetched @@ -247,7 +247,7 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header) +[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) ### HTTP reuqest headers 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 9dd27601909..b3bf40d11e0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -618,11 +618,6 @@ class PetApi $httpBody = $formParams; // for HTTP post (form) } - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); if (strlen($apiKey) !== 0) { @@ -630,6 +625,11 @@ class PetApi } + // this endpoint requires OAuth (access token) + if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { + $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); + } + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( @@ -725,11 +725,6 @@ class PetApi $httpBody = $formParams; // for HTTP post (form) } - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); if (strlen($apiKey) !== 0) { @@ -737,6 +732,11 @@ class PetApi } + // this endpoint requires OAuth (access token) + if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { + $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); + } + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( @@ -832,11 +832,6 @@ class PetApi $httpBody = $formParams; // for HTTP post (form) } - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); if (strlen($apiKey) !== 0) { @@ -844,6 +839,11 @@ class PetApi } + // this endpoint requires OAuth (access token) + if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { + $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); + } + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( 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 df8d1a4961f..91dc0cde444 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -525,16 +525,16 @@ class StoreApi } // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query'); + $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header'); if (strlen($apiKey) !== 0) { - $queryParams['test_api_key_query'] = $apiKey; + $headerParams['test_api_key_header'] = $apiKey; } // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header'); + $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query'); if (strlen($apiKey) !== 0) { - $headerParams['test_api_key_header'] = $apiKey; + $queryParams['test_api_key_query'] = $apiKey; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php index 87b9854efb7..321f400d0f4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -51,12 +51,12 @@ class InlineResponse200 implements ArrayAccess * @var string[] */ static $swaggerTypes = array( - 'photo_urls' => 'string[]', - 'name' => 'string', + 'tags' => '\Swagger\Client\Model\Tag[]', 'id' => 'int', 'category' => 'object', - 'tags' => '\Swagger\Client\Model\Tag[]', - 'status' => 'string' + 'status' => 'string', + 'name' => 'string', + 'photo_urls' => 'string[]' ); /** @@ -64,12 +64,12 @@ class InlineResponse200 implements ArrayAccess * @var string[] */ static $attributeMap = array( - 'photo_urls' => 'photoUrls', - 'name' => 'name', + 'tags' => 'tags', 'id' => 'id', 'category' => 'category', - 'tags' => 'tags', - 'status' => 'status' + 'status' => 'status', + 'name' => 'name', + 'photo_urls' => 'photoUrls' ); /** @@ -77,12 +77,12 @@ class InlineResponse200 implements ArrayAccess * @var string[] */ static $setters = array( - 'photo_urls' => 'setPhotoUrls', - 'name' => 'setName', + 'tags' => 'setTags', 'id' => 'setId', 'category' => 'setCategory', - 'tags' => 'setTags', - 'status' => 'setStatus' + 'status' => 'setStatus', + 'name' => 'setName', + 'photo_urls' => 'setPhotoUrls' ); /** @@ -90,26 +90,20 @@ class InlineResponse200 implements ArrayAccess * @var string[] */ static $getters = array( - 'photo_urls' => 'getPhotoUrls', - 'name' => 'getName', + 'tags' => 'getTags', 'id' => 'getId', 'category' => 'getCategory', - 'tags' => 'getTags', - 'status' => 'getStatus' + 'status' => 'getStatus', + 'name' => 'getName', + 'photo_urls' => 'getPhotoUrls' ); /** - * $photo_urls - * @var string[] + * $tags + * @var \Swagger\Client\Model\Tag[] */ - protected $photo_urls; - - /** - * $name - * @var string - */ - protected $name; + protected $tags; /** * $id @@ -123,18 +117,24 @@ class InlineResponse200 implements ArrayAccess */ protected $category; - /** - * $tags - * @var \Swagger\Client\Model\Tag[] - */ - protected $tags; - /** * $status pet status in the store * @var string */ protected $status; + /** + * $name + * @var string + */ + protected $name; + + /** + * $photo_urls + * @var string[] + */ + protected $photo_urls; + /** * Constructor @@ -143,54 +143,33 @@ class InlineResponse200 implements ArrayAccess public function __construct(array $data = null) { if ($data != null) { - $this->photo_urls = $data["photo_urls"]; - $this->name = $data["name"]; + $this->tags = $data["tags"]; $this->id = $data["id"]; $this->category = $data["category"]; - $this->tags = $data["tags"]; $this->status = $data["status"]; + $this->name = $data["name"]; + $this->photo_urls = $data["photo_urls"]; } } /** - * Gets photo_urls - * @return string[] + * Gets tags + * @return \Swagger\Client\Model\Tag[] */ - public function getPhotoUrls() + public function getTags() { - return $this->photo_urls; + return $this->tags; } /** - * Sets photo_urls - * @param string[] $photo_urls + * Sets tags + * @param \Swagger\Client\Model\Tag[] $tags * @return $this */ - public function setPhotoUrls($photo_urls) + public function setTags($tags) { - $this->photo_urls = $photo_urls; - return $this; - } - - /** - * Gets name - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Sets name - * @param string $name - * @return $this - */ - public function setName($name) - { - - $this->name = $name; + $this->tags = $tags; return $this; } @@ -236,27 +215,6 @@ class InlineResponse200 implements ArrayAccess return $this; } - /** - * Gets tags - * @return \Swagger\Client\Model\Tag[] - */ - public function getTags() - { - return $this->tags; - } - - /** - * Sets tags - * @param \Swagger\Client\Model\Tag[] $tags - * @return $this - */ - public function setTags($tags) - { - - $this->tags = $tags; - return $this; - } - /** * Gets status * @return string @@ -281,6 +239,48 @@ class InlineResponse200 implements ArrayAccess return $this; } + /** + * Gets name + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Sets name + * @param string $name + * @return $this + */ + public function setName($name) + { + + $this->name = $name; + return $this; + } + + /** + * Gets photo_urls + * @return string[] + */ + public function getPhotoUrls() + { + return $this->photo_urls; + } + + /** + * Sets photo_urls + * @param string[] $photo_urls + * @return $this + */ + public function setPhotoUrls($photo_urls) + { + + $this->photo_urls = $photo_urls; + return $this; + } + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php new file mode 100644 index 00000000000..d4c1c9a69e2 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -0,0 +1,174 @@ + 'int' + ); + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + static $attributeMap = array( + 'name' => 'name' + ); + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'name' => 'setName' + ); + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'name' => 'getName' + ); + + + /** + * $name + * @var int + */ + protected $name; + + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + if ($data != null) { + $this->name = $data["name"]; + } + } + + /** + * Gets name + * @return int + */ + public function getName() + { + return $this->name; + } + + /** + * Sets name + * @param int $name + * @return $this + */ + public function setName($name) + { + + $this->name = $name; + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->$offset); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->$offset; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + $this->$offset = $value; + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->$offset); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } else { + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index c52735a3e77..480e0845fa0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -256,7 +256,7 @@ class ObjectSerializer } else { $deserialized = null; } - } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { + } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { settype($data, $class); $deserialized = $data; } elseif ($class === '\SplFileObject') { From 01353f25baa15be7d9111ced538c615fa3aae3cb Mon Sep 17 00:00:00 2001 From: Ole Lensmar Date: Wed, 16 Mar 2016 11:30:33 -0400 Subject: [PATCH 23/23] fixed typename generation for Map> types and added gen folder to maven build in generated pom --- .../languages/JavaInflectorServerCodegen.java | 15 --------------- .../main/resources/JavaInflector/pom.mustache | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java index 78f3653671b..24f7fddc524 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java @@ -83,21 +83,6 @@ public class JavaInflectorServerCodegen extends JavaClientCodegen { (sourceFolder + '/' + invokerPackage).replace(".", "/"), "StringUtil.java")); } - @Override - public String getTypeDeclaration(Property p) { - if (p instanceof ArrayProperty) { - ArrayProperty ap = (ArrayProperty) p; - Property inner = ap.getItems(); - return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">"; - } else if (p instanceof MapProperty) { - MapProperty mp = (MapProperty) p; - Property inner = mp.getAdditionalProperties(); - - return getTypeDeclaration(inner); - } - return super.getTypeDeclaration(p); - } - @Override public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { String basePath = resourcePath; diff --git a/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache index d79fec75123..491d800923d 100644 --- a/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaInflector/pom.mustache @@ -19,6 +19,25 @@ target ${project.artifactId}-${project.version} + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + maven-dependency-plugin