diff --git a/modules/swagger-codegen/src/main/resources/Java/api.mustache b/modules/swagger-codegen/src/main/resources/Java/api.mustache index af10f614e325..0487cd8ef982 100644 --- a/modules/swagger-codegen/src/main/resources/Java/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/api.mustache @@ -42,7 +42,7 @@ public class {{classname}} { /** * {{summary}} * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{/allParams}}{{#returnType}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#returnType}} * @return {{{returnType}}}{{/returnType}} * @throws ApiException if fails to make API call */ diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/api.mustache index cd10de1364db..6c980b727fa5 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/api.mustache @@ -42,7 +42,7 @@ public class {{classname}} { /** * {{summary}} * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{/allParams}}{{#returnType}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#returnType}} * @return {{{returnType}}}{{/returnType}} * @throws ApiException if fails to make API call */ diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache index 70559ac281c8..6c46a9aed9ab 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -106,7 +106,7 @@ public class {{classname}} { /** * {{summary}} * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{/allParams}}{{#returnType}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#returnType}} * @return {{{returnType}}}{{/returnType}} * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -118,7 +118,7 @@ public class {{classname}} { /** * {{summary}} * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{/allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} * @return ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -131,7 +131,7 @@ public class {{classname}} { /** * {{summary}} (asynchronously) * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{/allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} * @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 diff --git a/modules/swagger-codegen/src/main/resources/ruby/api.mustache b/modules/swagger-codegen/src/main/resources/ruby/api.mustache index 522807541d96..45a4faa109a8 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api.mustache @@ -18,7 +18,7 @@ module {{moduleName}} # {{notes}} {{#allParams}}{{#required}} # @param {{paramName}} {{description}} {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters -{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}} +{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} {{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}] def {{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {}) {{#returnType}}data, status_code, headers = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts) diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java index a8ab7a8f853d..50c0e8db6413 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java @@ -41,7 +41,7 @@ import io.swagger.client.auth.HttpBasicAuth; import io.swagger.client.auth.ApiKeyAuth; import io.swagger.client.auth.OAuth; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-18T20:04:40.386+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T15:55:38.841+08:00") public class ApiClient { private Map defaultHeaderMap = new HashMap(); private String basePath = "http://petstore.swagger.io/v2"; @@ -71,7 +71,7 @@ public class ApiClient { dateFormat = ApiClient.buildDefaultDateFormat(); // Set default User-Agent. - setUserAgent("Java-Swagger"); + setUserAgent("Swagger-Codegen/1.0.0/java"); // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); @@ -79,6 +79,7 @@ public class ApiClient { authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("test_http_basic", new HttpBasicAuth()); authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); // Prevent the authentications from being modified. 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 5c99be8393e5..3c20bd021787 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-17T10:45:51.189+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00") public class PetApi { private ApiClient apiClient; @@ -40,7 +40,7 @@ public class PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @throws ApiException if fails to make API call */ public void addPet(Pet body) throws ApiException { @@ -80,7 +80,7 @@ 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 + * @param body Pet object in the form of byte array (optional) * @throws ApiException if fails to make API call */ public void addPetUsingByteArray(byte[] body) throws ApiException { @@ -120,8 +120,8 @@ public class PetApi { /** * Deletes a pet * - * @param petId Pet id to delete - * @param apiKey + * @param petId Pet id to delete (required) + * @param apiKey (optional) * @throws ApiException if fails to make API call */ public void deletePet(Long petId, String apiKey) throws ApiException { @@ -169,7 +169,7 @@ public class PetApi { /** * Finds Pets by status * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query + * @param status Status values that need to be considered for query (optional, default to available) * @return List * @throws ApiException if fails to make API call */ @@ -213,7 +213,7 @@ public class PetApi { /** * Finds Pets by tags * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by + * @param tags Tags to filter by (optional) * @return List * @throws ApiException if fails to make API call */ @@ -257,7 +257,7 @@ public class PetApi { /** * 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 + * @param petId ID of pet that needs to be fetched (required) * @return Pet * @throws ApiException if fails to make API call */ @@ -294,7 +294,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; GenericType localVarReturnType = new GenericType() {}; @@ -305,7 +305,7 @@ 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 + * @param petId ID of pet that needs to be fetched (required) * @return InlineResponse200 * @throws ApiException if fails to make API call */ @@ -342,7 +342,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; GenericType localVarReturnType = new GenericType() {}; @@ -353,7 +353,7 @@ 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 + * @param petId ID of pet that needs to be fetched (required) * @return byte[] * @throws ApiException if fails to make API call */ @@ -390,7 +390,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; GenericType localVarReturnType = new GenericType() {}; @@ -401,7 +401,7 @@ public class PetApi { /** * Update an existing pet * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @throws ApiException if fails to make API call */ public void updatePet(Pet body) throws ApiException { @@ -441,9 +441,9 @@ public class 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 + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public void updatePetWithForm(String petId, String name, String status) throws ApiException { @@ -493,9 +493,9 @@ public class PetApi { /** * uploads an image * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @throws ApiException if fails to make API call */ public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { 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 d1d411b90e19..22eee4712b0f 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-17T10:45:51.189+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00") public class StoreApi { private ApiClient apiClient; @@ -38,7 +38,7 @@ 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 + * @param orderId ID of the order that needs to be deleted (required) * @throws ApiException if fails to make API call */ public void deleteOrder(String orderId) throws ApiException { @@ -84,7 +84,7 @@ public class StoreApi { /** * Finds orders by status * A single status value can be provided as a string - * @param status Status value that needs to be considered for query + * @param status Status value that needs to be considered for query (optional, default to placed) * @return List * @throws ApiException if fails to make API call */ @@ -210,7 +210,7 @@ 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 + * @param orderId ID of pet that needs to be fetched (required) * @return Order * @throws ApiException if fails to make API call */ @@ -247,7 +247,7 @@ public class StoreApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" }; + String[] localVarAuthNames = new String[] { "test_api_key_query", "test_api_key_header" }; GenericType localVarReturnType = new GenericType() {}; @@ -258,7 +258,7 @@ public class StoreApi { /** * Place an order for a pet * - * @param body order placed for purchasing the pet + * @param body order placed for purchasing the pet (optional) * @return Order * @throws ApiException if fails to make API call */ 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 74a0f333ad36..988ea22da18f 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-17T10:45:51.189+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00") public class UserApi { private ApiClient apiClient; @@ -38,7 +38,7 @@ public class UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object + * @param body Created user object (optional) * @throws ApiException if fails to make API call */ public void createUser(User body) throws ApiException { @@ -78,7 +78,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object + * @param body List of user object (optional) * @throws ApiException if fails to make API call */ public void createUsersWithArrayInput(List body) throws ApiException { @@ -118,7 +118,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object + * @param body List of user object (optional) * @throws ApiException if fails to make API call */ public void createUsersWithListInput(List body) throws ApiException { @@ -158,7 +158,7 @@ public class UserApi { /** * Delete user * This can only be done by the logged in user. - * @param username The name that needs to be deleted + * @param username The name that needs to be deleted (required) * @throws ApiException if fails to make API call */ public void deleteUser(String username) throws ApiException { @@ -204,7 +204,7 @@ public class UserApi { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException if fails to make API call */ @@ -252,8 +252,8 @@ public class UserApi { /** * Logs user into the system * - * @param username The user name for login - * @param password The password for login in clear text + * @param username The user name for login (optional) + * @param password The password for login in clear text (optional) * @return String * @throws ApiException if fails to make API call */ @@ -338,8 +338,8 @@ public class UserApi { /** * Updated user * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object + * @param username name that need to be deleted (required) + * @param body Updated user object (optional) * @throws ApiException if fails to make API call */ public void updateUser(String username, User body) throws ApiException { diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/client/ApiClientTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/client/ApiClientTest.java index 9fa51a06baa0..47f004c283bf 100644 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/client/ApiClientTest.java +++ b/samples/client/petstore/java/default/src/test/java/io/swagger/client/ApiClientTest.java @@ -112,21 +112,25 @@ public class ApiClientTest { } @Test - public void testSetUsername() { - try { - apiClient.setUsername("my-username"); - fail("there should be no HTTP basic authentications"); - } catch (RuntimeException e) { + public void testSetUsernameAndPassword() { + HttpBasicAuth auth = null; + for (Authentication _auth : apiClient.getAuthentications().values()) { + if (_auth instanceof HttpBasicAuth) { + auth = (HttpBasicAuth) _auth; + break; + } } - } + auth.setUsername(null); + auth.setPassword(null); - @Test - public void testSetPassword() { - try { - apiClient.setPassword("my-password"); - fail("there should be no HTTP basic authentications"); - } catch (RuntimeException e) { - } + apiClient.setUsername("my-username"); + apiClient.setPassword("my-password"); + assertEquals("my-username", auth.getUsername()); + assertEquals("my-password", auth.getPassword()); + + // reset values + auth.setUsername(null); + auth.setPassword(null); } @Test diff --git a/samples/client/petstore/java/jersey2/.gitignore b/samples/client/petstore/java/jersey2/.gitignore new file mode 100644 index 000000000000..32858aad3c38 --- /dev/null +++ b/samples/client/petstore/java/jersey2/.gitignore @@ -0,0 +1,12 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/samples/client/petstore/java/jersey2/git_push.sh b/samples/client/petstore/java/jersey2/git_push.sh new file mode 100644 index 000000000000..1a36388db023 --- /dev/null +++ b/samples/client/petstore/java/jersey2/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/java/jersey2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java index 77bcbef413cf..bc43cfe670e6 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java @@ -48,7 +48,7 @@ import io.swagger.client.auth.HttpBasicAuth; import io.swagger.client.auth.ApiKeyAuth; import io.swagger.client.auth.OAuth; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T17:22:31.147+08:00") public class ApiClient { private Map defaultHeaderMap = new HashMap(); private String basePath = "http://petstore.swagger.io/v2"; @@ -80,7 +80,7 @@ public class ApiClient { this.json.setDateFormat((DateFormat) dateFormat.clone()); // Set default User-Agent. - setUserAgent("Java-Swagger"); + setUserAgent("Swagger-Codegen/1.0.0/java"); // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); @@ -88,6 +88,7 @@ public class ApiClient { authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("test_http_basic", new HttpBasicAuth()); authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); // Prevent the authentications from being modified. 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 6299c79e19bf..dff33b11fc4a 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 @@ -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-14T22:17:48.808+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:00:50.657+08:00") public class PetApi { private ApiClient apiClient; @@ -40,7 +40,7 @@ public class PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @throws ApiException if fails to make API call */ public void addPet(Pet body) throws ApiException { @@ -80,7 +80,7 @@ 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 + * @param body Pet object in the form of byte array (optional) * @throws ApiException if fails to make API call */ public void addPetUsingByteArray(byte[] body) throws ApiException { @@ -120,8 +120,8 @@ public class PetApi { /** * Deletes a pet * - * @param petId Pet id to delete - * @param apiKey + * @param petId Pet id to delete (required) + * @param apiKey (optional) * @throws ApiException if fails to make API call */ public void deletePet(Long petId, String apiKey) throws ApiException { @@ -169,7 +169,7 @@ public class PetApi { /** * Finds Pets by status * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query + * @param status Status values that need to be considered for query (optional, default to available) * @return List * @throws ApiException if fails to make API call */ @@ -213,7 +213,7 @@ public class PetApi { /** * Finds Pets by tags * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by + * @param tags Tags to filter by (optional) * @return List * @throws ApiException if fails to make API call */ @@ -257,7 +257,7 @@ public class PetApi { /** * 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 + * @param petId ID of pet that needs to be fetched (required) * @return Pet * @throws ApiException if fails to make API call */ @@ -294,7 +294,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; GenericType localVarReturnType = new GenericType() {}; @@ -305,7 +305,7 @@ 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 + * @param petId ID of pet that needs to be fetched (required) * @return InlineResponse200 * @throws ApiException if fails to make API call */ @@ -342,7 +342,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; GenericType localVarReturnType = new GenericType() {}; @@ -353,7 +353,7 @@ 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 + * @param petId ID of pet that needs to be fetched (required) * @return byte[] * @throws ApiException if fails to make API call */ @@ -390,7 +390,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; GenericType localVarReturnType = new GenericType() {}; @@ -401,7 +401,7 @@ public class PetApi { /** * Update an existing pet * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @throws ApiException if fails to make API call */ public void updatePet(Pet body) throws ApiException { @@ -441,9 +441,9 @@ public class 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 + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public void updatePetWithForm(String petId, String name, String status) throws ApiException { @@ -493,9 +493,9 @@ public class PetApi { /** * uploads an image * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @throws ApiException if fails to make API call */ public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { 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 a80e0f4ee639..9b7bf83fea42 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-14T22:17:48.808+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:00:50.657+08:00") public class StoreApi { private ApiClient apiClient; @@ -38,7 +38,7 @@ 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 + * @param orderId ID of the order that needs to be deleted (required) * @throws ApiException if fails to make API call */ public void deleteOrder(String orderId) throws ApiException { @@ -84,7 +84,7 @@ public class StoreApi { /** * Finds orders by status * A single status value can be provided as a string - * @param status Status value that needs to be considered for query + * @param status Status value that needs to be considered for query (optional, default to placed) * @return List * @throws ApiException if fails to make API call */ @@ -210,7 +210,7 @@ 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 + * @param orderId ID of pet that needs to be fetched (required) * @return Order * @throws ApiException if fails to make API call */ @@ -247,7 +247,7 @@ public class StoreApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" }; + String[] localVarAuthNames = new String[] { "test_api_key_query", "test_api_key_header" }; GenericType localVarReturnType = new GenericType() {}; @@ -258,7 +258,7 @@ public class StoreApi { /** * Place an order for a pet * - * @param body order placed for purchasing the pet + * @param body order placed for purchasing the pet (optional) * @return Order * @throws ApiException if fails to make API call */ 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 921fefc5b1e7..473340964888 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-03-14T22:17:48.808+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:00:50.657+08:00") public class UserApi { private ApiClient apiClient; @@ -38,7 +38,7 @@ public class UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object + * @param body Created user object (optional) * @throws ApiException if fails to make API call */ public void createUser(User body) throws ApiException { @@ -78,7 +78,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object + * @param body List of user object (optional) * @throws ApiException if fails to make API call */ public void createUsersWithArrayInput(List body) throws ApiException { @@ -118,7 +118,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object + * @param body List of user object (optional) * @throws ApiException if fails to make API call */ public void createUsersWithListInput(List body) throws ApiException { @@ -158,7 +158,7 @@ public class UserApi { /** * Delete user * This can only be done by the logged in user. - * @param username The name that needs to be deleted + * @param username The name that needs to be deleted (required) * @throws ApiException if fails to make API call */ public void deleteUser(String username) throws ApiException { @@ -204,7 +204,7 @@ public class UserApi { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException if fails to make API call */ @@ -252,8 +252,8 @@ public class UserApi { /** * Logs user into the system * - * @param username The user name for login - * @param password The password for login in clear text + * @param username The user name for login (optional) + * @param password The password for login in clear text (optional) * @return String * @throws ApiException if fails to make API call */ @@ -338,8 +338,8 @@ public class UserApi { /** * Updated user * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object + * @param username name that need to be deleted (required) + * @param body Updated user object (optional) * @throws ApiException if fails to make API call */ public void updateUser(String username, User body) throws ApiException { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java new file mode 100644 index 000000000000..a05d493feb6e --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java @@ -0,0 +1,74 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:00:50.657+08:00") +public class Model200Response { + + private Integer name = null; + + + /** + **/ + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") + public Integer getName() { + return name; + } + public void setName(Integer name) { + this.name = name; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200Response = (Model200Response) o; + return Objects.equals(this.name, _200Response.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java new file mode 100644 index 000000000000..e2e95fd0f771 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java @@ -0,0 +1,74 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:00:50.657+08:00") +public class ModelReturn { + + private Integer _return = null; + + + /** + **/ + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("return") + public Integer getReturn() { + return _return; + } + public void setReturn(Integer _return) { + this._return = _return; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java new file mode 100644 index 000000000000..fc0985915ce0 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java @@ -0,0 +1,74 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:00:50.657+08:00") +public class Name { + + private Integer name = null; + + + /** + **/ + public Name name(Integer name) { + this.name = name; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") + public Integer getName() { + return name; + } + public void setName(Integer name) { + this.name = name; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java new file mode 100644 index 000000000000..0349889b1906 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -0,0 +1,74 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:00:50.657+08:00") +public class SpecialModelName { + + private Long specialPropertyName = null; + + + /** + **/ + public SpecialModelName specialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("$special[property.name]") + public Long getSpecialPropertyName() { + return specialPropertyName; + } + public void setSpecialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.specialPropertyName, specialModelName.specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash(specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/ApiClientTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/ApiClientTest.java index 9fa51a06baa0..47f004c283bf 100644 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/ApiClientTest.java +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/ApiClientTest.java @@ -112,21 +112,25 @@ public class ApiClientTest { } @Test - public void testSetUsername() { - try { - apiClient.setUsername("my-username"); - fail("there should be no HTTP basic authentications"); - } catch (RuntimeException e) { + public void testSetUsernameAndPassword() { + HttpBasicAuth auth = null; + for (Authentication _auth : apiClient.getAuthentications().values()) { + if (_auth instanceof HttpBasicAuth) { + auth = (HttpBasicAuth) _auth; + break; + } } - } + auth.setUsername(null); + auth.setPassword(null); - @Test - public void testSetPassword() { - try { - apiClient.setPassword("my-password"); - fail("there should be no HTTP basic authentications"); - } catch (RuntimeException e) { - } + apiClient.setUsername("my-username"); + apiClient.setPassword("my-password"); + assertEquals("my-username", auth.getUsername()); + assertEquals("my-password", auth.getPassword()); + + // reset values + auth.setUsername(null); + auth.setPassword(null); } @Test diff --git a/samples/client/petstore/java/okhttp-gson/.gitignore b/samples/client/petstore/java/okhttp-gson/.gitignore new file mode 100644 index 000000000000..32858aad3c38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/.gitignore @@ -0,0 +1,12 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/samples/client/petstore/java/okhttp-gson/git_push.sh b/samples/client/petstore/java/okhttp-gson/git_push.sh new file mode 100644 index 000000000000..1a36388db023 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/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/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java index 0f853388744d..ef5ae6fa25d2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java @@ -141,7 +141,7 @@ public class ApiClient { this.lenientDatetimeFormat = true; // Set default User-Agent. - setUserAgent("Java-Swagger"); + setUserAgent("Swagger-Codegen/1.0.0/java"); // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); @@ -149,6 +149,7 @@ public class ApiClient { authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("test_http_basic", new HttpBasicAuth()); authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); // Prevent the authentications from being modified. 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 213970be0037..507f838e3419 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 @@ -92,7 +92,7 @@ public class PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void addPet(Pet body) throws ApiException { @@ -102,7 +102,7 @@ public class PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -114,7 +114,7 @@ public class PetApi { /** * Add a new pet to the store (asynchronously) * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @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 @@ -190,7 +190,7 @@ 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 + * @param body Pet object in the form of byte array (optional) * @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 { @@ -200,7 +200,7 @@ 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 + * @param body Pet object in the form of byte array (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -212,7 +212,7 @@ public class PetApi { /** * 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 body Pet object in the form of byte array (optional) * @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 @@ -296,8 +296,8 @@ public class PetApi { /** * Deletes a pet * - * @param petId Pet id to delete - * @param apiKey + * @param petId Pet id to delete (required) + * @param apiKey (optional) * @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 { @@ -307,8 +307,8 @@ public class PetApi { /** * Deletes a pet * - * @param petId Pet id to delete - * @param apiKey + * @param petId Pet id to delete (required) + * @param apiKey (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -320,8 +320,8 @@ public class PetApi { /** * Deletes a pet (asynchronously) * - * @param petId Pet id to delete - * @param apiKey + * @param petId Pet id to delete (required) + * @param apiKey (optional) * @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 @@ -399,7 +399,7 @@ public class PetApi { /** * Finds Pets by status * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query + * @param status Status values that need to be considered for query (optional, default to available) * @return List * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -411,7 +411,7 @@ public class PetApi { /** * Finds Pets by status * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query + * @param status Status values that need to be considered for query (optional, default to available) * @return ApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -424,7 +424,7 @@ public class PetApi { /** * Finds Pets by status (asynchronously) * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query + * @param status Status values that need to be considered for query (optional, default to available) * @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 @@ -503,7 +503,7 @@ public class PetApi { /** * Finds Pets by tags * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by + * @param tags Tags to filter by (optional) * @return List * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -515,7 +515,7 @@ public class PetApi { /** * Finds Pets by tags * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by + * @param tags Tags to filter by (optional) * @return ApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -528,7 +528,7 @@ public class PetApi { /** * Finds Pets by tags (asynchronously) * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by + * @param tags Tags to filter by (optional) * @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 @@ -604,14 +604,14 @@ public class PetApi { }); } - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * 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 + * @param petId ID of pet that needs to be fetched (required) * @return Pet * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -623,7 +623,7 @@ public class PetApi { /** * 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 + * @param petId ID of pet that needs to be fetched (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -636,7 +636,7 @@ public class PetApi { /** * 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 petId ID of pet that needs to be fetched (required) * @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 @@ -712,14 +712,14 @@ public class PetApi { }); } - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + 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 + * @param petId ID of pet that needs to be fetched (required) * @return InlineResponse200 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -731,7 +731,7 @@ 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 + * @param petId ID of pet that needs to be fetched (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -744,7 +744,7 @@ public class PetApi { /** * 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 petId ID of pet that needs to be fetched (required) * @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 @@ -820,14 +820,14 @@ public class PetApi { }); } - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + 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 + * @param petId ID of pet that needs to be fetched (required) * @return byte[] * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -839,7 +839,7 @@ 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 + * @param petId ID of pet that needs to be fetched (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -852,7 +852,7 @@ public class PetApi { /** * 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 petId ID of pet that needs to be fetched (required) * @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 @@ -929,7 +929,7 @@ public class PetApi { /** * Update an existing pet * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @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 { @@ -939,7 +939,7 @@ public class PetApi { /** * Update an existing pet * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -951,7 +951,7 @@ public class PetApi { /** * Update an existing pet (asynchronously) * - * @param body Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store (optional) * @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 @@ -1037,9 +1037,9 @@ public class 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 + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void updatePetWithForm(String petId, String name, String status) throws ApiException { @@ -1049,9 +1049,9 @@ public class 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 + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1063,9 +1063,9 @@ public class PetApi { /** * Updates a pet in the store with form data (asynchronously) * - * @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 petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @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 @@ -1151,9 +1151,9 @@ public class PetApi { /** * uploads an image * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { @@ -1163,9 +1163,9 @@ public class PetApi { /** * uploads an image * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1177,9 +1177,9 @@ public class PetApi { /** * uploads an image (asynchronously) * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @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 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 7c26c285dd1b..086db3000d82 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 @@ -96,7 +96,7 @@ 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 + * @param orderId ID of the order that needs to be deleted (required) * @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 { @@ -106,7 +106,7 @@ 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 + * @param orderId ID of the order that needs to be deleted (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -118,7 +118,7 @@ public class StoreApi { /** * 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 orderId ID of the order that needs to be deleted (required) * @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 @@ -196,7 +196,7 @@ public class StoreApi { /** * Finds orders by status * A single status value can be provided as a string - * @param status Status value that needs to be considered for query + * @param status Status value that needs to be considered for query (optional, default to placed) * @return List * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -208,7 +208,7 @@ public class StoreApi { /** * Finds orders by status * A single status value can be provided as a string - * @param status Status value that needs to be considered for query + * @param status Status value that needs to be considered for query (optional, default to placed) * @return ApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -221,7 +221,7 @@ public class StoreApi { /** * Finds orders by status (asynchronously) * A single status value can be provided as a string - * @param status Status value that needs to be considered for query + * @param status Status value that needs to be considered for query (optional, default to placed) * @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 @@ -495,14 +495,14 @@ public class StoreApi { }); } - String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" }; + 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 + * @param orderId ID of pet that needs to be fetched (required) * @return Order * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -514,7 +514,7 @@ 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 + * @param orderId ID of pet that needs to be fetched (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -527,7 +527,7 @@ public class StoreApi { /** * 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 orderId ID of pet that needs to be fetched (required) * @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 @@ -604,7 +604,7 @@ public class StoreApi { /** * Place an order for a pet * - * @param body order placed for purchasing the pet + * @param body order placed for purchasing the pet (optional) * @return Order * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -616,7 +616,7 @@ public class StoreApi { /** * Place an order for a pet * - * @param body order placed for purchasing the pet + * @param body order placed for purchasing the pet (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -629,7 +629,7 @@ public class StoreApi { /** * Place an order for a pet (asynchronously) * - * @param body order placed for purchasing the pet + * @param body order placed for purchasing the pet (optional) * @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 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 64059481018d..6da2483722b6 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 @@ -90,7 +90,7 @@ public class UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object + * @param body Created user object (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void createUser(User body) throws ApiException { @@ -100,7 +100,7 @@ public class UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object + * @param body Created user object (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -112,7 +112,7 @@ public class UserApi { /** * Create user (asynchronously) * This can only be done by the logged in user. - * @param body Created user object + * @param body Created user object (optional) * @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 @@ -188,7 +188,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object + * @param body List of user object (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void createUsersWithArrayInput(List body) throws ApiException { @@ -198,7 +198,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object + * @param body List of user object (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -210,7 +210,7 @@ public class UserApi { /** * Creates list of users with given input array (asynchronously) * - * @param body List of user object + * @param body List of user object (optional) * @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 @@ -286,7 +286,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object + * @param body List of user object (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void createUsersWithListInput(List body) throws ApiException { @@ -296,7 +296,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object + * @param body List of user object (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -308,7 +308,7 @@ public class UserApi { /** * Creates list of users with given input array (asynchronously) * - * @param body List of user object + * @param body List of user object (optional) * @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 @@ -390,7 +390,7 @@ public class UserApi { /** * Delete user * This can only be done by the logged in user. - * @param username The name that needs to be deleted + * @param username The name that needs to be deleted (required) * @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 { @@ -400,7 +400,7 @@ public class UserApi { /** * Delete user * This can only be done by the logged in user. - * @param username The name that needs to be deleted + * @param username The name that needs to be deleted (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -412,7 +412,7 @@ public class UserApi { /** * Delete user (asynchronously) * This can only be done by the logged in user. - * @param username The name that needs to be deleted + * @param username The name that needs to be deleted (required) * @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 @@ -494,7 +494,7 @@ public class UserApi { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -506,7 +506,7 @@ public class UserApi { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -519,7 +519,7 @@ public class UserApi { /** * Get user by user name (asynchronously) * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. (required) * @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 @@ -600,8 +600,8 @@ public class UserApi { /** * Logs user into the system * - * @param username The user name for login - * @param password The password for login in clear text + * @param username The user name for login (optional) + * @param password The password for login in clear text (optional) * @return String * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -613,8 +613,8 @@ public class UserApi { /** * Logs user into the system * - * @param username The user name for login - * @param password The password for login in clear text + * @param username The user name for login (optional) + * @param password The password for login in clear text (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -627,8 +627,8 @@ public class UserApi { /** * Logs user into the system (asynchronously) * - * @param username The user name for login - * @param password The password for login in clear text + * @param username The user name for login (optional) + * @param password The password for login in clear text (optional) * @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 @@ -806,8 +806,8 @@ public class UserApi { /** * Updated user * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object + * @param username name that need to be deleted (required) + * @param body Updated user object (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void updateUser(String username, User body) throws ApiException { @@ -817,8 +817,8 @@ public class UserApi { /** * Updated user * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object + * @param username name that need to be deleted (required) + * @param body Updated user object (optional) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -830,8 +830,8 @@ public class UserApi { /** * Updated user (asynchronously) * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object + * @param username name that need to be deleted (required) + * @param body Updated user object (optional) * @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 diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java index e7052e471700..5aa82b234157 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") + public class Category { @SerializedName("id") 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 7c2e9e6544e7..41d02b8a23fd 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 @@ -12,11 +12,14 @@ import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") + public class InlineResponse200 { - @SerializedName("tags") - private List tags = new ArrayList(); + @SerializedName("photoUrls") + private List photoUrls = new ArrayList(); + + @SerializedName("name") + private String name = null; @SerializedName("id") private Long id = null; @@ -24,6 +27,9 @@ public class InlineResponse200 { @SerializedName("category") private Object category = null; + @SerializedName("tags") + private List tags = new ArrayList(); + public enum StatusEnum { @SerializedName("available") @@ -50,22 +56,27 @@ 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 getTags() { - return tags; + public List getPhotoUrls() { + return photoUrls; } - public void setTags(List tags) { - this.tags = tags; + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + + /** + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; } @@ -91,6 +102,17 @@ public enum StatusEnum { } + /** + **/ + @ApiModelProperty(value = "") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + + /** * pet status in the store **/ @@ -103,28 +125,6 @@ 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(this.tags, inlineResponse200.tags) && + return Objects.equals(this.photoUrls, inlineResponse200.photoUrls) && + Objects.equals(this.name, inlineResponse200.name) && Objects.equals(this.id, inlineResponse200.id) && Objects.equals(this.category, inlineResponse200.category) && - Objects.equals(this.status, inlineResponse200.status) && - Objects.equals(this.name, inlineResponse200.name) && - Objects.equals(this.photoUrls, inlineResponse200.photoUrls); + Objects.equals(this.tags, inlineResponse200.tags) && + Objects.equals(this.status, inlineResponse200.status); } @Override public int hashCode() { - return Objects.hash(tags, id, category, status, name, photoUrls); + return Objects.hash(photoUrls, name, id, category, tags, status); } @Override @@ -153,12 +153,12 @@ public enum StatusEnum { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java new file mode 100644 index 000000000000..3afae36dbfe0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java @@ -0,0 +1,69 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class Model200Response { + + @SerializedName("name") + private Integer name = null; + + + + /** + **/ + @ApiModelProperty(value = "") + public Integer getName() { + return name; + } + public void setName(Integer name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200Response = (Model200Response) o; + return Objects.equals(this.name, _200Response.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java new file mode 100644 index 000000000000..60da9b8e181f --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java @@ -0,0 +1,69 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class ModelReturn { + + @SerializedName("return") + private Integer _return = null; + + + + /** + **/ + @ApiModelProperty(value = "") + public Integer getReturn() { + return _return; + } + public void setReturn(Integer _return) { + this._return = _return; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java new file mode 100644 index 000000000000..a65b8fda6148 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java @@ -0,0 +1,69 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class Name { + + @SerializedName("name") + private Integer name = null; + + + + /** + **/ + @ApiModelProperty(value = "") + public Integer getName() { + return name; + } + public void setName(Integer name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java index b0e4e246c112..31097ea438dc 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java @@ -10,7 +10,7 @@ import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") + public class Order { @SerializedName("id") diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java index 854b72195f6b..7895e23ba13b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java @@ -13,7 +13,7 @@ import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") + public class Pet { @SerializedName("id") diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java new file mode 100644 index 000000000000..9a0c166186c5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -0,0 +1,69 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class SpecialModelName { + + @SerializedName("$special[property.name]") + private Long specialPropertyName = null; + + + + /** + **/ + @ApiModelProperty(value = "") + public Long getSpecialPropertyName() { + return specialPropertyName; + } + public void setSpecialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.specialPropertyName, specialModelName.specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash(specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java index 4f8217b76783..f5a148ecc36e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") + public class Tag { @SerializedName("id") diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java index bcec1fc0a1cd..9b71b457d152 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") + public class User { @SerializedName("id") diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/ApiClientTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/ApiClientTest.java index 9e6d5f426424..000dbd96bfbc 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/ApiClientTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/ApiClientTest.java @@ -151,21 +151,25 @@ public class ApiClientTest { } @Test - public void testSetUsername() { - try { - apiClient.setUsername("my-username"); - fail("there should be no HTTP basic authentications"); - } catch (RuntimeException e) { + public void testSetUsernameAndPassword() { + HttpBasicAuth auth = null; + for (Authentication _auth : apiClient.getAuthentications().values()) { + if (_auth instanceof HttpBasicAuth) { + auth = (HttpBasicAuth) _auth; + break; + } } - } + auth.setUsername(null); + auth.setPassword(null); - @Test - public void testSetPassword() { - try { - apiClient.setPassword("my-password"); - fail("there should be no HTTP basic authentications"); - } catch (RuntimeException e) { - } + apiClient.setUsername("my-username"); + apiClient.setPassword("my-password"); + assertEquals("my-username", auth.getUsername()); + assertEquals("my-password", auth.getPassword()); + + // reset values + auth.setUsername(null); + auth.setPassword(null); } @Test diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md new file mode 100644 index 000000000000..e181365bd60d --- /dev/null +++ b/samples/client/petstore/javascript-promise/README.md @@ -0,0 +1,161 @@ +# swagger-petstore + +SwaggerPetstore - JavaScript client for swagger-petstore + +Version: 1.0.0 + +Automatically generated by the JavaScript Swagger Codegen project: + +- Build date: 2016-03-17T16:01:50.137+08:00 +- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen + +## Installation + +### Use in [Node.js](https://nodejs.org/) + +The generated client is valid [npm](https://www.npmjs.com/) package, you can publish it as described +in [Publishing npm packages](https://docs.npmjs.com/getting-started/publishing-npm-packages). + +After that, you can install it into your project via: + +```shell +npm install swagger-petstore --save +``` + +You can also host the generated client as a git repository on github, e.g. +https://github.com/YOUR_USERNAME/swagger-petstore + +Then you can install it via: + +```shell +npm install YOUR_USERNAME/swagger-petstore --save +``` + +### Use in browser with [browserify](http://browserify.org/) + +The client also works in browser environment via npm and browserify. After following +the above steps with Node.js and installing browserify with `npm install -g browserify`, +you can do this in your project (assuming *main.js* is your entry file): + +```shell +browserify main.js > bundle.js +``` + +The generated *bundle.js* can now be included in your HTML pages. + +## Getting Started + +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var defaultClient = SwaggerPetstore.ApiClient.default; +defaultClient.timeout = 10 * 1000; +defaultClient.defaultHeaders['Test-Header'] = 'test_value'; + +// Assuming there's a `PetApi` containing a `getPetById` method +// which returns a model object: +var api = new SwaggerPetstore.PetApi(); +api.getPetById(2, function(err, pet, resp) { + console.log('HTTP status code: ' + resp.status); + console.log('Response Content-Type: ' + resp.get('Content-Type')); + if (err) { + console.error(err); + } else { + console.log(pet); + } +}); +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*SwaggerPetstore.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 +*SwaggerPetstore.PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*SwaggerPetstore.PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*SwaggerPetstore.PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*SwaggerPetstore.PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*SwaggerPetstore.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' +*SwaggerPetstore.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' +*SwaggerPetstore.PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*SwaggerPetstore.PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*SwaggerPetstore.PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*SwaggerPetstore.StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*SwaggerPetstore.StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status +*SwaggerPetstore.StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*SwaggerPetstore.StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' +*SwaggerPetstore.StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*SwaggerPetstore.StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*SwaggerPetstore.UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*SwaggerPetstore.UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*SwaggerPetstore.UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*SwaggerPetstore.UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*SwaggerPetstore.UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*SwaggerPetstore.UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*SwaggerPetstore.UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*SwaggerPetstore.UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [SwaggerPetstore.Category](docs/Category.md) + - [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md) + - [SwaggerPetstore.Model200Response](docs/Model200Response.md) + - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) + - [SwaggerPetstore.Name](docs/Name.md) + - [SwaggerPetstore.Order](docs/Order.md) + - [SwaggerPetstore.Pet](docs/Pet.md) + - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) + - [SwaggerPetstore.Tag](docs/Tag.md) + - [SwaggerPetstore.User](docs/User.md) + + +## 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 + +- **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 +- **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_key_query + +- **Type**: API key +- **API key parameter name**: test_api_key_query +- **Location**: URL query string + +### test_api_key_header + +- **Type**: API key +- **API key parameter name**: test_api_key_header +- **Location**: HTTP header + diff --git a/samples/client/petstore/javascript-promise/docs/Category.md b/samples/client/petstore/javascript-promise/docs/Category.md new file mode 100644 index 000000000000..47930eb882ce --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Category.md @@ -0,0 +1,9 @@ +# SwaggerPetstore.Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Integer** | | [optional] +**name** | **String** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/InlineResponse200.md b/samples/client/petstore/javascript-promise/docs/InlineResponse200.md new file mode 100644 index 000000000000..09b88b74e499 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/InlineResponse200.md @@ -0,0 +1,13 @@ +# SwaggerPetstore.InlineResponse200 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**photoUrls** | **[String]** | | [optional] +**name** | **String** | | [optional] +**id** | **Integer** | | +**category** | **Object** | | [optional] +**tags** | [**[Tag]**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/Model200Response.md b/samples/client/petstore/javascript-promise/docs/Model200Response.md new file mode 100644 index 000000000000..cc06fcd2d181 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Model200Response.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/ModelReturn.md b/samples/client/petstore/javascript-promise/docs/ModelReturn.md new file mode 100644 index 000000000000..88412c87197a --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/ModelReturn.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Integer** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/Name.md b/samples/client/petstore/javascript-promise/docs/Name.md new file mode 100644 index 000000000000..114d6dc980ef --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Name.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/Order.md b/samples/client/petstore/javascript-promise/docs/Order.md new file mode 100644 index 000000000000..b34b67d3a56a --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Order.md @@ -0,0 +1,13 @@ +# SwaggerPetstore.Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Integer** | | [optional] +**petId** | **Integer** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | **Date** | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/Pet.md b/samples/client/petstore/javascript-promise/docs/Pet.md new file mode 100644 index 000000000000..f1b049dcadd0 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Pet.md @@ -0,0 +1,13 @@ +# SwaggerPetstore.Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Integer** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **[String]** | | +**tags** | [**[Tag]**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md new file mode 100644 index 000000000000..b152d6ff78d6 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/PetApi.md @@ -0,0 +1,586 @@ +# SwaggerPetstore.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(opts) + +Add a new pet to the store + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var opts = { + 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store +}; +api.addPet(opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + + +# **addPetUsingByteArray** +> addPetUsingByteArray(opts) + +Fake endpoint to test byte array in body parameter for adding a new pet to the store + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var opts = { + 'body': "B" // {String} Pet object in the form of byte array +}; +api.addPetUsingByteArray(opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Pet object in the form of byte array | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + + +# **deletePet** +> deletePet(petId, opts) + +Deletes a pet + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var petId = 789; // {Integer} Pet id to delete + +var opts = { + 'apiKey': "apiKey_example" // {String} +}; +api.deletePet(petId, opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Integer**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **findPetsByStatus** +> [Pet] findPetsByStatus(opts) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var opts = { + 'status': ["available"] // {[String]} Status values that need to be considered for query +}; +api.findPetsByStatus(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**[String]**](String.md)| Status values that need to be considered for query | [optional] [default to available] + +### Return type + +[**[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **findPetsByTags** +> [Pet] findPetsByTags(opts) + +Finds Pets by tags + +Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var opts = { + 'tags': ["tags_example"] // {[String]} Tags to filter by +}; +api.findPetsByTags(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**[String]**](String.md)| Tags to filter by | [optional] + +### Return type + +[**[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +// Configure API key authorization: api_key +var api_key = defaultClient.authentications['api_key']; +api_key.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.apiKeyPrefix['api_key'] = "Token" + +var api = new SwaggerPetstore.PetApi() + +var petId = 789; // {Integer} ID of pet that needs to be fetched + +api.getPetById(petId).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Integer**| ID of pet that needs to be fetched | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getPetByIdInObject** +> InlineResponse200 getPetByIdInObject(petId) + +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 +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +// Configure API key authorization: api_key +var api_key = defaultClient.authentications['api_key']; +api_key.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.apiKeyPrefix['api_key'] = "Token" + +var api = new SwaggerPetstore.PetApi() + +var petId = 789; // {Integer} ID of pet that needs to be fetched + +api.getPetByIdInObject(petId).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Integer**| ID of pet that needs to be fetched | + +### Return type + +[**InlineResponse200**](InlineResponse200.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **petPetIdtestingByteArraytrueGet** +> 'String' petPetIdtestingByteArraytrueGet(petId) + +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 +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +// Configure API key authorization: api_key +var api_key = defaultClient.authentications['api_key']; +api_key.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.apiKeyPrefix['api_key'] = "Token" + +var api = new SwaggerPetstore.PetApi() + +var petId = 789; // {Integer} ID of pet that needs to be fetched + +api.petPetIdtestingByteArraytrueGet(petId).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Integer**| ID of pet that needs to be fetched | + +### Return type + +**'String'** + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **updatePet** +> updatePet(opts) + +Update an existing pet + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var opts = { + 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store +}; +api.updatePet(opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml + + +# **updatePetWithForm** +> updatePetWithForm(petId, opts) + +Updates a pet in the store with form data + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var petId = "petId_example"; // {String} ID of pet that needs to be updated + +var opts = { + 'name': "name_example", // {String} Updated name of the pet + 'status': "status_example" // {String} Updated status of the pet +}; +api.updatePetWithForm(petId, opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **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 + +null (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 + + +# **uploadFile** +> uploadFile(petId, opts) + +uploads an image + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure OAuth2 access token for authorization: petstore_auth +var petstore_auth = defaultClient.authentications['petstore_auth']; +petstore_auth.accessToken = "YOUR ACCESS TOKEN" + +var api = new SwaggerPetstore.PetApi() + +var petId = 789; // {Integer} ID of pet to update + +var opts = { + 'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server + 'file': "/path/to/file.txt" // {File} file to upload +}; +api.uploadFile(petId, opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Integer**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json, application/xml + diff --git a/samples/client/petstore/javascript-promise/docs/SpecialModelName.md b/samples/client/petstore/javascript-promise/docs/SpecialModelName.md new file mode 100644 index 000000000000..03dffa54c3f8 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/SpecialModelName.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**specialPropertyName** | **Integer** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/StoreApi.md b/samples/client/petstore/javascript-promise/docs/StoreApi.md new file mode 100644 index 000000000000..91aa8d669730 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/StoreApi.md @@ -0,0 +1,315 @@ +# SwaggerPetstore.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(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var api = new SwaggerPetstore.StoreApi() + +var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted + +api.deleteOrder(orderId).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **findOrdersByStatus** +> [Order] findOrdersByStatus(opts) + +Finds orders by status + +A single status value can be provided as a string + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure API key authorization: test_api_client_id +var test_api_client_id = defaultClient.authentications['test_api_client_id']; +test_api_client_id.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" + +// Configure API key authorization: test_api_client_secret +var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; +test_api_client_secret.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" + +var api = new SwaggerPetstore.StoreApi() + +var opts = { + 'status': "placed" // {String} Status value that needs to be considered for query +}; +api.findOrdersByStatus(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **String**| Status value that needs to be considered for query | [optional] [default to placed] + +### Return type + +[**[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 + + +# **getInventory** +> {'String': 'Integer'} getInventory + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure API key authorization: api_key +var api_key = defaultClient.authentications['api_key']; +api_key.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.apiKeyPrefix['api_key'] = "Token" + +var api = new SwaggerPetstore.StoreApi() +api.getInventory().then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**{'String': 'Integer'}** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **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 +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure API key authorization: api_key +var api_key = defaultClient.authentications['api_key']; +api_key.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.apiKeyPrefix['api_key'] = "Token" + +var api = new SwaggerPetstore.StoreApi() +api.getInventoryInObject().then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### 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 + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure API key authorization: test_api_key_query +var test_api_key_query = defaultClient.authentications['test_api_key_query']; +test_api_key_query.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token" + +// Configure API key authorization: test_api_key_header +var test_api_key_header = defaultClient.authentications['test_api_key_header']; +test_api_key_header.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//test_api_key_header.apiKeyPrefix['test_api_key_header'] = "Token" + +var api = new SwaggerPetstore.StoreApi() + +var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched + +api.getOrderById(orderId).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **placeOrder** +> Order placeOrder(opts) + +Place an order for a pet + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure API key authorization: test_api_client_id +var test_api_client_id = defaultClient.authentications['test_api_client_id']; +test_api_client_id.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" + +// Configure API key authorization: test_api_client_secret +var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; +test_api_client_secret.apiKey = "YOUR API KEY" +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" + +var api = new SwaggerPetstore.StoreApi() + +var opts = { + 'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet +}; +api.placeOrder(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + +### Return type + +[**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 + diff --git a/samples/client/petstore/javascript-promise/docs/Tag.md b/samples/client/petstore/javascript-promise/docs/Tag.md new file mode 100644 index 000000000000..6c109046fb3e --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/Tag.md @@ -0,0 +1,9 @@ +# SwaggerPetstore.Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Integer** | | [optional] +**name** | **String** | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/User.md b/samples/client/petstore/javascript-promise/docs/User.md new file mode 100644 index 000000000000..071fbb46e473 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/User.md @@ -0,0 +1,15 @@ +# SwaggerPetstore.User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Integer** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **Integer** | User Status | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md new file mode 100644 index 000000000000..1a401b698db4 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -0,0 +1,370 @@ +# SwaggerPetstore.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(opts) + +Create user + +This can only be done by the logged in user. + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var api = new SwaggerPetstore.UserApi() + +var opts = { + 'body': new SwaggerPetstore.User() // {User} Created user object +}; +api.createUser(opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(opts) + +Creates list of users with given input array + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var api = new SwaggerPetstore.UserApi() + +var opts = { + 'body': [new SwaggerPetstore.User()] // {[User]} List of user object +}; +api.createUsersWithArrayInput(opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[User]**](User.md)| List of user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **createUsersWithListInput** +> createUsersWithListInput(opts) + +Creates list of users with given input array + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var api = new SwaggerPetstore.UserApi() + +var opts = { + 'body': [new SwaggerPetstore.User()] // {[User]} List of user object +}; +api.createUsersWithListInput(opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[User]**](User.md)| List of user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); +var defaultClient = SwaggerPetstore.ApiClient.default; + +// Configure HTTP basic authorization: test_http_basic +var test_http_basic = defaultClient.authentications['test_http_basic']; +test_http_basic.username = 'YOUR USERNAME' +test_http_basic.password = 'YOUR PASSWORD' + +var api = new SwaggerPetstore.UserApi() + +var username = "username_example"; // {String} The name that needs to be deleted + +api.deleteUser(username).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +[test_http_basic](../README.md#test_http_basic) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var api = new SwaggerPetstore.UserApi() + +var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing. + +api.getUserByName(username).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **loginUser** +> 'String' loginUser(opts) + +Logs user into the system + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var api = new SwaggerPetstore.UserApi() + +var opts = { + 'username': "username_example", // {String} The user name for login + 'password': "password_example" // {String} The password for login in clear text +}; +api.loginUser(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### 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 + + +# **logoutUser** +> logoutUser + +Logs out current logged in user session + + + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var api = new SwaggerPetstore.UserApi() +api.logoutUser().then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + +# **updateUser** +> updateUser(username, opts) + +Updated user + +This can only be done by the logged in user. + +### Example +```javascript +var SwaggerPetstore = require('swagger-petstore'); + +var api = new SwaggerPetstore.UserApi() + +var username = "username_example"; // {String} name that need to be deleted + +var opts = { + 'body': new SwaggerPetstore.User() // {User} Updated user object +}; +api.updateUser(username, opts).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | [optional] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + diff --git a/samples/client/petstore/javascript-promise/git_push.sh b/samples/client/petstore/javascript-promise/git_push.sh new file mode 100644 index 000000000000..1a36388db023 --- /dev/null +++ b/samples/client/petstore/javascript-promise/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/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index db7bdb4d7b8d..f1cbadb95050 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -26,6 +26,7 @@ 'test_api_client_id': {type: 'apiKey', in: 'header', name: 'x-test_api_client_id'}, 'test_api_client_secret': {type: 'apiKey', in: 'header', name: 'x-test_api_client_secret'}, 'api_key': {type: 'apiKey', in: 'header', name: 'api_key'}, + 'test_http_basic': {type: 'basic'}, 'test_api_key_query': {type: 'apiKey', in: 'query', name: 'test_api_key_query'}, 'test_api_key_header': {type: 'apiKey', in: 'header', name: 'test_api_key_header'} }; diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index c12280e31526..4058a4334416 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -21,38 +21,6 @@ var self = this; - /** - * Update an existing pet - * - * @param {Pet} opts['body'] Pet object that needs to be added to the store - */ - self.updatePet = function(opts) { - opts = opts || {}; - var postBody = opts['body']; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/pet', 'PUT', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - - } - /** * Add a new pet to the store * @@ -85,10 +53,82 @@ } + /** + * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * + * @param {String} opts['body'] Pet object in the form of byte array + */ + self.addPetUsingByteArray = function(opts) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = ['petstore_auth']; + var contentTypes = ['application/json', 'application/xml']; + var accepts = ['application/json', 'application/xml']; + var returnType = null; + + return this.apiClient.callApi( + '/pet?testing_byte_array=true', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + + } + + /** + * Deletes a pet + * + * @param {Integer} petId Pet id to delete + * @param {String} opts['apiKey'] + */ + self.deletePet = function(petId, opts) { + opts = opts || {}; + var postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw "Missing the required parameter 'petId' when calling deletePet"; + } + + + var pathParams = { + 'petId': petId + }; + var queryParams = { + }; + var headerParams = { + 'api_key': opts['apiKey'] + }; + var formParams = { + }; + + var authNames = ['petstore_auth']; + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + var returnType = null; + + return this.apiClient.callApi( + '/pet/{petId}', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + + } + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings - * @param {[String]} opts['status'] Status values that need to be considered for query + * @param {[String]} opts['status'] Status values that need to be considered for query (default to available) * data is of type: [Pet] */ self.findPetsByStatus = function(opts) { @@ -191,130 +231,6 @@ } - /** - * Updates a pet in the store with form data - * - * @param {String} petId ID of pet that needs to be updated - * @param {String} opts['name'] Updated name of the pet - * @param {String} opts['status'] Updated status of the pet - */ - self.updatePetWithForm = function(petId, opts) { - opts = opts || {}; - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw "Missing the required parameter 'petId' when calling updatePetWithForm"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - 'name': opts['name'], - 'status': opts['status'] - }; - - var authNames = ['petstore_auth']; - var contentTypes = ['application/x-www-form-urlencoded']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/pet/{petId}', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - - } - - /** - * Deletes a pet - * - * @param {Integer} petId Pet id to delete - * @param {String} opts['apiKey'] - */ - self.deletePet = function(petId, opts) { - opts = opts || {}; - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw "Missing the required parameter 'petId' when calling deletePet"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - 'api_key': opts['apiKey'] - }; - var formParams = { - }; - - var authNames = ['petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/pet/{petId}', 'DELETE', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - - } - - /** - * uploads an image - * - * @param {Integer} petId ID of pet to update - * @param {String} opts['additionalMetadata'] Additional data to pass to server - * @param {File} opts['file'] file to upload - */ - self.uploadFile = function(petId, opts) { - opts = opts || {}; - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw "Missing the required parameter 'petId' when calling uploadFile"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - 'additionalMetadata': opts['additionalMetadata'], - 'file': opts['file'] - }; - - var authNames = ['petstore_auth']; - var contentTypes = ['multipart/form-data']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/pet/{petId}/uploadImage', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - - } - /** * 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 @@ -392,11 +308,11 @@ } /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store + * Update an existing pet * - * @param {String} opts['body'] Pet object in the form of byte array + * @param {Pet} opts['body'] Pet object that needs to be added to the store */ - self.addPetUsingByteArray = function(opts) { + self.updatePet = function(opts) { opts = opts || {}; var postBody = opts['body']; @@ -416,7 +332,91 @@ var returnType = null; return this.apiClient.callApi( - '/pet?testing_byte_array=true', 'POST', + '/pet', 'PUT', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + + } + + /** + * Updates a pet in the store with form data + * + * @param {String} petId ID of pet that needs to be updated + * @param {String} opts['name'] Updated name of the pet + * @param {String} opts['status'] Updated status of the pet + */ + self.updatePetWithForm = function(petId, opts) { + opts = opts || {}; + var postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw "Missing the required parameter 'petId' when calling updatePetWithForm"; + } + + + var pathParams = { + 'petId': petId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + 'name': opts['name'], + 'status': opts['status'] + }; + + var authNames = ['petstore_auth']; + var contentTypes = ['application/x-www-form-urlencoded']; + var accepts = ['application/json', 'application/xml']; + var returnType = null; + + return this.apiClient.callApi( + '/pet/{petId}', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + + } + + /** + * uploads an image + * + * @param {Integer} petId ID of pet to update + * @param {String} opts['additionalMetadata'] Additional data to pass to server + * @param {File} opts['file'] file to upload + */ + self.uploadFile = function(petId, opts) { + opts = opts || {}; + var postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw "Missing the required parameter 'petId' when calling uploadFile"; + } + + + var pathParams = { + 'petId': petId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + 'additionalMetadata': opts['additionalMetadata'], + 'file': opts['file'] + }; + + var authNames = ['petstore_auth']; + var contentTypes = ['multipart/form-data']; + var accepts = ['application/json', 'application/xml']; + var returnType = null; + + return this.apiClient.callApi( + '/pet/{petId}/uploadImage', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index d695b6508d40..b7b7766c30ff 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -21,10 +21,47 @@ var self = this; + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param {String} orderId ID of the order that needs to be deleted + */ + self.deleteOrder = function(orderId) { + var postBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw "Missing the required parameter 'orderId' when calling deleteOrder"; + } + + + var pathParams = { + 'orderId': orderId + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + var returnType = null; + + return this.apiClient.callApi( + '/store/order/{orderId}', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + + } + /** * Finds orders by status * A single status value can be provided as a string - * @param {String} opts['status'] Status value that needs to be considered for query + * @param {String} opts['status'] Status value that needs to be considered for query (default to placed) * data is of type: [Order] */ self.findOrdersByStatus = function(opts) { @@ -117,39 +154,6 @@ } - /** - * Place an order for a pet - * - * @param {Order} opts['body'] order placed for purchasing the pet - * data is of type: Order - */ - self.placeOrder = function(opts) { - opts = opts || {}; - var postBody = opts['body']; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['test_api_client_id', 'test_api_client_secret']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = Order; - - return this.apiClient.callApi( - '/store/order', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - - } - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -189,21 +193,17 @@ } /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param {String} orderId ID of the order that needs to be deleted + * Place an order for a pet + * + * @param {Order} opts['body'] order placed for purchasing the pet + * data is of type: Order */ - self.deleteOrder = function(orderId) { - var postBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw "Missing the required parameter 'orderId' when calling deleteOrder"; - } + self.placeOrder = function(opts) { + opts = opts || {}; + var postBody = opts['body']; var pathParams = { - 'orderId': orderId }; var queryParams = { }; @@ -212,13 +212,13 @@ var formParams = { }; - var authNames = []; + var authNames = ['test_api_client_id', 'test_api_client_secret']; var contentTypes = []; var accepts = ['application/json', 'application/xml']; - var returnType = null; + var returnType = Order; return this.apiClient.callApi( - '/store/order/{orderId}', 'DELETE', + '/store/order', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index 893ab3e68f1d..397d60a97689 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -117,6 +117,81 @@ } + /** + * Delete user + * This can only be done by the logged in user. + * @param {String} username The name that needs to be deleted + */ + self.deleteUser = function(username) { + var postBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw "Missing the required parameter 'username' when calling deleteUser"; + } + + + var pathParams = { + 'username': username + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = ['test_http_basic']; + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + var returnType = null; + + return this.apiClient.callApi( + '/user/{username}', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + + } + + /** + * Get user by user name + * + * @param {String} username The name that needs to be fetched. Use user1 for testing. + * data is of type: User + */ + self.getUserByName = function(username) { + var postBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw "Missing the required parameter 'username' when calling getUserByName"; + } + + + var pathParams = { + 'username': username + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = ['application/json', 'application/xml']; + var returnType = User; + + return this.apiClient.callApi( + '/user/{username}', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + + } + /** * Logs user into the system * @@ -183,44 +258,6 @@ } - /** - * Get user by user name - * - * @param {String} username The name that needs to be fetched. Use user1 for testing. - * data is of type: User - */ - self.getUserByName = function(username) { - var postBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw "Missing the required parameter 'username' when calling getUserByName"; - } - - - var pathParams = { - 'username': username - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = []; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = User; - - return this.apiClient.callApi( - '/user/{username}', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - - } - /** * Updated user * This can only be done by the logged in user. @@ -260,43 +297,6 @@ } - /** - * Delete user - * This can only be done by the logged in user. - * @param {String} username The name that needs to be deleted - */ - self.deleteUser = function(username) { - var postBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw "Missing the required parameter 'username' when calling deleteUser"; - } - - - var pathParams = { - 'username': username - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = []; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/user/{username}', 'DELETE', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - - } - }; diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index 6c57bd53ded3..dfc123e35843 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -1,26 +1,28 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Order', './model/SpecialModelName', './model/User', './model/Category', './model/ObjectReturn', './model/InlineResponse200', './model/Tag', './model/Pet', './api/UserApi', './api/StoreApi', './api/PetApi'], factory); + define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Order'), require('./model/SpecialModelName'), require('./model/User'), require('./model/Category'), require('./model/ObjectReturn'), require('./model/InlineResponse200'), require('./model/Tag'), require('./model/Pet'), require('./api/UserApi'), require('./api/StoreApi'), require('./api/PetApi')); + module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Order, SpecialModelName, User, Category, ObjectReturn, InlineResponse200, Tag, Pet, UserApi, StoreApi, PetApi) { +}(function(ApiClient, Category, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { 'use strict'; return { ApiClient: ApiClient, - Order: Order, - SpecialModelName: SpecialModelName, - User: User, Category: Category, - ObjectReturn: ObjectReturn, InlineResponse200: InlineResponse200, - Tag: Tag, + Model200Response: Model200Response, + ModelReturn: ModelReturn, + Name: Name, + Order: Order, Pet: Pet, - UserApi: UserApi, + SpecialModelName: SpecialModelName, + Tag: Tag, + User: User, + PetApi: PetApi, StoreApi: StoreApi, - PetApi: PetApi + UserApi: UserApi }; })); diff --git a/samples/client/petstore/javascript-promise/src/model/Model200Response.js b/samples/client/petstore/javascript-promise/src/model/Model200Response.js new file mode 100644 index 000000000000..eab775e7476f --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/Model200Response.js @@ -0,0 +1,59 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Model200Response = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + var Model200Response = function Model200Response() { + + }; + + Model200Response.constructFromObject = function(data) { + if (!data) { + return null; + } + var _this = new Model200Response(); + + if (data['name']) { + _this['name'] = ApiClient.convertToType(data['name'], 'Integer'); + } + + return _this; + } + + + + /** + * @return {Integer} + **/ + Model200Response.prototype.getName = function() { + return this['name']; + } + + /** + * @param {Integer} name + **/ + Model200Response.prototype.setName = function(name) { + this['name'] = name; + } + + + + + + return Model200Response; + + +})); diff --git a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js new file mode 100644 index 000000000000..e93e4de28f67 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js @@ -0,0 +1,59 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.ModelReturn = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + var ModelReturn = function ModelReturn() { + + }; + + ModelReturn.constructFromObject = function(data) { + if (!data) { + return null; + } + var _this = new ModelReturn(); + + if (data['return']) { + _this['return'] = ApiClient.convertToType(data['return'], 'Integer'); + } + + return _this; + } + + + + /** + * @return {Integer} + **/ + ModelReturn.prototype.getReturn = function() { + return this['return']; + } + + /** + * @param {Integer} _return + **/ + ModelReturn.prototype.setReturn = function(_return) { + this['return'] = _return; + } + + + + + + return ModelReturn; + + +})); diff --git a/samples/client/petstore/javascript-promise/src/model/Name.js b/samples/client/petstore/javascript-promise/src/model/Name.js new file mode 100644 index 000000000000..8367c1b1e62e --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/Name.js @@ -0,0 +1,59 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Name = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + var Name = function Name() { + + }; + + Name.constructFromObject = function(data) { + if (!data) { + return null; + } + var _this = new Name(); + + if (data['name']) { + _this['name'] = ApiClient.convertToType(data['name'], 'Integer'); + } + + return _this; + } + + + + /** + * @return {Integer} + **/ + Name.prototype.getName = function() { + return this['name']; + } + + /** + * @param {Integer} name + **/ + Name.prototype.setName = function(name) { + this['name'] = name; + } + + + + + + return Name; + + +})); diff --git a/samples/client/petstore/javascript-promise/test/ApiClientTest.js b/samples/client/petstore/javascript-promise/test/ApiClientTest.js index fd3f63bb7afa..8eebe6bf7dcf 100644 --- a/samples/client/petstore/javascript-promise/test/ApiClientTest.js +++ b/samples/client/petstore/javascript-promise/test/ApiClientTest.js @@ -13,6 +13,7 @@ describe('ApiClient', function() { expect(apiClient.authentications).to.eql({ petstore_auth: {type: 'oauth2'}, api_key: {type: 'apiKey', in: 'header', name: 'api_key'}, + test_http_basic: {type: 'basic'}, test_api_client_id: { type: 'apiKey', in: 'header', diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 8ead7f7e7f95..d0233cb1a556 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ Version: 1.0.0 Automatically generated by the JavaScript Swagger Codegen project: -- Build date: 2016-03-16T19:41:06.099+08:00 +- Build date: 2016-03-17T16:01:44.795+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -103,6 +103,7 @@ Class | Method | HTTP request | Description - [SwaggerPetstore.Category](docs/Category.md) - [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md) + - [SwaggerPetstore.Model200Response](docs/Model200Response.md) - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.Order](docs/Order.md) diff --git a/samples/client/petstore/javascript/docs/Model200Response.md b/samples/client/petstore/javascript/docs/Model200Response.md new file mode 100644 index 000000000000..cc06fcd2d181 --- /dev/null +++ b/samples/client/petstore/javascript/docs/Model200Response.md @@ -0,0 +1,8 @@ +# SwaggerPetstore.Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] + + diff --git a/samples/client/petstore/javascript/git_push.sh b/samples/client/petstore/javascript/git_push.sh index 6ca091b49d95..1a36388db023 100644 --- a/samples/client/petstore/javascript/git_push.sh +++ b/samples/client/petstore/javascript/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/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index 908ffde2ac6e..ce6c017a1bf1 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -131,7 +131,7 @@ /** * Finds Pets by status * Multiple status values can be provided with comma separated strings - * @param {[String]} opts['status'] Status values that need to be considered for query + * @param {[String]} opts['status'] Status values that need to be considered for query (default to available) * @param {function} callback the callback function, accepting three arguments: error, data, response * data is of type: [Pet] */ diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index 2bb246869046..1f2d80adf3ec 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -62,7 +62,7 @@ /** * Finds orders by status * A single status value can be provided as a string - * @param {String} opts['status'] Status value that needs to be considered for query + * @param {String} opts['status'] Status value that needs to be considered for query (default to placed) * @param {function} callback the callback function, accepting three arguments: error, data, response * data is of type: [Order] */ diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index 35f454d85e4e..dfc123e35843 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,18 +1,19 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Category, InlineResponse200, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Category, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { 'use strict'; return { ApiClient: ApiClient, Category: Category, InlineResponse200: InlineResponse200, + Model200Response: Model200Response, ModelReturn: ModelReturn, Name: Name, Order: Order, diff --git a/samples/client/petstore/javascript/src/model/Model200Response.js b/samples/client/petstore/javascript/src/model/Model200Response.js new file mode 100644 index 000000000000..eab775e7476f --- /dev/null +++ b/samples/client/petstore/javascript/src/model/Model200Response.js @@ -0,0 +1,59 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['../ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.Model200Response = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + var Model200Response = function Model200Response() { + + }; + + Model200Response.constructFromObject = function(data) { + if (!data) { + return null; + } + var _this = new Model200Response(); + + if (data['name']) { + _this['name'] = ApiClient.convertToType(data['name'], 'Integer'); + } + + return _this; + } + + + + /** + * @return {Integer} + **/ + Model200Response.prototype.getName = function() { + return this['name']; + } + + /** + * @param {Integer} name + **/ + Model200Response.prototype.setName = function(name) { + this['name'] = name; + } + + + + + + return Model200Response; + + +})); diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 80d5e4e700ff..bb74e0c4c58d 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-16T23:43:41.882+08:00 +- Build date: 2016-03-17T16:01:35.253+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -120,10 +120,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 @@ -136,30 +151,15 @@ 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 diff --git a/samples/client/petstore/ruby/docs/InlineResponse200.md b/samples/client/petstore/ruby/docs/InlineResponse200.md index c3b0d978c072..d06f729f2f88 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 ------------ | ------------- | ------------- | ------------- -**tags** | [**Array<Tag>**](Tag.md) | | [optional] +**photo_urls** | **Array<String>** | | [optional] +**name** | **String** | | [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 8dd272ccd373..d1ce71a0e062 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 -[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 @@ -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 -[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 @@ -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 -[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/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index 0b38f5b6fed6..f3bab7e3d695 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_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" + + # 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" end api = Petstore::StoreApi.new @@ -254,7 +254,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/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index 29f631a983e6..cbbe399a4aac 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -201,7 +201,7 @@ module Petstore # Finds Pets by status # Multiple status values can be provided with comma separated strings # @param [Hash] opts the optional parameters - # @option opts [Array] :status Status values that need to be considered for query + # @option opts [Array] :status Status values that need to be considered for query (default to available) # @return [Array] def find_pets_by_status(opts = {}) data, status_code, headers = find_pets_by_status_with_http_info(opts) @@ -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 11bdfaadf62c..60bdd7dafb70 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -86,7 +86,7 @@ module Petstore # Finds orders by status # A single status value can be provided as a string # @param [Hash] opts the optional parameters - # @option opts [String] :status Status value that needs to be considered for query + # @option opts [String] :status Status value that needs to be considered for query (default to placed) # @return [Array] def find_orders_by_status(opts = {}) data, status_code, headers = find_orders_by_status_with_http_info(opts) @@ -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/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 5125ebe5960e..a5c37d54e9cd 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -157,12 +157,26 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { - 'test_api_key_header' => + 'petstore_auth' => + { + type: 'oauth2', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token}" + }, + 'test_api_client_id' => { type: 'api_key', in: 'header', - key: 'test_api_key_header', - value: api_key_with_prefix('test_api_key_header') + 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' => { @@ -178,20 +192,6 @@ 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', @@ -199,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 190170f18eb7..a793250e45b6 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 858b6504908f..241a2ded1d1d 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,7 +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() @@ -66,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 @@ -76,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