diff --git a/README.md b/README.md index 94a5e6999741..1d97c7675d8c 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for addit - [Run docker in Vagrant](#run-docker-in-vagrant) - [Public Docker image](#public-docker-image) - [Homebrew](#homebrew) + - [Getting Started](#getting-started) - Generators - [To generate a sample client library](#to-generate-a-sample-client-library) - [Generating libraries from your server](#generating-libraries-from-your-server) @@ -141,7 +142,27 @@ Here is an example usage: ``` swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l ruby -o /tmp/test/ ``` +## Getting Started +To generate a PHP client for http://petstore.swagger.io/v2/swagger.json, please run the following +```sh +git clone https://github.com/swagger-api/swagger-codegen +cd swagger-codegen +mvn clean package +java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ + -i http://petstore.swagger.io/v2/swagger.json \ + -l php \ + -o /var/tmp/php_api_client +``` +(if you're on Windows, replace the last command with `java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l php -o c:\temp\php_api_client`) + +You can also download the JAR (latest relesae) directly from [maven.org]( http://central.maven.org/maven2/io/swagger/swagger-codegen/2.1.6/swagger-codegen-2.1.6.jar) + +To get a list of **general** options available, please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar help generate` + +To get a list of PHP specified options (which can be passed to the generator with a config file via the `-c` option), please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l php` + +## Generators ### To generate a sample client library You can build a client against the swagger sample [petstore](http://petstore.swagger.io) API as follows: @@ -150,7 +171,7 @@ You can build a client against the swagger sample [petstore](http://petstore.swa ./bin/java-petstore.sh ``` -(On Windows, run `./bin/windows/java-petstore.bat` instead) +(On Windows, run `.\bin\windows\java-petstore.bat` instead) This will run the generator with this command: diff --git a/bin/all-petstore.sh b/bin/all-petstore.sh index cb7eb4ffc96c..af322af4820e 100755 --- a/bin/all-petstore.sh +++ b/bin/all-petstore.sh @@ -50,3 +50,4 @@ cd $APP_DIR ./bin/typescript-angular-petstore.sh ./bin/typescript-angular2-petstore.sh ./bin/typescript-node-petstore.sh +./bin/lumen-petstore-server.sh \ No newline at end of file diff --git a/bin/java-petstore-all.sh b/bin/java-petstore-all.sh index 635e8523edb0..143ebc819c5d 100755 --- a/bin/java-petstore-all.sh +++ b/bin/java-petstore-all.sh @@ -7,3 +7,4 @@ ./bin/java-petstore-okhttp-gson.sh ./bin/java-petstore-retrofit.sh ./bin/java-petstore-retrofit2.sh +./bin/java-petstore-retrofit2rx.sh diff --git a/bin/java-petstore-feign.sh b/bin/java-petstore-feign.sh index 6f0a5fdf8ff5..063b85f70a16 100755 --- a/bin/java-petstore-feign.sh +++ b/bin/java-petstore-feign.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-jersey2.sh b/bin/java-petstore-jersey2.sh index cb51c1e1a8d4..a715e7ff5450 100755 --- a/bin/java-petstore-jersey2.sh +++ b/bin/java-petstore-jersey2.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-okhttp-gson.sh b/bin/java-petstore-okhttp-gson.sh index 17a48ddee53a..f656624a6c62 100755 --- a/bin/java-petstore-okhttp-gson.sh +++ b/bin/java-petstore-okhttp-gson.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-retrofit.sh b/bin/java-petstore-retrofit.sh index d9228fb2ecaa..db4001e4c9ed 100755 --- a/bin/java-petstore-retrofit.sh +++ b/bin/java-petstore-retrofit.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-retrofit2.sh b/bin/java-petstore-retrofit2.sh index fbd1f9779e4f..3fda4df31663 100755 --- a/bin/java-petstore-retrofit2.sh +++ b/bin/java-petstore-retrofit2.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-retrofit2rx.sh b/bin/java-petstore-retrofit2rx.sh index b0320644142e..d714cc334559 100755 --- a/bin/java-petstore-retrofit2rx.sh +++ b/bin/java-petstore-retrofit2rx.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore.sh b/bin/java-petstore.sh index 17a1b0d6b98f..ed80c841df67 100755 --- a/bin/java-petstore.sh +++ b/bin/java-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/lumen-petstore-server.sh b/bin/lumen-petstore-server.sh new file mode 100755 index 000000000000..15acb2fe2bd3 --- /dev/null +++ b/bin/lumen-petstore-server.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/lumen -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l lumen -o samples/server/petstore/lumen" + +java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/XhhGitIgnore/sdk_unit_testing_binary.json b/modules/swagger-codegen/XhhGitIgnore/sdk_unit_testing_binary.json new file mode 100644 index 000000000000..2d87e3bcb7f6 --- /dev/null +++ b/modules/swagger-codegen/XhhGitIgnore/sdk_unit_testing_binary.json @@ -0,0 +1,67 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "SDK Unit Testing - File Downloading" + }, + "schemes": [ + "http" + ], + "host": "localhost:3000", + "basePath": "/unittesting", + "paths": { + "/request/file_uploading": { + "get": { + "operationId": "file_uploading", + "tags": [ + "Request" + ], + "parameters": [ + {"name": "f1", + "in": "formData", + "type": "string", + "format": "binary", + "required": true + }, + {"name": "f2", + "in": "formData", + "type": "string", + "format": "binary", + "required": false + } + ], + "consumes": [ + "multipart/form-data" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/response/file_downloading": { + "get": { + "operationId": "file_downloading", + "tags": [ + "Response" + ], + "produces": [ + "multipart/form-data" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string", + "format": "binary" + } + } + } + } + } + } +} diff --git a/modules/swagger-codegen/XhhGitIgnore/sdk_unit_testing_file_downloading.json b/modules/swagger-codegen/XhhGitIgnore/sdk_unit_testing_file_downloading.json new file mode 100644 index 000000000000..6169272c05d5 --- /dev/null +++ b/modules/swagger-codegen/XhhGitIgnore/sdk_unit_testing_file_downloading.json @@ -0,0 +1,30 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "SDK Unit Testing - File Downloading" + }, + "schemes": [ + "http" + ], + "host": "localhost:3000", + "basePath": "/unittesting", + "paths": { + "/response/file_downloading": { + "get": { + "operationId": "file_downloading", + "tags": [ + "Response" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 380a1eee2a10..9fe2b6fc370a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -43,7 +43,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { protected boolean serializeBigDecimalAsString = false; protected boolean useRxJava = false; protected boolean hideGenerationTimestamp = false; - + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; public JavaClientCodegen() { super(); @@ -60,6 +61,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { "localVarPath", "localVarQueryParams", "localVarHeaderParams", "localVarFormParams", "localVarPostBody", "localVarAccepts", "localVarAccept", "localVarContentTypes", "localVarContentType", "localVarAuthNames", "localReturnType", + "ApiClient", "ApiException", "ApiResponse", "Configuration", "StringUtil", // language reserved words "abstract", "continue", "for", "new", "switch", "assert", @@ -208,6 +210,10 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { additionalProperties.put(FULL_JAVA_UTIL, fullJavaUtil); additionalProperties.put("javaUtilPrefix", javaUtilPrefix); + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + importMapping.put("List", "java.util.List"); if (fullJavaUtil) { @@ -269,7 +275,14 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { } // library-specific files - if ("okhttp-gson".equals(getLibrary())) { + if (StringUtils.isEmpty(getLibrary())) { + // generate markdown docs + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + } else if ("okhttp-gson".equals(getLibrary())) { + // generate markdown docs + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); // the "okhttp-gson" library template requires "ApiCallback.mustache" for async call supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java")); supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); @@ -282,6 +295,9 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java")); supportingFiles.add(new SupportingFile("CollectionFormats.mustache", invokerFolder, "CollectionFormats.java")); } else if("jersey2".equals(getLibrary())) { + // generate markdown docs + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); } @@ -353,6 +369,26 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', '/'); } + @Override + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + } + + @Override + public String toApiDocFilename(String name) { + return toApiName(name); + } + + @Override + public String toModelDocFilename(String name) { + return toModelName(name); + } + @Override public String toVarName(String name) { // sanitize name @@ -497,6 +533,70 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { return super.toDefaultValue(p); } + @Override + public void setParameterExampleValue(CodegenParameter p) { + String example; + + if (p.defaultValue == null) { + example = p.example; + } else { + example = p.defaultValue; + } + + String type = p.baseType; + if (type == null) { + type = p.dataType; + } + + if ("String".equals(type)) { + if (example == null) { + example = p.paramName + "_example"; + } + example = "\"" + escapeText(example) + "\""; + } else if ("Integer".equals(type) || "Short".equals(type)) { + if (example == null) { + example = "56"; + } + } else if ("Long".equals(type)) { + if (example == null) { + example = "56"; + } + example = example + "L"; + } else if ("Float".equals(type)) { + if (example == null) { + example = "3.4"; + } + example = example + "F"; + } else if ("Double".equals(type)) { + example = "3.4"; + example = example + "D"; + } else if ("Boolean".equals(type)) { + if (example == null) { + example = "true"; + } + } else if ("File".equals(type)) { + if (example == null) { + example = "/path/to/file"; + } + example = "new File(\"" + escapeText(example) + "\")"; + } else if ("Date".equals(type)) { + example = "new Date()"; + } else if (!languageSpecificPrimitives.contains(type)) { + // type is a model class, e.g. User + example = "new " + type + "()"; + } + + if (example == null) { + example = "null"; + } else if (Boolean.TRUE.equals(p.isListContainer)) { + example = "Arrays.asList(" + example + ")"; + } else if (Boolean.TRUE.equals(p.isMapContainer)) { + example = "new HashMap()"; + } + + p.example = example; + } + @Override public String getSwaggerType(Property p) { String swaggerType = super.getSwaggerType(p); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java index d2d3808f8ebf..846796e3b8f6 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java @@ -524,26 +524,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo type = p.dataType; } - typeMapping.put("array", "Array"); - typeMapping.put("List", "Array"); - typeMapping.put("map", "Object"); - typeMapping.put("object", "Object"); - typeMapping.put("boolean", "Boolean"); - typeMapping.put("char", "String"); - typeMapping.put("string", "String"); - typeMapping.put("short", "Integer"); - typeMapping.put("int", "Integer"); - typeMapping.put("integer", "Integer"); - typeMapping.put("long", "Integer"); - typeMapping.put("float", "Number"); - typeMapping.put("double", "Number"); - typeMapping.put("number", "Number"); - typeMapping.put("DateTime", "Date"); - typeMapping.put("Date", "Date"); - typeMapping.put("file", "File"); - // binary not supported in JavaScript client right now, using String as a workaround - typeMapping.put("binary", "String"); - if ("String".equals(type)) { if (example == null) { example = p.paramName + "_example"; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java new file mode 100644 index 000000000000..55e72f793846 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LumenServerCodegen.java @@ -0,0 +1,235 @@ +package io.swagger.codegen.languages; + +import io.swagger.codegen.*; +import io.swagger.models.properties.*; + +import java.util.*; +import java.io.File; + +public class LumenServerCodegen extends DefaultCodegen implements CodegenConfig { + + // source folder where to write the files + protected String sourceFolder = "src"; + protected String apiVersion = "1.0.0"; + + /** + * Configures the type of generator. + * + * @return the CodegenType for this generator + * @see io.swagger.codegen.CodegenType + */ + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + /** + * Configures a friendly name for the generator. This will be used by the generator + * to select the library with the -l flag. + * + * @return the friendly name for the generator + */ + public String getName() { + return "lumen"; + } + + /** + * Returns human-friendly help for the generator. Provide the consumer with help + * tips, parameters here + * + * @return A string value for the help message + */ + public String getHelp() { + return "Generates a LumenServerCodegen client library."; + } + + public LumenServerCodegen() { + super(); + + // set the output folder here + outputFolder = "generated-code/lumen"; + String packagePath = "lumen"; + + // modelPackage = packagePath + "\\lib\\Models"; + // apiPackage = packagePath + "\\lib"; + // // outputFolder = "generated-code" + File.separator + "slim"; + // modelTemplateFiles.put("model.mustache", ".php"); + + /** + * Models. You can write model files using the modelTemplateFiles map. + * if you want to create one template for file, you can do so here. + * for multiple files for model, just put another entry in the `modelTemplateFiles` with + * a different extension + */ + // modelTemplateFiles.put( + // "model.mustache", // the template to use + // ".sample"); // the extension for each file to write + + /** + * Api classes. You can write classes for each Api file with the apiTemplateFiles map. + * as with models, add multiple entries with different extensions for multiple files per + * class + */ + // apiTemplateFiles.put( + // "api.mustache", // the template to use + // ".sample"); // the extension for each file to write + + + // no api files + apiTemplateFiles.clear(); + + // embeddedTemplateDir = templateDir = "slim"; + + /** + * Template Location. This is the location which templates will be read from. The generator + * will use the resource stream to attempt to read the templates. + */ + templateDir = "lumen"; + + /** + * Api Package. Optional, if needed, this can be used in templates + */ + apiPackage = "io.swagger.client.api"; + + /** + * Model Package. Optional, if needed, this can be used in templates + */ + modelPackage = "io.swagger.client.model"; + + /** + * Reserved words. Override this with reserved words specific to your language + */ + reservedWords = new HashSet ( + Arrays.asList( + "sample1", // replace with static values + "sample2") + ); + + /** + * Additional Properties. These values can be passed to the templates and + * are available in models, apis, and supporting files + */ + additionalProperties.put("apiVersion", apiVersion); + + /** + * Supporting Files. You can write single files for the generator with the + * entire object tree available. If the input file has a suffix of `.mustache + * it will be processed by the template engine. Otherwise, it will be copied + */ + // supportingFiles.add(new SupportingFile("index.mustache", packagePath, "index.php")); + // supportingFiles.add(new SupportingFile("routes.mustache", packagePath, "routes.php")); + + supportingFiles.add(new SupportingFile("composer.json", packagePath, "composer.json")); + supportingFiles.add(new SupportingFile("readme.md", packagePath, "readme.md")); + supportingFiles.add(new SupportingFile("artisan", packagePath, "artisan")); + // supportingFiles.add(new SupportingFile("server.php", packagePath, "server.php")); + + supportingFiles.add(new SupportingFile("bootstrap" + File.separator + "app.php", packagePath + File.separator + "bootstrap", "app.php")); + + supportingFiles.add(new SupportingFile("public" + File.separator + "index.php", packagePath + File.separator + "public", "index.php")); + + supportingFiles.add(new SupportingFile("app" + File.separator + "User.php", packagePath + File.separator + "app", "User.php")); + supportingFiles.add(new SupportingFile("app" + File.separator + "Console" + File.separator + "Kernel.php", packagePath + File.separator + "app" + File.separator + "Console", "Kernel.php")); + supportingFiles.add(new SupportingFile("app" + File.separator + "Exceptions" + File.separator + "Handler.php", packagePath + File.separator + "app" + File.separator + "Exceptions", "Handler.php")); + // supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Kernel.php", packagePath + File.separator + "app" + File.separator + "Http", "Kernel.php")); + supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "routes.mustache", packagePath + File.separator + "app" + File.separator + "Http", "routes.php")); + + supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Controller.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator, "Controller.php")); + supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "ExampleController.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator, "ExampleController.php")); + // supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Auth" + File.separator + "AuthController.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Auth" + File.separator, "AuthController.php")); + // supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Auth" + File.separator + "PasswordController.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Auth" + File.separator, "PasswordController.php")); + + supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Middleware" + File.separator + "Authenticate.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "Authenticate.php")); + supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Middleware" + File.separator + "ExampleMiddleware.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "ExampleMiddleware.php")); + // supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Middleware" + File.separator + "RedirectIfAuthenticated.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "RedirectIfAuthenticated.php")); + // supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Middleware" + File.separator + "VerifyCsrfToken.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "VerifyCsrfToken.php")); + + // supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Requests" + File.separator + "Request.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Requests" + File.separator, "Request.php")); + + supportingFiles.add(new SupportingFile("app" + File.separator + "Providers" + File.separator + "AppServiceProvider.php", packagePath + File.separator + "app" + File.separator + "Providers", "AppServiceProvider.php")); + supportingFiles.add(new SupportingFile("app" + File.separator + "Providers" + File.separator + "AuthServiceProvider.php", packagePath + File.separator + "app" + File.separator + "Providers", "AuthServiceProvider.php")); + supportingFiles.add(new SupportingFile("app" + File.separator + "Providers" + File.separator + "EventServiceProvider.php", packagePath + File.separator + "app" + File.separator + "Providers", "EventServiceProvider.php")); + // supportingFiles.add(new SupportingFile("app" + File.separator + "Providers" + File.separator + "RouteServiceProvider.php", packagePath + File.separator + "app" + File.separator + "Providers", "RouteServiceProvider.php")); + + // supportingFiles.add(new SupportingFile("config" + File.separator + "app.php", packagePath + File.separator + "config" + File.separator, "app.php")); + + /** + * Language Specific Primitives. These types will not trigger imports by + * the client generator + */ + languageSpecificPrimitives = new HashSet( + Arrays.asList( + "Type1", // replace these with your types + "Type2") + ); + } + + /** + * Escapes a reserved word as defined in the `reservedWords` array. Handle escaping + * those terms here. This logic is only called if a variable matches the reseved words + * + * @return the escaped term + */ + @Override + public String escapeReservedWord(String name) { + return "_" + name; // add an underscore to the name + } + + /** + * Location to write model files. You can use the modelPackage() as defined when the class is + * instantiated + */ + public String modelFileFolder() { + return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar); + } + + /** + * Location to write api files. You can use the apiPackage() as defined when the class is + * instantiated + */ + @Override + public String apiFileFolder() { + return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', File.separatorChar); + } + + /** + * Optional - type declaration. This is a String which is used by the templates to instantiate your + * types. There is typically special handling for different property types + * + * @return a string value used as the `dataType` field for model templates, `returnType` for api templates + */ + @Override + public String getTypeDeclaration(Property p) { + if(p instanceof ArrayProperty) { + ArrayProperty ap = (ArrayProperty) p; + Property inner = ap.getItems(); + return getSwaggerType(p) + "[" + getTypeDeclaration(inner) + "]"; + } + else if (p instanceof MapProperty) { + MapProperty mp = (MapProperty) p; + Property inner = mp.getAdditionalProperties(); + return getSwaggerType(p) + "[String, " + getTypeDeclaration(inner) + "]"; + } + return super.getTypeDeclaration(p); + } + + /** + * Optional - swagger type conversion. This is used to map swagger types in a `Property` into + * either language specific types via `typeMapping` or into complex models if there is not a mapping. + * + * @return a string value of the type or complex model for this property + * @see io.swagger.models.properties.Property + */ + @Override + public String getSwaggerType(Property p) { + String swaggerType = super.getSwaggerType(p); + String type = null; + if(typeMapping.containsKey(swaggerType)) { + type = typeMapping.get(swaggerType); + if(languageSpecificPrimitives.contains(type)) + return toModelName(type); + } + else + type = swaggerType; + return toModelName(type); + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index d560a9462143..a1e3d6f93563 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -69,6 +69,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // local variable name used in API methods (endpoints) "all_params", "resource_path", "path_params", "query_params", "header_params", "form_params", "local_var_files", "body_params", "auth_settings", + // @property + "property", // python reserved words "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", "assert", "else", "if", "pass", "yield", "break", "except", "import", diff --git a/modules/swagger-codegen/src/main/resources/Java/README.mustache b/modules/swagger-codegen/src/main/resources/Java/README.mustache index 50e2cf3fbe99..f3b766a67d80 100644 --- a/modules/swagger-codegen/src/main/resources/Java/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/README.mustache @@ -4,7 +4,7 @@ Building the API client library requires [Maven](https://maven.apache.org/) to be installed. -## Installation & Usage +## Installation To install the API client library to your local Maven repository, simply execute: @@ -20,18 +20,124 @@ mvn deploy Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. -After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: +### Maven users + +Add this dependency to your project's POM: ```xml - {{groupId}} - {{artifactId}} - {{artifactVersion}} + {{{groupId}}} + {{{artifactId}}} + {{{artifactVersion}}} compile - ``` +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" +``` + +### Others + +At first generate the JAR by executing: + + mvn package + +Then manually install the following JARs: + +* target/{{{artifactId}}}-{{{artifactVersion}}}.jar +* target/lib/*.jar + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +import {{{invokerPackage}}}.*; +import {{{invokerPackage}}}.auth.*; +import {{{invokerPackage}}}.model.*; +import {{{package}}}.{{{classname}}}; + +import java.io.File; +import java.util.*; + +public class {{{classname}}}Example { + + public static void main(String[] args) { + {{#hasAuthMethods}}ApiClient defaultClient = Configuration.getDefaultApiClient(); + {{#authMethods}}{{#isBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + e.printStackTrace(); + } + } +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation for Models + +{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) +{{/model}}{{/models}} + +## Documentation for Authorization + +{{^authMethods}}All endpoints do not require authorization. +{{/authMethods}}Authentication schemes defined for the API: +{{#authMethods}}### {{name}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorizatoin URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. @@ -40,4 +146,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} {{/hasMore}}{{/apis}}{{/apiInfo}} - diff --git a/modules/swagger-codegen/src/main/resources/Java/api_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/api_doc.mustache new file mode 100644 index 000000000000..93c5bc5b13a5 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/api_doc.mustache @@ -0,0 +1,82 @@ +# {{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} + +# **{{operationId}}** +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + +{{summary}}{{#notes}} + +{{notes}}{{/notes}} + +### Example +```java +// Import classes:{{#hasAuthMethods}} +//import {{{invokerPackage}}}.ApiClient;{{/hasAuthMethods}} +//import {{{invokerPackage}}}.ApiException;{{#hasAuthMethods}} +//import {{{invokerPackage}}}.Configuration; +//import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +//import {{{package}}}.{{{classname}}}; + +{{#hasAuthMethods}} +ApiClient defaultClient = Configuration.getDefaultApiClient(); +{{#authMethods}}{{#isBasic}} +// Configure HTTP basic authorization: {{{name}}} +HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); +{{{name}}}.setUsername("YOUR USERNAME"); +{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}} +// Configure API key authorization: {{{name}}} +ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); +{{{name}}}.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} +// Configure OAuth2 access token for authorization: {{{name}}} +OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); +{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + +{{{classname}}} apiInstance = new {{{classname}}}(); +{{#allParams}} +{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} +try { + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + System.out.println(result);{{/returnType}} +} catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + e.printStackTrace(); +} +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/Java/enum_outer_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/enum_outer_doc.mustache new file mode 100644 index 000000000000..14b5d524c4a3 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/enum_outer_doc.mustache @@ -0,0 +1,7 @@ +# {{classname}} + +## Enum + +{{#allowableValues}} +* `{{.}}` +{{/allowableValues}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/README.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/README.mustache new file mode 100644 index 000000000000..50e2cf3fbe99 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/README.mustache @@ -0,0 +1,43 @@ +# {{artifactId}} + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation & Usage + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: + +```xml + + {{groupId}} + {{artifactId}} + {{artifactVersion}} + compile + + +``` + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} + diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache new file mode 100644 index 000000000000..a7e706eba4e2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/enum_outer_doc.mustache @@ -0,0 +1,7 @@ +# {{classname}} + +## Enum + +{{#allowableValues}}{{#enumVars}} +* `{{name}}` (value: `{{value}}`) +{{#enumVars}}{{/allowableValues}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model_doc.mustache new file mode 100644 index 000000000000..a3703db3bf94 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model_doc.mustache @@ -0,0 +1,3 @@ +{{#models}}{{#model}} +{{#isEnum}}{{>libraries/okhttp-gson/enum_outer_doc}}{{/isEnum}}{{^isEnum}}{{>pojo_doc}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/README.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/README.mustache new file mode 100644 index 000000000000..50e2cf3fbe99 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/README.mustache @@ -0,0 +1,43 @@ +# {{artifactId}} + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation & Usage + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: + +```xml + + {{groupId}} + {{artifactId}} + {{artifactVersion}} + compile + + +``` + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} + diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/README.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/README.mustache new file mode 100644 index 000000000000..50e2cf3fbe99 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/README.mustache @@ -0,0 +1,43 @@ +# {{artifactId}} + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation & Usage + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: + +```xml + + {{groupId}} + {{artifactId}} + {{artifactVersion}} + compile + + +``` + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} + diff --git a/modules/swagger-codegen/src/main/resources/Java/model_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/model_doc.mustache new file mode 100644 index 000000000000..658df8d53225 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/model_doc.mustache @@ -0,0 +1,3 @@ +{{#models}}{{#model}} +{{#isEnum}}{{>enum_outer_doc}}{{/isEnum}}{{^isEnum}}{{>pojo_doc}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo_doc.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo_doc.mustache new file mode 100644 index 000000000000..0e4c07498669 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/pojo_doc.mustache @@ -0,0 +1,15 @@ +# {{classname}} + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isEnum}}[**{{datatypeWithEnum}}**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#readOnly}} [readonly]{{/readOnly}} +{{/vars}} +{{#vars}}{{#isEnum}} + + +## Enum: {{datatypeWithEnum}} +Name | Value +---- | -----{{#allowableValues}}{{#enumVars}} +{{name}} | {{value}}{{/enumVars}}{{/allowableValues}} +{{/isEnum}}{{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/Javascript/api_doc.mustache b/modules/swagger-codegen/src/main/resources/Javascript/api_doc.mustache index 714350a2170b..f5aad995da55 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/api_doc.mustache @@ -12,7 +12,7 @@ Method | HTTP request | Description {{#operation}} # **{{operationId}}** -> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}} +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}) {{summary}}{{#notes}} @@ -26,25 +26,25 @@ var defaultClient = {{{moduleName}}}.ApiClient.default; {{#authMethods}}{{#isBasic}} // Configure HTTP basic authorization: {{{name}}} var {{{name}}} = defaultClient.authentications['{{{name}}}']; -{{{name}}}.username = 'YOUR USERNAME' -{{{name}}}.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}} +{{{name}}}.username = 'YOUR USERNAME'; +{{{name}}}.password = 'YOUR PASSWORD';{{/isBasic}}{{#isApiKey}} // Configure API key authorization: {{{name}}} var {{{name}}} = defaultClient.authentications['{{{name}}}']; -{{{name}}}.apiKey = "YOUR API KEY" +{{{name}}}.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//{{{name}}}.apiKeyPrefix['{{{keyParamName}}}'] = "Token"{{/isApiKey}}{{#isOAuth}} +//{{{name}}}.apiKeyPrefix = 'Token';{{/isApiKey}}{{#isOAuth}} // Configure OAuth2 access token for authorization: {{{name}}} var {{{name}}} = defaultClient.authentications['{{{name}}}']; -{{{name}}}.accessToken = "YOUR ACCESS TOKEN"{{/isOAuth}} +{{{name}}}.accessToken = 'YOUR ACCESS TOKEN';{{/isOAuth}} {{/authMethods}} {{/hasAuthMethods}} -var apiInstance = new {{{moduleName}}}.{{{classname}}}(){{#hasParams}} +var apiInstance = new {{{moduleName}}}.{{{classname}}}();{{#hasParams}} {{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}} -var {{{paramName}}} = {{{example}}}; // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}} +var {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}} var opts = { {{#allParams}}{{^required}} - '{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}{{/required}}{{/allParams}} + '{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}} };{{/hasOptionalParams}}{{/hasParams}} {{#usePromises}} apiInstance.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) { @@ -61,7 +61,7 @@ var callback = function(error, data, response) { {{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}} } }; -api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}callback); +apiInstance.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}callback); {{/usePromises}} ``` diff --git a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig index 50d5357285db..21a75b23d5ca 100644 --- a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig @@ -41,3 +41,4 @@ io.swagger.codegen.languages.AkkaScalaClientCodegen io.swagger.codegen.languages.CsharpDotNet2ClientCodegen io.swagger.codegen.languages.ClojureClientCodegen io.swagger.codegen.languages.HaskellServantCodegen +io.swagger.codegen.languages.LumenServerCodegen \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/model.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/model.mustache index 6c805a832e44..d22bfa5693b5 100644 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/model.mustache +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/model.mustache @@ -38,6 +38,29 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{/vars}} + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + {{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}} + return {{#vars}}({{name}} == null ? {{classVarName}}.{{name}} == null : {{name}}.equals({{classVarName}}.{{name}})){{#hasMore}} && + {{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}} + return true;{{/hasVars}} + } + + @Override + public int hashCode() { + int result = 17; + {{#vars}} + result = 31 * result + ({{name}} == null ? 0: {{name}}.hashCode());{{#hasMore}}{{/hasMore}} + {{/vars}} + return result; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/modules/swagger-codegen/src/main/resources/android/model.mustache b/modules/swagger-codegen/src/main/resources/android/model.mustache index 6c805a832e44..d22bfa5693b5 100644 --- a/modules/swagger-codegen/src/main/resources/android/model.mustache +++ b/modules/swagger-codegen/src/main/resources/android/model.mustache @@ -38,6 +38,29 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{/vars}} + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + {{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}} + return {{#vars}}({{name}} == null ? {{classVarName}}.{{name}} == null : {{name}}.equals({{classVarName}}.{{name}})){{#hasMore}} && + {{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}} + return true;{{/hasVars}} + } + + @Override + public int hashCode() { + int result = 17; + {{#vars}} + result = 31 * result + ({{name}} == null ? 0: {{name}}.hashCode());{{#hasMore}}{{/hasMore}} + {{/vars}} + return result; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache index f1b3c15e6161..e445191085a3 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache @@ -17,7 +17,7 @@ Method | HTTP request | Description {{{notes}}}{{/notes}} -### Example +### Example ```csharp using System; using System.Diagnostics; diff --git a/modules/swagger-codegen/src/main/resources/csharp/model.mustache b/modules/swagger-codegen/src/main/resources/csharp/model.mustache index 3626da0f1c45..6d0878958471 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/model.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/model.mustache @@ -41,7 +41,7 @@ namespace {{packageName}}.Model /// {{#vars}}{{^isReadOnly}} /// {{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}. {{/isReadOnly}}{{/vars}} - public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}} {{name}} = null{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/isReadOnly}}{{/vars}}) + public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}}) { {{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null) if ({{name}} == null) diff --git a/modules/swagger-codegen/src/main/resources/lumen/app/Console/Commands/.gitkeep b/modules/swagger-codegen/src/main/resources/lumen/app/Console/Commands/.gitkeep new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/modules/swagger-codegen/src/main/resources/lumen/app/Console/Kernel.php b/modules/swagger-codegen/src/main/resources/lumen/app/Console/Kernel.php new file mode 100644 index 000000000000..ad6e311cdd04 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/app/Console/Kernel.php @@ -0,0 +1,29 @@ +auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * @return mixed + */ + public function handle($request, Closure $next, $guard = null) + { + if ($this->auth->guard($guard)->guest()) { + return response('Unauthorized.', 401); + } + + return $next($request); + } +} diff --git a/modules/swagger-codegen/src/main/resources/lumen/app/Http/Middleware/ExampleMiddleware.php b/modules/swagger-codegen/src/main/resources/lumen/app/Http/Middleware/ExampleMiddleware.php new file mode 100644 index 000000000000..166581c8e69b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/app/Http/Middleware/ExampleMiddleware.php @@ -0,0 +1,20 @@ +get('/', function () use ($app) { + return $app->version(); +}); + +{{#apis}}{{#operations}}{{#operation}} +/** + * {{httpMethod}} {{nickname}} + * Summary: {{summary}} + * Notes: {{notes}} +{{#hasProduces}} * Output-Formats: [{{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}]{{/hasProduces}} + */ +$app->{{httpMethod}}('{{path}}', function({{#pathParams}}${{paramName}}, {{/pathParams}}$null = null) use ($app) { + {{#hasHeaderParams}}$headers = Request::header();{{/hasHeaderParams}} + {{#hasQueryParams}}{{#queryParams}}${{paramName}} = Request::input('{{paramName}}');{{newline}} + {{/queryParams}}{{/hasQueryParams}} + {{#hasFormParams}}{{#formParams}}${{paramName}} = Request::input('{{paramName}}');{{newline}} {{/formParams}}{{/hasFormParams}} + + return response('How about implementing {{nickname}} as a {{httpMethod}} method ?'); + }); + +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + diff --git a/modules/swagger-codegen/src/main/resources/lumen/app/Providers/AppServiceProvider.php b/modules/swagger-codegen/src/main/resources/lumen/app/Providers/AppServiceProvider.php new file mode 100644 index 000000000000..ddec04694c37 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/app/Providers/AppServiceProvider.php @@ -0,0 +1,18 @@ +input('api_token')) { + return User::where('api_token', $request->input('api_token'))->first(); + } + }); + } +} diff --git a/modules/swagger-codegen/src/main/resources/lumen/app/Providers/EventServiceProvider.php b/modules/swagger-codegen/src/main/resources/lumen/app/Providers/EventServiceProvider.php new file mode 100644 index 000000000000..0b8f3934fb3c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/app/Providers/EventServiceProvider.php @@ -0,0 +1,19 @@ + [ + 'App\Listeners\EventListener', + ], + ]; +} diff --git a/modules/swagger-codegen/src/main/resources/lumen/app/User.php b/modules/swagger-codegen/src/main/resources/lumen/app/User.php new file mode 100644 index 000000000000..fd4de31172cf --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/app/User.php @@ -0,0 +1,34 @@ +make( + 'Illuminate\Contracts\Console\Kernel' +); + +exit($kernel->handle(new ArgvInput, new ConsoleOutput)); diff --git a/modules/swagger-codegen/src/main/resources/lumen/bootstrap/app.php b/modules/swagger-codegen/src/main/resources/lumen/bootstrap/app.php new file mode 100644 index 000000000000..9bc334dd8866 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/bootstrap/app.php @@ -0,0 +1,102 @@ +load(); +} catch (Dotenv\Exception\InvalidPathException $e) { + // +} + +/* +|-------------------------------------------------------------------------- +| Create The Application +|-------------------------------------------------------------------------- +| +| Here we will load the environment and create the application instance +| that serves as the central piece of this framework. We'll use this +| application as an "IoC" container and router for this framework. +| +*/ + +$app = new Laravel\Lumen\Application( + realpath(__DIR__.'/../') +); + +// $app->withFacades(); + +// $app->withEloquent(); + +/* +|-------------------------------------------------------------------------- +| Register Container Bindings +|-------------------------------------------------------------------------- +| +| Now we will register a few bindings in the service container. We will +| register the exception handler and the console kernel. You may add +| your own bindings here if you like or you can make another file. +| +*/ + +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + App\Exceptions\Handler::class +); + +$app->singleton( + Illuminate\Contracts\Console\Kernel::class, + App\Console\Kernel::class +); + +class_alias('Illuminate\Support\Facades\Request', 'Request'); //to use the Reqesut facade + +/* +|-------------------------------------------------------------------------- +| Register Middleware +|-------------------------------------------------------------------------- +| +| Next, we will register the middleware with the application. These can +| be global middleware that run before and after each request into a +| route or middleware that'll be assigned to some specific routes. +| +*/ + +// $app->middleware([ +// App\Http\Middleware\ExampleMiddleware::class +// ]); + +// $app->routeMiddleware([ +// 'auth' => App\Http\Middleware\Authenticate::class, +// ]); + +/* +|-------------------------------------------------------------------------- +| Register Service Providers +|-------------------------------------------------------------------------- +| +| Here we will register all of the application's service providers which +| are used to bind services into the container. Service providers are +| totally optional, so you are not required to uncomment this line. +| +*/ + +// $app->register(App\Providers\AppServiceProvider::class); +// $app->register(App\Providers\AuthServiceProvider::class); +// $app->register(App\Providers\EventServiceProvider::class); + +/* +|-------------------------------------------------------------------------- +| Load The Application Routes +|-------------------------------------------------------------------------- +| +| Next we will include the routes file so that they can all be added to +| the application. This will provide all of the URLs the application +| can respond to, as well as the controllers that may handle them. +| +*/ + +$app->group(['namespace' => 'App\Http\Controllers'], function ($app) { + require __DIR__.'/../app/Http/routes.php'; +}); + +return $app; diff --git a/modules/swagger-codegen/src/main/resources/lumen/composer.json b/modules/swagger-codegen/src/main/resources/lumen/composer.json new file mode 100644 index 000000000000..62df199e76a7 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/composer.json @@ -0,0 +1,17 @@ +{ + "name": "laravel/lumen", + "description": "The Laravel Lumen Framework.", + "keywords": ["framework", "laravel", "lumen"], + "license": "MIT", + "type": "project", + "require": { + "php": ">=5.5.9", + "laravel/lumen-framework": "5.2.*", + "vlucas/phpdotenv": "~2.2" + }, + "autoload": { + "psr-4": { + "App\\": "app/" + } + } +} diff --git a/modules/swagger-codegen/src/main/resources/lumen/public/.htaccess b/modules/swagger-codegen/src/main/resources/lumen/public/.htaccess new file mode 100644 index 000000000000..8eb2dd0ddfa5 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/public/.htaccess @@ -0,0 +1,16 @@ + + + Options -MultiViews + + + RewriteEngine On + + # Redirect Trailing Slashes If Not A Folder... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)/$ /$1 [L,R=301] + + # Handle Front Controller... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + diff --git a/modules/swagger-codegen/src/main/resources/lumen/public/index.php b/modules/swagger-codegen/src/main/resources/lumen/public/index.php new file mode 100644 index 000000000000..04aa08688e00 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/public/index.php @@ -0,0 +1,28 @@ +run(); diff --git a/modules/swagger-codegen/src/main/resources/lumen/readme.md b/modules/swagger-codegen/src/main/resources/lumen/readme.md new file mode 100644 index 000000000000..9605e5f3f459 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/readme.md @@ -0,0 +1,21 @@ +## Lumen PHP Framework + +[![Build Status](https://travis-ci.org/laravel/lumen-framework.svg)](https://travis-ci.org/laravel/lumen-framework) +[![Total Downloads](https://poser.pugx.org/laravel/lumen-framework/d/total.svg)](https://packagist.org/packages/laravel/lumen-framework) +[![Latest Stable Version](https://poser.pugx.org/laravel/lumen-framework/v/stable.svg)](https://packagist.org/packages/laravel/lumen-framework) +[![Latest Unstable Version](https://poser.pugx.org/laravel/lumen-framework/v/unstable.svg)](https://packagist.org/packages/laravel/lumen-framework) +[![License](https://poser.pugx.org/laravel/lumen-framework/license.svg)](https://packagist.org/packages/laravel/lumen-framework) + +Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching. + +## Official Documentation + +Documentation for the framework can be found on the [Lumen website](http://lumen.laravel.com/docs). + +## Security Vulnerabilities + +If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed. + +### License + +The Lumen framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT) diff --git a/modules/swagger-codegen/src/main/resources/lumen/routes.mustache b/modules/swagger-codegen/src/main/resources/lumen/routes.mustache new file mode 100644 index 000000000000..be2fac8d86e5 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/routes.mustache @@ -0,0 +1,28 @@ +get('/', function () use ($app) { + return $app->version(); +}); + +{{#apis}}{{#operations}}{{#operation}} +/** + * {{httpMethod}} {{nickname}} + * Summary: {{summary}} + * Notes: {{notes}} +{{#hasProduces}} * Output-Formats: [{{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}]{{/hasProduces}} + */ +Route::{{httpMethod}}('{{path}}', function({{#pathParams}}${{paramName}}, {{/pathParams}}null) use ($app) { + {{#hasHeaderParams}}$headers = Request::header();{{/hasHeaderParams}} + {{#hasQueryParams}}{{#queryParams}}${{paramName}} = Request::input('{{paramName}}');{{newline}} + {{/queryParams}}{{/hasQueryParams}} + {{#hasFormParams}}{{#formParams}}${{paramName}} = Request::input('{{paramName}}');{{newline}} {{/formParams}}{{/hasFormParams}} + + return response('How about implementing {{nickname}} as a {{httpMethod}} method ?'); + }); + +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + diff --git a/modules/swagger-codegen/src/main/resources/lumen/storage/app/.gitignore b/modules/swagger-codegen/src/main/resources/lumen/storage/app/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/storage/app/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/modules/swagger-codegen/src/main/resources/lumen/storage/framework/views/.gitignore b/modules/swagger-codegen/src/main/resources/lumen/storage/framework/views/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/storage/framework/views/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/modules/swagger-codegen/src/main/resources/lumen/storage/logs/.gitignore b/modules/swagger-codegen/src/main/resources/lumen/storage/logs/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/storage/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/modules/swagger-codegen/src/main/resources/lumen/tests/ExampleTest.php b/modules/swagger-codegen/src/main/resources/lumen/tests/ExampleTest.php new file mode 100644 index 000000000000..2b206c66173e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/tests/ExampleTest.php @@ -0,0 +1,20 @@ +get('/'); + + $this->assertEquals( + $this->response->getContent(), $this->app->version() + ); + } +} diff --git a/modules/swagger-codegen/src/main/resources/lumen/tests/TestCase.php b/modules/swagger-codegen/src/main/resources/lumen/tests/TestCase.php new file mode 100644 index 000000000000..651d9cbd67f3 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/lumen/tests/TestCase.php @@ -0,0 +1,14 @@ + 1.0', '>= 1.0.1' s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3' diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/lumen/LumenServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/lumen/LumenServerOptionsTest.java new file mode 100644 index 000000000000..71d9b3942f19 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/lumen/LumenServerOptionsTest.java @@ -0,0 +1,33 @@ +package io.swagger.codegen.slim; + +import io.swagger.codegen.AbstractOptionsTest; +import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.languages.LumenServerCodegen; +import io.swagger.codegen.options.LumenServerOptionsProvider; + +import mockit.Expectations; +import mockit.Tested; + +public class LumenServerOptionsTest extends AbstractOptionsTest { + + @Tested + private LumenServerCodegen clientCodegen; + + public LumenServerOptionsTest() { + super(new LumenServerOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void setExpectations() { + new Expectations(clientCodegen) {{ + clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(LumenServerOptionsProvider.SORT_PARAMS_VALUE)); + times = 1; + }}; + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/LumenServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/LumenServerOptionsProvider.java new file mode 100644 index 000000000000..1ffc290ee461 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/LumenServerOptionsProvider.java @@ -0,0 +1,30 @@ +package io.swagger.codegen.options; + +import io.swagger.codegen.CodegenConstants; + +import com.google.common.collect.ImmutableMap; + +import java.util.Map; + +public class LumenServerOptionsProvider implements OptionsProvider { + public static final String SORT_PARAMS_VALUE = "false"; + public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; + + @Override + public String getLanguage() { + return "lumen"; + } + + @Override + public Map createOptions() { + ImmutableMap.Builder builder = new ImmutableMap.Builder(); + return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) + .build(); + } + + @Override + public boolean isServer() { + return true; + } +} diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index bf84cf9c38cb..01c0be8c9a32 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -717,6 +717,8 @@ definitions: readOnly: true type: integer format: int32 + property: + type: string xml: name: Name 200_response: diff --git a/modules/swagger-generator/src/test/java/io/swagger/generator/online/OnlineGeneratorOptionsTest.java b/modules/swagger-generator/src/test/java/io/swagger/generator/online/OnlineGeneratorOptionsTest.java index 2ae76374adb1..9a50c9481f69 100644 --- a/modules/swagger-generator/src/test/java/io/swagger/generator/online/OnlineGeneratorOptionsTest.java +++ b/modules/swagger-generator/src/test/java/io/swagger/generator/online/OnlineGeneratorOptionsTest.java @@ -56,7 +56,7 @@ public class OnlineGeneratorOptionsTest { {new StaticHtmlOptionsProvider()}, {new SwaggerOptionsProvider()}, {new SwaggerYamlOptionsProvider()}, {new SwiftOptionsProvider()}, {new TizenClientOptionsProvider()}, {new TypeScriptAngularClientOptionsProvider()}, - {new TypeScriptNodeClientOptionsProvider()} + {new TypeScriptNodeClientOptionsProvider()}, {new LumenServerOptionsProvider()} }; } diff --git a/samples/client/petstore/android/default/build.gradle b/samples/client/petstore/android/default/build.gradle index e48f72b31389..42adec67a418 100644 --- a/samples/client/petstore/android/default/build.gradle +++ b/samples/client/petstore/android/default/build.gradle @@ -7,9 +7,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' - } } diff --git a/samples/client/petstore/android/default/hello.txt b/samples/client/petstore/android/default/hello.txt deleted file mode 100644 index 6769dd60bdf5..000000000000 --- a/samples/client/petstore/android/default/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java index 17ff327a8aa3..e725cf3291db 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java @@ -35,38 +35,10 @@ public class JsonUtil { public static Type getListTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); - if ("Animal".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("Cat".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - if ("Category".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } - if ("Dog".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("InlineResponse200".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("Model200Response".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("ModelReturn".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("Name".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - if ("Order".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } @@ -75,10 +47,6 @@ public class JsonUtil { return new TypeToken>(){}.getType(); } - if ("SpecialModelName".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - if ("Tag".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } @@ -93,38 +61,10 @@ public class JsonUtil { public static Type getTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); - if ("Animal".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("Cat".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - if ("Category".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } - if ("Dog".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("InlineResponse200".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("Model200Response".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("ModelReturn".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("Name".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - if ("Order".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } @@ -133,10 +73,6 @@ public class JsonUtil { return new TypeToken(){}.getType(); } - if ("SpecialModelName".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - if ("Tag".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/PetApi.java index 41dac192d82e..52e84575ad33 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/PetApi.java @@ -9,7 +9,6 @@ import io.swagger.client.model.*; import java.util.*; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; import java.io.File; import org.apache.http.entity.mime.MultipartEntityBuilder; @@ -38,7 +37,6 @@ public class PetApi { return basePath; } - /** * Add a new pet to the store * @@ -59,9 +57,7 @@ public class PetApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { "application/json","application/xml" @@ -76,8 +72,7 @@ public class PetApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -91,60 +86,6 @@ public class PetApi { throw ex; } } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - * @return void - */ - public void addPetUsingByteArray (byte[] body) throws ApiException { - Object localVarPostBody = body; - - - // create path and map variables - String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - // header params - Map localVarHeaderParams = new HashMap(); - // form params - Map localVarFormParams = new HashMap(); - - - - - - String[] localVarContentTypes = { - "application/json","application/xml" - }; - String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json"; - - if (localVarContentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - localVarPostBody = localVarBuilder.build(); - } else { - // normal form params - - } - - try { - String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); - if(localVarResponse != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - throw ex; - } - } - /** * Deletes a pet * @@ -171,11 +112,8 @@ public class PetApi { // form params Map localVarFormParams = new HashMap(); - - localVarHeaderParams.put("api_key", ApiInvoker.parameterToString(apiKey)); - String[] localVarContentTypes = { @@ -190,8 +128,7 @@ public class PetApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -205,11 +142,10 @@ public class PetApi { throw ex; } } - /** * 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 + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter * @return List */ public List findPetsByStatus (List status) throws ApiException { @@ -226,11 +162,8 @@ public class PetApi { // form params Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status)); - - String[] localVarContentTypes = { @@ -245,8 +178,7 @@ public class PetApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -260,7 +192,6 @@ public class PetApi { throw ex; } } - /** * Finds Pets by tags * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. @@ -281,11 +212,8 @@ public class PetApi { // form params Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags)); - - String[] localVarContentTypes = { @@ -300,8 +228,7 @@ public class PetApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -315,7 +242,6 @@ public class PetApi { throw ex; } } - /** * Find pet by ID * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -341,9 +267,7 @@ public class PetApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -358,8 +282,7 @@ public class PetApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -373,123 +296,6 @@ public class PetApi { throw ex; } } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return InlineResponse200 - */ - public InlineResponse200 getPetByIdInObject (Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - // header params - Map localVarHeaderParams = new HashMap(); - // form params - Map localVarFormParams = new HashMap(); - - - - - - String[] localVarContentTypes = { - - }; - String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json"; - - if (localVarContentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - localVarPostBody = localVarBuilder.build(); - } else { - // normal form params - - } - - try { - String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); - if(localVarResponse != null){ - return (InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class); - } - else { - return null; - } - } catch (ApiException ex) { - throw ex; - } - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return byte[] - */ - public byte[] petPetIdtestingByteArraytrueGet (Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - // header params - Map localVarHeaderParams = new HashMap(); - // form params - Map localVarFormParams = new HashMap(); - - - - - - String[] localVarContentTypes = { - - }; - String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json"; - - if (localVarContentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - localVarPostBody = localVarBuilder.build(); - } else { - // normal form params - - } - - try { - String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); - if(localVarResponse != null){ - return (byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class); - } - else { - return null; - } - } catch (ApiException ex) { - throw ex; - } - } - /** * Update an existing pet * @@ -510,9 +316,7 @@ public class PetApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { "application/json","application/xml" @@ -527,8 +331,7 @@ public class PetApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -542,7 +345,6 @@ public class PetApi { throw ex; } } - /** * Updates a pet in the store with form data * @@ -570,9 +372,7 @@ public class PetApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -596,8 +396,7 @@ public class PetApi { } else { // normal form params localVarFormParams.put("name", ApiInvoker.parameterToString(name)); - localVarFormParams.put("status", ApiInvoker.parameterToString(status)); - +localVarFormParams.put("status", ApiInvoker.parameterToString(status)); } try { @@ -612,7 +411,6 @@ public class PetApi { throw ex; } } - /** * uploads an image * @@ -640,9 +438,7 @@ public class PetApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { "multipart/form-data" @@ -666,8 +462,7 @@ public class PetApi { } else { // normal form params localVarFormParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata)); - - + } try { @@ -682,5 +477,4 @@ public class PetApi { throw ex; } } - } diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/StoreApi.java index d5ecbca1ab33..d20c70ad997f 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/StoreApi.java @@ -8,8 +8,8 @@ import io.swagger.client.model.*; import java.util.*; -import io.swagger.client.model.Order; import java.util.Map; +import io.swagger.client.model.Order; import org.apache.http.entity.mime.MultipartEntityBuilder; @@ -37,7 +37,6 @@ public class StoreApi { return basePath; } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -63,9 +62,7 @@ public class StoreApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -80,8 +77,7 @@ public class StoreApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -95,62 +91,6 @@ public class StoreApi { throw ex; } } - - /** - * 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 - * @return List - */ - public List findOrdersByStatus (String status) throws ApiException { - Object localVarPostBody = null; - - - // create path and map variables - String localVarPath = "/store/findByStatus".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - // header params - Map localVarHeaderParams = new HashMap(); - // form params - Map localVarFormParams = new HashMap(); - - - localVarQueryParams.addAll(ApiInvoker.parameterToPairs("", "status", status)); - - - - - String[] localVarContentTypes = { - - }; - String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json"; - - if (localVarContentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - localVarPostBody = localVarBuilder.build(); - } else { - // normal form params - - } - - try { - String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); - if(localVarResponse != null){ - return (List) ApiInvoker.deserialize(localVarResponse, "array", Order.class); - } - else { - return null; - } - } catch (ApiException ex) { - throw ex; - } - } - /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -170,9 +110,7 @@ public class StoreApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -187,8 +125,7 @@ public class StoreApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -202,62 +139,9 @@ public class StoreApi { throw ex; } } - - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Object - */ - public Object getInventoryInObject () throws ApiException { - Object localVarPostBody = null; - - - // create path and map variables - String localVarPath = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - // header params - Map localVarHeaderParams = new HashMap(); - // form params - Map localVarFormParams = new HashMap(); - - - - - - String[] localVarContentTypes = { - - }; - String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json"; - - if (localVarContentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - localVarPostBody = localVarBuilder.build(); - } else { - // normal form params - - } - - try { - String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); - if(localVarResponse != null){ - return (Object) ApiInvoker.deserialize(localVarResponse, "", Object.class); - } - else { - return null; - } - } catch (ApiException ex) { - throw ex; - } - } - /** * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order */ @@ -280,9 +164,7 @@ public class StoreApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -297,8 +179,7 @@ public class StoreApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -312,7 +193,6 @@ public class StoreApi { throw ex; } } - /** * Place an order for a pet * @@ -333,9 +213,7 @@ public class StoreApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -350,8 +228,7 @@ public class StoreApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -365,5 +242,4 @@ public class StoreApi { throw ex; } } - } diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java index 848f1d2a6cc8..5f61ba724ae2 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java @@ -37,7 +37,6 @@ public class UserApi { return basePath; } - /** * Create user * This can only be done by the logged in user. @@ -58,9 +57,7 @@ public class UserApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -75,8 +72,7 @@ public class UserApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -90,7 +86,6 @@ public class UserApi { throw ex; } } - /** * Creates list of users with given input array * @@ -111,9 +106,7 @@ public class UserApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -128,8 +121,7 @@ public class UserApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -143,7 +135,6 @@ public class UserApi { throw ex; } } - /** * Creates list of users with given input array * @@ -164,9 +155,7 @@ public class UserApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -181,8 +170,7 @@ public class UserApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -196,7 +184,6 @@ public class UserApi { throw ex; } } - /** * Delete user * This can only be done by the logged in user. @@ -222,9 +209,7 @@ public class UserApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -239,8 +224,7 @@ public class UserApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -254,7 +238,6 @@ public class UserApi { throw ex; } } - /** * Get user by user name * @@ -280,9 +263,7 @@ public class UserApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -297,8 +278,7 @@ public class UserApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -312,7 +292,6 @@ public class UserApi { throw ex; } } - /** * Logs user into the system * @@ -334,13 +313,9 @@ public class UserApi { // form params Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(ApiInvoker.parameterToPairs("", "username", username)); - localVarQueryParams.addAll(ApiInvoker.parameterToPairs("", "password", password)); - - String[] localVarContentTypes = { @@ -355,8 +330,7 @@ public class UserApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -370,7 +344,6 @@ public class UserApi { throw ex; } } - /** * Logs out current logged in user session * @@ -390,9 +363,7 @@ public class UserApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -407,8 +378,7 @@ public class UserApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -422,7 +392,6 @@ public class UserApi { throw ex; } } - /** * Updated user * This can only be done by the logged in user. @@ -449,9 +418,7 @@ public class UserApi { // form params Map localVarFormParams = new HashMap(); - - String[] localVarContentTypes = { @@ -466,8 +433,7 @@ public class UserApi { localVarPostBody = localVarBuilder.build(); } else { // normal form params - - } + } try { String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType); @@ -481,5 +447,4 @@ public class UserApi { throw ex; } } - } diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java deleted file mode 100644 index 6f956f69f9e5..000000000000 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class Animal { - - @SerializedName("className") - private String className = null; - - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Animal {\n"); - - sb.append(" className: ").append(className).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java deleted file mode 100644 index b0cd7e96b432..000000000000 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.swagger.client.model; - -import io.swagger.client.model.Animal; - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class Cat extends Animal { - - @SerializedName("className") - private String className = null; - @SerializedName("declawed") - private Boolean declawed = null; - - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - - /** - **/ - @ApiModelProperty(value = "") - public Boolean getDeclawed() { - return declawed; - } - public void setDeclawed(Boolean declawed) { - this.declawed = declawed; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Cat {\n"); - sb.append(" " + super.toString()).append("\n"); - sb.append(" className: ").append(className).append("\n"); - sb.append(" declawed: ").append(declawed).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Category.java index 44c71e8a6208..f5d5ea86b631 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Category.java @@ -13,7 +13,6 @@ public class Category { @SerializedName("name") private String name = null; - /** **/ @ApiModelProperty(value = "") @@ -24,7 +23,6 @@ public class Category { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -35,7 +33,27 @@ public class Category { this.name = name; } - + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return (id == null ? category.id == null : id.equals(category.id)) && + (name == null ? category.name == null : name.equals(category.name)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (name == null ? 0: name.hashCode()); + return result; + } @Override public String toString() { diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java deleted file mode 100644 index 07b2df5488a2..000000000000 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.swagger.client.model; - -import io.swagger.client.model.Animal; - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class Dog extends Animal { - - @SerializedName("className") - private String className = null; - @SerializedName("breed") - private String breed = null; - - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - - /** - **/ - @ApiModelProperty(value = "") - public String getBreed() { - return breed; - } - public void setBreed(String breed) { - this.breed = breed; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Dog {\n"); - sb.append(" " + super.toString()).append("\n"); - sb.append(" className: ").append(className).append("\n"); - sb.append(" breed: ").append(breed).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java deleted file mode 100644 index 303d160d764e..000000000000 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java +++ /dev/null @@ -1,112 +0,0 @@ -package io.swagger.client.model; - -import io.swagger.client.model.Tag; -import java.util.*; - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class InlineResponse200 { - - @SerializedName("photoUrls") - private List photoUrls = null; - @SerializedName("name") - private String name = null; - @SerializedName("id") - private Long id = null; - @SerializedName("category") - private Object category = null; - @SerializedName("tags") - private List tags = null; - public enum StatusEnum { - available, pending, sold, - }; - @SerializedName("status") - private StatusEnum status = null; - - - /** - **/ - @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(value = "") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } - - - /** - **/ - @ApiModelProperty(value = "") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - - /** - * pet status in the store - **/ - @ApiModelProperty(value = "pet status in the store") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); - - sb.append(" photoUrls: ").append(photoUrls).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append(" id: ").append(id).append("\n"); - sb.append(" category: ").append(category).append("\n"); - sb.append(" tags: ").append(tags).append("\n"); - sb.append(" status: ").append(status).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java deleted file mode 100644 index 6d3c93d9799e..000000000000 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -/** - * Model for testing model name starting with number - **/ -@ApiModel(description = "Model for testing model name starting with number") -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 String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Model200Response {\n"); - - sb.append(" name: ").append(name).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java deleted file mode 100644 index 464b0cca25e8..000000000000 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -/** - * Model for testing reserved words - **/ -@ApiModel(description = "Model for testing reserved words") -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 String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelReturn {\n"); - - sb.append(" _return: ").append(_return).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java deleted file mode 100644 index 1b320fb26ea1..000000000000 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java +++ /dev/null @@ -1,53 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -/** - * Model for testing model name same as property name - **/ -@ApiModel(description = "Model for testing model name same as property name") -public class Name { - - @SerializedName("name") - private Integer name = null; - @SerializedName("snake_case") - private Integer snakeCase = null; - - - /** - **/ - @ApiModelProperty(value = "") - public Integer getName() { - return name; - } - public void setName(Integer name) { - this.name = name; - } - - - /** - **/ - @ApiModelProperty(value = "") - public Integer getSnakeCase() { - return snakeCase; - } - public void setSnakeCase(Integer snakeCase) { - this.snakeCase = snakeCase; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Name {\n"); - - sb.append(" name: ").append(name).append("\n"); - sb.append(" snakeCase: ").append(snakeCase).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Order.java index f3f42db615c5..f184238f7176 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Order.java @@ -25,7 +25,6 @@ public class Order { @SerializedName("complete") private Boolean complete = null; - /** **/ @ApiModelProperty(value = "") @@ -36,7 +35,6 @@ public class Order { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -47,7 +45,6 @@ public class Order { this.petId = petId; } - /** **/ @ApiModelProperty(value = "") @@ -58,7 +55,6 @@ public class Order { this.quantity = quantity; } - /** **/ @ApiModelProperty(value = "") @@ -69,7 +65,6 @@ public class Order { this.shipDate = shipDate; } - /** * Order Status **/ @@ -81,7 +76,6 @@ public class Order { this.status = status; } - /** **/ @ApiModelProperty(value = "") @@ -92,7 +86,35 @@ public class Order { this.complete = complete; } - + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return (id == null ? order.id == null : id.equals(order.id)) && + (petId == null ? order.petId == null : petId.equals(order.petId)) && + (quantity == null ? order.quantity == null : quantity.equals(order.quantity)) && + (shipDate == null ? order.shipDate == null : shipDate.equals(order.shipDate)) && + (status == null ? order.status == null : status.equals(order.status)) && + (complete == null ? order.complete == null : complete.equals(order.complete)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (petId == null ? 0: petId.hashCode()); + result = 31 * result + (quantity == null ? 0: quantity.hashCode()); + result = 31 * result + (shipDate == null ? 0: shipDate.hashCode()); + result = 31 * result + (status == null ? 0: status.hashCode()); + result = 31 * result + (complete == null ? 0: complete.hashCode()); + return result; + } @Override public String toString() { diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Pet.java index 20865ad54340..e471a300a313 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Pet.java @@ -27,7 +27,6 @@ public class Pet { @SerializedName("status") private StatusEnum status = null; - /** **/ @ApiModelProperty(value = "") @@ -38,7 +37,6 @@ public class Pet { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -49,7 +47,6 @@ public class Pet { this.category = category; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -60,7 +57,6 @@ public class Pet { this.name = name; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -71,7 +67,6 @@ public class Pet { this.photoUrls = photoUrls; } - /** **/ @ApiModelProperty(value = "") @@ -82,7 +77,6 @@ public class Pet { this.tags = tags; } - /** * pet status in the store **/ @@ -94,7 +88,35 @@ public class Pet { this.status = status; } - + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return (id == null ? pet.id == null : id.equals(pet.id)) && + (category == null ? pet.category == null : category.equals(pet.category)) && + (name == null ? pet.name == null : name.equals(pet.name)) && + (photoUrls == null ? pet.photoUrls == null : photoUrls.equals(pet.photoUrls)) && + (tags == null ? pet.tags == null : tags.equals(pet.tags)) && + (status == null ? pet.status == null : status.equals(pet.status)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (category == null ? 0: category.hashCode()); + result = 31 * result + (name == null ? 0: name.hashCode()); + result = 31 * result + (photoUrls == null ? 0: photoUrls.hashCode()); + result = 31 * result + (tags == null ? 0: tags.hashCode()); + result = 31 * result + (status == null ? 0: status.hashCode()); + return result; + } @Override public String toString() { diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/SpecialModelName.java deleted file mode 100644 index d804bdd8765b..000000000000 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/SpecialModelName.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -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 String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SpecialModelName {\n"); - - sb.append(" specialPropertyName: ").append(specialPropertyName).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Tag.java index 7c9651b1ba8e..722e9194eb28 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Tag.java @@ -13,7 +13,6 @@ public class Tag { @SerializedName("name") private String name = null; - /** **/ @ApiModelProperty(value = "") @@ -24,7 +23,6 @@ public class Tag { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -35,7 +33,27 @@ public class Tag { this.name = name; } - + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return (id == null ? tag.id == null : id.equals(tag.id)) && + (name == null ? tag.name == null : name.equals(tag.name)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (name == null ? 0: name.hashCode()); + return result; + } @Override public String toString() { diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/User.java index dc022697eb0f..4f0a64671e23 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/User.java @@ -25,7 +25,6 @@ public class User { @SerializedName("userStatus") private Integer userStatus = null; - /** **/ @ApiModelProperty(value = "") @@ -36,7 +35,6 @@ public class User { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -47,7 +45,6 @@ public class User { this.username = username; } - /** **/ @ApiModelProperty(value = "") @@ -58,7 +55,6 @@ public class User { this.firstName = firstName; } - /** **/ @ApiModelProperty(value = "") @@ -69,7 +65,6 @@ public class User { this.lastName = lastName; } - /** **/ @ApiModelProperty(value = "") @@ -80,7 +75,6 @@ public class User { this.email = email; } - /** **/ @ApiModelProperty(value = "") @@ -91,7 +85,6 @@ public class User { this.password = password; } - /** **/ @ApiModelProperty(value = "") @@ -102,7 +95,6 @@ public class User { this.phone = phone; } - /** * User Status **/ @@ -114,7 +106,39 @@ public class User { this.userStatus = userStatus; } - + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return (id == null ? user.id == null : id.equals(user.id)) && + (username == null ? user.username == null : username.equals(user.username)) && + (firstName == null ? user.firstName == null : firstName.equals(user.firstName)) && + (lastName == null ? user.lastName == null : lastName.equals(user.lastName)) && + (email == null ? user.email == null : email.equals(user.email)) && + (password == null ? user.password == null : password.equals(user.password)) && + (phone == null ? user.phone == null : phone.equals(user.phone)) && + (userStatus == null ? user.userStatus == null : userStatus.equals(user.userStatus)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (username == null ? 0: username.hashCode()); + result = 31 * result + (firstName == null ? 0: firstName.hashCode()); + result = 31 * result + (lastName == null ? 0: lastName.hashCode()); + result = 31 * result + (email == null ? 0: email.hashCode()); + result = 31 * result + (password == null ? 0: password.hashCode()); + result = 31 * result + (phone == null ? 0: phone.hashCode()); + result = 31 * result + (userStatus == null ? 0: userStatus.hashCode()); + return result; + } @Override public String toString() { diff --git a/samples/client/petstore/android/default/src/test/java/io/swagger/client/ApiInvokerTest.java b/samples/client/petstore/android/default/src/test/java/io/swagger/client/ApiInvokerTest.java deleted file mode 100644 index 3e4b114012c0..000000000000 --- a/samples/client/petstore/android/default/src/test/java/io/swagger/client/ApiInvokerTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package io.swagger.client; - -import org.junit.*; -import static org.junit.Assert.*; - -import java.util.*; - - -public class ApiInvokerTest { - - @Test - public void testParameterToPairsWhenNameIsInvalid() throws Exception { - List pairs_a = ApiInvoker.parameterToPairs("csv", null, new Integer(1)); - List pairs_b = ApiInvoker.parameterToPairs("csv", "", new Integer(1)); - - assertTrue(pairs_a.isEmpty()); - assertTrue(pairs_b.isEmpty()); - } - - @Test - public void testParameterToPairsWhenValueIsNull() throws Exception { - List pairs = ApiInvoker.parameterToPairs("csv", "param-a", null); - - assertTrue(pairs.isEmpty()); - } - - @Test - public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception { - - // single empty string - List pairs = ApiInvoker.parameterToPairs("csv", "param-a", " "); - assertEquals(1, pairs.size()); - - // list of empty strings - List strs = new ArrayList(); - strs.add(" "); - strs.add(" "); - strs.add(" "); - - List concatStrings = ApiInvoker.parameterToPairs("csv", "param-a", strs); - - assertEquals(1, concatStrings.size()); - assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters - } - - @Test - public void testParameterToPairsWhenValueIsNotCollection() throws Exception { - String name = "param-a"; - Integer value = 1; - - List pairs = ApiInvoker.parameterToPairs("csv", name, value); - - assertEquals(1, pairs.size()); - assertEquals(value, Integer.valueOf(pairs.get(0).getValue())); - } - - @Test - public void testParameterToPairsWhenValueIsCollection() throws Exception { - Map collectionFormatMap = new HashMap(); - collectionFormatMap.put("csv", ","); - collectionFormatMap.put("tsv", "\t"); - collectionFormatMap.put("ssv", " "); - collectionFormatMap.put("pipes", "\\|"); - collectionFormatMap.put("", ","); // no format, must default to csv - collectionFormatMap.put("unknown", ","); // all other formats, must default to csv - - String name = "param-a"; - - List values = new ArrayList(); - values.add("value-a"); - values.add(123); - values.add(new Date()); - - // check for multi separately - List multiPairs = ApiInvoker.parameterToPairs("multi", name, values); - assertEquals(values.size(), multiPairs.size()); - - // all other formats - for (String collectionFormat : collectionFormatMap.keySet()) { - List pairs = ApiInvoker.parameterToPairs(collectionFormat, name, values); - - assertEquals(1, pairs.size()); - - String delimiter = collectionFormatMap.get(collectionFormat); - String[] pairValueSplit = pairs.get(0).getValue().split(delimiter); - - // must equal input values - assertEquals(values.size(), pairValueSplit.length); - } - } -} diff --git a/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/PetApiTest.java deleted file mode 100644 index 75039a9fa397..000000000000 --- a/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ /dev/null @@ -1,164 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import io.swagger.client.ApiException; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.junit.*; -import static org.junit.Assert.*; - -public class PetApiTest { - PetApi api = null; - - @Before - public void setup() { - api = new PetApi(); - } - - @Test - public void testCreateAndGetPet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testUpdatePet() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testFindPetsByStatus() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.available); - - api.updatePet(pet); - - List pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - } - - @Test - @Ignore - /* ignoring the findPetByTags test below as it's very similar to - * testFindPetsByStatus and testFindPetsByTags sometimes got 500 - * due to server issue, which makes the test unstable. - */ - public void testFindPetsByTags() throws Exception { - Pet pet = createRandomPet(); - pet.setName("monster"); - pet.setStatus(Pet.StatusEnum.available); - - List tags = new ArrayList(); - Tag tag1 = new Tag(); - tag1.setName("friendly"); - tags.add(tag1); - pet.setTags(tags); - - api.updatePet(pet); - - List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - assertTrue(found); - } - - @Test - public void testUpdatePetWithForm() throws Exception { - Pet pet = createRandomPet(); - pet.setName("frank"); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertEquals("frank", fetched.getName()); - - api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null); - Pet updated = api.getPetById(fetched.getId()); - assertEquals("furt", updated.getName()); - } - - @Test - public void testDeletePet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - api.deletePet(fetched.getId(), null); - - try { - fetched = api.getPetById(fetched.getId()); - fail("expected an error"); - } catch (ApiException e) { - assertEquals(404, e.getCode()); - } - } - - @Test - public void testUploadFile() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - File file = new File("hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("Hello world!"); - writer.close(); - - api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(System.currentTimeMillis()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.available); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); - pet.setPhotoUrls(photos); - - return pet; - } -} diff --git a/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java deleted file mode 100644 index 71ba4291ca96..000000000000 --- a/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import io.swagger.client.ApiException; - -import java.util.Map; - -import org.junit.*; -import static org.junit.Assert.*; - -public class StoreApiTest { - StoreApi api = null; - - @Before - public void setup() { - api = new StoreApi(); - } - - @Test - public void testGetInventory() throws Exception { - Map inventory = api.getInventory(); - assertTrue(inventory.keySet().size() > 0); - } - - @Test - public void testPlaceOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(String.valueOf(order.getId())); - assertEquals(order.getId(), fetched.getId()); - assertEquals(order.getPetId(), fetched.getPetId()); - assertEquals(order.getQuantity(), fetched.getQuantity()); - } - - @Test - public void testDeleteOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(String.valueOf(order.getId())); - assertEquals(fetched.getId(), order.getId()); - - api.deleteOrder(String.valueOf(order.getId())); - - try { - api.getOrderById(String.valueOf(order.getId())); - // fail("expected an error"); - } catch (ApiException e) { - // ok - } - } - - private Order createOrder() { - Order order = new Order(); - order.setId(new Long(System.currentTimeMillis())); - order.setPetId(new Long(200)); - order.setQuantity(new Integer(13)); - order.setShipDate(new java.util.Date()); - order.setStatus(Order.StatusEnum.placed); - order.setComplete(true); - - return order; - } -} \ No newline at end of file diff --git a/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/UserApiTest.java b/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/UserApiTest.java deleted file mode 100644 index 6f5877d24a29..000000000000 --- a/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/UserApiTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import java.util.Arrays; - -import org.junit.*; -import static org.junit.Assert.*; - -public class UserApiTest { - UserApi api = null; - - @Before - public void setup() { - api = new UserApi(); - } - - @Test - public void testCreateUser() throws Exception { - User user = createUser(); - - api.createUser(user); - - User fetched = api.getUserByName(user.getUsername()); - assertEquals(user.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithArray() throws Exception { - User user1 = createUser(); - user1.setUsername("abc123"); - User user2 = createUser(); - user2.setUsername("123abc"); - - api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithList() throws Exception { - User user1 = createUser(); - user1.setUsername("abc123"); - User user2 = createUser(); - user2.setUsername("123abc"); - - api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testLoginUser() throws Exception { - User user = createUser(); - api.createUser(user); - - String token = api.loginUser(user.getUsername(), user.getPassword()); - assertTrue(token.startsWith("logged in user session:")); - } - - @Test - public void logoutUser() throws Exception { - api.logoutUser(); - } - - private User createUser() { - User user = new User(); - user.setId(System.currentTimeMillis()); - user.setUsername("fred"); - user.setFirstName("Fred"); - user.setLastName("Meyer"); - user.setEmail("fred@fredmeyer.com"); - user.setPassword("xxXXxx"); - user.setPhone("408-867-5309"); - user.setUserStatus(123); - - return user; - } -} \ No newline at end of file diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java index 7ef69c6f0ab4..cad5981703f8 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java @@ -189,14 +189,9 @@ public class ApiInvoker { // Setup authentications (key: authentication name, value: authentication). INSTANCE.authentications = new HashMap(); + INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key")); // TODO: comment out below as OAuth does not exist //INSTANCE.authentications.put("petstore_auth", new OAuth()); - INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); - INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); - INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - INSTANCE.authentications.put("test_http_basic", new HttpBasicAuth()); - INSTANCE.authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); - INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); // Prevent the authentications from being modified. INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications); } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java index 318c23f957de..e725cf3291db 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java @@ -35,42 +35,10 @@ public class JsonUtil { public static Type getListTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); - if ("Animal".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("Cat".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - if ("Category".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } - if ("Dog".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("FormatTest".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("InlineResponse200".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("Model200Response".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("ModelReturn".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - - if ("Name".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - if ("Order".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } @@ -79,10 +47,6 @@ public class JsonUtil { return new TypeToken>(){}.getType(); } - if ("SpecialModelName".equalsIgnoreCase(className)) { - return new TypeToken>(){}.getType(); - } - if ("Tag".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } @@ -97,42 +61,10 @@ public class JsonUtil { public static Type getTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); - if ("Animal".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("Cat".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - if ("Category".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } - if ("Dog".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("FormatTest".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("InlineResponse200".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("Model200Response".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("ModelReturn".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - - if ("Name".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - if ("Order".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } @@ -141,10 +73,6 @@ public class JsonUtil { return new TypeToken(){}.getType(); } - if ("SpecialModelName".equalsIgnoreCase(className)) { - return new TypeToken(){}.getType(); - } - if ("Tag".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/Responses.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/Responses.java deleted file mode 100644 index bc17fec1e853..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/Responses.java +++ /dev/null @@ -1,60 +0,0 @@ -package io.swagger.client; - -import java.util.List; -import io.swagger.client.model.*; - -public class Responses { - - - public static interface UserResponse { - public void onResponse(User user); - } - public static interface UserListResponse { - public void onResponse(List userList); - } - - - - public static interface CategoryResponse { - public void onResponse(Category category); - } - public static interface CategoryListResponse { - public void onResponse(List categoryList); - } - - - - public static interface PetResponse { - public void onResponse(Pet pet); - } - public static interface PetListResponse { - public void onResponse(List petList); - } - - - - public static interface TagResponse { - public void onResponse(Tag tag); - } - public static interface TagListResponse { - public void onResponse(List tagList); - } - - - - public static interface OrderResponse { - public void onResponse(Order order); - } - public static interface OrderListResponse { - public void onResponse(List orderList); - } - - - public static interface StringResponse { - public void onResponse(String response); - } - - public static interface StringListResponse { - public void onResponse(List stringList); - } -} \ No newline at end of file diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java index 2f39cf7cab10..c76ce6262bc1 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java @@ -12,7 +12,6 @@ import com.android.volley.Response; import com.android.volley.VolleyError; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; import java.io.File; import org.apache.http.HttpEntity; @@ -131,127 +130,6 @@ public class PetApi { - String[] contentTypes = { - "application/json","application/xml" - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "petstore_auth" }; - - try { - apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - responseListener.onResponse(localVarResponse); - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - * @return void - */ - public void addPetUsingByteArray (byte[] body) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - String[] contentTypes = { - "application/json","application/xml" - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "petstore_auth" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return ; - } else { - return ; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - VolleyError volleyError = (VolleyError)ex.getCause(); - if (volleyError.networkResponse != null) { - throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); - } - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array - */ - public void addPetUsingByteArray (byte[] body, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = body; - - - - // create path and map variables - String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - String[] contentTypes = { "application/json","application/xml" }; @@ -425,8 +303,8 @@ 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 + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter * @return List */ public List findPetsByStatus (List status) throws TimeoutException, ExecutionException, InterruptedException, ApiException { @@ -490,8 +368,8 @@ 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 + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter */ public void findPetsByStatus (List status, final Response.Listener> responseListener, final Response.ErrorListener errorListener) { Object postBody = null; @@ -721,7 +599,7 @@ public class PetApi { // normal form params } - String[] authNames = new String[] { "petstore_auth", "api_key" }; + String[] authNames = new String[] { "api_key", "petstore_auth" }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -791,7 +669,7 @@ public class PetApi { // normal form params } - String[] authNames = new String[] { "petstore_auth", "api_key" }; + String[] authNames = new String[] { "api_key", "petstore_auth" }; try { apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, @@ -815,280 +693,6 @@ public class PetApi { } } /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return InlineResponse200 - */ - public InlineResponse200 getPetByIdInObject (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling getPetByIdInObject", - new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject")); - } - - - // create path and map variables - String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "petstore_auth", "api_key" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return (InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class); - } else { - return null; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - VolleyError volleyError = (VolleyError)ex.getCause(); - if (volleyError.networkResponse != null) { - throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); - } - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - */ - public void getPetByIdInObject (Long petId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - // verify the required parameter 'petId' is set - if (petId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling getPetByIdInObject", - new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject")); - } - - - // create path and map variables - String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "petstore_auth", "api_key" }; - - try { - apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - try { - responseListener.onResponse((InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class)); - } catch (ApiException exception) { - errorListener.onErrorResponse(new VolleyError(exception)); - } - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return byte[] - */ - public byte[] petPetIdtestingByteArraytrueGet (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet", - new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet")); - } - - - // create path and map variables - String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "petstore_auth", "api_key" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return (byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class); - } else { - return null; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - VolleyError volleyError = (VolleyError)ex.getCause(); - if (volleyError.networkResponse != null) { - throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); - } - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - */ - public void petPetIdtestingByteArraytrueGet (Long petId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - // verify the required parameter 'petId' is set - if (petId == null) { - VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet", - new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet")); - } - - - // create path and map variables - String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "petstore_auth", "api_key" }; - - try { - apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - try { - responseListener.onResponse((byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class)); - } catch (ApiException exception) { - errorListener.onErrorResponse(new VolleyError(exception)); - } - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - /** * Update an existing pet * * @param body Pet object that needs to be added to the store diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java index 2d7b1e7683f3..e39a1b01d525 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java @@ -11,8 +11,8 @@ import java.util.*; import com.android.volley.Response; import com.android.volley.VolleyError; -import io.swagger.client.model.Order; import java.util.Map; +import io.swagger.client.model.Order; import org.apache.http.HttpEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; @@ -178,133 +178,6 @@ 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 - * @return List - */ - public List findOrdersByStatus (String status) throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/store/findByStatus".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - queryParams.addAll(ApiInvoker.parameterToPairs("", "status", status)); - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return (List) ApiInvoker.deserialize(localVarResponse, "array", Order.class); - } else { - return null; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - VolleyError volleyError = (VolleyError)ex.getCause(); - if (volleyError.networkResponse != null) { - throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); - } - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * 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 - */ - public void findOrdersByStatus (String status, final Response.Listener> responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - - // create path and map variables - String path = "/store/findByStatus".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - queryParams.addAll(ApiInvoker.parameterToPairs("", "status", status)); - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" }; - - try { - apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - try { - responseListener.onResponse((List) ApiInvoker.deserialize(localVarResponse, "array", Order.class)); - } catch (ApiException exception) { - errorListener.onErrorResponse(new VolleyError(exception)); - } - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - /** * Returns pet inventories by status * Returns a map of status codes to quantities * @return Map @@ -429,130 +302,6 @@ public class StoreApi { } } /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Object - */ - public Object getInventoryInObject () throws TimeoutException, ExecutionException, InterruptedException, ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "api_key" }; - - try { - String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); - if(localVarResponse != null){ - return (Object) ApiInvoker.deserialize(localVarResponse, "", Object.class); - } else { - return null; - } - } catch (ApiException ex) { - throw ex; - } catch (InterruptedException ex) { - throw ex; - } catch (ExecutionException ex) { - if(ex.getCause() instanceof VolleyError) { - VolleyError volleyError = (VolleyError)ex.getCause(); - if (volleyError.networkResponse != null) { - throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); - } - } - throw ex; - } catch (TimeoutException ex) { - throw ex; - } - } - - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - - */ - public void getInventoryInObject (final Response.Listener responseListener, final Response.ErrorListener errorListener) { - Object postBody = null; - - - - // create path and map variables - String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - // header params - Map headerParams = new HashMap(); - // form params - Map formParams = new HashMap(); - - - - String[] contentTypes = { - - }; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if (contentType.startsWith("multipart/form-data")) { - // file uploading - MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create(); - - - HttpEntity httpEntity = localVarBuilder.build(); - postBody = httpEntity; - } else { - // normal form params - } - - String[] authNames = new String[] { "api_key" }; - - try { - apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, - new Response.Listener() { - @Override - public void onResponse(String localVarResponse) { - try { - responseListener.onResponse((Object) ApiInvoker.deserialize(localVarResponse, "", Object.class)); - } catch (ApiException exception) { - errorListener.onErrorResponse(new VolleyError(exception)); - } - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - errorListener.onErrorResponse(error); - } - }); - } catch (ApiException ex) { - errorListener.onErrorResponse(new VolleyError(ex)); - } - } - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched @@ -596,7 +345,7 @@ public class StoreApi { // normal form params } - String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" }; + String[] authNames = new String[] { }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -666,7 +415,7 @@ public class StoreApi { // normal form params } - String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" }; + String[] authNames = new String[] { }; try { apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, @@ -727,7 +476,7 @@ public class StoreApi { // normal form params } - String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" }; + String[] authNames = new String[] { }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -791,7 +540,7 @@ public class StoreApi { // normal form params } - String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" }; + String[] authNames = new String[] { }; try { apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames, diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java index 33575e314b9a..18eb24777b44 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java @@ -451,7 +451,7 @@ public class UserApi { // normal form params } - String[] authNames = new String[] { "test_http_basic" }; + String[] authNames = new String[] { }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -521,7 +521,7 @@ public class UserApi { // normal form params } - String[] authNames = new String[] { "test_http_basic" }; + String[] authNames = new String[] { }; try { apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames, diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java deleted file mode 100644 index 80b84fb850a3..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class Animal { - - @SerializedName("className") - private String className = null; - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Animal {\n"); - - sb.append(" className: ").append(className).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Cat.java deleted file mode 100644 index 449d6bddaa78..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Cat.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.swagger.client.model; - -import io.swagger.client.model.Animal; - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class Cat extends Animal { - - @SerializedName("className") - private String className = null; - @SerializedName("declawed") - private Boolean declawed = null; - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - /** - **/ - @ApiModelProperty(value = "") - public Boolean getDeclawed() { - return declawed; - } - public void setDeclawed(Boolean declawed) { - this.declawed = declawed; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Cat {\n"); - sb.append(" " + super.toString()).append("\n"); - sb.append(" className: ").append(className).append("\n"); - sb.append(" declawed: ").append(declawed).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java index b3fa2f933412..f5d5ea86b631 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java @@ -34,6 +34,27 @@ public class Category { } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return (id == null ? category.id == null : id.equals(category.id)) && + (name == null ? category.name == null : name.equals(category.name)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (name == null ? 0: name.hashCode()); + return result; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java deleted file mode 100644 index 8f35b9b0ea98..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.swagger.client.model; - -import io.swagger.client.model.Animal; - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class Dog extends Animal { - - @SerializedName("className") - private String className = null; - @SerializedName("breed") - private String breed = null; - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getBreed() { - return breed; - } - public void setBreed(String breed) { - this.breed = breed; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Dog {\n"); - sb.append(" " + super.toString()).append("\n"); - sb.append(" className: ").append(className).append("\n"); - sb.append(" breed: ").append(breed).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/FormatTest.java deleted file mode 100644 index 3f362afc925c..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/FormatTest.java +++ /dev/null @@ -1,179 +0,0 @@ -package io.swagger.client.model; - -import java.math.BigDecimal; -import java.util.Date; - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class FormatTest { - - @SerializedName("integer") - private Integer integer = null; - @SerializedName("int32") - private Integer int32 = null; - @SerializedName("int64") - private Long int64 = null; - @SerializedName("number") - private BigDecimal number = null; - @SerializedName("float") - private Float _float = null; - @SerializedName("double") - private Double _double = null; - @SerializedName("string") - private String string = null; - @SerializedName("byte") - private byte[] _byte = null; - @SerializedName("binary") - private byte[] binary = null; - @SerializedName("date") - private Date date = null; - @SerializedName("dateTime") - private Date dateTime = null; - @SerializedName("password") - private String password = null; - - /** - **/ - @ApiModelProperty(value = "") - public Integer getInteger() { - return integer; - } - public void setInteger(Integer integer) { - this.integer = integer; - } - - /** - **/ - @ApiModelProperty(value = "") - public Integer getInt32() { - return int32; - } - public void setInt32(Integer int32) { - this.int32 = int32; - } - - /** - **/ - @ApiModelProperty(value = "") - public Long getInt64() { - return int64; - } - public void setInt64(Long int64) { - this.int64 = int64; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public BigDecimal getNumber() { - return number; - } - public void setNumber(BigDecimal number) { - this.number = number; - } - - /** - **/ - @ApiModelProperty(value = "") - public Float getFloat() { - return _float; - } - public void setFloat(Float _float) { - this._float = _float; - } - - /** - **/ - @ApiModelProperty(value = "") - public Double getDouble() { - return _double; - } - public void setDouble(Double _double) { - this._double = _double; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getString() { - return string; - } - public void setString(String string) { - this.string = string; - } - - /** - **/ - @ApiModelProperty(value = "") - public byte[] getByte() { - return _byte; - } - public void setByte(byte[] _byte) { - this._byte = _byte; - } - - /** - **/ - @ApiModelProperty(value = "") - public byte[] getBinary() { - return binary; - } - public void setBinary(byte[] binary) { - this.binary = binary; - } - - /** - **/ - @ApiModelProperty(value = "") - public Date getDate() { - return date; - } - public void setDate(Date date) { - this.date = date; - } - - /** - **/ - @ApiModelProperty(value = "") - public Date getDateTime() { - return dateTime; - } - public void setDateTime(Date dateTime) { - this.dateTime = dateTime; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FormatTest {\n"); - - sb.append(" integer: ").append(integer).append("\n"); - sb.append(" int32: ").append(int32).append("\n"); - sb.append(" int64: ").append(int64).append("\n"); - sb.append(" number: ").append(number).append("\n"); - sb.append(" _float: ").append(_float).append("\n"); - sb.append(" _double: ").append(_double).append("\n"); - sb.append(" string: ").append(string).append("\n"); - sb.append(" _byte: ").append(_byte).append("\n"); - sb.append(" binary: ").append(binary).append("\n"); - sb.append(" date: ").append(date).append("\n"); - sb.append(" dateTime: ").append(dateTime).append("\n"); - sb.append(" password: ").append(password).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java deleted file mode 100644 index 85b56f0e488f..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java +++ /dev/null @@ -1,105 +0,0 @@ -package io.swagger.client.model; - -import io.swagger.client.model.Tag; -import java.util.*; - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -public class InlineResponse200 { - - @SerializedName("photoUrls") - private List photoUrls = null; - @SerializedName("name") - private String name = null; - @SerializedName("id") - private Long id = null; - @SerializedName("category") - private Object category = null; - @SerializedName("tags") - private List tags = null; - public enum StatusEnum { - available, pending, sold, - }; - @SerializedName("status") - private StatusEnum status = null; - - /** - **/ - @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } - - /** - **/ - @ApiModelProperty(value = "") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - /** - * pet status in the store - **/ - @ApiModelProperty(value = "pet status in the store") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); - - sb.append(" photoUrls: ").append(photoUrls).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append(" id: ").append(id).append("\n"); - sb.append(" category: ").append(category).append("\n"); - sb.append(" tags: ").append(tags).append("\n"); - sb.append(" status: ").append(status).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java deleted file mode 100644 index 31664d1e6cf1..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -/** - * Model for testing model name starting with number - **/ -@ApiModel(description = "Model for testing model name starting with number") -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 String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Model200Response {\n"); - - sb.append(" name: ").append(name).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java deleted file mode 100644 index f0b0802096ff..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -/** - * Model for testing reserved words - **/ -@ApiModel(description = "Model for testing reserved words") -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 String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelReturn {\n"); - - sb.append(" _return: ").append(_return).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java deleted file mode 100644 index d9f6153eb45f..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java +++ /dev/null @@ -1,50 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -/** - * Model for testing model name same as property name - **/ -@ApiModel(description = "Model for testing model name same as property name") -public class Name { - - @SerializedName("name") - private Integer name = null; - @SerializedName("snake_case") - private Integer snakeCase = null; - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Integer getName() { - return name; - } - public void setName(Integer name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(value = "") - public Integer getSnakeCase() { - return snakeCase; - } - public void setSnakeCase(Integer snakeCase) { - this.snakeCase = snakeCase; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Name {\n"); - - sb.append(" name: ").append(name).append("\n"); - sb.append(" snakeCase: ").append(snakeCase).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java index be6f1b96db2e..f184238f7176 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java @@ -87,6 +87,35 @@ public class Order { } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return (id == null ? order.id == null : id.equals(order.id)) && + (petId == null ? order.petId == null : petId.equals(order.petId)) && + (quantity == null ? order.quantity == null : quantity.equals(order.quantity)) && + (shipDate == null ? order.shipDate == null : shipDate.equals(order.shipDate)) && + (status == null ? order.status == null : status.equals(order.status)) && + (complete == null ? order.complete == null : complete.equals(order.complete)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (petId == null ? 0: petId.hashCode()); + result = 31 * result + (quantity == null ? 0: quantity.hashCode()); + result = 31 * result + (shipDate == null ? 0: shipDate.hashCode()); + result = 31 * result + (status == null ? 0: status.hashCode()); + result = 31 * result + (complete == null ? 0: complete.hashCode()); + return result; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java index 425b11a6ddc3..e471a300a313 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java @@ -89,6 +89,35 @@ public class Pet { } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return (id == null ? pet.id == null : id.equals(pet.id)) && + (category == null ? pet.category == null : category.equals(pet.category)) && + (name == null ? pet.name == null : name.equals(pet.name)) && + (photoUrls == null ? pet.photoUrls == null : photoUrls.equals(pet.photoUrls)) && + (tags == null ? pet.tags == null : tags.equals(pet.tags)) && + (status == null ? pet.status == null : status.equals(pet.status)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (category == null ? 0: category.hashCode()); + result = 31 * result + (name == null ? 0: name.hashCode()); + result = 31 * result + (photoUrls == null ? 0: photoUrls.hashCode()); + result = 31 * result + (tags == null ? 0: tags.hashCode()); + result = 31 * result + (status == null ? 0: status.hashCode()); + return result; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java deleted file mode 100644 index 78aae71a5c56..000000000000 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.swagger.client.model; - - -import io.swagger.annotations.*; -import com.google.gson.annotations.SerializedName; - - -@ApiModel(description = "") -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 String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SpecialModelName {\n"); - - sb.append(" specialPropertyName: ").append(specialPropertyName).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java index 2d21e6240dbc..722e9194eb28 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java @@ -34,6 +34,27 @@ public class Tag { } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return (id == null ? tag.id == null : id.equals(tag.id)) && + (name == null ? tag.name == null : name.equals(tag.name)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (name == null ? 0: name.hashCode()); + return result; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java index d2b89faec074..4f0a64671e23 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java @@ -107,6 +107,39 @@ public class User { } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return (id == null ? user.id == null : id.equals(user.id)) && + (username == null ? user.username == null : username.equals(user.username)) && + (firstName == null ? user.firstName == null : firstName.equals(user.firstName)) && + (lastName == null ? user.lastName == null : lastName.equals(user.lastName)) && + (email == null ? user.email == null : email.equals(user.email)) && + (password == null ? user.password == null : password.equals(user.password)) && + (phone == null ? user.phone == null : phone.equals(user.phone)) && + (userStatus == null ? user.userStatus == null : userStatus.equals(user.userStatus)); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (id == null ? 0: id.hashCode()); + result = 31 * result + (username == null ? 0: username.hashCode()); + result = 31 * result + (firstName == null ? 0: firstName.hashCode()); + result = 31 * result + (lastName == null ? 0: lastName.hashCode()); + result = 31 * result + (email == null ? 0: email.hashCode()); + result = 31 * result + (password == null ? 0: password.hashCode()); + result = 31 * result + (phone == null ? 0: phone.hashCode()); + result = 31 * result + (userStatus == null ? 0: userStatus.hashCode()); + return result; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/android/volley/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/android/volley/src/test/java/io/swagger/petstore/test/PetApiTest.java deleted file mode 100644 index 92812f805064..000000000000 --- a/samples/client/petstore/android/volley/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ /dev/null @@ -1,394 +0,0 @@ -package es.shyri.swagger.android.volley.petstore.full; - -import com.android.volley.ExecutorDelivery; -import com.android.volley.Network; -import com.android.volley.Response; -import com.android.volley.VolleyError; -import com.android.volley.toolbox.BasicNetwork; -import com.android.volley.toolbox.HttpStack; -import com.android.volley.toolbox.HurlStack; -import com.android.volley.toolbox.NoCache; - -import net.jodah.concurrentunit.Waiter; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.Executors; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiInvoker; -import io.swagger.client.api.PetApi; -import io.swagger.client.model.Category; -import io.swagger.client.model.Pet; - -import static com.ibm.icu.impl.Assert.fail; -import static junit.framework.Assert.assertTrue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - - -@RunWith(RobolectricTestRunner.class) -public class PetApiTest { - PetApi api = null; - - @Before - public void setup() { - HttpStack stack = new HurlStack(); - Network network = new BasicNetwork(stack); - ApiInvoker.initializeInstance(new NoCache(), network, 4, new ExecutorDelivery(Executors.newSingleThreadExecutor()), 30); - api = new PetApi(); - } - - @Test - public void testCreateAndGetPet() throws Exception { - final Waiter waiter = new Waiter(); - final Pet pet = createRandomPet(); - api.addPet(pet, new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - api.getPetById(pet.getId(), new Response.Listener() { - @Override - public void onResponse(Pet response) { - Pet fetched = response; - waiter.assertNotNull(fetched); - waiter.assertEquals(pet.getId(), fetched.getId()); - waiter.assertNotNull(fetched.getCategory()); - waiter.assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - } - - @Test - public void testUpdatePet() throws Exception { - final Waiter waiter = new Waiter(); - - final Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet, new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - api.getPetById(pet.getId(), new Response.Listener() { - @Override - public void onResponse(Pet fetched) { - waiter.assertNotNull(fetched); - waiter.assertEquals(pet.getId(), fetched.getId()); - waiter.assertNotNull(fetched.getCategory()); - waiter.assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - } - - @Test - public void testFindPetsByStatus() throws Exception { - final Waiter waiter = new Waiter(); - final Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.available); - - api.updatePet(pet, new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - api.findPetsByStatus(Arrays.asList(new String[]{"available"}), new Response.Listener>() { - @Override - public void onResponse(List pets) { - waiter.assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - waiter.assertTrue(found); - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - } - - @Test - public void testUpdatePetWithForm() throws Exception { - final Waiter waiter = new Waiter(); - final Pet pet = createRandomPet(); - pet.setName("frank"); - - api.addPet(pet, new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - final Pet[] fetched = new Pet[1]; - - api.getPetById(pet.getId(), new Response.Listener() { - @Override - public void onResponse(Pet petResponse) { - fetched[0] = petResponse; - waiter.assertEquals("frank", fetched[0].getName()); - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - api.updatePetWithForm(String.valueOf(fetched[0].getId()), "furt", null, new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - api.getPetById(fetched[0].getId(), new Response.Listener() { - @Override - public void onResponse(Pet updated) { - waiter.assertEquals("furt", updated.getName()); - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - } - - @Test - public void testDeletePet() throws Exception { - final Waiter waiter = new Waiter(); - - Pet pet = createRandomPet(); - api.addPet(pet, new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - final Pet[] fetched = new Pet[1]; - - api.getPetById(pet.getId(), new Response.Listener() { - @Override - public void onResponse(Pet response) { - fetched[0] = response; - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - api.deletePet(fetched[0].getId(), "special-key", new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - - api.getPetById(fetched[0].getId(), new Response.Listener() { - @Override - public void onResponse(Pet response) { - waiter.fail("expected an error"); - waiter.resume(); - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - waiter.assertEquals(404, error.networkResponse.statusCode); - waiter.resume(); - } - }); - waiter.await(); - } - - - - @Test - public void testUploadFile() throws Exception { - final Waiter waiter = new Waiter(); - - Pet pet = createRandomPet(); - api.addPet(pet, new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - - File file = new File("hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("Hello world!"); - writer.close(); - - api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath()), new Response.Listener() { - @Override - public void onResponse(String response) { - waiter.resume(); - } - }, createErrorListener(waiter)); - - waiter.await(); - } - - @Test - public void testCreateAndGetPetSync() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testUpdatePetSync() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testFindPetsByStatusSync() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.available); - - api.updatePet(pet); - - List pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - } - - @Test - public void testUpdatePetWithFormSync() throws Exception { - Pet pet = createRandomPet(); - pet.setName("frank"); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertEquals("frank", fetched.getName()); - - api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null); - Pet updated = api.getPetById(fetched.getId()); - assertEquals("furt", updated.getName()); - } - - @Test - public void testDeletePetSync() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - api.deletePet(fetched.getId(), null); - - try { - fetched = api.getPetById(fetched.getId()); - fail("expected an error"); - } catch (ApiException e) { - assertEquals(404, e.getCode()); - } - } - - @Test - public void testUploadFileSync() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - File file = new File("hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("Hello world!"); - writer.close(); - - api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(System.currentTimeMillis()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.available); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); - pet.setPhotoUrls(photos); - - return pet; - } - - private Response.ErrorListener createErrorListener(final Waiter waiter) { - return new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - error.printStackTrace(); - waiter.fail(error.getMessage()); - waiter.resume(); - } - }; - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs index 896cb8f12bff..c6c68253ca0e 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/NameTests.cs @@ -66,6 +66,14 @@ namespace IO.Swagger.Test { // TODO: unit test for the property 'SnakeCase' } + /// + /// Test the property 'Property' + /// + [Test] + public void PropertyTest() + { + // TODO: unit test for the property 'Property' + } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md index a73dec9973a4..a5c2cd333598 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md @@ -1,11 +1,12 @@ # IO.Swagger - the C# library for the Swagger Petstore + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 -- Package version: 1.0.0 -- Build date: 2016-04-17T23:54:21.676+08:00 +- SDK version: 1.0.0 +- Build date: 2016-04-21T17:22:44.115+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -29,10 +30,11 @@ Run the following command to generate the DLL - [Mac/Linux] `/bin/sh compile-mono.sh` - [Windows] `compile.bat` -Then include the DLL (under the `bin` folder) in the C# project, and import the packages: +Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: ```csharp using IO.Swagger.Api; using IO.Swagger.Client; +using IO.Swagger.Model; ``` ## Getting Started @@ -42,7 +44,7 @@ using System; using System.Diagnostics; using IO.Swagger.Api; using IO.Swagger.Client; - +using IO.Swagger.Model; namespace Example { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Animal.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Animal.md index ef6727b89c4a..46eb96c05f42 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Animal.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Animal.md @@ -1,8 +1,9 @@ # IO.Swagger.Model.Animal - ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md index 4a551f439987..3e4b4c5e9cbb 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.ApiResponse - ## Properties Name | Type | Description | Notes @@ -8,3 +7,5 @@ Name | Type | Description | Notes **Type** | **string** | | [optional] **Message** | **string** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Cat.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Cat.md index 0acd66d65304..e0034d4ab5d0 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Cat.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Cat.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.Cat - ## Properties Name | Type | Description | Notes @@ -7,3 +6,5 @@ Name | Type | Description | Notes **ClassName** | **string** | | **Declawed** | **bool?** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md index d0ebf1a1ec7e..20b56b1728c1 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.Category - ## Properties Name | Type | Description | Notes @@ -7,3 +6,5 @@ Name | Type | Description | Notes **Id** | **long?** | | [optional] **Name** | **string** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md index 12949333e192..0acf4182d942 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.Dog - ## Properties Name | Type | Description | Notes @@ -7,3 +6,5 @@ Name | Type | Description | Notes **ClassName** | **string** | | **Breed** | **string** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md index b32763555077..d29dc6b5d795 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.FormatTest - ## Properties Name | Type | Description | Notes @@ -17,3 +16,5 @@ Name | Type | Description | Notes **DateTime** | **DateTime?** | | [optional] **Password** | **string** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md index 647d981bc529..5cd7e66ea7ea 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md @@ -1,8 +1,9 @@ # IO.Swagger.Model.Model200Response - ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Name** | **int?** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md index 859f217de9d4..9895ccde2b0c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md @@ -1,8 +1,9 @@ # IO.Swagger.Model.ModelReturn - ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **_Return** | **int?** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md index a2b0df80869c..6cb961b6fcf9 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md @@ -1,9 +1,11 @@ # IO.Swagger.Model.Name - ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **_Name** | **int?** | | **SnakeCase** | **int?** | | [optional] +**Property** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md index b4ffb22e6bb2..32aeab388e52 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.Order - ## Properties Name | Type | Description | Notes @@ -11,3 +10,5 @@ Name | Type | Description | Notes **Status** | **string** | Order Status | [optional] **Complete** | **bool?** | | [optional] [default to false] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md index 74d7b6caca77..e83933d1c60a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.Pet - ## Properties Name | Type | Description | Notes @@ -11,3 +10,5 @@ Name | Type | Description | Notes **Tags** | [**List<Tag>**](Tag.md) | | [optional] **Status** | **string** | pet status in the store | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md index 46b1d566ba12..6d05169a4ccf 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md @@ -21,7 +21,7 @@ Add a new pet to the store -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -75,6 +75,8 @@ void (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **DeletePet** > void DeletePet (long? petId, string apiKey = null) @@ -82,7 +84,7 @@ Deletes a pet -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -138,6 +140,8 @@ void (empty response body) - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **FindPetsByStatus** > List FindPetsByStatus (List status) @@ -145,7 +149,7 @@ Finds Pets by status Multiple status values can be provided with comma separated strings -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -200,6 +204,8 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **FindPetsByTags** > List FindPetsByTags (List tags) @@ -207,7 +213,7 @@ Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -262,6 +268,8 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **GetPetById** > Pet GetPetById (long? petId) @@ -269,7 +277,7 @@ Find pet by ID Returns a single pet -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -326,6 +334,8 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **UpdatePet** > void UpdatePet (Pet body) @@ -333,7 +343,7 @@ Update an existing pet -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -387,6 +397,8 @@ void (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **UpdatePetWithForm** > void UpdatePetWithForm (long? petId, string name = null, string status = null) @@ -394,7 +406,7 @@ Updates a pet in the store with form data -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -452,6 +464,8 @@ void (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **UploadFile** > ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream file = null) @@ -459,7 +473,7 @@ uploads an image -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -518,3 +532,5 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md index 1d6f2f252de8..ee1bc3168353 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md @@ -1,8 +1,9 @@ # IO.Swagger.Model.SpecialModelName - ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SpecialPropertyName** | **long?** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md index 382e56160ebe..f558166ecb04 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md @@ -17,7 +17,7 @@ Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -68,6 +68,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **GetInventory** > Dictionary GetInventory () @@ -75,7 +77,7 @@ Returns pet inventories by status Returns a map of status codes to quantities -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -128,6 +130,8 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **GetOrderById** > Order GetOrderById (long? orderId) @@ -135,7 +139,7 @@ Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -187,6 +191,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **PlaceOrder** > Order PlaceOrder (Order body) @@ -194,7 +200,7 @@ Place an order for a pet -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -246,3 +252,5 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md index a68cd6f0ecc5..64c5e6bdc720 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.Tag - ## Properties Name | Type | Description | Notes @@ -7,3 +6,5 @@ Name | Type | Description | Notes **Id** | **long?** | | [optional] **Name** | **string** | | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md index 54485476d2f3..fbea33c48b92 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md @@ -1,5 +1,4 @@ # IO.Swagger.Model.User - ## Properties Name | Type | Description | Notes @@ -13,3 +12,5 @@ Name | Type | Description | Notes **Phone** | **string** | | [optional] **UserStatus** | **int?** | User Status | [optional] +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md index 11061b7a1e2c..65c22f9f072c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md @@ -21,7 +21,7 @@ Create user This can only be done by the logged in user. -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -72,6 +72,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **CreateUsersWithArrayInput** > void CreateUsersWithArrayInput (List body) @@ -79,7 +81,7 @@ Creates list of users with given input array -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -130,6 +132,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **CreateUsersWithListInput** > void CreateUsersWithListInput (List body) @@ -137,7 +141,7 @@ Creates list of users with given input array -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -188,6 +192,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **DeleteUser** > void DeleteUser (string username) @@ -195,7 +201,7 @@ Delete user This can only be done by the logged in user. -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -246,6 +252,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **GetUserByName** > User GetUserByName (string username) @@ -253,7 +261,7 @@ Get user by user name -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -305,6 +313,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **LoginUser** > string LoginUser (string username, string password) @@ -312,7 +322,7 @@ Logs user into the system -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -366,6 +376,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **LogoutUser** > void LogoutUser () @@ -373,7 +385,7 @@ Logs out current logged in user session -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -420,6 +432,8 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **UpdateUser** > void UpdateUser (string username, User body) @@ -427,7 +441,7 @@ Updated user This can only be done by the logged in user. -### Example +### Example ```csharp using System; using System.Diagnostics; @@ -480,3 +494,5 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs index f9138390e3e2..fe9c89588c98 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs @@ -23,8 +23,9 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// /// _Name (required). + /// Property. - public Name(int? _Name = null) + public Name(int? _Name = null, string Property = null) { // to ensure "_Name" is required (not null) if (_Name == null) @@ -35,6 +36,7 @@ namespace IO.Swagger.Model { this._Name = _Name; } + this.Property = Property; } @@ -51,6 +53,12 @@ namespace IO.Swagger.Model [DataMember(Name="snake_case", EmitDefaultValue=false)] public int? SnakeCase { get; private set; } + /// + /// Gets or Sets Property + /// + [DataMember(Name="property", EmitDefaultValue=false)] + public string Property { get; set; } + /// /// Returns the string presentation of the object /// @@ -61,6 +69,7 @@ namespace IO.Swagger.Model sb.Append("class Name {\n"); sb.Append(" _Name: ").Append(_Name).Append("\n"); sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); + sb.Append(" Property: ").Append(Property).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -106,6 +115,11 @@ namespace IO.Swagger.Model this.SnakeCase == other.SnakeCase || this.SnakeCase != null && this.SnakeCase.Equals(other.SnakeCase) + ) && + ( + this.Property == other.Property || + this.Property != null && + this.Property.Equals(other.Property) ); } @@ -124,6 +138,8 @@ namespace IO.Swagger.Model hash = hash * 59 + this._Name.GetHashCode(); if (this.SnakeCase != null) hash = hash * 59 + this.SnakeCase.GetHashCode(); + if (this.Property != null) + hash = hash * 59 + this.Property.GetHashCode(); return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt index 0991d15f1187..323cad108c6b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt +++ b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt @@ -1,9 +1,9 @@ /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb +/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll +/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll +/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll diff --git a/samples/client/petstore/java/default/README.md b/samples/client/petstore/java/default/README.md index cc9672eab41a..562d76a8db4d 100644 --- a/samples/client/petstore/java/default/README.md +++ b/samples/client/petstore/java/default/README.md @@ -4,7 +4,7 @@ Building the API client library requires [Maven](https://maven.apache.org/) to be installed. -## Installation & Usage +## Installation To install the API client library to your local Maven repository, simply execute: @@ -20,7 +20,9 @@ mvn deploy Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. -After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: +### Maven users + +Add this dependency to your project's POM: ```xml @@ -29,9 +31,164 @@ After the client library is installed/deployed, you can use it in your Maven pro 1.0.0 compile +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "io.swagger:swagger-java-client:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + + mvn package + +Then manually install the following JARs: + +* target/swagger-java-client-1.0.0.jar +* target/lib/*.jar + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import io.swagger.client.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; +import io.swagger.client.api.PetApi; + +import java.io.File; +import java.util.*; + +public class PetApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + + + PetApi apiInstance = new PetApi(); + + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); + } + } +} ``` +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Animal](docs/Animal.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [Dog](docs/Dog.md) + - [InlineResponse200](docs/InlineResponse200.md) + - [Model200Response](docs/Model200Response.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### 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 + + ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. @@ -40,4 +197,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea apiteam@swagger.io - diff --git a/samples/client/petstore/java/default/docs/Animal.md b/samples/client/petstore/java/default/docs/Animal.md new file mode 100644 index 000000000000..3ecb7f991f38 --- /dev/null +++ b/samples/client/petstore/java/default/docs/Animal.md @@ -0,0 +1,10 @@ + +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | + + + diff --git a/samples/client/petstore/java/default/docs/ApiResponse.md b/samples/client/petstore/java/default/docs/ApiResponse.md new file mode 100644 index 000000000000..1c17767c2b72 --- /dev/null +++ b/samples/client/petstore/java/default/docs/ApiResponse.md @@ -0,0 +1,12 @@ + +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/Cat.md b/samples/client/petstore/java/default/docs/Cat.md new file mode 100644 index 000000000000..373af540c416 --- /dev/null +++ b/samples/client/petstore/java/default/docs/Cat.md @@ -0,0 +1,11 @@ + +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**declawed** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/Category.md b/samples/client/petstore/java/default/docs/Category.md new file mode 100644 index 000000000000..e2df08032787 --- /dev/null +++ b/samples/client/petstore/java/default/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/Dog.md b/samples/client/petstore/java/default/docs/Dog.md new file mode 100644 index 000000000000..a1d638d3badd --- /dev/null +++ b/samples/client/petstore/java/default/docs/Dog.md @@ -0,0 +1,11 @@ + +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**breed** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/FormatTest.md b/samples/client/petstore/java/default/docs/FormatTest.md new file mode 100644 index 000000000000..8e400e7bcd77 --- /dev/null +++ b/samples/client/petstore/java/default/docs/FormatTest.md @@ -0,0 +1,21 @@ + +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | | [optional] +**int32** | **Integer** | | [optional] +**int64** | **Long** | | [optional] +**number** | [**BigDecimal**](BigDecimal.md) | | +**_float** | **Float** | | [optional] +**_double** | **Double** | | [optional] +**string** | **String** | | [optional] +**_byte** | **byte[]** | | [optional] +**binary** | **byte[]** | | [optional] +**date** | [**Date**](Date.md) | | [optional] +**dateTime** | [**Date**](Date.md) | | [optional] +**password** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/InlineResponse200.md b/samples/client/petstore/java/default/docs/InlineResponse200.md new file mode 100644 index 000000000000..487ebe429e49 --- /dev/null +++ b/samples/client/petstore/java/default/docs/InlineResponse200.md @@ -0,0 +1,24 @@ + +# InlineResponse200 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**photoUrls** | **List<String>** | | [optional] +**name** | **String** | | [optional] +**id** | **Long** | | +**category** | **Object** | | [optional] +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +AVAILABLE | available +PENDING | pending +SOLD | sold + + + diff --git a/samples/client/petstore/java/default/docs/Model200Response.md b/samples/client/petstore/java/default/docs/Model200Response.md new file mode 100644 index 000000000000..0819b88c4f4d --- /dev/null +++ b/samples/client/petstore/java/default/docs/Model200Response.md @@ -0,0 +1,10 @@ + +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/ModelApiResponse.md b/samples/client/petstore/java/default/docs/ModelApiResponse.md new file mode 100644 index 000000000000..3eec8686cc95 --- /dev/null +++ b/samples/client/petstore/java/default/docs/ModelApiResponse.md @@ -0,0 +1,12 @@ + +# ModelApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/ModelReturn.md b/samples/client/petstore/java/default/docs/ModelReturn.md new file mode 100644 index 000000000000..a679b04953e5 --- /dev/null +++ b/samples/client/petstore/java/default/docs/ModelReturn.md @@ -0,0 +1,10 @@ + +# ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/Name.md b/samples/client/petstore/java/default/docs/Name.md new file mode 100644 index 000000000000..a1adac1dd39b --- /dev/null +++ b/samples/client/petstore/java/default/docs/Name.md @@ -0,0 +1,11 @@ + +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | +**snakeCase** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/Order.md b/samples/client/petstore/java/default/docs/Order.md new file mode 100644 index 000000000000..b1709c14eee0 --- /dev/null +++ b/samples/client/petstore/java/default/docs/Order.md @@ -0,0 +1,24 @@ + +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**Date**](Date.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +PLACED | placed +APPROVED | approved +DELIVERED | delivered + + + diff --git a/samples/client/petstore/java/default/docs/Pet.md b/samples/client/petstore/java/default/docs/Pet.md new file mode 100644 index 000000000000..20a1c298dd61 --- /dev/null +++ b/samples/client/petstore/java/default/docs/Pet.md @@ -0,0 +1,24 @@ + +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +AVAILABLE | available +PENDING | pending +SOLD | sold + + + diff --git a/samples/client/petstore/java/default/docs/PetApi.md b/samples/client/petstore/java/default/docs/PetApi.md new file mode 100644 index 000000000000..e0314e20e519 --- /dev/null +++ b/samples/client/petstore/java/default/docs/PetApi.md @@ -0,0 +1,448 @@ +# 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 +[**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 +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.addPet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | Pet id to delete +String apiKey = "apiKey_example"; // String | +try { + apiInstance.deletePet(petId, apiKey); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List tags = Arrays.asList("tags_example"); // List | Tags to filter by +try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to return +try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updatePet** +> updatePet(body) + +Update an existing pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.updatePet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet that needs to be updated +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet +try { + apiInstance.updatePetWithForm(petId, name, status); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| 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 request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/xml, application/json + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to update +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server +File file = new File("/path/to/file.txt"); // File | file to upload +try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + diff --git a/samples/client/petstore/java/default/docs/SpecialModelName.md b/samples/client/petstore/java/default/docs/SpecialModelName.md new file mode 100644 index 000000000000..c2c6117c552c --- /dev/null +++ b/samples/client/petstore/java/default/docs/SpecialModelName.md @@ -0,0 +1,10 @@ + +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**specialPropertyName** | **Long** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/StoreApi.md b/samples/client/petstore/java/default/docs/StoreApi.md new file mode 100644 index 000000000000..0b30791725aa --- /dev/null +++ b/samples/client/petstore/java/default/docs/StoreApi.md @@ -0,0 +1,197 @@ +# 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 +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**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 +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +String orderId = "orderId_example"; // String | ID of the order that needs to be deleted +try { + apiInstance.deleteOrder(orderId); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + e.printStackTrace(); +} +``` + +### 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 request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.StoreApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +StoreApi apiInstance = new StoreApi(); +try { + Map result = apiInstance.getInventory(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Map<String, Integer>**](Map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **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 +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Long orderId = 789L; // Long | ID of pet that needs to be fetched +try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Long**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Order body = new Order(); // Order | order placed for purchasing the pet +try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/java/default/docs/Tag.md b/samples/client/petstore/java/default/docs/Tag.md new file mode 100644 index 000000000000..de6814b55d57 --- /dev/null +++ b/samples/client/petstore/java/default/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/User.md b/samples/client/petstore/java/default/docs/User.md new file mode 100644 index 000000000000..8b6753dd284a --- /dev/null +++ b/samples/client/petstore/java/default/docs/User.md @@ -0,0 +1,17 @@ + +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [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/java/default/docs/UserApi.md b/samples/client/petstore/java/default/docs/UserApi.md new file mode 100644 index 000000000000..8cdc15992eef --- /dev/null +++ b/samples/client/petstore/java/default/docs/UserApi.md @@ -0,0 +1,370 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +User body = new User(); // User | Created user object +try { + apiInstance.createUser(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithArrayInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithListInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be deleted +try { + apiInstance.deleteUser(username); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +try { + User result = apiInstance.getUserByName(username); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + e.printStackTrace(); +} +``` + +### 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 request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The user name for login +String password = "password_example"; // String | The password for login in clear text +try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +try { + apiInstance.logoutUser(); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | name that need to be deleted +User body = new User(); // User | Updated user object +try { + apiInstance.updateUser(username, body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + 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 fdc5110304f1..584c85aaae47 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 @@ -8,7 +8,7 @@ import io.swagger.client.Configuration; import io.swagger.client.Pair; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; +import io.swagger.client.model.ModelApiResponse; import java.io.File; import java.util.ArrayList; @@ -39,12 +39,17 @@ public class PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call */ public void addPet(Pet body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); + } + // create path and map variables String localVarPath = "/pet".replaceAll("\\{format\\}","json"); @@ -57,42 +62,7 @@ public class PetApi { final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * 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 (optional) - * @throws ApiException if fails to make API call - */ - public void addPetUsingByteArray(byte[] body) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -136,7 +106,7 @@ public class PetApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -153,13 +123,18 @@ 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 (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return List * @throws ApiException if fails to make API call */ public List findPetsByStatus(List status) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + // create path and map variables String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); @@ -168,12 +143,12 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "status", status)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -189,14 +164,19 @@ 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 (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return List * @throws ApiException if fails to make API call */ public List findPetsByTags(List tags) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + // create path and map variables String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); @@ -205,12 +185,12 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -226,8 +206,8 @@ 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 (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Pet * @throws ApiException if fails to make API call */ @@ -252,7 +232,7 @@ public class PetApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -261,104 +241,25 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "api_key" }; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } - /** - * 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 (required) - * @return InlineResponse200 - * @throws ApiException if fails to make API call - */ - public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (required) - * @return byte[] - * @throws ApiException if fails to make API call - */ - public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call */ public void updatePet(Pet body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); + } + // create path and map variables String localVarPath = "/pet".replaceAll("\\{format\\}","json"); @@ -371,7 +272,7 @@ public class PetApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -393,7 +294,7 @@ public class PetApi { * @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 { + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -418,7 +319,7 @@ if (status != null) localVarFormParams.put("status", status); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -438,9 +339,10 @@ if (status != null) * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) + * @return ModelApiResponse * @throws ApiException if fails to make API call */ - public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -465,7 +367,7 @@ if (file != null) localVarFormParams.put("file", file); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -476,7 +378,7 @@ if (file != null) String[] localVarAuthNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } } 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 3f2e38c0e3a4..59a1a58266eb 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 @@ -61,7 +61,7 @@ public class StoreApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -75,43 +75,6 @@ public class StoreApi { apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); } - /** - * Finds orders by status - * A single status value can be provided as a string - * @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 - */ - public List findOrdersByStatus(String status) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/findByStatus".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status)); - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; - - GenericType> localVarReturnType = new GenericType>() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -133,7 +96,7 @@ public class StoreApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -147,41 +110,6 @@ public class StoreApi { GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Object - * @throws ApiException if fails to make API call - */ - public Object getInventoryInObject() throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -189,7 +117,7 @@ public class StoreApi { * @return Order * @throws ApiException if fails to make API call */ - public Order getOrderById(String orderId) throws ApiException { + public Order getOrderById(Long orderId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'orderId' is set @@ -210,7 +138,7 @@ public class StoreApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -219,7 +147,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[] { }; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); @@ -227,13 +155,18 @@ public class StoreApi { /** * Place an order for a pet * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return Order * @throws ApiException if fails to make API call */ public Order placeOrder(Order body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); + } + // create path and map variables String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); @@ -246,7 +179,7 @@ public class StoreApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -255,7 +188,7 @@ public class StoreApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; + String[] localVarAuthNames = new String[] { }; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); 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 600ad0b678af..7ab75eabd344 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 @@ -37,12 +37,17 @@ public class UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @throws ApiException if fails to make API call */ public void createUser(User body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); + } + // create path and map variables String localVarPath = "/user".replaceAll("\\{format\\}","json"); @@ -55,7 +60,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -72,12 +77,17 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @throws ApiException if fails to make API call */ public void createUsersWithArrayInput(List body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + } + // create path and map variables String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); @@ -90,7 +100,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -107,12 +117,17 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @throws ApiException if fails to make API call */ public void createUsersWithListInput(List body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); + } + // create path and map variables String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); @@ -125,7 +140,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -166,7 +181,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -175,7 +190,7 @@ public class UserApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_http_basic" }; + String[] localVarAuthNames = new String[] { }; apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); @@ -208,7 +223,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -225,14 +240,24 @@ public class UserApi { /** * Logs user into the system * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return String * @throws ApiException if fails to make API call */ public String loginUser(String username, String password) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + // create path and map variables String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); @@ -247,7 +272,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -281,7 +306,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -299,7 +324,7 @@ public class UserApi { * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @throws ApiException if fails to make API call */ public void updateUser(String username, User body) throws ApiException { @@ -310,6 +335,11 @@ public class UserApi { throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); + } + // create path and map variables String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); @@ -323,7 +353,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/InlineResponse200.java deleted file mode 100644 index ee6afefe2658..000000000000 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/InlineResponse200.java +++ /dev/null @@ -1,198 +0,0 @@ -package io.swagger.client.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.client.model.Tag; -import java.util.ArrayList; -import java.util.List; - - - - - - -public class InlineResponse200 { - - private List tags = new ArrayList(); - private Long id = null; - private Object category = null; - - - public enum StatusEnum { - AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status = null; - private String name = null; - private List photoUrls = new ArrayList(); - - - /** - **/ - public InlineResponse200 tags(List tags) { - this.tags = tags; - return this; - } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("tags") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - - /** - **/ - public InlineResponse200 id(Long id) { - this.id = id; - return this; - } - - @ApiModelProperty(example = "null", required = true, value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - public InlineResponse200 category(Object category) { - this.category = category; - return this; - } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("category") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } - - - /** - * pet status in the store - **/ - public InlineResponse200 status(StatusEnum status) { - this.status = status; - return this; - } - - @ApiModelProperty(example = "null", value = "pet status in the store") - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - /** - **/ - public InlineResponse200 name(String name) { - this.name = name; - return this; - } - - @ApiModelProperty(example = "doggie", value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - public InlineResponse200 photoUrls(List photoUrls) { - this.photoUrls = photoUrls; - return this; - } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.tags, inlineResponse200.tags) && - 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); - } - - @Override - public int hashCode() { - return Objects.hash(tags, id, category, status, name, photoUrls); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); - - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * 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/default/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..62300f1a0ebc --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -0,0 +1,113 @@ +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; + + + + + + +public class ModelApiResponse { + + private Integer code = null; + private String type = null; + private String message = null; + + + /** + **/ + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + + /** + **/ + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("type") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + + /** + **/ + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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/default/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java index 43ddec1ff6a3..94be5295f5df 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java @@ -39,14 +39,24 @@ public class Order { } private StatusEnum status = null; - private Boolean complete = null; + private Boolean complete = false; + /** + **/ + public Order id(Long id) { + this.id = id; + return this; + } + @ApiModelProperty(example = "null", value = "") @JsonProperty("id") public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } /** diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/PetstoreProfiling.java b/samples/client/petstore/java/default/src/test/java/io/swagger/PetstoreProfiling.java index 0c5ef6f1eda9..d0be1523e45d 100644 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/PetstoreProfiling.java +++ b/samples/client/petstore/java/default/src/test/java/io/swagger/PetstoreProfiling.java @@ -48,7 +48,7 @@ public class PetstoreProfiling { /* UPDATE PET WITH FORM */ start = System.nanoTime(); - petApi.updatePetWithForm(String.valueOf(newPetId), "new profiler", "sold"); + petApi.updatePetWithForm(newPetId, "new profiler", "sold"); results.add(buildResult(index, "UPDATE PET", System.nanoTime() - start)); /* DELETE PET */ diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/PetApiTest.java index ad971ea66692..9e927a69ba2e 100644 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ b/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/PetApiTest.java @@ -73,6 +73,7 @@ public class PetApiTest { assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } + /* @Test public void testCreateAndGetPetWithByteArray() throws Exception { Pet pet = createRandomPet(); @@ -119,6 +120,7 @@ public class PetApiTest { assertEquals(category.getId(), Long.valueOf(categoryIdInt)); assertEquals(category.getName(), categoryMap.get("name")); } + */ @Test public void testUpdatePet() throws Exception { @@ -191,7 +193,7 @@ public class PetApiTest { Pet fetched = api.getPetById(pet.getId()); - api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null); + api.updatePetWithForm(fetched.getId(), "furt", null); Pet updated = api.getPetById(fetched.getId()); assertEquals(updated.getName(), "furt"); diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java index 403f9b64ec97..4b33d380f147 100644 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ b/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java @@ -35,6 +35,7 @@ public class StoreApiTest { assertTrue(inventory.keySet().size() > 0); } + /* @Test public void testGetInventoryInObject() throws Exception { Object inventoryObj = api.getInventoryInObject(); @@ -47,13 +48,14 @@ public class StoreApiTest { assertTrue(firstEntry.getKey() instanceof String); assertTrue(firstEntry.getValue() instanceof Integer); } + */ @Test public void testPlaceOrder() throws Exception { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(String.valueOf(order.getId())); + Order fetched = api.getOrderById(order.getId()); assertEquals(order.getId(), fetched.getId()); assertEquals(order.getPetId(), fetched.getPetId()); assertEquals(order.getQuantity(), fetched.getQuantity()); @@ -64,13 +66,13 @@ public class StoreApiTest { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(String.valueOf(order.getId())); + Order fetched = api.getOrderById(order.getId()); assertEquals(fetched.getId(), order.getId()); api.deleteOrder(String.valueOf(order.getId())); try { - api.getOrderById(String.valueOf(order.getId())); + api.getOrderById(order.getId()); // fail("expected an error"); } catch (ApiException e) { // ok diff --git a/samples/client/petstore/java/feign/README.md b/samples/client/petstore/java/feign/README.md index 3ca7abfb5573..d5d447e2865d 100644 --- a/samples/client/petstore/java/feign/README.md +++ b/samples/client/petstore/java/feign/README.md @@ -20,7 +20,7 @@ mvn deploy Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. -After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: ```xml diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java index bf9378fc9c1e..043861f4e537 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java @@ -14,7 +14,7 @@ import feign.codec.EncodeException; import feign.codec.Encoder; import feign.RequestTemplate; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class FormAwareEncoder implements Encoder { public static final String UTF_8 = "utf-8"; private static final String LINE_FEED = "\r\n"; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java index b8a4d2924f6b..6439885ed11b 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index 2d5ac8be9ee0..e2e1ad0bee68 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -3,7 +3,7 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; +import io.swagger.client.model.ModelApiResponse; import java.io.File; import java.util.ArrayList; @@ -12,14 +12,14 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-21T18:26:32.462+08:00") public interface PetApi extends ApiClient.Api { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return void */ @RequestLine("POST /pet") @@ -29,19 +29,6 @@ public interface PetApi extends ApiClient.Api { }) void addPet(Pet body); - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array (optional) - * @return void - */ - @RequestLine("POST /pet?testing_byte_array=true") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - void addPetUsingByteArray(byte[] body); - /** * Deletes a pet * @@ -60,7 +47,7 @@ public interface PetApi extends ApiClient.Api { /** * 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 (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return List */ @RequestLine("GET /pet/findByStatus?status={status}") @@ -72,8 +59,8 @@ public interface PetApi extends ApiClient.Api { /** * 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 (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return List */ @RequestLine("GET /pet/findByTags?tags={tags}") @@ -85,8 +72,8 @@ public interface PetApi extends ApiClient.Api { /** * 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 (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Pet */ @RequestLine("GET /pet/{petId}") @@ -96,36 +83,10 @@ public interface PetApi extends ApiClient.Api { }) Pet getPetById(@Param("petId") Long 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 - * @param petId ID of pet that needs to be fetched (required) - * @return InlineResponse200 - */ - @RequestLine("GET /pet/{petId}?response=inline_arbitrary_object") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - InlineResponse200 getPetByIdInObject(@Param("petId") Long 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 - * @param petId ID of pet that needs to be fetched (required) - * @return byte[] - */ - @RequestLine("GET /pet/{petId}?testing_byte_array=true") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - byte[] petPetIdtestingByteArraytrueGet(@Param("petId") Long petId); - /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return void */ @RequestLine("PUT /pet") @@ -148,7 +109,7 @@ public interface PetApi extends ApiClient.Api { "Content-type: application/x-www-form-urlencoded", "Accepts: application/json", }) - void updatePetWithForm(@Param("petId") String petId, @Param("name") String name, @Param("status") String status); + void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); /** * uploads an image @@ -156,12 +117,12 @@ public interface PetApi extends ApiClient.Api { * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return void + * @return ModelApiResponse */ @RequestLine("POST /pet/{petId}/uploadImage") @Headers({ "Content-type: multipart/form-data", "Accepts: application/json", }) - void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index 0c358eae7dfd..45c9610c5c05 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public interface StoreApi extends ApiClient.Api { @@ -27,19 +27,6 @@ public interface StoreApi extends ApiClient.Api { }) void deleteOrder(@Param("orderId") String orderId); - /** - * 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 (optional, default to placed) - * @return List - */ - @RequestLine("GET /store/findByStatus?status={status}") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - List findOrdersByStatus(@Param("status") String status); - /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -52,18 +39,6 @@ public interface StoreApi extends ApiClient.Api { }) Map getInventory(); - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Object - */ - @RequestLine("GET /store/inventory?response=arbitrary_object") - @Headers({ - "Content-type: application/json", - "Accepts: application/json", - }) - Object getInventoryInObject(); - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -75,12 +50,12 @@ public interface StoreApi extends ApiClient.Api { "Content-type: application/json", "Accepts: application/json", }) - Order getOrderById(@Param("orderId") String orderId); + Order getOrderById(@Param("orderId") Long orderId); /** * Place an order for a pet * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return Order */ @RequestLine("POST /store/order") diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index ff46fb078b57..ae731977c6b1 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -10,14 +10,14 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public interface UserApi extends ApiClient.Api { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @return void */ @RequestLine("POST /user") @@ -30,7 +30,7 @@ public interface UserApi extends ApiClient.Api { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return void */ @RequestLine("POST /user/createWithArray") @@ -43,7 +43,7 @@ public interface UserApi extends ApiClient.Api { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return void */ @RequestLine("POST /user/createWithList") @@ -82,8 +82,8 @@ public interface UserApi extends ApiClient.Api { /** * Logs user into the system * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return String */ @RequestLine("GET /user/login?username={username}&password={password}") @@ -109,7 +109,7 @@ public interface UserApi extends ApiClient.Api { * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @return void */ @RequestLine("PUT /user/{username}") diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java index 20987177b521..8e3eb2af9355 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java index 5312e49f241d..3d79c4118245 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Cat extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index 7d472b3e71b6..66f4830bce00 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java index 920c9a7ac6c5..96d35603bf55 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Dog extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java index 9917e21724a3..9c6b5e35de66 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java @@ -11,7 +11,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class FormatTest { private Integer integer = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index bcc40ca5b246..41b7842d606e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Model200Response { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..91fb6b5b9392 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -0,0 +1,113 @@ +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-04-21T18:26:32.462+08:00") +public class ModelApiResponse { + + private Integer code = null; + private String type = null; + private String message = null; + + + /** + **/ + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + + /** + **/ + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("type") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + + /** + **/ + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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/feign/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java index 539032cec41f..2994e48adaf8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java @@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class ModelReturn { private Integer _return = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java index c29314eb091d..e51b32ff5a26 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java @@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Name { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index e713b75a8450..3c0ea427c411 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -11,7 +11,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Order { private Long id = null; @@ -39,14 +39,24 @@ public class Order { } private StatusEnum status = null; - private Boolean complete = null; + private Boolean complete = false; + /** + **/ + public Order id(Long id) { + this.id = id; + return this; + } + @ApiModelProperty(example = "null", value = "") @JsonProperty("id") public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } /** diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index 2d7a49dd47f0..ee4ce28371b3 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -14,7 +14,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java index 51f88ff43062..786d75c976cd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index 981302df5479..4e323812065c 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index 5502f018489f..23e363a518e8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00") public class User { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/PetApiTest.java index bf0686529052..a2e8c34d95ed 100644 --- a/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/PetApiTest.java @@ -120,7 +120,7 @@ public class PetApiTest { Pet fetched = api.getPetById(pet.getId()); - api.updatePetWithForm(fetched.getId().toString(), "furt", null); + api.updatePetWithForm(fetched.getId(), "furt", null); Pet updated = api.getPetById(fetched.getId()); assertEquals(updated.getName(), "furt"); diff --git a/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/StoreApiTest.java index 32dcd6d0c0e6..ca14be28a800 100644 --- a/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/StoreApiTest.java @@ -35,7 +35,7 @@ public class StoreApiTest { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(order.getId().toString()); + Order fetched = api.getOrderById(order.getId()); assertEquals(order.getId(), fetched.getId()); assertEquals(order.getPetId(), fetched.getPetId()); assertEquals(order.getQuantity(), fetched.getQuantity()); @@ -46,13 +46,13 @@ public class StoreApiTest { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(order.getId().toString()); + Order fetched = api.getOrderById(order.getId()); assertEquals(fetched.getId(), order.getId()); api.deleteOrder(order.getId().toString()); try { - api.getOrderById(order.getId().toString()); + api.getOrderById(order.getId()); fail("expected an error"); } catch (FeignException e) { assertTrue(e.getMessage().startsWith("status 404 ")); diff --git a/samples/client/petstore/java/jersey2/README.md b/samples/client/petstore/java/jersey2/README.md index 930a4f28c55e..6b6db0995816 100644 --- a/samples/client/petstore/java/jersey2/README.md +++ b/samples/client/petstore/java/jersey2/README.md @@ -4,7 +4,7 @@ Building the API client library requires [Maven](https://maven.apache.org/) to be installed. -## Installation & Usage +## Installation To install the API client library to your local Maven repository, simply execute: @@ -20,7 +20,9 @@ mvn deploy Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. -After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: +### Maven users + +Add this dependency to your project's POM: ```xml @@ -29,9 +31,161 @@ After the client library is installed/deployed, you can use it in your Maven pro 1.0.0 compile +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "io.swagger:swagger-petstore-jersey2:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + + mvn package + +Then manually install the following JARs: + +* target/swagger-petstore-jersey2-1.0.0.jar +* target/lib/*.jar + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import io.swagger.client.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; +import io.swagger.client.api.PetApi; + +import java.io.File; +import java.util.*; + +public class PetApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + + + PetApi apiInstance = new PetApi(); + + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); + } + } +} ``` +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [InlineResponse200](docs/InlineResponse200.md) + - [Model200Response](docs/Model200Response.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### 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 + + ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. @@ -40,4 +194,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea apiteam@swagger.io - diff --git a/samples/client/petstore/java/jersey2/docs/Animal.md b/samples/client/petstore/java/jersey2/docs/Animal.md new file mode 100644 index 000000000000..3ecb7f991f38 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Animal.md @@ -0,0 +1,10 @@ + +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | + + + diff --git a/samples/client/petstore/java/jersey2/docs/ApiResponse.md b/samples/client/petstore/java/jersey2/docs/ApiResponse.md new file mode 100644 index 000000000000..1c17767c2b72 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/ApiResponse.md @@ -0,0 +1,12 @@ + +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/Cat.md b/samples/client/petstore/java/jersey2/docs/Cat.md new file mode 100644 index 000000000000..373af540c416 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Cat.md @@ -0,0 +1,11 @@ + +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**declawed** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/Category.md b/samples/client/petstore/java/jersey2/docs/Category.md new file mode 100644 index 000000000000..e2df08032787 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/Dog.md b/samples/client/petstore/java/jersey2/docs/Dog.md new file mode 100644 index 000000000000..a1d638d3badd --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Dog.md @@ -0,0 +1,11 @@ + +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**breed** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/FormatTest.md b/samples/client/petstore/java/jersey2/docs/FormatTest.md new file mode 100644 index 000000000000..8e400e7bcd77 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/FormatTest.md @@ -0,0 +1,21 @@ + +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | | [optional] +**int32** | **Integer** | | [optional] +**int64** | **Long** | | [optional] +**number** | [**BigDecimal**](BigDecimal.md) | | +**_float** | **Float** | | [optional] +**_double** | **Double** | | [optional] +**string** | **String** | | [optional] +**_byte** | **byte[]** | | [optional] +**binary** | **byte[]** | | [optional] +**date** | [**Date**](Date.md) | | [optional] +**dateTime** | [**Date**](Date.md) | | [optional] +**password** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/InlineResponse200.md b/samples/client/petstore/java/jersey2/docs/InlineResponse200.md new file mode 100644 index 000000000000..232cb0ed5c11 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/InlineResponse200.md @@ -0,0 +1,13 @@ +# InlineResponse200 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**photoUrls** | **List<String>** | | [optional] +**name** | **String** | | [optional] +**id** | **Long** | | +**category** | **Object** | | [optional] +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + + diff --git a/samples/client/petstore/java/jersey2/docs/Model200Response.md b/samples/client/petstore/java/jersey2/docs/Model200Response.md new file mode 100644 index 000000000000..0819b88c4f4d --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Model200Response.md @@ -0,0 +1,10 @@ + +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/ModelApiResponse.md b/samples/client/petstore/java/jersey2/docs/ModelApiResponse.md new file mode 100644 index 000000000000..3eec8686cc95 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/ModelApiResponse.md @@ -0,0 +1,12 @@ + +# ModelApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/ModelReturn.md b/samples/client/petstore/java/jersey2/docs/ModelReturn.md new file mode 100644 index 000000000000..a679b04953e5 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/ModelReturn.md @@ -0,0 +1,10 @@ + +# ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/Name.md b/samples/client/petstore/java/jersey2/docs/Name.md new file mode 100644 index 000000000000..a1adac1dd39b --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Name.md @@ -0,0 +1,11 @@ + +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | +**snakeCase** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/Order.md b/samples/client/petstore/java/jersey2/docs/Order.md new file mode 100644 index 000000000000..b1709c14eee0 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Order.md @@ -0,0 +1,24 @@ + +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**Date**](Date.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +PLACED | placed +APPROVED | approved +DELIVERED | delivered + + + diff --git a/samples/client/petstore/java/jersey2/docs/Pet.md b/samples/client/petstore/java/jersey2/docs/Pet.md new file mode 100644 index 000000000000..20a1c298dd61 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Pet.md @@ -0,0 +1,24 @@ + +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +AVAILABLE | available +PENDING | pending +SOLD | sold + + + diff --git a/samples/client/petstore/java/jersey2/docs/PetApi.md b/samples/client/petstore/java/jersey2/docs/PetApi.md new file mode 100644 index 000000000000..e0314e20e519 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/PetApi.md @@ -0,0 +1,448 @@ +# 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 +[**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 +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.addPet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | Pet id to delete +String apiKey = "apiKey_example"; // String | +try { + apiInstance.deletePet(petId, apiKey); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List tags = Arrays.asList("tags_example"); // List | Tags to filter by +try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to return +try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updatePet** +> updatePet(body) + +Update an existing pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.updatePet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet that needs to be updated +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet +try { + apiInstance.updatePetWithForm(petId, name, status); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| 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 request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/xml, application/json + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to update +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server +File file = new File("/path/to/file.txt"); // File | file to upload +try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + diff --git a/samples/client/petstore/java/jersey2/docs/SpecialModelName.md b/samples/client/petstore/java/jersey2/docs/SpecialModelName.md new file mode 100644 index 000000000000..c2c6117c552c --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/SpecialModelName.md @@ -0,0 +1,10 @@ + +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**specialPropertyName** | **Long** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/StoreApi.md b/samples/client/petstore/java/jersey2/docs/StoreApi.md new file mode 100644 index 000000000000..0b30791725aa --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/StoreApi.md @@ -0,0 +1,197 @@ +# 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 +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**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 +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +String orderId = "orderId_example"; // String | ID of the order that needs to be deleted +try { + apiInstance.deleteOrder(orderId); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + e.printStackTrace(); +} +``` + +### 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 request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.StoreApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +StoreApi apiInstance = new StoreApi(); +try { + Map result = apiInstance.getInventory(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Map<String, Integer>**](Map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **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 +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Long orderId = 789L; // Long | ID of pet that needs to be fetched +try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Long**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Order body = new Order(); // Order | order placed for purchasing the pet +try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/java/jersey2/docs/Tag.md b/samples/client/petstore/java/jersey2/docs/Tag.md new file mode 100644 index 000000000000..de6814b55d57 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/docs/User.md b/samples/client/petstore/java/jersey2/docs/User.md new file mode 100644 index 000000000000..8b6753dd284a --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/User.md @@ -0,0 +1,17 @@ + +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [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/java/jersey2/docs/UserApi.md b/samples/client/petstore/java/jersey2/docs/UserApi.md new file mode 100644 index 000000000000..8cdc15992eef --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/UserApi.md @@ -0,0 +1,370 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +User body = new User(); // User | Created user object +try { + apiInstance.createUser(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithArrayInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithListInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be deleted +try { + apiInstance.deleteUser(username); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +try { + User result = apiInstance.getUserByName(username); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + e.printStackTrace(); +} +``` + +### 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 request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The user name for login +String password = "password_example"; // String | The password for login in clear text +try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +try { + apiInstance.logoutUser(); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | name that need to be deleted +User body = new User(); // User | Updated user object +try { + apiInstance.updateUser(username, body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java index 0b0368d214f6..f513e2165c79 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java index 256cd5ff0871..c6c4f0b1cd65 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java index 51b30d45655a..8d447238daf7 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java @@ -8,7 +8,7 @@ import java.text.DateFormat; import javax.ws.rs.ext.ContextResolver; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class JSON implements ContextResolver { private ObjectMapper mapper; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java index d09ea6040bf1..6fb0888876fe 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java index b42e4d241aea..cd18a2479283 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java index 61ba97f3feae..d96bf5dcc0bd 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java @@ -8,7 +8,7 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; +import io.swagger.client.model.ModelApiResponse; import java.io.File; import java.util.ArrayList; @@ -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-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-21T18:26:21.396+08:00") public class PetApi { private ApiClient apiClient; @@ -39,12 +39,17 @@ public class PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call */ public void addPet(Pet body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); + } + // create path and map variables String localVarPath = "/pet".replaceAll("\\{format\\}","json"); @@ -57,42 +62,7 @@ public class PetApi { final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } - /** - * 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 (optional) - * @throws ApiException if fails to make API call - */ - public void addPetUsingByteArray(byte[] body) throws ApiException { - Object localVarPostBody = body; - - // create path and map variables - String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -136,7 +106,7 @@ public class PetApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -153,13 +123,18 @@ 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 (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return List * @throws ApiException if fails to make API call */ public List findPetsByStatus(List status) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + // create path and map variables String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); @@ -168,12 +143,12 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "status", status)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -189,14 +164,19 @@ 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 (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return List * @throws ApiException if fails to make API call */ public List findPetsByTags(List tags) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + // create path and map variables String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); @@ -205,12 +185,12 @@ public class PetApi { Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -226,8 +206,8 @@ 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 (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Pet * @throws ApiException if fails to make API call */ @@ -252,7 +232,7 @@ public class PetApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -261,104 +241,25 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "api_key" }; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } - /** - * 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 (required) - * @return InlineResponse200 - * @throws ApiException if fails to make API call - */ - public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (required) - * @return byte[] - * @throws ApiException if fails to make API call - */ - public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"); - } - - // create path and map variables - String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call */ public void updatePet(Pet body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); + } + // create path and map variables String localVarPath = "/pet".replaceAll("\\{format\\}","json"); @@ -371,7 +272,7 @@ public class PetApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -393,7 +294,7 @@ public class PetApi { * @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 { + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -418,7 +319,7 @@ if (status != null) localVarFormParams.put("status", status); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -438,9 +339,10 @@ if (status != null) * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) + * @return ModelApiResponse * @throws ApiException if fails to make API call */ - public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -465,7 +367,7 @@ if (file != null) localVarFormParams.put("file", file); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -476,7 +378,7 @@ if (file != null) String[] localVarAuthNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - } + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } } 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 bed19115aa01..65d0ff6a6150 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-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class StoreApi { private ApiClient apiClient; @@ -61,7 +61,7 @@ public class StoreApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -75,43 +75,6 @@ public class StoreApi { apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); } - /** - * Finds orders by status - * A single status value can be provided as a string - * @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 - */ - public List findOrdersByStatus(String status) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/findByStatus".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status)); - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; - - GenericType> localVarReturnType = new GenericType>() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -133,7 +96,7 @@ public class StoreApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -147,41 +110,6 @@ public class StoreApi { GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Object - * @throws ApiException if fails to make API call - */ - public Object getInventoryInObject() throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - - GenericType localVarReturnType = new GenericType() {}; - return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -189,7 +117,7 @@ public class StoreApi { * @return Order * @throws ApiException if fails to make API call */ - public Order getOrderById(String orderId) throws ApiException { + public Order getOrderById(Long orderId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'orderId' is set @@ -210,7 +138,7 @@ public class StoreApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -219,7 +147,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[] { }; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); @@ -227,13 +155,18 @@ public class StoreApi { /** * Place an order for a pet * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return Order * @throws ApiException if fails to make API call */ public Order placeOrder(Order body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); + } + // create path and map variables String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); @@ -246,7 +179,7 @@ public class StoreApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -255,7 +188,7 @@ public class StoreApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; + String[] localVarAuthNames = new String[] { }; GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); 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 a6a28778e091..8a1cba219a6f 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-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class UserApi { private ApiClient apiClient; @@ -37,12 +37,17 @@ public class UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @throws ApiException if fails to make API call */ public void createUser(User body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); + } + // create path and map variables String localVarPath = "/user".replaceAll("\\{format\\}","json"); @@ -55,7 +60,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -72,12 +77,17 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @throws ApiException if fails to make API call */ public void createUsersWithArrayInput(List body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + } + // create path and map variables String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); @@ -90,7 +100,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -107,12 +117,17 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @throws ApiException if fails to make API call */ public void createUsersWithListInput(List body) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); + } + // create path and map variables String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); @@ -125,7 +140,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -166,7 +181,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -175,7 +190,7 @@ public class UserApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "test_http_basic" }; + String[] localVarAuthNames = new String[] { }; apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); @@ -208,7 +223,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -225,14 +240,24 @@ public class UserApi { /** * Logs user into the system * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return String * @throws ApiException if fails to make API call */ public String loginUser(String username, String password) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + // create path and map variables String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); @@ -247,7 +272,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -281,7 +306,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -299,7 +324,7 @@ public class UserApi { * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @throws ApiException if fails to make API call */ public void updateUser(String username, User body) throws ApiException { @@ -310,6 +335,11 @@ public class UserApi { throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); + } + // create path and map variables String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); @@ -323,7 +353,7 @@ public class UserApi { final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index d7cfe647b596..acdcaa52fcd6 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index a956d40501b4..fc96078e06ef 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -9,7 +9,7 @@ import java.util.List; import java.io.UnsupportedEncodingException; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java index 9534d08fd363..e70241f1171c 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java index 37262216c72b..d56e70d76895 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Animal { private String className = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java index c8e19c39c301..da8a3553b003 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Cat extends Animal { private String className = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java index fad08101a448..e8e19c2d32e5 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java index 920d45354d52..0d620e5adddc 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java @@ -10,7 +10,7 @@ import io.swagger.client.model.Animal; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Dog extends Animal { private String className = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java index 9d0b1a22e98b..1586ae89d6d1 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java @@ -11,7 +11,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class FormatTest { private Integer integer = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/InlineResponse200.java deleted file mode 100644 index 570849863962..000000000000 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/InlineResponse200.java +++ /dev/null @@ -1,198 +0,0 @@ -package io.swagger.client.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.client.model.Tag; -import java.util.ArrayList; -import java.util.List; - - - - - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") -public class InlineResponse200 { - - private List tags = new ArrayList(); - private Long id = null; - private Object category = null; - - - public enum StatusEnum { - AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status = null; - private String name = null; - private List photoUrls = new ArrayList(); - - - /** - **/ - public InlineResponse200 tags(List tags) { - this.tags = tags; - return this; - } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("tags") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - - /** - **/ - public InlineResponse200 id(Long id) { - this.id = id; - return this; - } - - @ApiModelProperty(example = "null", required = true, value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - public InlineResponse200 category(Object category) { - this.category = category; - return this; - } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("category") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } - - - /** - * pet status in the store - **/ - public InlineResponse200 status(StatusEnum status) { - this.status = status; - return this; - } - - @ApiModelProperty(example = "null", value = "pet status in the store") - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - /** - **/ - public InlineResponse200 name(String name) { - this.name = name; - return this; - } - - @ApiModelProperty(example = "doggie", value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - public InlineResponse200 photoUrls(List photoUrls) { - this.photoUrls = photoUrls; - return this; - } - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.tags, inlineResponse200.tags) && - 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); - } - - @Override - public int hashCode() { - return Objects.hash(tags, id, category, status, name, photoUrls); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); - - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * 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/Model200Response.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java index 32010398f487..1db08de21f45 100644 --- 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 @@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Model200Response { private Integer name = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..fe1bf3f483d8 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -0,0 +1,113 @@ +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-04-21T18:26:21.396+08:00") +public class ModelApiResponse { + + private Integer code = null; + private String type = null; + private String message = null; + + + /** + **/ + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + + /** + **/ + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("type") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + + /** + **/ + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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 index 0fad49d781de..1f89198ddda0 100644 --- 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 @@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class ModelReturn { private Integer _return = null; 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 index 72b8652423e9..cc7dbe3dd6ef 100644 --- 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 @@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Name { private Integer name = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java index e5b35f515399..136aa894eb48 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java @@ -11,7 +11,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Order { private Long id = null; @@ -39,14 +39,24 @@ public class Order { } private StatusEnum status = null; - private Boolean complete = null; + private Boolean complete = false; + /** + **/ + public Order id(Long id) { + this.id = id; + return this; + } + @ApiModelProperty(example = "null", value = "") @JsonProperty("id") public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } /** diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java index 2ae12be0c91b..859a1ce8c3c9 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java @@ -14,7 +14,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Pet { private Long id = null; 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 index 7233dae4aaef..be6b9c3c92a9 100644 --- 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 @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java index 5a680e603569..276ff12d6eb3 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java index 6017c1f66ab5..646f9969f300 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java @@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:32.196+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:55.995+08:00") public class User { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/PetApiTest.java index 9af7c537877a..515838532575 100644 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/PetApiTest.java @@ -70,6 +70,7 @@ public class PetApiTest { assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } + /* @Test public void testCreateAndGetPetWithByteArray() throws Exception { Pet pet = createRandomPet(); @@ -116,6 +117,7 @@ public class PetApiTest { assertEquals(category.getId(), Long.valueOf(categoryIdInt)); assertEquals(category.getName(), categoryMap.get("name")); } + */ @Test public void testUpdatePet() throws Exception { @@ -188,7 +190,7 @@ public class PetApiTest { Pet fetched = api.getPetById(pet.getId()); - api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null); + api.updatePetWithForm(fetched.getId(), "furt", null); Pet updated = api.getPetById(fetched.getId()); assertEquals(updated.getName(), "furt"); diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/StoreApiTest.java index b0106d2f4c61..7ccbdf3f32bf 100644 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/StoreApiTest.java @@ -33,6 +33,7 @@ public class StoreApiTest { assertTrue(inventory.keySet().size() > 0); } + /* @Test public void testGetInventoryInObject() throws Exception { Object inventoryObj = api.getInventoryInObject(); @@ -45,13 +46,14 @@ public class StoreApiTest { assertTrue(firstEntry.getKey() instanceof String); assertTrue(firstEntry.getValue() instanceof Integer); } + */ @Test public void testPlaceOrder() throws Exception { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(String.valueOf(order.getId())); + Order fetched = api.getOrderById(order.getId()); assertEquals(order.getId(), fetched.getId()); assertEquals(order.getPetId(), fetched.getPetId()); assertEquals(order.getQuantity(), fetched.getQuantity()); @@ -62,13 +64,13 @@ public class StoreApiTest { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(String.valueOf(order.getId())); + Order fetched = api.getOrderById(order.getId()); assertEquals(fetched.getId(), order.getId()); api.deleteOrder(String.valueOf(order.getId())); try { - api.getOrderById(String.valueOf(order.getId())); + api.getOrderById(order.getId()); // fail("expected an error"); } catch (ApiException e) { // ok diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index fd85a16cd076..f2b11d703c27 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -4,7 +4,7 @@ Building the API client library requires [Maven](https://maven.apache.org/) to be installed. -## Installation & Usage +## Installation To install the API client library to your local Maven repository, simply execute: @@ -20,7 +20,9 @@ mvn deploy Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. -After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: +### Maven users + +Add this dependency to your project's POM: ```xml @@ -29,9 +31,164 @@ After the client library is installed/deployed, you can use it in your Maven pro 1.0.0 compile +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "io.swagger:swagger-petstore-okhttp-gson:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + + mvn package + +Then manually install the following JARs: + +* target/swagger-petstore-okhttp-gson-1.0.0.jar +* target/lib/*.jar + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import io.swagger.client.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; +import io.swagger.client.api.PetApi; + +import java.io.File; +import java.util.*; + +public class PetApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + + + PetApi apiInstance = new PetApi(); + + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); + } + } +} ``` +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Animal](docs/Animal.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [Dog](docs/Dog.md) + - [InlineResponse200](docs/InlineResponse200.md) + - [Model200Response](docs/Model200Response.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### 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 + + ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue. @@ -40,4 +197,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea apiteam@swagger.io - diff --git a/samples/client/petstore/java/okhttp-gson/docs/Animal.md b/samples/client/petstore/java/okhttp-gson/docs/Animal.md new file mode 100644 index 000000000000..3ecb7f991f38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Animal.md @@ -0,0 +1,10 @@ + +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/ApiResponse.md b/samples/client/petstore/java/okhttp-gson/docs/ApiResponse.md new file mode 100644 index 000000000000..1c17767c2b72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/ApiResponse.md @@ -0,0 +1,12 @@ + +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/Cat.md b/samples/client/petstore/java/okhttp-gson/docs/Cat.md new file mode 100644 index 000000000000..373af540c416 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Cat.md @@ -0,0 +1,11 @@ + +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**declawed** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/Category.md b/samples/client/petstore/java/okhttp-gson/docs/Category.md new file mode 100644 index 000000000000..e2df08032787 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/Dog.md b/samples/client/petstore/java/okhttp-gson/docs/Dog.md new file mode 100644 index 000000000000..a1d638d3badd --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Dog.md @@ -0,0 +1,11 @@ + +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**breed** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md b/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md new file mode 100644 index 000000000000..8e400e7bcd77 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md @@ -0,0 +1,21 @@ + +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | | [optional] +**int32** | **Integer** | | [optional] +**int64** | **Long** | | [optional] +**number** | [**BigDecimal**](BigDecimal.md) | | +**_float** | **Float** | | [optional] +**_double** | **Double** | | [optional] +**string** | **String** | | [optional] +**_byte** | **byte[]** | | [optional] +**binary** | **byte[]** | | [optional] +**date** | [**Date**](Date.md) | | [optional] +**dateTime** | [**Date**](Date.md) | | [optional] +**password** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/InlineResponse200.md b/samples/client/petstore/java/okhttp-gson/docs/InlineResponse200.md new file mode 100644 index 000000000000..487ebe429e49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/InlineResponse200.md @@ -0,0 +1,24 @@ + +# InlineResponse200 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**photoUrls** | **List<String>** | | [optional] +**name** | **String** | | [optional] +**id** | **Long** | | +**category** | **Object** | | [optional] +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +AVAILABLE | available +PENDING | pending +SOLD | sold + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/Model200Response.md b/samples/client/petstore/java/okhttp-gson/docs/Model200Response.md new file mode 100644 index 000000000000..0819b88c4f4d --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Model200Response.md @@ -0,0 +1,10 @@ + +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-gson/docs/ModelApiResponse.md new file mode 100644 index 000000000000..3eec8686cc95 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/ModelApiResponse.md @@ -0,0 +1,12 @@ + +# ModelApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/ModelReturn.md b/samples/client/petstore/java/okhttp-gson/docs/ModelReturn.md new file mode 100644 index 000000000000..a679b04953e5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/ModelReturn.md @@ -0,0 +1,10 @@ + +# ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/Name.md b/samples/client/petstore/java/okhttp-gson/docs/Name.md new file mode 100644 index 000000000000..a1adac1dd39b --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Name.md @@ -0,0 +1,11 @@ + +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | +**snakeCase** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/Order.md b/samples/client/petstore/java/okhttp-gson/docs/Order.md new file mode 100644 index 000000000000..b1709c14eee0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Order.md @@ -0,0 +1,24 @@ + +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**Date**](Date.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +PLACED | placed +APPROVED | approved +DELIVERED | delivered + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/Pet.md b/samples/client/petstore/java/okhttp-gson/docs/Pet.md new file mode 100644 index 000000000000..20a1c298dd61 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Pet.md @@ -0,0 +1,24 @@ + +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +AVAILABLE | available +PENDING | pending +SOLD | sold + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/PetApi.md b/samples/client/petstore/java/okhttp-gson/docs/PetApi.md new file mode 100644 index 000000000000..e0314e20e519 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/PetApi.md @@ -0,0 +1,448 @@ +# 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 +[**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 +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.addPet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | Pet id to delete +String apiKey = "apiKey_example"; // String | +try { + apiInstance.deletePet(petId, apiKey); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List tags = Arrays.asList("tags_example"); // List | Tags to filter by +try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to return +try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updatePet** +> updatePet(body) + +Update an existing pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.updatePet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet that needs to be updated +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet +try { + apiInstance.updatePetWithForm(petId, name, status); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| 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 request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/xml, application/json + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to update +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server +File file = new File("/path/to/file.txt"); // File | file to upload +try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + diff --git a/samples/client/petstore/java/okhttp-gson/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp-gson/docs/SpecialModelName.md new file mode 100644 index 000000000000..c2c6117c552c --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/SpecialModelName.md @@ -0,0 +1,10 @@ + +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**specialPropertyName** | **Long** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/StoreApi.md b/samples/client/petstore/java/okhttp-gson/docs/StoreApi.md new file mode 100644 index 000000000000..0b30791725aa --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/StoreApi.md @@ -0,0 +1,197 @@ +# 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 +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**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 +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +String orderId = "orderId_example"; // String | ID of the order that needs to be deleted +try { + apiInstance.deleteOrder(orderId); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + e.printStackTrace(); +} +``` + +### 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 request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.StoreApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +StoreApi apiInstance = new StoreApi(); +try { + Map result = apiInstance.getInventory(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Map<String, Integer>**](Map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **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 +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Long orderId = 789L; // Long | ID of pet that needs to be fetched +try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Long**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Order body = new Order(); // Order | order placed for purchasing the pet +try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/java/okhttp-gson/docs/Tag.md b/samples/client/petstore/java/okhttp-gson/docs/Tag.md new file mode 100644 index 000000000000..de6814b55d57 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/User.md b/samples/client/petstore/java/okhttp-gson/docs/User.md new file mode 100644 index 000000000000..8b6753dd284a --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/User.md @@ -0,0 +1,17 @@ + +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [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/java/okhttp-gson/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson/docs/UserApi.md new file mode 100644 index 000000000000..8cdc15992eef --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/UserApi.md @@ -0,0 +1,370 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +User body = new User(); // User | Created user object +try { + apiInstance.createUser(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithArrayInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithListInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be deleted +try { + apiInstance.deleteUser(username); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +try { + User result = apiInstance.getUserByName(username); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + e.printStackTrace(); +} +``` + +### 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 request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The user name for login +String password = "password_example"; // String | The password for login in clear text +try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +try { + apiInstance.logoutUser(); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | name that need to be deleted +User body = new User(); // User | Updated user object +try { + apiInstance.updateUser(username, body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + 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 ef5ae6fa25d2..9328cb74d843 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 @@ -146,12 +146,7 @@ public class ApiClient { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); authentications.put("petstore_auth", new OAuth()); - 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. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 564721b41280..38c89d2d0fcd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:34.419+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T20:27:24.514+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index d165a15b2c70..e879206d377e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:34.419+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T20:27:24.514+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index 3527bb741c66..e1b2c38f0a22 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:34.419+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T20:27:24.514+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index 67634780b8e9..32556afd1b61 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:34.419+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T20:27:24.514+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index 1bfdafb1fcb4..ac7ad688c56a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -18,7 +18,7 @@ import com.squareup.okhttp.Response; import java.io.IOException; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; +import io.swagger.client.model.ModelApiResponse; import java.io.File; import java.lang.reflect.Type; @@ -50,6 +50,11 @@ public class PetApi { private Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling addPet(Async)"); + } + // create path and map variables String localVarPath = "/pet".replaceAll("\\{format\\}","json"); @@ -61,7 +66,7 @@ public class PetApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -91,7 +96,7 @@ public class PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @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 { @@ -101,7 +106,7 @@ public class PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -113,7 +118,7 @@ public class PetApi { /** * Add a new pet to the store (asynchronously) * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (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 @@ -143,103 +148,6 @@ public class PetApi { apiClient.executeAsync(call, callback); return call; } - /* Build call for addPetUsingByteArray */ - private Call addPetUsingByteArrayCall(byte[] body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - - // create path and map variables - String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array (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 { - addPetUsingByteArrayWithHttpInfo(body); - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array (optional) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse addPetUsingByteArrayWithHttpInfo(byte[] body) throws ApiException { - Call call = addPetUsingByteArrayCall(body, null, null); - return apiClient.execute(call); - } - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store (asynchronously) - * - * @param body Pet object in the form of byte array (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 - */ - public Call addPetUsingByteArrayAsync(byte[] body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = addPetUsingByteArrayCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } /* Build call for deletePet */ private Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -263,7 +171,7 @@ public class PetApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -352,20 +260,25 @@ public class PetApi { private Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + // create path and map variables String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); List localVarQueryParams = new ArrayList(); if (status != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "status", status)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -395,7 +308,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 (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return List * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -407,7 +320,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 (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return ApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -420,7 +333,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 (optional, default to available) + * @param status Status values that need to be considered for filter (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 @@ -455,20 +368,25 @@ public class PetApi { private Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + // create path and map variables String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); List localVarQueryParams = new ArrayList(); if (tags != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -497,8 +415,8 @@ 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 (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return List * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -509,8 +427,8 @@ 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 (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return ApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -522,8 +440,8 @@ 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 (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (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 @@ -575,7 +493,7 @@ public class PetApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -598,14 +516,14 @@ public class PetApi { }); } - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "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 (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Pet * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -616,8 +534,8 @@ 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 (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -629,8 +547,8 @@ 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 (required) + * Returns a single pet + * @param petId ID of pet to return (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 @@ -661,224 +579,15 @@ public class PetApi { apiClient.executeAsync(call, localVarReturnType, callback); return call; } - /* Build call for getPetByIdInObject */ - private Call getPetByIdInObjectCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling getPetByIdInObject(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (required) - * @return InlineResponse200 - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException { - ApiResponse resp = getPetByIdInObjectWithHttpInfo(petId); - return resp.getData(); - } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getPetByIdInObjectWithHttpInfo(Long petId) throws ApiException { - Call call = getPetByIdInObjectCall(petId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' (asynchronously) - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (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 - */ - public Call getPetByIdInObjectAsync(Long petId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = getPetByIdInObjectCall(petId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for petPetIdtestingByteArraytrueGet */ - private Call petPetIdtestingByteArraytrueGetCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (required) - * @return byte[] - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException { - ApiResponse resp = petPetIdtestingByteArraytrueGetWithHttpInfo(petId); - return resp.getData(); - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse petPetIdtestingByteArraytrueGetWithHttpInfo(Long petId) throws ApiException { - Call call = petPetIdtestingByteArraytrueGetCall(petId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' (asynchronously) - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched (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 - */ - public Call petPetIdtestingByteArraytrueGetAsync(Long petId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = petPetIdtestingByteArraytrueGetCall(petId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } /* Build call for updatePet */ private Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updatePet(Async)"); + } + // create path and map variables String localVarPath = "/pet".replaceAll("\\{format\\}","json"); @@ -890,7 +599,7 @@ public class PetApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -920,7 +629,7 @@ public class PetApi { /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @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 { @@ -930,7 +639,7 @@ public class PetApi { /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -942,7 +651,7 @@ public class PetApi { /** * Update an existing pet (asynchronously) * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (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 @@ -973,7 +682,7 @@ public class PetApi { return call; } /* Build call for updatePetWithForm */ - private Call updatePetWithFormCall(String petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -997,7 +706,7 @@ public class PetApi { localVarFormParams.put("status", status); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -1032,7 +741,7 @@ public class PetApi { * @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 { + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { updatePetWithFormWithHttpInfo(petId, name, status); } @@ -1045,7 +754,7 @@ public class PetApi { * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse updatePetWithFormWithHttpInfo(String petId, String name, String status) throws ApiException { + public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { Call call = updatePetWithFormCall(petId, name, status, null, null); return apiClient.execute(call); } @@ -1060,7 +769,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call updatePetWithFormAsync(String petId, String name, String status, final ApiCallback callback) throws ApiException { + public Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1110,7 +819,7 @@ public class PetApi { localVarFormParams.put("file", file); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -1143,10 +852,12 @@ public class PetApi { * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) + * @return ModelApiResponse * @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 { - uploadFileWithHttpInfo(petId, additionalMetadata, file); + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + ApiResponse resp = uploadFileWithHttpInfo(petId, additionalMetadata, file); + return resp.getData(); } /** @@ -1155,12 +866,13 @@ public class PetApi { * @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 + * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { + public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { Call call = uploadFileCall(petId, additionalMetadata, file, null, null); - return apiClient.execute(call); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); } /** @@ -1173,7 +885,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { + public Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1195,7 +907,8 @@ public class PetApi { } Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); return call; } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java index 4d803d3b575e..5d960d0b104a 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 @@ -65,7 +65,7 @@ public class StoreApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -147,109 +147,6 @@ public class StoreApi { apiClient.executeAsync(call, callback); return call; } - /* Build call for findOrdersByStatus */ - private Call findOrdersByStatusCall(String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - - // create path and map variables - String localVarPath = "/store/findByStatus".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - if (status != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * 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 (optional, default to placed) - * @return List - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public List findOrdersByStatus(String status) throws ApiException { - ApiResponse> resp = findOrdersByStatusWithHttpInfo(status); - return resp.getData(); - } - - /** - * 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 (optional, default to placed) - * @return ApiResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse> findOrdersByStatusWithHttpInfo(String status) throws ApiException { - Call call = findOrdersByStatusCall(status, null, null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * 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 (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 - */ - public Call findOrdersByStatusAsync(String status, final ApiCallback> callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = findOrdersByStatusCall(status, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken>(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } /* Build call for getInventory */ private Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -265,7 +162,7 @@ public class StoreApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -348,106 +245,8 @@ public class StoreApi { apiClient.executeAsync(call, localVarReturnType, callback); return call; } - /* Build call for getInventoryInObject */ - private Call getInventoryInObjectCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - - // create path and map variables - String localVarPath = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json", "application/xml" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "api_key" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Object - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public Object getInventoryInObject() throws ApiException { - ApiResponse resp = getInventoryInObjectWithHttpInfo(); - return resp.getData(); - } - - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getInventoryInObjectWithHttpInfo() throws ApiException { - Call call = getInventoryInObjectCall(null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' (asynchronously) - * Returns an arbitrary object which is actually a map of status codes to quantities - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getInventoryInObjectAsync(final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - Call call = getInventoryInObjectCall(progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } /* Build call for getOrderById */ - private Call getOrderByIdCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'orderId' is set @@ -467,7 +266,7 @@ public class StoreApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -490,7 +289,7 @@ public class StoreApi { }); } - String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" }; + String[] localVarAuthNames = new String[] { }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @@ -501,7 +300,7 @@ public class StoreApi { * @return Order * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public Order getOrderById(String orderId) throws ApiException { + public Order getOrderById(Long orderId) throws ApiException { ApiResponse resp = getOrderByIdWithHttpInfo(orderId); return resp.getData(); } @@ -513,7 +312,7 @@ public class StoreApi { * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse getOrderByIdWithHttpInfo(String orderId) throws ApiException { + public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { Call call = getOrderByIdCall(orderId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); @@ -527,7 +326,7 @@ public class StoreApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call getOrderByIdAsync(String orderId, final ApiCallback callback) throws ApiException { + public Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -557,6 +356,11 @@ public class StoreApi { private Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling placeOrder(Async)"); + } + // create path and map variables String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); @@ -568,7 +372,7 @@ public class StoreApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -591,14 +395,14 @@ public class StoreApi { }); } - String[] localVarAuthNames = new String[] { "test_api_client_id", "test_api_client_secret" }; + String[] localVarAuthNames = new String[] { }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } /** * Place an order for a pet * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return Order * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -610,7 +414,7 @@ public class StoreApi { /** * Place an order for a pet * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -623,7 +427,7 @@ public class StoreApi { /** * Place an order for a pet (asynchronously) * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (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 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 5126228e3237..be0269ef28f2 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 @@ -48,6 +48,11 @@ public class UserApi { private Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUser(Async)"); + } + // create path and map variables String localVarPath = "/user".replaceAll("\\{format\\}","json"); @@ -59,7 +64,7 @@ public class UserApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -89,7 +94,7 @@ public class UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @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 { @@ -99,7 +104,7 @@ public class UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -111,7 +116,7 @@ public class UserApi { /** * Create user (asynchronously) * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (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 @@ -145,6 +150,11 @@ public class UserApi { private Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUsersWithArrayInput(Async)"); + } + // create path and map variables String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); @@ -156,7 +166,7 @@ public class UserApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -186,7 +196,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @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 { @@ -196,7 +206,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -208,7 +218,7 @@ public class UserApi { /** * Creates list of users with given input array (asynchronously) * - * @param body List of user object (optional) + * @param body List of user object (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 @@ -242,6 +252,11 @@ public class UserApi { private Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUsersWithListInput(Async)"); + } + // create path and map variables String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); @@ -253,7 +268,7 @@ public class UserApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -283,7 +298,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @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 { @@ -293,7 +308,7 @@ public class UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -305,7 +320,7 @@ public class UserApi { /** * Creates list of users with given input array (asynchronously) * - * @param body List of user object (optional) + * @param body List of user object (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 @@ -356,7 +371,7 @@ public class UserApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -379,7 +394,7 @@ public class UserApi { }); } - String[] localVarAuthNames = new String[] { "test_http_basic" }; + String[] localVarAuthNames = new String[] { }; return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @@ -459,7 +474,7 @@ public class UserApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -549,6 +564,16 @@ public class UserApi { private Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + // create path and map variables String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); @@ -564,7 +589,7 @@ public class UserApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -594,8 +619,8 @@ public class UserApi { /** * Logs user into the system * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return String * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -607,8 +632,8 @@ public class UserApi { /** * Logs user into the system * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -621,8 +646,8 @@ public class UserApi { /** * Logs user into the system (asynchronously) * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (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 @@ -668,7 +693,7 @@ public class UserApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -756,6 +781,11 @@ public class UserApi { throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); } + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateUser(Async)"); + } + // create path and map variables String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") @@ -768,7 +798,7 @@ public class UserApi { Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/json", "application/xml" + "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); @@ -799,7 +829,7 @@ public class UserApi { * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @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 { @@ -810,7 +840,7 @@ public class UserApi { * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @return ApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -823,7 +853,7 @@ public class UserApi { * Updated user (asynchronously) * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (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 diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 526c11636720..fa2d52930188 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:34.419+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T20:27:24.514+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index a109275004ee..81d6fddf5b00 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:34.419+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T20:27:24.514+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/InlineResponse200.java deleted file mode 100644 index 15bb92523feb..000000000000 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/InlineResponse200.java +++ /dev/null @@ -1,168 +0,0 @@ -package io.swagger.client.model; - -import java.util.Objects; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.client.model.Tag; -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; - - - - - -public class InlineResponse200 { - - @SerializedName("tags") - private List tags = new ArrayList(); - - @SerializedName("id") - private Long id = null; - - @SerializedName("category") - private Object category = null; - - -public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), - - @SerializedName("pending") - PENDING("pending"), - - @SerializedName("sold") - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } -} - - @SerializedName("status") - private StatusEnum status = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("photoUrls") - private List photoUrls = new ArrayList(); - - /** - **/ - @ApiModelProperty(value = "") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } - - /** - * pet status in the store - **/ - @ApiModelProperty(value = "pet status in the store") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(this.tags, inlineResponse200.tags) && - 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); - } - - @Override - public int hashCode() { - return Objects.hash(tags, id, category, status, name, photoUrls); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); - - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * 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/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..20d2fc58dd3c --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -0,0 +1,96 @@ +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 ModelApiResponse { + + @SerializedName("code") + private Integer code = null; + + @SerializedName("type") + private String type = null; + + @SerializedName("message") + private String message = null; + + /** + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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 cc13fe4bfd02..b0ebd0e87581 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 @@ -52,7 +52,7 @@ public enum StatusEnum { private StatusEnum status = null; @SerializedName("complete") - private Boolean complete = null; + private Boolean complete = false; /** **/ @@ -60,6 +60,9 @@ public enum StatusEnum { public Long getId() { return id; } + public void setId(Long id) { + this.id = 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 000dbd96bfbc..5345e2a1646e 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 @@ -150,6 +150,7 @@ public class ApiClientTest { } } + /* @Test public void testSetUsernameAndPassword() { HttpBasicAuth auth = null; @@ -171,6 +172,7 @@ public class ApiClientTest { auth.setUsername(null); auth.setPassword(null); } + */ @Test public void testSetApiKeyAndPrefix() { diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/PetApiTest.java index 97e708fb2ece..e378356d0d4d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/PetApiTest.java @@ -72,6 +72,7 @@ public class PetApiTest { assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } + /* @Test public void testCreateAndGetPetWithByteArray() throws Exception { Pet pet = createRandomPet(); @@ -86,6 +87,7 @@ public class PetApiTest { assertNotNull(fetched.getCategory()); assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } + */ @Test public void testCreateAndGetPetWithHttpInfo() throws Exception { @@ -197,6 +199,7 @@ public class PetApiTest { assertEquals("application/json", exception.getResponseHeaders().get("Content-Type").get(0)); } + /* @Test public void testGetPetByIdInObject() throws Exception { Pet pet = new Pet(); @@ -230,6 +233,7 @@ public class PetApiTest { assertEquals(category.getId(), categoryIdLong); assertEquals(category.getName(), categoryMap.get("name")); } + */ @Test public void testUpdatePet() throws Exception { @@ -306,7 +310,7 @@ public class PetApiTest { Pet fetched = api.getPetById(pet.getId()); - api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null); + api.updatePetWithForm(fetched.getId(), "furt", null); Pet updated = api.getPetById(fetched.getId()); assertEquals(updated.getName(), "furt"); diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/StoreApiTest.java index 2f4c42972503..0d1910dc1e74 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/StoreApiTest.java @@ -38,6 +38,7 @@ public class StoreApiTest { assertTrue(inventory.keySet().size() > 0); } + /* @Test public void testGetInventoryInObject() throws Exception { Object inventoryObj = api.getInventoryInObject(); @@ -51,13 +52,14 @@ public class StoreApiTest { // NOTE: Gson parses integer value to double. assertTrue(firstEntry.getValue() instanceof Double); } + */ @Test public void testPlaceOrder() throws Exception { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(String.valueOf(order.getId())); + Order fetched = api.getOrderById(order.getId()); assertEquals(order.getId(), fetched.getId()); assertEquals(order.getPetId(), fetched.getPetId()); assertEquals(order.getQuantity(), fetched.getQuantity()); @@ -68,13 +70,13 @@ public class StoreApiTest { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(String.valueOf(order.getId())); + Order fetched = api.getOrderById(order.getId()); assertEquals(fetched.getId(), order.getId()); api.deleteOrder(String.valueOf(order.getId())); try { - api.getOrderById(String.valueOf(order.getId())); + api.getOrderById(order.getId()); // fail("expected an error"); } catch (ApiException e) { // ok diff --git a/samples/client/petstore/java/retrofit/README.md b/samples/client/petstore/java/retrofit/README.md index b687b09ab262..93488cf4e5cf 100644 --- a/samples/client/petstore/java/retrofit/README.md +++ b/samples/client/petstore/java/retrofit/README.md @@ -20,7 +20,7 @@ mvn deploy Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. -After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: ```xml diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java index ed1ff85acabc..6540997c3198 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java @@ -47,10 +47,10 @@ public class ApiClient { this(); for(String authName : authNames) { Interceptor auth; - if (authName == "api_key") { - auth = new ApiKeyAuth("header", "api_key"); - } else if (authName == "petstore_auth") { + if (authName == "petstore_auth") { auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + } else if (authName == "api_key") { + auth = new ApiKeyAuth("header", "api_key"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java index 1ce483dd74c3..1ec34d9e71d5 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:35.471+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:30:01.525+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java index af2482b371ff..a019a4bf886d 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java @@ -7,7 +7,7 @@ import retrofit.http.*; import retrofit.mime.*; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; +import io.swagger.client.model.ModelApiResponse; import java.io.File; import java.util.ArrayList; @@ -20,7 +20,7 @@ public interface PetApi { * Add a new pet to the store * Sync method * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return Void */ @@ -32,7 +32,7 @@ public interface PetApi { /** * Add a new pet to the store * Async method - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @param cb callback method * @return void */ @@ -41,31 +41,6 @@ public interface PetApi { void addPet( @Body Pet body, Callback cb ); - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * Sync method - * - * @param body Pet object in the form of byte array (optional) - * @return Void - */ - - @POST("/pet?testing_byte_array=true") - Void addPetUsingByteArray( - @Body byte[] body - ); - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * Async method - * @param body Pet object in the form of byte array (optional) - * @param cb callback method - * @return void - */ - - @POST("/pet?testing_byte_array=true") - void addPetUsingByteArray( - @Body byte[] body, Callback cb - ); /** * Deletes a pet * Sync method @@ -97,57 +72,57 @@ public interface PetApi { * Finds Pets by status * Sync method * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for query (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return List */ @GET("/pet/findByStatus") List findPetsByStatus( - @Query("status") List status + @Query("status") CSVParams status ); /** * Finds Pets by status * Async method - * @param status Status values that need to be considered for query (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @param cb callback method * @return void */ @GET("/pet/findByStatus") void findPetsByStatus( - @Query("status") List status, Callback> cb + @Query("status") CSVParams status, Callback> cb ); /** * Finds Pets by tags * Sync method - * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return List */ @GET("/pet/findByTags") List findPetsByTags( - @Query("tags") List tags + @Query("tags") CSVParams tags ); /** * Finds Pets by tags * Async method - * @param tags Tags to filter by (optional) + * @param tags Tags to filter by (required) * @param cb callback method * @return void */ @GET("/pet/findByTags") void findPetsByTags( - @Query("tags") List tags, Callback> cb + @Query("tags") CSVParams tags, Callback> cb ); /** * Find pet by ID * Sync method - * 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 (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Pet */ @@ -159,7 +134,7 @@ public interface PetApi { /** * Find pet by ID * Async method - * @param petId ID of pet that needs to be fetched (required) + * @param petId ID of pet to return (required) * @param cb callback method * @return void */ @@ -168,61 +143,11 @@ public interface PetApi { void getPetById( @Path("petId") Long petId, Callback cb ); - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Sync method - * 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 (required) - * @return InlineResponse200 - */ - - @GET("/pet/{petId}?response=inline_arbitrary_object") - InlineResponse200 getPetByIdInObject( - @Path("petId") Long petId - ); - - /** - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * Async method - * @param petId ID of pet that needs to be fetched (required) - * @param cb callback method - * @return void - */ - - @GET("/pet/{petId}?response=inline_arbitrary_object") - void getPetByIdInObject( - @Path("petId") Long petId, Callback cb - ); - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Sync method - * 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 (required) - * @return byte[] - */ - - @GET("/pet/{petId}?testing_byte_array=true") - byte[] petPetIdtestingByteArraytrueGet( - @Path("petId") Long petId - ); - - /** - * Fake endpoint to test byte array return by 'Find pet by ID' - * Async method - * @param petId ID of pet that needs to be fetched (required) - * @param cb callback method - * @return void - */ - - @GET("/pet/{petId}?testing_byte_array=true") - void petPetIdtestingByteArraytrueGet( - @Path("petId") Long petId, Callback cb - ); /** * Update an existing pet * Sync method * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return Void */ @@ -234,7 +159,7 @@ public interface PetApi { /** * Update an existing pet * Async method - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @param cb callback method * @return void */ @@ -256,7 +181,7 @@ public interface PetApi { @FormUrlEncoded @POST("/pet/{petId}") Void updatePetWithForm( - @Path("petId") String petId, @Field("name") String name, @Field("status") String status + @Path("petId") Long petId, @Field("name") String name, @Field("status") String status ); /** @@ -272,7 +197,7 @@ public interface PetApi { @FormUrlEncoded @POST("/pet/{petId}") void updatePetWithForm( - @Path("petId") String petId, @Field("name") String name, @Field("status") String status, Callback cb + @Path("petId") Long petId, @Field("name") String name, @Field("status") String status, Callback cb ); /** * uploads an image @@ -281,12 +206,12 @@ public interface PetApi { * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return Void + * @return ModelApiResponse */ @Multipart @POST("/pet/{petId}/uploadImage") - Void uploadFile( + ModelApiResponse uploadFile( @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file ); @@ -303,6 +228,6 @@ public interface PetApi { @Multipart @POST("/pet/{petId}/uploadImage") void uploadFile( - @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file, Callback cb + @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file, Callback cb ); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/StoreApi.java index ede732a986bf..def4aa2efc70 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/StoreApi.java @@ -39,31 +39,6 @@ public interface StoreApi { void deleteOrder( @Path("orderId") String orderId, Callback cb ); - /** - * Finds orders by status - * Sync method - * A single status value can be provided as a string - * @param status Status value that needs to be considered for query (optional, default to placed) - * @return List - */ - - @GET("/store/findByStatus") - List findOrdersByStatus( - @Query("status") String status - ); - - /** - * Finds orders by status - * Async method - * @param status Status value that needs to be considered for query (optional, default to placed) - * @param cb callback method - * @return void - */ - - @GET("/store/findByStatus") - void findOrdersByStatus( - @Query("status") String status, Callback> cb - ); /** * Returns pet inventories by status * Sync method @@ -86,28 +61,6 @@ public interface StoreApi { void getInventory( Callback> cb ); - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Sync method - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Object - */ - - @GET("/store/inventory?response=arbitrary_object") - Object getInventoryInObject(); - - - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Async method - * @param cb callback method - * @return void - */ - - @GET("/store/inventory?response=arbitrary_object") - void getInventoryInObject( - Callback cb - ); /** * Find purchase order by ID * Sync method @@ -118,7 +71,7 @@ public interface StoreApi { @GET("/store/order/{orderId}") Order getOrderById( - @Path("orderId") String orderId + @Path("orderId") Long orderId ); /** @@ -131,13 +84,13 @@ public interface StoreApi { @GET("/store/order/{orderId}") void getOrderById( - @Path("orderId") String orderId, Callback cb + @Path("orderId") Long orderId, Callback cb ); /** * Place an order for a pet * Sync method * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return Order */ @@ -149,7 +102,7 @@ public interface StoreApi { /** * Place an order for a pet * Async method - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @param cb callback method * @return void */ diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/UserApi.java index ea7285de79c0..8c3380d07d4e 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/UserApi.java @@ -18,7 +18,7 @@ public interface UserApi { * Create user * Sync method * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @return Void */ @@ -30,7 +30,7 @@ public interface UserApi { /** * Create user * Async method - * @param body Created user object (optional) + * @param body Created user object (required) * @param cb callback method * @return void */ @@ -43,7 +43,7 @@ public interface UserApi { * Creates list of users with given input array * Sync method * - * @param body List of user object (optional) + * @param body List of user object (required) * @return Void */ @@ -55,7 +55,7 @@ public interface UserApi { /** * Creates list of users with given input array * Async method - * @param body List of user object (optional) + * @param body List of user object (required) * @param cb callback method * @return void */ @@ -68,7 +68,7 @@ public interface UserApi { * Creates list of users with given input array * Sync method * - * @param body List of user object (optional) + * @param body List of user object (required) * @return Void */ @@ -80,7 +80,7 @@ public interface UserApi { /** * Creates list of users with given input array * Async method - * @param body List of user object (optional) + * @param body List of user object (required) * @param cb callback method * @return void */ @@ -143,8 +143,8 @@ public interface UserApi { * Logs user into the system * Sync method * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return String */ @@ -156,8 +156,8 @@ public interface UserApi { /** * Logs user into the system * Async method - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @param cb callback method * @return void */ @@ -193,7 +193,7 @@ public interface UserApi { * Sync method * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @return Void */ @@ -206,7 +206,7 @@ public interface UserApi { * Updated user * Async method * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @param cb callback method * @return void */ diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/InlineResponse200.java deleted file mode 100644 index b17bf005009c..000000000000 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/InlineResponse200.java +++ /dev/null @@ -1,168 +0,0 @@ -package io.swagger.client.model; - -import java.util.Objects; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.client.model.Tag; -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; - - - - - -public class InlineResponse200 { - - @SerializedName("tags") - private List tags = new ArrayList(); - - @SerializedName("id") - private Long id = null; - - @SerializedName("category") - private Object category = null; - - -public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), - - @SerializedName("pending") - PENDING("pending"), - - @SerializedName("sold") - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } -} - - @SerializedName("status") - private StatusEnum status = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("photoUrls") - private List photoUrls = new ArrayList(); - - /** - **/ - @ApiModelProperty(value = "") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } - - /** - * pet status in the store - **/ - @ApiModelProperty(value = "pet status in the store") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(tags, inlineResponse200.tags) && - Objects.equals(id, inlineResponse200.id) && - Objects.equals(category, inlineResponse200.category) && - Objects.equals(status, inlineResponse200.status) && - Objects.equals(name, inlineResponse200.name) && - Objects.equals(photoUrls, inlineResponse200.photoUrls); - } - - @Override - public int hashCode() { - return Objects.hash(tags, id, category, status, name, photoUrls); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); - - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * 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/retrofit/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..bb5313b42d41 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -0,0 +1,96 @@ +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 ModelApiResponse { + + @SerializedName("code") + private Integer code = null; + + @SerializedName("type") + private String type = null; + + @SerializedName("message") + private String message = null; + + /** + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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/retrofit/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java index f1fb2ad7409f..196a57024040 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java @@ -52,7 +52,7 @@ public enum StatusEnum { private StatusEnum status = null; @SerializedName("complete") - private Boolean complete = null; + private Boolean complete = false; /** **/ @@ -60,6 +60,9 @@ public enum StatusEnum { public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } /** **/ diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/PetApiTest.java index a943a8ffe6e1..9fa93650d545 100644 --- a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/PetApiTest.java @@ -2,7 +2,8 @@ package io.swagger.petstore.test; import io.swagger.TestUtils; -import io.swagger.client.ApiClient; +import io.swagger.client.*; +import io.swagger.client.CollectionFormats.*; import io.swagger.client.api.*; import io.swagger.client.model.*; @@ -61,7 +62,7 @@ public class PetApiTest { api.updatePet(pet); - List pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"})); + List pets = api.findPetsByStatus(new CSVParams("available")); assertNotNull(pets); boolean found = false; @@ -89,7 +90,7 @@ public class PetApiTest { api.updatePet(pet); - List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})); + List pets = api.findPetsByTags(new CSVParams("friendly")); assertNotNull(pets); boolean found = false; @@ -110,7 +111,7 @@ public class PetApiTest { Pet fetched = api.getPetById(pet.getId()); - api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null); + api.updatePetWithForm(fetched.getId(), "furt", null); Pet updated = api.getPetById(fetched.getId()); assertEquals(updated.getName(), "furt"); diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/StoreApiTest.java index 07d3b6a298d5..c823245355a7 100644 --- a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/StoreApiTest.java @@ -33,7 +33,7 @@ public class StoreApiTest { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(String.valueOf(order.getId())); + Order fetched = api.getOrderById(order.getId()); assertEquals(order.getId(), fetched.getId()); assertEquals(order.getPetId(), fetched.getPetId()); assertEquals(order.getQuantity(), fetched.getQuantity()); @@ -44,13 +44,13 @@ public class StoreApiTest { Order order = createOrder(); api.placeOrder(order); - Order fetched = api.getOrderById(String.valueOf(order.getId())); + Order fetched = api.getOrderById(order.getId()); assertEquals(fetched.getId(), order.getId()); api.deleteOrder(String.valueOf(order.getId())); try { - api.getOrderById(String.valueOf(order.getId())); + api.getOrderById(order.getId()); // fail("expected an error"); } catch (RetrofitError e) { // ok diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java index ffff8c26d4fc..e49bdf24d7bd 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java @@ -49,16 +49,8 @@ public class ApiClient { Interceptor auth; if (authName == "petstore_auth") { auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); - } else if (authName == "test_api_client_id") { - auth = new ApiKeyAuth("header", "x-test_api_client_id"); - } else if (authName == "test_api_client_secret") { - auth = new ApiKeyAuth("header", "x-test_api_client_secret"); } else if (authName == "api_key") { auth = new ApiKeyAuth("header", "api_key"); - } else if (authName == "test_api_key_query") { - auth = new ApiKeyAuth("query", "test_api_key_query"); - } else if (authName == "test_api_key_header") { - auth = new ApiKeyAuth("header", "test_api_key_header"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java index dace285deca2..fd13370ea3ab 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:36.537+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:30:03.337+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java index f56c7de3ddf7..ec9d67a74497 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java @@ -9,7 +9,7 @@ import retrofit2.http.*; import okhttp3.RequestBody; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; +import io.swagger.client.model.ModelApiResponse; import java.io.File; import java.util.ArrayList; @@ -21,7 +21,7 @@ public interface PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return Call */ @@ -30,18 +30,6 @@ public interface PetApi { @Body Pet body ); - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array (optional) - * @return Call - */ - - @POST("pet?testing_byte_array=true") - Call addPetUsingByteArray( - @Body byte[] body - ); - /** * Deletes a pet * @@ -58,31 +46,31 @@ public interface 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 (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return Call> */ @GET("pet/findByStatus") Call> findPetsByStatus( - @Query("status") List status + @Query("status") CSVParams status ); /** * 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 (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return Call> */ @GET("pet/findByTags") Call> findPetsByTags( - @Query("tags") List tags + @Query("tags") CSVParams tags ); /** * 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 (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Call */ @@ -91,34 +79,10 @@ public interface PetApi { @Path("petId") Long 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 - * @param petId ID of pet that needs to be fetched (required) - * @return Call - */ - - @GET("pet/{petId}?response=inline_arbitrary_object") - Call getPetByIdInObject( - @Path("petId") Long 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 - * @param petId ID of pet that needs to be fetched (required) - * @return Call - */ - - @GET("pet/{petId}?testing_byte_array=true") - Call petPetIdtestingByteArraytrueGet( - @Path("petId") Long petId - ); - /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return Call */ @@ -139,7 +103,7 @@ public interface PetApi { @FormUrlEncoded @POST("pet/{petId}") Call updatePetWithForm( - @Path("petId") String petId, @Field("name") String name, @Field("status") String status + @Path("petId") Long petId, @Field("name") String name, @Field("status") String status ); /** @@ -148,12 +112,12 @@ public interface PetApi { * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return Call + * @return Call */ @Multipart @POST("pet/{petId}/uploadImage") - Call uploadFile( + Call uploadFile( @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file\"; filename=\"file\"") RequestBody file ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java index 55a3ea5b46ae..1651c07482c4 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java @@ -28,18 +28,6 @@ public interface StoreApi { @Path("orderId") String orderId ); - /** - * 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 (optional, default to placed) - * @return Call> - */ - - @GET("store/findByStatus") - Call> findOrdersByStatus( - @Query("status") String status - ); - /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -50,16 +38,6 @@ public interface StoreApi { Call> getInventory(); - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Call - */ - - @GET("store/inventory?response=arbitrary_object") - Call getInventoryInObject(); - - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -69,13 +47,13 @@ public interface StoreApi { @GET("store/order/{orderId}") Call getOrderById( - @Path("orderId") String orderId + @Path("orderId") Long orderId ); /** * Place an order for a pet * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return Call */ diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java index ce02953a0c8d..a0f17545a0f6 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java @@ -19,7 +19,7 @@ public interface UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @return Call */ @@ -31,7 +31,7 @@ public interface UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return Call */ @@ -43,7 +43,7 @@ public interface UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return Call */ @@ -79,8 +79,8 @@ public interface UserApi { /** * Logs user into the system * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return Call */ @@ -103,7 +103,7 @@ public interface UserApi { * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @return Call */ diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/InlineResponse200.java deleted file mode 100644 index b17bf005009c..000000000000 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/InlineResponse200.java +++ /dev/null @@ -1,168 +0,0 @@ -package io.swagger.client.model; - -import java.util.Objects; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.client.model.Tag; -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; - - - - - -public class InlineResponse200 { - - @SerializedName("tags") - private List tags = new ArrayList(); - - @SerializedName("id") - private Long id = null; - - @SerializedName("category") - private Object category = null; - - -public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), - - @SerializedName("pending") - PENDING("pending"), - - @SerializedName("sold") - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } -} - - @SerializedName("status") - private StatusEnum status = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("photoUrls") - private List photoUrls = new ArrayList(); - - /** - **/ - @ApiModelProperty(value = "") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } - - /** - * pet status in the store - **/ - @ApiModelProperty(value = "pet status in the store") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(tags, inlineResponse200.tags) && - Objects.equals(id, inlineResponse200.id) && - Objects.equals(category, inlineResponse200.category) && - Objects.equals(status, inlineResponse200.status) && - Objects.equals(name, inlineResponse200.name) && - Objects.equals(photoUrls, inlineResponse200.photoUrls); - } - - @Override - public int hashCode() { - return Objects.hash(tags, id, category, status, name, photoUrls); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); - - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * 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/retrofit2/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..bb5313b42d41 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -0,0 +1,96 @@ +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 ModelApiResponse { + + @SerializedName("code") + private Integer code = null; + + @SerializedName("type") + private String type = null; + + @SerializedName("message") + private String message = null; + + /** + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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/retrofit2/src/main/java/io/swagger/client/model/ObjectReturn.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ObjectReturn.java deleted file mode 100644 index 920640ad2cb2..000000000000 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ObjectReturn.java +++ /dev/null @@ -1,69 +0,0 @@ -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; - - - - -@ApiModel(description = "") -public class ObjectReturn { - - @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; - } - ObjectReturn _return = (ObjectReturn) o; - return Objects.equals(_return, _return._return); - } - - @Override - public int hashCode() { - return Objects.hash(_return); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ObjectReturn {\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/retrofit2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java index f1fb2ad7409f..196a57024040 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java @@ -52,7 +52,7 @@ public enum StatusEnum { private StatusEnum status = null; @SerializedName("complete") - private Boolean complete = null; + private Boolean complete = false; /** **/ @@ -60,6 +60,9 @@ public enum StatusEnum { public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } /** **/ diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/PetApiTest.java index 3905fb962e38..ac8abefb216a 100644 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/PetApiTest.java @@ -3,6 +3,7 @@ package io.swagger.petstore.test; import io.swagger.TestUtils; import io.swagger.client.ApiClient; +import io.swagger.client.CollectionFormats.*; import io.swagger.client.api.*; import io.swagger.client.model.*; @@ -65,7 +66,7 @@ public class PetApiTest { api.updatePet(pet).execute(); - List pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"})).execute().body(); + List pets = api.findPetsByStatus(new CSVParams("available")).execute().body(); assertNotNull(pets); boolean found = false; @@ -93,7 +94,7 @@ public class PetApiTest { api.updatePet(pet).execute(); - List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})).execute().body(); + List pets = api.findPetsByTags(new CSVParams("friendly")).execute().body(); assertNotNull(pets); boolean found = false; @@ -114,7 +115,7 @@ public class PetApiTest { Pet fetched = api.getPetById(pet.getId()).execute().body(); - api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null).execute(); + api.updatePetWithForm(fetched.getId(), "furt", null).execute(); Pet updated = api.getPetById(fetched.getId()).execute().body(); assertEquals(updated.getName(), "furt"); diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/StoreApiTest.java index bda483d3fd4f..249d5dc48281 100644 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/petstore/test/StoreApiTest.java @@ -33,7 +33,7 @@ public class StoreApiTest { Order order = createOrder(); api.placeOrder(order).execute(); - Order fetched = api.getOrderById(String.valueOf(order.getId())).execute().body(); + Order fetched = api.getOrderById(order.getId()).execute().body(); assertEquals(order.getId(), fetched.getId()); assertEquals(order.getPetId(), fetched.getPetId()); assertEquals(order.getQuantity(), fetched.getQuantity()); @@ -44,12 +44,12 @@ public class StoreApiTest { Order order = createOrder(); Response aa = api.placeOrder(order).execute(); - Order fetched = api.getOrderById(String.valueOf(order.getId())).execute().body(); + Order fetched = api.getOrderById(order.getId()).execute().body(); assertEquals(fetched.getId(), order.getId()); api.deleteOrder(String.valueOf(order.getId())).execute(); - api.getOrderById(String.valueOf(order.getId())).execute(); + api.getOrderById(order.getId()).execute(); //also in retrofit 1 should return an error but don't, check server api impl. } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java index 5582509be76b..32799fdf3d80 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java @@ -49,16 +49,8 @@ public class ApiClient { Interceptor auth; if (authName == "petstore_auth") { auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); - } else if (authName == "test_api_client_id") { - auth = new ApiKeyAuth("header", "x-test_api_client_id"); - } else if (authName == "test_api_client_secret") { - auth = new ApiKeyAuth("header", "x-test_api_client_secret"); } else if (authName == "api_key") { auth = new ApiKeyAuth("header", "api_key"); - } else if (authName == "test_api_key_query") { - auth = new ApiKeyAuth("query", "test_api_key_query"); - } else if (authName == "test_api_key_header") { - auth = new ApiKeyAuth("header", "test_api_key_header"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java index 873647cb45e8..423a57628225 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:37:27.438+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:30:05.103+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java index 5f35286fb30f..4a2e64b726e3 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java @@ -9,7 +9,7 @@ import retrofit2.http.*; import okhttp3.RequestBody; import io.swagger.client.model.Pet; -import io.swagger.client.model.InlineResponse200; +import io.swagger.client.model.ModelApiResponse; import java.io.File; import java.util.ArrayList; @@ -21,7 +21,7 @@ public interface PetApi { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return Call */ @@ -30,18 +30,6 @@ public interface PetApi { @Body Pet body ); - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param body Pet object in the form of byte array (optional) - * @return Call - */ - - @POST("pet?testing_byte_array=true") - Observable addPetUsingByteArray( - @Body byte[] body - ); - /** * Deletes a pet * @@ -58,31 +46,31 @@ public interface 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 (optional, default to available) + * @param status Status values that need to be considered for filter (required) * @return Call> */ @GET("pet/findByStatus") Observable> findPetsByStatus( - @Query("status") List status + @Query("status") CSVParams status ); /** * 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 (optional) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) * @return Call> */ @GET("pet/findByTags") Observable> findPetsByTags( - @Query("tags") List tags + @Query("tags") CSVParams tags ); /** * 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 (required) + * Returns a single pet + * @param petId ID of pet to return (required) * @return Call */ @@ -91,34 +79,10 @@ public interface PetApi { @Path("petId") Long 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 - * @param petId ID of pet that needs to be fetched (required) - * @return Call - */ - - @GET("pet/{petId}?response=inline_arbitrary_object") - Observable getPetByIdInObject( - @Path("petId") Long 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 - * @param petId ID of pet that needs to be fetched (required) - * @return Call - */ - - @GET("pet/{petId}?testing_byte_array=true") - Observable petPetIdtestingByteArraytrueGet( - @Path("petId") Long petId - ); - /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (optional) + * @param body Pet object that needs to be added to the store (required) * @return Call */ @@ -139,7 +103,7 @@ public interface PetApi { @FormUrlEncoded @POST("pet/{petId}") Observable updatePetWithForm( - @Path("petId") String petId, @Field("name") String name, @Field("status") String status + @Path("petId") Long petId, @Field("name") String name, @Field("status") String status ); /** @@ -148,12 +112,12 @@ public interface PetApi { * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return Call + * @return Call */ @Multipart @POST("pet/{petId}/uploadImage") - Observable uploadFile( + Observable uploadFile( @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file\"; filename=\"file\"") RequestBody file ); diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/StoreApi.java index a0a60b0e3b6f..19be150428b0 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/StoreApi.java @@ -28,18 +28,6 @@ public interface StoreApi { @Path("orderId") String orderId ); - /** - * 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 (optional, default to placed) - * @return Call> - */ - - @GET("store/findByStatus") - Observable> findOrdersByStatus( - @Query("status") String status - ); - /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -50,16 +38,6 @@ public interface StoreApi { Observable> getInventory(); - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @return Call - */ - - @GET("store/inventory?response=arbitrary_object") - Observable getInventoryInObject(); - - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -69,13 +47,13 @@ public interface StoreApi { @GET("store/order/{orderId}") Observable getOrderById( - @Path("orderId") String orderId + @Path("orderId") Long orderId ); /** * Place an order for a pet * - * @param body order placed for purchasing the pet (optional) + * @param body order placed for purchasing the pet (required) * @return Call */ diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/UserApi.java index e5a17e2bef92..4cad0d804d79 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/UserApi.java @@ -19,7 +19,7 @@ public interface UserApi { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (optional) + * @param body Created user object (required) * @return Call */ @@ -31,7 +31,7 @@ public interface UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return Call */ @@ -43,7 +43,7 @@ public interface UserApi { /** * Creates list of users with given input array * - * @param body List of user object (optional) + * @param body List of user object (required) * @return Call */ @@ -79,8 +79,8 @@ public interface UserApi { /** * Logs user into the system * - * @param username The user name for login (optional) - * @param password The password for login in clear text (optional) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return Call */ @@ -103,7 +103,7 @@ public interface UserApi { * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (optional) + * @param body Updated user object (required) * @return Call */ diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/InlineResponse200.java deleted file mode 100644 index b17bf005009c..000000000000 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/InlineResponse200.java +++ /dev/null @@ -1,168 +0,0 @@ -package io.swagger.client.model; - -import java.util.Objects; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.client.model.Tag; -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; - - - - - -public class InlineResponse200 { - - @SerializedName("tags") - private List tags = new ArrayList(); - - @SerializedName("id") - private Long id = null; - - @SerializedName("category") - private Object category = null; - - -public enum StatusEnum { - @SerializedName("available") - AVAILABLE("available"), - - @SerializedName("pending") - PENDING("pending"), - - @SerializedName("sold") - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } -} - - @SerializedName("status") - private StatusEnum status = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("photoUrls") - private List photoUrls = new ArrayList(); - - /** - **/ - @ApiModelProperty(value = "") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public Object getCategory() { - return category; - } - public void setCategory(Object category) { - this.category = category; - } - - /** - * pet status in the store - **/ - @ApiModelProperty(value = "pet status in the store") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InlineResponse200 inlineResponse200 = (InlineResponse200) o; - return Objects.equals(tags, inlineResponse200.tags) && - Objects.equals(id, inlineResponse200.id) && - Objects.equals(category, inlineResponse200.category) && - Objects.equals(status, inlineResponse200.status) && - Objects.equals(name, inlineResponse200.name) && - Objects.equals(photoUrls, inlineResponse200.photoUrls); - } - - @Override - public int hashCode() { - return Objects.hash(tags, id, category, status, name, photoUrls); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InlineResponse200 {\n"); - - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * 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/retrofit2rx/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..bb5313b42d41 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -0,0 +1,96 @@ +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 ModelApiResponse { + + @SerializedName("code") + private Integer code = null; + + @SerializedName("type") + private String type = null; + + @SerializedName("message") + private String message = null; + + /** + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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/retrofit2rx/src/main/java/io/swagger/client/model/ObjectReturn.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ObjectReturn.java deleted file mode 100644 index 920640ad2cb2..000000000000 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ObjectReturn.java +++ /dev/null @@ -1,69 +0,0 @@ -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; - - - - -@ApiModel(description = "") -public class ObjectReturn { - - @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; - } - ObjectReturn _return = (ObjectReturn) o; - return Objects.equals(_return, _return._return); - } - - @Override - public int hashCode() { - return Objects.hash(_return); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ObjectReturn {\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/retrofit2rx/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java index f1fb2ad7409f..196a57024040 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java @@ -52,7 +52,7 @@ public enum StatusEnum { private StatusEnum status = null; @SerializedName("complete") - private Boolean complete = null; + private Boolean complete = false; /** **/ @@ -60,6 +60,9 @@ public enum StatusEnum { public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } /** **/ diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/PetApiTest.java index a433321a0f93..e506ec00e9af 100644 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/PetApiTest.java @@ -1,6 +1,7 @@ package io.swagger.petstore.test; import io.swagger.client.ApiClient; +import io.swagger.client.CollectionFormats.*; import io.swagger.client.api.*; import io.swagger.client.model.*; @@ -79,7 +80,7 @@ public class PetApiTest { api.updatePet(pet).subscribe(new SkeletonSubscriber() { @Override public void onCompleted() { - api.findPetsByStatus(Arrays.asList(new String[]{"available"})).subscribe(new SkeletonSubscriber>() { + api.findPetsByStatus(new CSVParams("available")).subscribe(new SkeletonSubscriber>() { @Override public void onNext(List pets) { assertNotNull(pets); @@ -116,7 +117,7 @@ public class PetApiTest { api.updatePet(pet).subscribe(new SkeletonSubscriber() { @Override public void onCompleted() { - api.findPetsByTags(Arrays.asList(new String[]{"friendly"})).subscribe(new SkeletonSubscriber>() { + api.findPetsByTags(new CSVParams("friendly")).subscribe(new SkeletonSubscriber>() { @Override public void onNext(List pets) { assertNotNull(pets); @@ -145,7 +146,7 @@ public class PetApiTest { api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { @Override public void onNext(final Pet fetched) { - api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null) + api.updatePetWithForm(fetched.getId(), "furt", null) .subscribe(new SkeletonSubscriber() { @Override public void onCompleted() { @@ -201,7 +202,7 @@ public class PetApiTest { api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError()); RequestBody body = RequestBody.create(MediaType.parse("text/plain"), file); - api.uploadFile(pet.getId(), "a test file", body).subscribe(new SkeletonSubscriber() { + api.uploadFile(pet.getId(), "a test file", body).subscribe(new SkeletonSubscriber() { @Override public void onError(Throwable e) { // this also yields a 400 for other tests, so I guess it's okay... @@ -251,4 +252,4 @@ public class PetApiTest { return pet; } -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/StoreApiTest.java index 39785f755ca7..f5a34eab2002 100644 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/petstore/test/StoreApiTest.java @@ -36,7 +36,7 @@ public class StoreApiTest { public void testPlaceOrder() throws Exception { final Order order = createOrder(); api.placeOrder(order).subscribe(SkeletonSubscriber.failTestOnError()); - api.getOrderById(String.valueOf(order.getId())).subscribe(new SkeletonSubscriber() { + api.getOrderById(order.getId()).subscribe(new SkeletonSubscriber() { @Override public void onNext(Order fetched) { assertEquals(order.getId(), fetched.getId()); @@ -51,7 +51,7 @@ public class StoreApiTest { final Order order = createOrder(); api.placeOrder(order).subscribe(SkeletonSubscriber.failTestOnError()); - api.getOrderById(String.valueOf(order.getId())).subscribe(new SkeletonSubscriber() { + api.getOrderById(order.getId()).subscribe(new SkeletonSubscriber() { @Override public void onNext(Order fetched) { assertEquals(fetched.getId(), order.getId()); @@ -60,7 +60,7 @@ public class StoreApiTest { api.deleteOrder(String.valueOf(order.getId())).subscribe(SkeletonSubscriber.failTestOnError()); - api.getOrderById(String.valueOf(order.getId())) + api.getOrderById(order.getId()) .subscribe(new SkeletonSubscriber() { @Override public void onNext(Order order) { diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 309ae5d6374b..79eef5803264 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-19T21:05:59.494+01:00 +- Build date: 2016-04-20T22:11:45.927+08:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/docs/Name.md b/samples/client/petstore/python/docs/Name.md index 905680a7d30c..a472a529a0fe 100644 --- a/samples/client/petstore/python/docs/Name.md +++ b/samples/client/petstore/python/docs/Name.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **int** | | **snake_case** | **int** | | [optional] +**_property** | **str** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/swagger_client/models/name.py b/samples/client/petstore/python/swagger_client/models/name.py index 068bca97eea3..4fbf1a03211c 100644 --- a/samples/client/petstore/python/swagger_client/models/name.py +++ b/samples/client/petstore/python/swagger_client/models/name.py @@ -38,16 +38,19 @@ class Name(object): """ self.swagger_types = { 'name': 'int', - 'snake_case': 'int' + 'snake_case': 'int', + '_property': 'str' } self.attribute_map = { 'name': 'name', - 'snake_case': 'snake_case' + 'snake_case': 'snake_case', + '_property': 'property' } self._name = None self._snake_case = None + self.__property = None @property def name(self): @@ -93,6 +96,28 @@ class Name(object): """ self._snake_case = snake_case + @property + def _property(self): + """ + Gets the _property of this Name. + + + :return: The _property of this Name. + :rtype: str + """ + return self.__property + + @_property.setter + def _property(self, _property): + """ + Sets the _property of this Name. + + + :param _property: The _property of this Name. + :type: str + """ + self.__property = _property + def to_dict(self): """ Returns the model properties as a dict diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index d5fc3c8405b1..4dc28289fa39 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-19T23:40:36.993+08:00 +- Build date: 2016-04-20T18:46:00.664+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation diff --git a/samples/client/petstore/ruby/petstore.gemspec b/samples/client/petstore/ruby/petstore.gemspec index 55ba462e2370..08b733a09213 100644 --- a/samples/client/petstore/ruby/petstore.gemspec +++ b/samples/client/petstore/ruby/petstore.gemspec @@ -6,12 +6,12 @@ Gem::Specification.new do |s| s.name = "petstore" s.version = Petstore::VERSION s.platform = Gem::Platform::RUBY - s.authors = [""] - s.email = [""] - s.homepage = "" - s.summary = "" - s.description = "" - s.license = "" + s.authors = ["Swagger-Codegen"] + s.email = ["apiteam@swagger.io"] + s.homepage = "https://github.com/swagger-api/swagger-codegen" + s.summary = "Swagger Petstore Ruby Gem" + s.description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose." + s.license = "Apache 2.0" s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3' diff --git a/samples/server/petstore/lumen/lumen/app/Console/Kernel.php b/samples/server/petstore/lumen/lumen/app/Console/Kernel.php new file mode 100644 index 000000000000..ad6e311cdd04 --- /dev/null +++ b/samples/server/petstore/lumen/lumen/app/Console/Kernel.php @@ -0,0 +1,29 @@ +auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * @return mixed + */ + public function handle($request, Closure $next, $guard = null) + { + if ($this->auth->guard($guard)->guest()) { + return response('Unauthorized.', 401); + } + + return $next($request); + } +} diff --git a/samples/server/petstore/lumen/lumen/app/Http/Middleware/ExampleMiddleware.php b/samples/server/petstore/lumen/lumen/app/Http/Middleware/ExampleMiddleware.php new file mode 100644 index 000000000000..166581c8e69b --- /dev/null +++ b/samples/server/petstore/lumen/lumen/app/Http/Middleware/ExampleMiddleware.php @@ -0,0 +1,20 @@ +get('/', function () use ($app) { + return $app->version(); +}); + + +/** + * POST addPet + * Summary: Add a new pet to the store + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->POST('/pet', function($null = null) use ($app) { + + + + + return response('How about implementing addPet as a POST method ?'); + }); + + +/** + * DELETE deletePet + * Summary: Deletes a pet + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->DELETE('/pet/{petId}', function($petId, $null = null) use ($app) { + $headers = Request::header(); + + + + return response('How about implementing deletePet as a DELETE method ?'); + }); + + +/** + * GET findPetsByStatus + * Summary: Finds Pets by status + * Notes: Multiple status values can be provided with comma separated strings + * Output-Formats: [application/xml, application/json] + */ +$app->GET('/pet/findByStatus', function($null = null) use ($app) { + + $status = Request::input('status'); + + + + return response('How about implementing findPetsByStatus as a GET method ?'); + }); + + +/** + * GET findPetsByTags + * Summary: Finds Pets by tags + * Notes: Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Output-Formats: [application/xml, application/json] + */ +$app->GET('/pet/findByTags', function($null = null) use ($app) { + + $tags = Request::input('tags'); + + + + return response('How about implementing findPetsByTags as a GET method ?'); + }); + + +/** + * GET getPetById + * Summary: Find pet by ID + * Notes: Returns a single pet + * Output-Formats: [application/xml, application/json] + */ +$app->GET('/pet/{petId}', function($petId, $null = null) use ($app) { + + + + + return response('How about implementing getPetById as a GET method ?'); + }); + + +/** + * PUT updatePet + * Summary: Update an existing pet + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->PUT('/pet', function($null = null) use ($app) { + + + + + return response('How about implementing updatePet as a PUT method ?'); + }); + + +/** + * POST updatePetWithForm + * Summary: Updates a pet in the store with form data + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->POST('/pet/{petId}', function($petId, $null = null) use ($app) { + + + $name = Request::input('name'); $status = Request::input('status'); + + return response('How about implementing updatePetWithForm as a POST method ?'); + }); + + +/** + * POST uploadFile + * Summary: uploads an image + * Notes: + * Output-Formats: [application/json] + */ +$app->POST('/pet/{petId}/uploadImage', function($petId, $null = null) use ($app) { + + + $additionalMetadata = Request::input('additionalMetadata'); $file = Request::input('file'); + + return response('How about implementing uploadFile as a POST method ?'); + }); + + +/** + * DELETE deleteOrder + * Summary: Delete purchase order by ID + * Notes: For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors + * Output-Formats: [application/xml, application/json] + */ +$app->DELETE('/store/order/{orderId}', function($orderId, $null = null) use ($app) { + + + + + return response('How about implementing deleteOrder as a DELETE method ?'); + }); + + +/** + * GET getInventory + * Summary: Returns pet inventories by status + * Notes: Returns a map of status codes to quantities + * Output-Formats: [application/json] + */ +$app->GET('/store/inventory', function($null = null) use ($app) { + + + + + return response('How about implementing getInventory as a GET method ?'); + }); + + +/** + * GET getOrderById + * Summary: Find purchase order by ID + * Notes: For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions + * Output-Formats: [application/xml, application/json] + */ +$app->GET('/store/order/{orderId}', function($orderId, $null = null) use ($app) { + + + + + return response('How about implementing getOrderById as a GET method ?'); + }); + + +/** + * POST placeOrder + * Summary: Place an order for a pet + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->POST('/store/order', function($null = null) use ($app) { + + + + + return response('How about implementing placeOrder as a POST method ?'); + }); + + +/** + * POST createUser + * Summary: Create user + * Notes: This can only be done by the logged in user. + * Output-Formats: [application/xml, application/json] + */ +$app->POST('/user', function($null = null) use ($app) { + + + + + return response('How about implementing createUser as a POST method ?'); + }); + + +/** + * POST createUsersWithArrayInput + * Summary: Creates list of users with given input array + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->POST('/user/createWithArray', function($null = null) use ($app) { + + + + + return response('How about implementing createUsersWithArrayInput as a POST method ?'); + }); + + +/** + * POST createUsersWithListInput + * Summary: Creates list of users with given input array + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->POST('/user/createWithList', function($null = null) use ($app) { + + + + + return response('How about implementing createUsersWithListInput as a POST method ?'); + }); + + +/** + * DELETE deleteUser + * Summary: Delete user + * Notes: This can only be done by the logged in user. + * Output-Formats: [application/xml, application/json] + */ +$app->DELETE('/user/{username}', function($username, $null = null) use ($app) { + + + + + return response('How about implementing deleteUser as a DELETE method ?'); + }); + + +/** + * GET getUserByName + * Summary: Get user by user name + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->GET('/user/{username}', function($username, $null = null) use ($app) { + + + + + return response('How about implementing getUserByName as a GET method ?'); + }); + + +/** + * GET loginUser + * Summary: Logs user into the system + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->GET('/user/login', function($null = null) use ($app) { + + $username = Request::input('username'); + $password = Request::input('password'); + + + + return response('How about implementing loginUser as a GET method ?'); + }); + + +/** + * GET logoutUser + * Summary: Logs out current logged in user session + * Notes: + * Output-Formats: [application/xml, application/json] + */ +$app->GET('/user/logout', function($null = null) use ($app) { + + + + + return response('How about implementing logoutUser as a GET method ?'); + }); + + +/** + * PUT updateUser + * Summary: Updated user + * Notes: This can only be done by the logged in user. + * Output-Formats: [application/xml, application/json] + */ +$app->PUT('/user/{username}', function($username, $null = null) use ($app) { + + + + + return response('How about implementing updateUser as a PUT method ?'); + }); + + + diff --git a/samples/server/petstore/lumen/lumen/app/Providers/AppServiceProvider.php b/samples/server/petstore/lumen/lumen/app/Providers/AppServiceProvider.php new file mode 100644 index 000000000000..ddec04694c37 --- /dev/null +++ b/samples/server/petstore/lumen/lumen/app/Providers/AppServiceProvider.php @@ -0,0 +1,18 @@ +input('api_token')) { + return User::where('api_token', $request->input('api_token'))->first(); + } + }); + } +} diff --git a/samples/server/petstore/lumen/lumen/app/Providers/EventServiceProvider.php b/samples/server/petstore/lumen/lumen/app/Providers/EventServiceProvider.php new file mode 100644 index 000000000000..0b8f3934fb3c --- /dev/null +++ b/samples/server/petstore/lumen/lumen/app/Providers/EventServiceProvider.php @@ -0,0 +1,19 @@ + [ + 'App\Listeners\EventListener', + ], + ]; +} diff --git a/samples/server/petstore/lumen/lumen/app/User.php b/samples/server/petstore/lumen/lumen/app/User.php new file mode 100644 index 000000000000..fd4de31172cf --- /dev/null +++ b/samples/server/petstore/lumen/lumen/app/User.php @@ -0,0 +1,34 @@ +make( + 'Illuminate\Contracts\Console\Kernel' +); + +exit($kernel->handle(new ArgvInput, new ConsoleOutput)); diff --git a/samples/server/petstore/lumen/lumen/bootstrap/app.php b/samples/server/petstore/lumen/lumen/bootstrap/app.php new file mode 100644 index 000000000000..9bc334dd8866 --- /dev/null +++ b/samples/server/petstore/lumen/lumen/bootstrap/app.php @@ -0,0 +1,102 @@ +load(); +} catch (Dotenv\Exception\InvalidPathException $e) { + // +} + +/* +|-------------------------------------------------------------------------- +| Create The Application +|-------------------------------------------------------------------------- +| +| Here we will load the environment and create the application instance +| that serves as the central piece of this framework. We'll use this +| application as an "IoC" container and router for this framework. +| +*/ + +$app = new Laravel\Lumen\Application( + realpath(__DIR__.'/../') +); + +// $app->withFacades(); + +// $app->withEloquent(); + +/* +|-------------------------------------------------------------------------- +| Register Container Bindings +|-------------------------------------------------------------------------- +| +| Now we will register a few bindings in the service container. We will +| register the exception handler and the console kernel. You may add +| your own bindings here if you like or you can make another file. +| +*/ + +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + App\Exceptions\Handler::class +); + +$app->singleton( + Illuminate\Contracts\Console\Kernel::class, + App\Console\Kernel::class +); + +class_alias('Illuminate\Support\Facades\Request', 'Request'); //to use the Reqesut facade + +/* +|-------------------------------------------------------------------------- +| Register Middleware +|-------------------------------------------------------------------------- +| +| Next, we will register the middleware with the application. These can +| be global middleware that run before and after each request into a +| route or middleware that'll be assigned to some specific routes. +| +*/ + +// $app->middleware([ +// App\Http\Middleware\ExampleMiddleware::class +// ]); + +// $app->routeMiddleware([ +// 'auth' => App\Http\Middleware\Authenticate::class, +// ]); + +/* +|-------------------------------------------------------------------------- +| Register Service Providers +|-------------------------------------------------------------------------- +| +| Here we will register all of the application's service providers which +| are used to bind services into the container. Service providers are +| totally optional, so you are not required to uncomment this line. +| +*/ + +// $app->register(App\Providers\AppServiceProvider::class); +// $app->register(App\Providers\AuthServiceProvider::class); +// $app->register(App\Providers\EventServiceProvider::class); + +/* +|-------------------------------------------------------------------------- +| Load The Application Routes +|-------------------------------------------------------------------------- +| +| Next we will include the routes file so that they can all be added to +| the application. This will provide all of the URLs the application +| can respond to, as well as the controllers that may handle them. +| +*/ + +$app->group(['namespace' => 'App\Http\Controllers'], function ($app) { + require __DIR__.'/../app/Http/routes.php'; +}); + +return $app; diff --git a/samples/server/petstore/lumen/lumen/composer.json b/samples/server/petstore/lumen/lumen/composer.json new file mode 100644 index 000000000000..62df199e76a7 --- /dev/null +++ b/samples/server/petstore/lumen/lumen/composer.json @@ -0,0 +1,17 @@ +{ + "name": "laravel/lumen", + "description": "The Laravel Lumen Framework.", + "keywords": ["framework", "laravel", "lumen"], + "license": "MIT", + "type": "project", + "require": { + "php": ">=5.5.9", + "laravel/lumen-framework": "5.2.*", + "vlucas/phpdotenv": "~2.2" + }, + "autoload": { + "psr-4": { + "App\\": "app/" + } + } +} diff --git a/samples/server/petstore/lumen/lumen/public/index.php b/samples/server/petstore/lumen/lumen/public/index.php new file mode 100644 index 000000000000..04aa08688e00 --- /dev/null +++ b/samples/server/petstore/lumen/lumen/public/index.php @@ -0,0 +1,28 @@ +run(); diff --git a/samples/server/petstore/lumen/lumen/readme.md b/samples/server/petstore/lumen/lumen/readme.md new file mode 100644 index 000000000000..9605e5f3f459 --- /dev/null +++ b/samples/server/petstore/lumen/lumen/readme.md @@ -0,0 +1,21 @@ +## Lumen PHP Framework + +[![Build Status](https://travis-ci.org/laravel/lumen-framework.svg)](https://travis-ci.org/laravel/lumen-framework) +[![Total Downloads](https://poser.pugx.org/laravel/lumen-framework/d/total.svg)](https://packagist.org/packages/laravel/lumen-framework) +[![Latest Stable Version](https://poser.pugx.org/laravel/lumen-framework/v/stable.svg)](https://packagist.org/packages/laravel/lumen-framework) +[![Latest Unstable Version](https://poser.pugx.org/laravel/lumen-framework/v/unstable.svg)](https://packagist.org/packages/laravel/lumen-framework) +[![License](https://poser.pugx.org/laravel/lumen-framework/license.svg)](https://packagist.org/packages/laravel/lumen-framework) + +Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching. + +## Official Documentation + +Documentation for the framework can be found on the [Lumen website](http://lumen.laravel.com/docs). + +## Security Vulnerabilities + +If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed. + +### License + +The Lumen framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)