diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f1ef0aa469b..32195b7df92 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,7 +4,8 @@
- If you're not using the latest master to generate API clients or server stubs, please give it another try by pulling the latest master as the issue may have already been addressed. Ref: [Getting Started](https://github.com/swagger-api/swagger-codegen#getting-started)
- Search the [open issue](https://github.com/swagger-api/swagger-codegen/issues) and [closed issue](https://github.com/swagger-api/swagger-codegen/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
- - File an [issue ticket](https://github.com/swagger-api/swagger-codegen/issues/new) by providing all the required information.
+ - File an [issue ticket](https://github.com/swagger-api/swagger-codegen/issues/new) by providing all the required information.
+ - Test with the latest master by building the JAR locally to see if the issue has already been addressed.
- You can also make a suggestion or ask a question by opening an "issue".
## Before submitting a PR
diff --git a/bin/java-petstore-okhttp-gson-parcelable.sh b/bin/java-petstore-okhttp-gson-parcelable.sh
new file mode 100755
index 00000000000..e3fcd52c478
--- /dev/null
+++ b/bin/java-petstore-okhttp-gson-parcelable.sh
@@ -0,0 +1,33 @@
+#!/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/Java/libraries/okhttp-gson -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-parcelableModel -DhideGenerationTimestamp=true,parcelableModel=true"
+
+rm -rf samples/client/petstore/java/okhttp-gson/src/main
+find samples/client/petstore/java/okhttp-gson -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
+java $JAVA_OPTS -jar $executable $ags
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
index 788223bec9b..e4dacc499bb 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
@@ -29,6 +29,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
protected String projectFolder = "src/main";
protected String sourceFolder = projectFolder + "/java";
protected Boolean useAndroidMavenGradlePlugin = true;
+ protected Boolean serializableModel = false;
// requestPackage and authPackage are used by the "volley" template/library
protected String requestPackage = "io.swagger.client.request";
@@ -90,6 +91,8 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
cliOptions.add(CliOption.newBoolean(USE_ANDROID_MAVEN_GRADLE_PLUGIN, "A flag to toggle android-maven gradle plugin.")
.defaultValue(Boolean.TRUE.toString()));
+ cliOptions.add(CliOption.newBoolean(CodegenConstants.SERIALIZABLE_MODEL, CodegenConstants.SERIALIZABLE_MODEL_DESC));
+
supportedLibraries.put("volley", "HTTP client: Volley 1.0.19 (default)");
supportedLibraries.put("httpclient", "HTTP client: Apache HttpClient 4.3.6. JSON processing: Gson 2.3.1. IMPORTANT: Android client using HttpClient is not actively maintained and will be depecreated in the next major release.");
CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
@@ -378,6 +381,14 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
this.setLibrary((String) additionalProperties.get(CodegenConstants.LIBRARY));
}
+ if (additionalProperties.containsKey(CodegenConstants.SERIALIZABLE_MODEL)) {
+ this.setSerializableModel(Boolean.valueOf(additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL).toString()));
+ }
+
+ // need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string
+ additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
+ LOGGER.info("CodegenConstants.SERIALIZABLE_MODEL = " + additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL));
+
//make api and model doc path available in mustache template
additionalProperties.put( "apiDocPath", apiDocPath );
additionalProperties.put( "modelDocPath", modelDocPath );
@@ -504,6 +515,10 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
this.sourceFolder = sourceFolder;
}
+ public void setSerializableModel(Boolean serializableModel) {
+ this.serializableModel = serializableModel;
+ }
+
@Override
public String escapeQuotationMark(String input) {
// remove " to avoid code injection
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java
index 3cf6c439aea..652ff759deb 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java
@@ -58,6 +58,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
"String",
"bool",
"int",
+ "num",
"double")
);
instantiationTypes.put("array", "List");
@@ -69,11 +70,12 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
typeMapping.put("List", "List");
typeMapping.put("boolean", "bool");
typeMapping.put("string", "String");
+ typeMapping.put("char", "String");
typeMapping.put("int", "int");
- typeMapping.put("float", "double");
typeMapping.put("long", "int");
typeMapping.put("short", "int");
- typeMapping.put("char", "String");
+ typeMapping.put("number", "num");
+ typeMapping.put("float", "double");
typeMapping.put("double", "double");
typeMapping.put("object", "Object");
typeMapping.put("integer", "int");
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 db181498586..3fe56dcd203 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
@@ -14,12 +14,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(JavaClientCodegen.class);
public static final String USE_RX_JAVA = "useRxJava";
+ public static final String PARCELABLE_MODEL = "parcelableModel";
public static final String RETROFIT_1 = "retrofit";
public static final String RETROFIT_2 = "retrofit2";
protected String gradleWrapperPackage = "gradle.wrapper";
protected boolean useRxJava = false;
+ protected boolean parcelableModel = false;
public JavaClientCodegen() {
super();
@@ -31,11 +33,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen {
modelPackage = "io.swagger.client.model";
cliOptions.add(CliOption.newBoolean(USE_RX_JAVA, "Whether to use the RxJava adapter with the retrofit2 library."));
+ cliOptions.add(CliOption.newBoolean(PARCELABLE_MODEL, "Whether to generate models for Android that implement Parcelable with the okhttp-gson library."));
supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.1. JSON processing: Jackson 2.7.0");
supportedLibraries.put("feign", "HTTP client: Netflix Feign 8.16.0. JSON processing: Jackson 2.7.0");
supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.22.2. JSON processing: Jackson 2.7.0");
- supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.6.2");
+ supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.6.2. Enable Parcelable modles on Android using '-DparcelableModel=true'");
supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.");
supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.2.0. JSON processing: Gson 2.6.1 (Retrofit 2.0.2). Enable the RxJava adapter using '-DuseRxJava=true'. (RxJava 1.1.3)");
@@ -70,6 +73,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen {
if (additionalProperties.containsKey(USE_RX_JAVA)) {
this.setUseRxJava(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA).toString()));
}
+ if (additionalProperties.containsKey(PARCELABLE_MODEL)) {
+ this.setParcelableModel(Boolean.valueOf(additionalProperties.get(PARCELABLE_MODEL).toString()));
+ }
+ // put the boolean value back to PARCELABLE_MODEL in additionalProperties
+ additionalProperties.put(PARCELABLE_MODEL, parcelableModel);
final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/");
final String authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/");
@@ -217,4 +225,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen {
this.useRxJava = useRxJava;
}
+ public void setParcelableModel(boolean parcelableModel) {
+ this.parcelableModel = parcelableModel;
+ }
}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java
index 02098d98b66..1a5c9e3397d 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java
@@ -46,7 +46,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
public ObjcClientCodegen() {
super();
-
+ supportsInheritance = true;
outputFolder = "generated-code" + File.separator + "objc";
modelTemplateFiles.put("model-header.mustache", ".h");
modelTemplateFiles.put("model-body.mustache", ".m");
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
index c775c8ec8f2..dc5969fc4b3 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SwiftCodegen.java
@@ -384,10 +384,18 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
@SuppressWarnings("static-method")
public String toSwiftyEnumName(String value) {
+ if (value.matches("^-?\\d*\\.{0,1}\\d+.*")) { // starts with number
+ value = "Number" + value;
+ value = value.replaceAll("-", "Minus");
+ value = value.replaceAll("\\+", "Plus");
+ value = value.replaceAll("\\.", "Dot");
+ }
+
// Prevent from breaking properly cased identifier
if (value.matches("[A-Z][a-z0-9]+[a-zA-Z0-9]*")) {
return value;
}
+
char[] separators = {'-', '_', ' ', ':'};
return WordUtils.capitalizeFully(StringUtils.lowerCase(value), separators).replaceAll("[-_ :]", "");
}
diff --git a/modules/swagger-codegen/src/main/resources/Java/model.mustache b/modules/swagger-codegen/src/main/resources/Java/model.mustache
index 1143fc413df..31148bafcec 100644
--- a/modules/swagger-codegen/src/main/resources/Java/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/Java/model.mustache
@@ -6,8 +6,14 @@ import java.util.Objects;
{{#imports}}
import {{import}};
{{/imports}}
+{{#serializableModel}}
+import java.io.Serializable;
+{{/serializableModel}}
+{{#parcelableModel}}
+import android.os.Parcelable;
+import android.os.Parcel;
+{{/parcelableModel}}
-{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
{{#models}}
{{#model}}
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}}
diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache
index f32a4e9b823..adb200bc449 100644
--- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache
+++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache
@@ -3,7 +3,7 @@
*/{{#description}}
@ApiModel(description = "{{{description}}}"){{/description}}
{{>generatedAnnotation}}
-public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
+public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcelableModel}}implements Parcelable {{#serializableModel}}, Serializable {{/serializableModel}}{{/parcelableModel}}{{^parcelableModel}}{{#serializableModel}}implements Serializable {{/serializableModel}}{{/parcelableModel}}{
{{#vars}}
{{#isEnum}}
{{^isContainer}}
@@ -119,4 +119,46 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
}
return o.toString().replace("\n", "\n ");
}
+
+ {{#parcelableModel}}
+ public void writeToParcel(Parcel out, int flags) {
+ {{#parent}} super.writeToParcel(out, flags); {{/parent}} {{#vars}}
+ out.writeValue({{name}});
+ {{/vars}}
+ }
+
+ public {{classname}}() {
+ super();
+ }
+
+ {{classname}}(Parcel in) {
+ {{#parent}} super(in); {{/parent}}
+ {{#vars}}
+ {{#isContainer}}
+ {{#complexType}}
+ {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader());
+ {{/complexType}}
+ {{^complexType}}
+ {{name}} = ({{{datatypeWithEnum}}})in.readValue(null);
+ {{/complexType}}
+ {{/isContainer}}
+ {{^isContainer}}
+ {{name}} = ({{{datatypeWithEnum}}})in.readValue(null);
+ {{/isContainer}}
+ {{/vars}}
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() {
+ public {{classname}} createFromParcel(Parcel in) {
+ return new {{classname}}(in);
+ }
+ public {{classname}}[] newArray(int size) {
+ return new {{classname}}[size];
+ }
+ };
+ {{/parcelableModel}}
}
diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache
index a85ebf9fbdd..d277079892c 100644
--- a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache
+++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache
@@ -363,7 +363,10 @@
var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) {
- request.type(contentType);
+ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
+ if(contentType != 'multipart/form-data') {
+ request.type(contentType);
+ }
} else if (!request.header['Content-Type']) {
request.type('application/json');
}
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 22d7435b325..e64bb09c8ab 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
@@ -3,17 +3,21 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
-
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
+{{#serializableModel}}
+import java.io.Serializable;
+{{/serializableModel}}
{{#models}}
-{{#model}}{{#description}}
+{{#model}}
+{{#description}}
/**
* {{description}}
- **/{{/description}}
+ **/
+{{/description}}
@ApiModel(description = "{{{description}}}")
-public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
+public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#serializableModel}}implements Serializable {{/serializableModel}}{
{{#vars}}{{#isEnum}}
public enum {{datatypeWithEnum}} {
{{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}}
diff --git a/modules/swagger-codegen/src/main/resources/objc/model-body.mustache b/modules/swagger-codegen/src/main/resources/objc/model-body.mustache
index 2a4a548458e..5ca9303e5a8 100644
--- a/modules/swagger-codegen/src/main/resources/objc/model-body.mustache
+++ b/modules/swagger-codegen/src/main/resources/objc/model-body.mustache
@@ -28,6 +28,9 @@
return [super initWithDictionary:dict error:err];
}
Class class = NSClassFromString([@"{{classPrefix}}" stringByAppendingString:discriminatedClassName]);
+ if(!class) {
+ class = NSClassFromString([@"{{classPrefix}}" stringByAppendingString:[discriminatedClassName capitalizedString]]);
+ }
if([self class ] == class) {
return [super initWithDictionary:dict error:err];
}
diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache
index aa4a9f2e90c..68e064bd190 100644
--- a/modules/swagger-codegen/src/main/resources/python/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/python/model.mustache
@@ -66,7 +66,7 @@ class {{classname}}(object):
if not set({{{name}}}).issubset(set(allowed_values)):
raise ValueError(
"Invalid values for `{{{name}}}` [{0}], must be a subset of [{1}]"
- .format(", ".join(map(str, set({{{name}}})-set(allowed_values))),
+ .format(", ".join(map(str, set({{{name}}})-set(allowed_values))),
", ".join(map(str, allowed_values)))
)
{{/isListContainer}}
@@ -74,7 +74,7 @@ class {{classname}}(object):
if not set({{{name}}}.keys()).issubset(set(allowed_values)):
raise ValueError(
"Invalid keys in `{{{name}}}` [{0}], must be a subset of [{1}]"
- .format(", ".join(map(str, set({{{name}}}.keys())-set(allowed_values))),
+ .format(", ".join(map(str, set({{{name}}}.keys())-set(allowed_values))),
", ".join(map(str, allowed_values)))
)
{{/isMapContainer}}
@@ -88,36 +88,37 @@ class {{classname}}(object):
{{/isContainer}}
{{/isEnum}}
{{^isEnum}}
-{{#hasValidation}}
-
- if not {{name}}:
+{{#required}}
+ if {{name}} is None:
raise ValueError("Invalid value for `{{name}}`, must not be `None`")
+{{/required}}
+{{#hasValidation}}
{{#maxLength}}
- if len({{name}}) > {{maxLength}}:
+ if {{name}} is not None and len({{name}}) > {{maxLength}}:
raise ValueError("Invalid value for `{{name}}`, length must be less than or equal to `{{maxLength}}`")
{{/maxLength}}
{{#minLength}}
- if len({{name}}) < {{minLength}}:
+ if {{name}} is not None and len({{name}}) < {{minLength}}:
raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`")
{{/minLength}}
{{#maximum}}
- if {{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}:
+ if {{name}} is not None and {{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}:
raise ValueError("Invalid value for `{{name}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`")
{{/maximum}}
{{#minimum}}
- if {{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}:
+ if {{name}} is not None and {{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}:
raise ValueError("Invalid value for `{{name}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`")
{{/minimum}}
{{#pattern}}
- if not re.search('{{{vendorExtensions.x-regex}}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}):
+ if {{name}} is not None and not re.search('{{{vendorExtensions.x-regex}}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}):
raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{{pattern}}}`")
{{/pattern}}
{{#maxItems}}
- if len({{name}}) > {{maxItems}}:
+ if {{name}} is not None and len({{name}}) > {{maxItems}}:
raise ValueError("Invalid value for `{{name}}`, number of items must be less than or equal to `{{maxItems}}`")
{{/maxItems}}
{{#minItems}}
- if len({{name}}) < {{minItems}}:
+ if {{name}} is not None and len({{name}}) < {{minItems}}:
raise ValueError("Invalid value for `{{name}}`, number of items must be greater than or equal to `{{minItems}}`")
{{/minItems}}
{{/hasValidation}}
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/android/AndroidClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/android/AndroidClientOptionsTest.java
index 538614436f4..b94ec49f361 100644
--- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/android/AndroidClientOptionsTest.java
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/android/AndroidClientOptionsTest.java
@@ -46,6 +46,8 @@ public class AndroidClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setLibrary(AndroidClientOptionsProvider.LIBRARY_VALUE);
times = 1;
+ clientCodegen.setSerializableModel(Boolean.valueOf(AndroidClientOptionsProvider.SERIALIZABLE_MODEL_VALUE));
+ times = 1;
}};
}
}
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/AndroidClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/AndroidClientOptionsProvider.java
index 82ffa437f2a..79e61844c8b 100644
--- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/AndroidClientOptionsProvider.java
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/AndroidClientOptionsProvider.java
@@ -19,6 +19,7 @@ public class AndroidClientOptionsProvider implements OptionsProvider {
public static final String SOURCE_FOLDER_VALUE = "src/main/java/test";
public static final String ANDROID_MAVEN_GRADLE_PLUGIN_VALUE = "true";
public static final String LIBRARY_VALUE = "httpclient";
+ public static final String SERIALIZABLE_MODEL_VALUE = "false";
@Override
public String getLanguage() {
@@ -39,6 +40,7 @@ public class AndroidClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.put(AndroidClientCodegen.USE_ANDROID_MAVEN_GRADLE_PLUGIN, ANDROID_MAVEN_GRADLE_PLUGIN_VALUE)
.put(CodegenConstants.LIBRARY, LIBRARY_VALUE)
+ .put(CodegenConstants.SERIALIZABLE_MODEL, SERIALIZABLE_MODEL_VALUE)
.build();
}
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java
index 53cfe826d36..a1da4cfd808 100644
--- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java
@@ -16,6 +16,7 @@ public class JavaClientOptionsProvider extends JavaOptionsProvider {
Map options = new HashMap(super.createOptions());
options.put(CodegenConstants.LIBRARY, DEFAULT_LIBRARY_VALUE);
options.put(JavaClientCodegen.USE_RX_JAVA, "false");
+ options.put(JavaClientCodegen.PARCELABLE_MODEL, "false");
return options;
}
diff --git a/pom.xml b/pom.xml
index 22921a0f2df..aa84bc04987 100644
--- a/pom.xml
+++ b/pom.xml
@@ -304,6 +304,18 @@
samples/client/petstore/java/okhttp-gson
+
+ java-client-okhttp-gson-parcelable
+
+
+ env
+ java
+
+
+
+ samples/client/petstore/java/okhttp-gson/parcelableModel
+
+ java-client-retrofit
diff --git a/samples/client/petstore-security-test/javascript/README.md b/samples/client/petstore-security-test/javascript/README.md
index b77d3ebd6a0..f49c8f9d42e 100644
--- a/samples/client/petstore-security-test/javascript/README.md
+++ b/samples/client/petstore-security-test/javascript/README.md
@@ -1,12 +1,11 @@
-# swagger_petstore____end
+# swagger_petstore____end____rn_n_r
-SwaggerPetstoreEnd - JavaScript client for swagger_petstore____end
-This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+SwaggerPetstoreEndRnNR - JavaScript client for swagger_petstore____end____rn_n_r
+This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
-- API version: 1.0.0 ' \" =end
-- Package version: 1.0.0 =end
-- Build date: 2016-06-29T21:40:05.384+08:00
+- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+- Package version: 1.0.0 *_/ =end -- \r\n \n \r
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
## Installation
@@ -21,7 +20,7 @@ please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.co
Then install it via:
```shell
-npm install swagger_petstore____end --save
+npm install swagger_petstore____end____rn_n_r --save
```
#### git
@@ -51,12 +50,12 @@ Then include *bundle.js* in the HTML pages.
Please follow the [installation](#installation) instruction and execute the following JS code:
```javascript
-var SwaggerPetstoreEnd = require('swagger_petstore____end');
+var SwaggerPetstoreEndRnNR = require('swagger_petstore____end____rn_n_r');
-var api = new SwaggerPetstoreEnd.FakeApi()
+var api = new SwaggerPetstoreEndRnNR.FakeApi()
var opts = {
- 'testCodeInjectEnd': "testCodeInjectEnd_example" // {String} To test code injection ' \" =end
+ 'testCodeInjectEndRnNR': "testCodeInjectEndRnNR_example" // {String} To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
};
var callback = function(error, data, response) {
@@ -66,22 +65,22 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
-api.testCodeInjectEnd(opts, callback);
+api.testCodeInjectEndRnNR(opts, callback);
```
## Documentation for API Endpoints
-All URIs are relative to *https://petstore.swagger.io ' \" =end/v2 ' \" =end*
+All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
-*SwaggerPetstoreEnd.FakeApi* | [**testCodeInjectEnd**](docs/FakeApi.md#testCodeInjectEnd) | **PUT** /fake | To test code injection ' \" =end
+*SwaggerPetstoreEndRnNR.FakeApi* | [**testCodeInjectEndRnNR**](docs/FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
## Documentation for Models
- - [SwaggerPetstoreEnd.ModelReturn](docs/ModelReturn.md)
+ - [SwaggerPetstoreEndRnNR.ModelReturn](docs/ModelReturn.md)
## Documentation for Authorization
@@ -90,7 +89,7 @@ Class | Method | HTTP request | Description
### api_key
- **Type**: API key
-- **API key parameter name**: api_key */ ' " =end
+- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header
### petstore_auth
@@ -99,6 +98,6 @@ Class | Method | HTTP request | Description
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- - write:pets: modify pets in your account */ ' " =end
- - read:pets: read your pets */ ' " =end
+ - write:pets: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r
+ - read:pets: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
diff --git a/samples/client/petstore-security-test/javascript/docs/FakeApi.md b/samples/client/petstore-security-test/javascript/docs/FakeApi.md
index adbbd32fdb0..61b58cf72a9 100644
--- a/samples/client/petstore-security-test/javascript/docs/FakeApi.md
+++ b/samples/client/petstore-security-test/javascript/docs/FakeApi.md
@@ -1,26 +1,26 @@
-# SwaggerPetstoreEnd.FakeApi
+# SwaggerPetstoreEndRnNR.FakeApi
-All URIs are relative to *https://petstore.swagger.io ' \" =end/v2 ' \" =end*
+All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
Method | HTTP request | Description
------------- | ------------- | -------------
-[**testCodeInjectEnd**](FakeApi.md#testCodeInjectEnd) | **PUT** /fake | To test code injection ' \" =end
+[**testCodeInjectEndRnNR**](FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
-
-# **testCodeInjectEnd**
-> testCodeInjectEnd(opts)
+
+# **testCodeInjectEndRnNR**
+> testCodeInjectEndRnNR(opts)
-To test code injection ' \" =end
+To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
### Example
```javascript
-var SwaggerPetstoreEnd = require('swagger_petstore____end');
+var SwaggerPetstoreEndRnNR = require('swagger_petstore____end____rn_n_r');
-var apiInstance = new SwaggerPetstoreEnd.FakeApi();
+var apiInstance = new SwaggerPetstoreEndRnNR.FakeApi();
var opts = {
- 'testCodeInjectEnd': "testCodeInjectEnd_example" // String | To test code injection ' \" =end
+ 'testCodeInjectEndRnNR': "testCodeInjectEndRnNR_example" // String | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
};
var callback = function(error, data, response) {
@@ -30,14 +30,14 @@ var callback = function(error, data, response) {
console.log('API called successfully.');
}
};
-apiInstance.testCodeInjectEnd(opts, callback);
+apiInstance.testCodeInjectEndRnNR(opts, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
- **testCodeInjectEnd** | **String**| To test code injection ' \" =end | [optional]
+ **testCodeInjectEndRnNR** | **String**| To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | [optional]
### Return type
@@ -49,6 +49,6 @@ No authorization required
### HTTP request headers
- - **Content-Type**: application/json, */ =end
- - **Accept**: application/json, */ =end
+ - **Content-Type**: application/json, *_/ =end --
+ - **Accept**: application/json, *_/ =end --
diff --git a/samples/client/petstore-security-test/javascript/docs/ModelReturn.md b/samples/client/petstore-security-test/javascript/docs/ModelReturn.md
index 2341e97142f..e542020a95c 100644
--- a/samples/client/petstore-security-test/javascript/docs/ModelReturn.md
+++ b/samples/client/petstore-security-test/javascript/docs/ModelReturn.md
@@ -1,8 +1,8 @@
-# SwaggerPetstoreEnd.ModelReturn
+# SwaggerPetstoreEndRnNR.ModelReturn
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
-**_return** | **Integer** | property description ' \" =end | [optional]
+**_return** | **Number** | property description *_/ ' \" =end -- \\r\\n \\n \\r | [optional]
diff --git a/samples/client/petstore-security-test/javascript/package.json b/samples/client/petstore-security-test/javascript/package.json
index 13a19a00ad3..89f2c51c2c2 100644
--- a/samples/client/petstore-security-test/javascript/package.json
+++ b/samples/client/petstore-security-test/javascript/package.json
@@ -1,7 +1,7 @@
{
- "name": "swagger_petstore____end",
- "version": "1.0.0 =end",
- "description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end",
+ "name": "swagger_petstore____end____rn_n_r",
+ "version": "1.0.0 *_/ =end -- \r\n \n \r",
+ "description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end______",
"license": "Apache-2.0",
"main": "src/index.js",
"scripts": {
diff --git a/samples/client/petstore-security-test/javascript/src/ApiClient.js b/samples/client/petstore-security-test/javascript/src/ApiClient.js
index b22ed5202a5..20e0bc173fe 100644
--- a/samples/client/petstore-security-test/javascript/src/ApiClient.js
+++ b/samples/client/petstore-security-test/javascript/src/ApiClient.js
@@ -1,9 +1,9 @@
/**
- * Swagger Petstore ' \" =end
- * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
- * OpenAPI spec version: 1.0.0 ' \" =end
- * Contact: apiteam@swagger.io ' \" =end
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -31,17 +31,17 @@
module.exports = factory(require('superagent'));
} else {
// Browser globals (root is window)
- if (!root.SwaggerPetstoreEnd) {
- root.SwaggerPetstoreEnd = {};
+ if (!root.SwaggerPetstoreEndRnNR) {
+ root.SwaggerPetstoreEndRnNR = {};
}
- root.SwaggerPetstoreEnd.ApiClient = factory(root.superagent);
+ root.SwaggerPetstoreEndRnNR.ApiClient = factory(root.superagent);
}
}(this, function(superagent) {
'use strict';
/**
* @module ApiClient
- * @version 1.0.0 =end
+ * @version 1.0.0 *_/ =end -- \r\n \n \r
*/
/**
@@ -55,16 +55,16 @@
/**
* The base URL against which to resolve every API call's (relative) path.
* @type {String}
- * @default https://petstore.swagger.io ' \" =end/v2 ' \" =end
+ * @default https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r
*/
- this.basePath = 'https://petstore.swagger.io ' \" =end/v2 ' \" =end'.replace(/\/+$/, '');
+ this.basePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'.replace(/\/+$/, '');
/**
* The authentication methods to be included for all API calls.
* @type {Array.}
*/
this.authentications = {
- 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key */ ' " =end'},
+ 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key */ ' " =end -- \r\n \n \r'},
'petstore_auth': {type: 'oauth2'}
};
/**
@@ -154,7 +154,7 @@
/**
* Checks whether the given parameter value represents file-like content.
* @param param The parameter to check.
- * @returns {Boolean} true if param represents a file.
+ * @returns {Boolean} true if param represents a file.
*/
exports.prototype.isFileParam = function(param) {
// fs.ReadStream in Node.js (but not in runtime like browserify)
@@ -206,7 +206,7 @@
/**
* Enumeration of collection format separator strategies.
- * @enum {String}
+ * @enum {String}
* @readonly
*/
exports.CollectionFormatEnum = {
@@ -376,7 +376,10 @@
var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) {
- request.type(contentType);
+ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
+ if(contentType != 'multipart/form-data') {
+ request.type(contentType);
+ }
} else if (!request.header['Content-Type']) {
request.type('application/json');
}
diff --git a/samples/client/petstore-security-test/javascript/src/api/FakeApi.js b/samples/client/petstore-security-test/javascript/src/api/FakeApi.js
index f2ccf169d90..f7585314e66 100644
--- a/samples/client/petstore-security-test/javascript/src/api/FakeApi.js
+++ b/samples/client/petstore-security-test/javascript/src/api/FakeApi.js
@@ -1,9 +1,9 @@
/**
- * Swagger Petstore ' \" =end
- * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
- * OpenAPI spec version: 1.0.0 ' \" =end
- * Contact: apiteam@swagger.io ' \" =end
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -31,10 +31,10 @@
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
- if (!root.SwaggerPetstoreEnd) {
- root.SwaggerPetstoreEnd = {};
+ if (!root.SwaggerPetstoreEndRnNR) {
+ root.SwaggerPetstoreEndRnNR = {};
}
- root.SwaggerPetstoreEnd.FakeApi = factory(root.SwaggerPetstoreEnd.ApiClient);
+ root.SwaggerPetstoreEndRnNR.FakeApi = factory(root.SwaggerPetstoreEndRnNR.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
@@ -42,7 +42,7 @@
/**
* Fake service.
* @module api/FakeApi
- * @version 1.0.0 =end
+ * @version 1.0.0 *_/ =end -- \r\n \n \r
*/
/**
@@ -57,20 +57,20 @@
/**
- * Callback function to receive the result of the testCodeInjectEnd operation.
- * @callback module:api/FakeApi~testCodeInjectEndCallback
+ * Callback function to receive the result of the testCodeInjectEndRnNR operation.
+ * @callback module:api/FakeApi~testCodeInjectEndRnNRCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**
- * To test code injection ' \" =end
+ * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
* @param {Object} opts Optional parameters
- * @param {String} opts.testCodeInjectEnd To test code injection ' \" =end
- * @param {module:api/FakeApi~testCodeInjectEndCallback} callback The callback function, accepting three arguments: error, data, response
+ * @param {String} opts.testCodeInjectEndRnNR To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
+ * @param {module:api/FakeApi~testCodeInjectEndRnNRCallback} callback The callback function, accepting three arguments: error, data, response
*/
- this.testCodeInjectEnd = function(opts, callback) {
+ this.testCodeInjectEndRnNR = function(opts, callback) {
opts = opts || {};
var postBody = null;
@@ -82,12 +82,12 @@
var headerParams = {
};
var formParams = {
- 'test code inject */ ' " =end': opts['testCodeInjectEnd']
+ 'test code inject */ ' " =end -- \r\n \n \r': opts['testCodeInjectEndRnNR']
};
var authNames = [];
- var contentTypes = ['application/json', '*/ =end'];
- var accepts = ['application/json', '*/ =end'];
+ var contentTypes = ['application/json', '*_/ =end -- '];
+ var accepts = ['application/json', '*_/ =end -- '];
var returnType = null;
return this.apiClient.callApi(
diff --git a/samples/client/petstore-security-test/javascript/src/index.js b/samples/client/petstore-security-test/javascript/src/index.js
index 6c5081c188c..3a2295732ee 100644
--- a/samples/client/petstore-security-test/javascript/src/index.js
+++ b/samples/client/petstore-security-test/javascript/src/index.js
@@ -1,9 +1,9 @@
/**
- * Swagger Petstore ' \" =end
- * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
- * OpenAPI spec version: 1.0.0 ' \" =end
- * Contact: apiteam@swagger.io ' \" =end
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -34,14 +34,14 @@
'use strict';
/**
- * This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end.
+ * This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end______.
* The index module provides access to constructors for all the classes which comprise the public API.
*
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
*
- * var SwaggerPetstoreEnd = require('index'); // See note below*.
- * var xxxSvc = new SwaggerPetstoreEnd.XxxApi(); // Allocate the API class we're going to use.
- * var yyyModel = new SwaggerPetstoreEnd.Yyy(); // Construct a model instance.
+ * var SwaggerPetstoreEndRnNR = require('index'); // See note below*.
+ * var xxxSvc = new SwaggerPetstoreEndRnNR.XxxApi(); // Allocate the API class we're going to use.
+ * var yyyModel = new SwaggerPetstoreEndRnNR.Yyy(); // Construct a model instance.
* yyyModel.someProperty = 'someValue';
* ...
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
@@ -53,8 +53,8 @@
*
* A non-AMD browser application (discouraged) might do something like this:
*
- * var xxxSvc = new SwaggerPetstoreEnd.XxxApi(); // Allocate the API class we're going to use.
- * var yyy = new SwaggerPetstoreEnd.Yyy(); // Construct a model instance.
+ * var xxxSvc = new SwaggerPetstoreEndRnNR.XxxApi(); // Allocate the API class we're going to use.
+ * var yyy = new SwaggerPetstoreEndRnNR.Yyy(); // Construct a model instance.
* yyyModel.someProperty = 'someValue';
* ...
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
@@ -62,7 +62,7 @@
*
*
* @module index
- * @version 1.0.0 =end
+ * @version 1.0.0 *_/ =end -- \r\n \n \r
*/
var exports = {
/**
diff --git a/samples/client/petstore-security-test/javascript/src/model/ModelReturn.js b/samples/client/petstore-security-test/javascript/src/model/ModelReturn.js
index 8c5d596cdca..7803d3622ca 100644
--- a/samples/client/petstore-security-test/javascript/src/model/ModelReturn.js
+++ b/samples/client/petstore-security-test/javascript/src/model/ModelReturn.js
@@ -1,9 +1,9 @@
/**
- * Swagger Petstore ' \" =end
- * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
+ * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
- * OpenAPI spec version: 1.0.0 ' \" =end
- * Contact: apiteam@swagger.io ' \" =end
+ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
+ * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -31,10 +31,10 @@
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
- if (!root.SwaggerPetstoreEnd) {
- root.SwaggerPetstoreEnd = {};
+ if (!root.SwaggerPetstoreEndRnNR) {
+ root.SwaggerPetstoreEndRnNR = {};
}
- root.SwaggerPetstoreEnd.ModelReturn = factory(root.SwaggerPetstoreEnd.ApiClient);
+ root.SwaggerPetstoreEndRnNR.ModelReturn = factory(root.SwaggerPetstoreEndRnNR.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
@@ -45,12 +45,12 @@
/**
* The ModelReturn model module.
* @module model/ModelReturn
- * @version 1.0.0 =end
+ * @version 1.0.0 *_/ =end -- \r\n \n \r
*/
/**
* Constructs a new ModelReturn.
- * Model for testing reserved words ' \" =end
+ * Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
* @alias module:model/ModelReturn
* @class
*/
@@ -72,15 +72,15 @@
obj = obj || new exports();
if (data.hasOwnProperty('return')) {
- obj['return'] = ApiClient.convertToType(data['return'], 'Integer');
+ obj['return'] = ApiClient.convertToType(data['return'], 'Number');
}
}
return obj;
}
/**
- * property description ' \" =end
- * @member {Integer} return
+ * property description *_/ ' \" =end -- \\r\\n \\n \\r
+ * @member {Number} return
*/
exports.prototype['return'] = undefined;
diff --git a/samples/client/petstore/android/volley/docs/PetApi.md b/samples/client/petstore/android/volley/docs/PetApi.md
index ff596b3d918..e7b393c8ea7 100644
--- a/samples/client/petstore/android/volley/docs/PetApi.md
+++ b/samples/client/petstore/android/volley/docs/PetApi.md
@@ -222,7 +222,7 @@ Name | Type | Description | Notes
### Authorization
-[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
+[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
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 5ef1079981a..ae9bcead7c5 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
@@ -623,7 +623,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);
@@ -693,7 +693,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,
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 6e2348fa509..7cdc4f56473 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
@@ -24,13 +24,11 @@
package io.swagger.client.model;
-
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
-
@ApiModel(description = "")
-public class Category {
+public class Category {
@SerializedName("id")
private Long id = null;
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 50809231d23..7f8554374d7 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
@@ -25,13 +25,11 @@
package io.swagger.client.model;
import java.util.Date;
-
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
-
@ApiModel(description = "")
-public class Order {
+public class Order {
@SerializedName("id")
private Long id = null;
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 7a505ec4e70..492f54dcd58 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
@@ -27,13 +27,11 @@ package io.swagger.client.model;
import io.swagger.client.model.Category;
import io.swagger.client.model.Tag;
import java.util.*;
-
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
-
@ApiModel(description = "")
-public class Pet {
+public class Pet {
@SerializedName("id")
private Long id = null;
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 d75041a573c..45d3b965226 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
@@ -24,13 +24,11 @@
package io.swagger.client.model;
-
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
-
@ApiModel(description = "")
-public class Tag {
+public class Tag {
@SerializedName("id")
private Long id = null;
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 fbaec6578dd..79ebc1d607c 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
@@ -24,13 +24,11 @@
package io.swagger.client.model;
-
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
-
@ApiModel(description = "")
-public class User {
+public class User {
@SerializedName("id")
private Long id = null;
diff --git a/samples/client/petstore/dart/swagger/lib/api_client.dart b/samples/client/petstore/dart/swagger/lib/api_client.dart
index 9087a80d8cc..73856b69d74 100644
--- a/samples/client/petstore/dart/swagger/lib/api_client.dart
+++ b/samples/client/petstore/dart/swagger/lib/api_client.dart
@@ -24,8 +24,8 @@ class ApiClient {
ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) {
// Setup authentications (key: authentication name, value: authentication).
- _authentications['petstore_auth'] = new OAuth();
_authentications['api_key'] = new ApiKeyAuth("header", "api_key");
+ _authentications['petstore_auth'] = new OAuth();
}
void addDefaultHeader(String key, String value) {
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/.gitignore b/samples/client/petstore/java/okhttp-gson-parcelableModel/.gitignore
new file mode 100644
index 00000000000..a530464afa1
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/.gitignore
@@ -0,0 +1,21 @@
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# exclude jar for gradle wrapper
+!gradle/wrapper/*.jar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# build files
+**/target
+target
+.gradle
+build
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/.swagger-codegen-ignore b/samples/client/petstore/java/okhttp-gson-parcelableModel/.swagger-codegen-ignore
new file mode 100644
index 00000000000..c5fa491b4c5
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/.swagger-codegen-ignore
@@ -0,0 +1,23 @@
+# Swagger Codegen Ignore
+# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/.travis.yml b/samples/client/petstore/java/okhttp-gson-parcelableModel/.travis.yml
new file mode 100644
index 00000000000..33e79472abd
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/.travis.yml
@@ -0,0 +1,29 @@
+#
+# Generated by: https://github.com/swagger-api/swagger-codegen.git
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+language: java
+jdk:
+ - oraclejdk8
+ - oraclejdk7
+before_install:
+ # ensure gradlew has proper permission
+ - chmod a+x ./gradlew
+script:
+ # test using maven
+ - mvn test
+ # uncomment below to test using gradle
+ # - gradle test
+ # uncomment below to test using sbt
+ # - sbt test
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/LICENSE b/samples/client/petstore/java/okhttp-gson-parcelableModel/LICENSE
new file mode 100644
index 00000000000..8dada3edaf5
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md
new file mode 100644
index 00000000000..8266ae87a9c
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md
@@ -0,0 +1,183 @@
+# swagger-petstore-okhttp-gson
+
+## Requirements
+
+Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
+
+## Installation
+
+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.
+
+### Maven users
+
+Add this dependency to your project's POM:
+
+```xml
+
+ io.swagger
+ swagger-petstore-okhttp-gson
+ 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.FakeApi;
+
+import java.io.File;
+import java.util.*;
+
+public class FakeApiExample {
+
+ public static void main(String[] args) {
+
+ FakeApi apiInstance = new FakeApi();
+ BigDecimal number = new BigDecimal(); // BigDecimal | None
+ Double _double = 3.4D; // Double | None
+ String string = "string_example"; // String | None
+ byte[] _byte = B; // byte[] | None
+ Integer integer = 56; // Integer | None
+ Integer int32 = 56; // Integer | None
+ Long int64 = 789L; // Long | None
+ Float _float = 3.4F; // Float | None
+ byte[] binary = B; // byte[] | None
+ LocalDate date = new LocalDate(); // LocalDate | None
+ DateTime dateTime = new DateTime(); // DateTime | None
+ String password = "password_example"; // String | None
+ try {
+ apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling FakeApi#testEndpointParameters");
+ e.printStackTrace();
+ }
+ }
+}
+
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+*FakeApi* | [**testEnumQueryParameters**](docs/FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
+*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add 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* | [**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* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
+*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
+
+ - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
+ - [Animal](docs/Animal.md)
+ - [AnimalFarm](docs/AnimalFarm.md)
+ - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
+ - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
+ - [ArrayTest](docs/ArrayTest.md)
+ - [Cat](docs/Cat.md)
+ - [Category](docs/Category.md)
+ - [Dog](docs/Dog.md)
+ - [EnumClass](docs/EnumClass.md)
+ - [EnumTest](docs/EnumTest.md)
+ - [FormatTest](docs/FormatTest.md)
+ - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
+ - [MapTest](docs/MapTest.md)
+ - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
+ - [Model200Response](docs/Model200Response.md)
+ - [ModelApiResponse](docs/ModelApiResponse.md)
+ - [ModelReturn](docs/ModelReturn.md)
+ - [Name](docs/Name.md)
+ - [NumberOnly](docs/NumberOnly.md)
+ - [Order](docs/Order.md)
+ - [Pet](docs/Pet.md)
+ - [ReadOnlyFirst](docs/ReadOnlyFirst.md)
+ - [SpecialModelName](docs/SpecialModelName.md)
+ - [Tag](docs/Tag.md)
+ - [User](docs/User.md)
+
+
+## Documentation for Authorization
+
+Authentication schemes defined for the API:
+### api_key
+
+- **Type**: API key
+- **API key parameter name**: api_key
+- **Location**: HTTP header
+
+### petstore_auth
+
+- **Type**: OAuth
+- **Flow**: implicit
+- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
+- **Scopes**:
+ - write:pets: modify pets in your account
+ - read:pets: read your pets
+
+
+## Recommendation
+
+It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue.
+
+## Author
+
+apiteam@swagger.io
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle
new file mode 100644
index 00000000000..d7c6b63ea75
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle
@@ -0,0 +1,103 @@
+apply plugin: 'idea'
+apply plugin: 'eclipse'
+
+group = 'io.swagger'
+version = '1.0.0'
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.5.+'
+ classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
+ }
+}
+
+repositories {
+ jcenter()
+}
+
+
+if(hasProperty('target') && target == 'android') {
+
+ apply plugin: 'com.android.library'
+ apply plugin: 'com.github.dcendents.android-maven'
+
+ android {
+ compileSdkVersion 23
+ buildToolsVersion '23.0.2'
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion 23
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+
+ // Rename the aar correctly
+ libraryVariants.all { variant ->
+ variant.outputs.each { output ->
+ def outputFile = output.outputFile
+ if (outputFile != null && outputFile.name.endsWith('.aar')) {
+ def fileName = "${project.name}-${variant.baseName}-${version}.aar"
+ output.outputFile = new File(outputFile.parent, fileName)
+ }
+ }
+ }
+
+ dependencies {
+ provided 'javax.annotation:jsr250-api:1.0'
+ }
+ }
+
+ afterEvaluate {
+ android.libraryVariants.all { variant ->
+ def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
+ task.description = "Create jar artifact for ${variant.name}"
+ task.dependsOn variant.javaCompile
+ task.from variant.javaCompile.destinationDir
+ task.destinationDir = project.file("${project.buildDir}/outputs/jar")
+ task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
+ artifacts.add('archives', task);
+ }
+ }
+
+ task sourcesJar(type: Jar) {
+ from android.sourceSets.main.java.srcDirs
+ classifier = 'sources'
+ }
+
+ artifacts {
+ archives sourcesJar
+ }
+
+} else {
+
+ apply plugin: 'java'
+ apply plugin: 'maven'
+
+ sourceCompatibility = JavaVersion.VERSION_1_7
+ targetCompatibility = JavaVersion.VERSION_1_7
+
+ install {
+ repositories.mavenInstaller {
+ pom.artifactId = 'swagger-petstore-okhttp-gson'
+ }
+ }
+
+ task execute(type:JavaExec) {
+ main = System.getProperty('mainClass')
+ classpath = sourceSets.main.runtimeClasspath
+ }
+}
+
+dependencies {
+ compile 'io.swagger:swagger-annotations:1.5.8'
+ compile 'com.squareup.okhttp:okhttp:2.7.5'
+ compile 'com.squareup.okhttp:logging-interceptor:2.7.5'
+ compile 'com.google.code.gson:gson:2.6.2'
+ compile 'joda-time:joda-time:2.9.3'
+ testCompile 'junit:junit:4.12'
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt
new file mode 100644
index 00000000000..01a1095f8a4
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt
@@ -0,0 +1,20 @@
+lazy val root = (project in file(".")).
+ settings(
+ organization := "io.swagger",
+ name := "swagger-petstore-okhttp-gson",
+ version := "1.0.0",
+ scalaVersion := "2.11.4",
+ scalacOptions ++= Seq("-feature"),
+ javacOptions in compile ++= Seq("-Xlint:deprecation"),
+ publishArtifact in (Compile, packageDoc) := false,
+ resolvers += Resolver.mavenLocal,
+ libraryDependencies ++= Seq(
+ "io.swagger" % "swagger-annotations" % "1.5.8",
+ "com.squareup.okhttp" % "okhttp" % "2.7.5",
+ "com.squareup.okhttp" % "logging-interceptor" % "2.7.5",
+ "com.google.code.gson" % "gson" % "2.6.2",
+ "joda-time" % "joda-time" % "2.9.3" % "compile",
+ "junit" % "junit" % "4.12" % "test",
+ "com.novocode" % "junit-interface" % "0.10" % "test"
+ )
+ )
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesClass.md
new file mode 100644
index 00000000000..0437c4dd8cc
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesClass.md
@@ -0,0 +1,11 @@
+
+# AdditionalPropertiesClass
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**mapProperty** | **Map<String, String>** | | [optional]
+**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Animal.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Animal.md
new file mode 100644
index 00000000000..b3f325c3524
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Animal.md
@@ -0,0 +1,11 @@
+
+# Animal
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**className** | **String** | |
+**color** | **String** | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AnimalFarm.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AnimalFarm.md
new file mode 100644
index 00000000000..c7c7f1ddcce
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AnimalFarm.md
@@ -0,0 +1,9 @@
+
+# AnimalFarm
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md
new file mode 100644
index 00000000000..77292549927
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md
@@ -0,0 +1,10 @@
+
+# ArrayOfArrayOfNumberOnly
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**arrayArrayNumber** | [**List<List<BigDecimal>>**](List.md) | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfNumberOnly.md
new file mode 100644
index 00000000000..e8cc4cd36dc
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfNumberOnly.md
@@ -0,0 +1,10 @@
+
+# ArrayOfNumberOnly
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**arrayNumber** | [**List<BigDecimal>**](BigDecimal.md) | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayTest.md
new file mode 100644
index 00000000000..9feee16427f
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayTest.md
@@ -0,0 +1,12 @@
+
+# ArrayTest
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**arrayOfString** | **List<String>** | | [optional]
+**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional]
+**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Cat.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Cat.md
new file mode 100644
index 00000000000..be6e56fa8ce
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Cat.md
@@ -0,0 +1,12 @@
+
+# Cat
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**className** | **String** | |
+**color** | **String** | | [optional]
+**declawed** | **Boolean** | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md
new file mode 100644
index 00000000000..e2df0803278
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/Dog.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Dog.md
new file mode 100644
index 00000000000..71a7dbe809e
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Dog.md
@@ -0,0 +1,12 @@
+
+# Dog
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**className** | **String** | |
+**color** | **String** | | [optional]
+**breed** | **String** | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumClass.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumClass.md
new file mode 100644
index 00000000000..c746edc3cb1
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumClass.md
@@ -0,0 +1,14 @@
+
+# EnumClass
+
+## Enum
+
+
+* `_ABC` (value: `"_abc"`)
+
+* `_EFG` (value: `"-efg"`)
+
+* `_XYZ_` (value: `"(xyz)"`)
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md
new file mode 100644
index 00000000000..deb1951c552
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md
@@ -0,0 +1,36 @@
+
+# EnumTest
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional]
+**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional]
+**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional]
+
+
+
+## Enum: EnumStringEnum
+Name | Value
+---- | -----
+UPPER | "UPPER"
+LOWER | "lower"
+
+
+
+## Enum: EnumIntegerEnum
+Name | Value
+---- | -----
+NUMBER_1 | 1
+NUMBER_MINUS_1 | -1
+
+
+
+## Enum: EnumNumberEnum
+Name | Value
+---- | -----
+NUMBER_1_DOT_1 | 1.1
+NUMBER_MINUS_1_DOT_2 | -1.2
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md
new file mode 100644
index 00000000000..21a4db7c377
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md
@@ -0,0 +1,122 @@
+# FakeApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+[**testEnumQueryParameters**](FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
+
+
+
+# **testEndpointParameters**
+> testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password)
+
+Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+
+Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+
+### Example
+```java
+// Import classes:
+//import io.swagger.client.ApiException;
+//import io.swagger.client.api.FakeApi;
+
+
+FakeApi apiInstance = new FakeApi();
+BigDecimal number = new BigDecimal(); // BigDecimal | None
+Double _double = 3.4D; // Double | None
+String string = "string_example"; // String | None
+byte[] _byte = B; // byte[] | None
+Integer integer = 56; // Integer | None
+Integer int32 = 56; // Integer | None
+Long int64 = 789L; // Long | None
+Float _float = 3.4F; // Float | None
+byte[] binary = B; // byte[] | None
+LocalDate date = new LocalDate(); // LocalDate | None
+DateTime dateTime = new DateTime(); // DateTime | None
+String password = "password_example"; // String | None
+try {
+ apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
+} catch (ApiException e) {
+ System.err.println("Exception when calling FakeApi#testEndpointParameters");
+ e.printStackTrace();
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **number** | **BigDecimal**| None |
+ **_double** | **Double**| None |
+ **string** | **String**| None |
+ **_byte** | **byte[]**| None |
+ **integer** | **Integer**| None | [optional]
+ **int32** | **Integer**| None | [optional]
+ **int64** | **Long**| None | [optional]
+ **_float** | **Float**| None | [optional]
+ **binary** | **byte[]**| None | [optional]
+ **date** | **LocalDate**| None | [optional]
+ **dateTime** | **DateTime**| None | [optional]
+ **password** | **String**| None | [optional]
+
+### Return type
+
+null (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
+ - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
+
+
+# **testEnumQueryParameters**
+> testEnumQueryParameters(enumQueryString, enumQueryInteger, enumQueryDouble)
+
+To test enum query parameters
+
+### Example
+```java
+// Import classes:
+//import io.swagger.client.ApiException;
+//import io.swagger.client.api.FakeApi;
+
+
+FakeApi apiInstance = new FakeApi();
+String enumQueryString = "-efg"; // String | Query parameter enum test (string)
+BigDecimal enumQueryInteger = new BigDecimal(); // BigDecimal | Query parameter enum test (double)
+Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double)
+try {
+ apiInstance.testEnumQueryParameters(enumQueryString, enumQueryInteger, enumQueryDouble);
+} catch (ApiException e) {
+ System.err.println("Exception when calling FakeApi#testEnumQueryParameters");
+ e.printStackTrace();
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
+ **enumQueryInteger** | **BigDecimal**| Query parameter enum test (double) | [optional]
+ **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional]
+
+### Return type
+
+null (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FormatTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FormatTest.md
new file mode 100644
index 00000000000..44de7d9511a
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FormatTest.md
@@ -0,0 +1,22 @@
+
+# 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[]** | |
+**binary** | **byte[]** | | [optional]
+**date** | [**LocalDate**](LocalDate.md) | |
+**dateTime** | [**DateTime**](DateTime.md) | | [optional]
+**uuid** | **String** | | [optional]
+**password** | **String** | |
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/HasOnlyReadOnly.md
new file mode 100644
index 00000000000..c1d0aac5672
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/HasOnlyReadOnly.md
@@ -0,0 +1,11 @@
+
+# HasOnlyReadOnly
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**bar** | **String** | | [optional]
+**foo** | **String** | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md
new file mode 100644
index 00000000000..c671e97ffbc
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md
@@ -0,0 +1,17 @@
+
+# MapTest
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional]
+**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional]
+
+
+
+## Enum: Map<String, InnerEnum>
+Name | Value
+---- | -----
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md
new file mode 100644
index 00000000000..e3487bcc501
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md
@@ -0,0 +1,12 @@
+
+# MixedPropertiesAndAdditionalPropertiesClass
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**uuid** | **String** | | [optional]
+**dateTime** | [**DateTime**](DateTime.md) | | [optional]
+**map** | [**Map<String, Animal>**](Animal.md) | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Model200Response.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Model200Response.md
new file mode 100644
index 00000000000..b47618b28cc
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Model200Response.md
@@ -0,0 +1,11 @@
+
+# Model200Response
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **Integer** | | [optional]
+**PropertyClass** | **String** | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelApiResponse.md
new file mode 100644
index 00000000000..3eec8686cc9
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/ModelReturn.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelReturn.md
new file mode 100644
index 00000000000..a679b04953e
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/Name.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Name.md
new file mode 100644
index 00000000000..ce2fb4dee50
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Name.md
@@ -0,0 +1,13 @@
+
+# Name
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **Integer** | |
+**snakeCase** | **Integer** | | [optional]
+**property** | **String** | | [optional]
+**_123Number** | **Integer** | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/NumberOnly.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/NumberOnly.md
new file mode 100644
index 00000000000..a3feac7fadc
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/NumberOnly.md
@@ -0,0 +1,10 @@
+
+# NumberOnly
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**justNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Order.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Order.md
new file mode 100644
index 00000000000..a1089f5384e
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Order.md
@@ -0,0 +1,24 @@
+
+# Order
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **Long** | | [optional]
+**petId** | **Long** | | [optional]
+**quantity** | **Integer** | | [optional]
+**shipDate** | [**DateTime**](DateTime.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-parcelableModel/docs/Pet.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Pet.md
new file mode 100644
index 00000000000..5b63109ef92
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/PetApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/PetApi.md
new file mode 100644
index 00000000000..e0314e20e51
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/ReadOnlyFirst.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ReadOnlyFirst.md
new file mode 100644
index 00000000000..426b7cde95a
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ReadOnlyFirst.md
@@ -0,0 +1,11 @@
+
+# ReadOnlyFirst
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**bar** | **String** | | [optional]
+**baz** | **String** | | [optional]
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/SpecialModelName.md
new file mode 100644
index 00000000000..c2c6117c552
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/StoreApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/StoreApi.md
new file mode 100644
index 00000000000..0b30791725a
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/Tag.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Tag.md
new file mode 100644
index 00000000000..de6814b55d5
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/User.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/User.md
new file mode 100644
index 00000000000..8b6753dd284
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md
new file mode 100644
index 00000000000..8cdc15992ee
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/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-parcelableModel/git_push.sh b/samples/client/petstore/java/okhttp-gson-parcelableModel/git_push.sh
new file mode 100644
index 00000000000..ed374619b13
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/git_push.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=`git remote`
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle.properties b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle.properties
new file mode 100644
index 00000000000..05644f0754a
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle.properties
@@ -0,0 +1,2 @@
+# Uncomment to build for Android
+#target = android
\ No newline at end of file
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000000..2c6137b8789
Binary files /dev/null and b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000000..b7a36473955
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue May 17 23:08:05 CST 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew
new file mode 100644
index 00000000000..9d82f789151
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat
new file mode 100644
index 00000000000..5f192121eb4
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml
new file mode 100644
index 00000000000..9998f398c10
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml
@@ -0,0 +1,168 @@
+
+ 4.0.0
+ io.swagger
+ petstore-okhttp-gson-parcelable
+ jar
+ petstore-okhttp-gson-parcelable
+ 1.0.0
+
+ scm:git:git@github.com:swagger-api/swagger-mustache.git
+ scm:git:git@github.com:swagger-api/swagger-codegen.git
+ https://github.com/swagger-api/swagger-codegen
+
+
+ 2.2.0
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12
+
+
+
+ loggerPath
+ conf/log4j.properties
+
+
+ -Xms512m -Xmx1500m
+ methods
+ pertest
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/lib
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.2
+
+
+
+ jar
+ test-jar
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.10
+
+
+ add_sources
+ generate-sources
+
+ add-source
+
+
+
+ src/main/java
+
+
+
+
+ add_test_sources
+ generate-test-sources
+
+ add-test-source
+
+
+
+ src/test/java
+
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.2.1
+
+
+ gradle-test
+ integration-test
+
+ exec
+
+
+ gradle
+
+ test
+
+
+
+
+
+
+
+
+
+ io.swagger
+ swagger-annotations
+ ${swagger-core-version}
+
+
+ com.squareup.okhttp
+ okhttp
+ ${okhttp-version}
+
+
+ com.squareup.okhttp
+ logging-interceptor
+ ${okhttp-version}
+
+
+ com.google.code.gson
+ gson
+ ${gson-version}
+
+
+ joda-time
+ joda-time
+ ${jodatime-version}
+
+
+
+
+ junit
+ junit
+ ${junit-version}
+ test
+
+
+
+ 1.7
+ ${java.version}
+ ${java.version}
+ 1.5.9
+ 2.7.5
+ 2.6.2
+ 2.9.3
+ 1.0.0
+ 4.12
+ UTF-8
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/settings.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/settings.gradle
new file mode 100644
index 00000000000..b73eec84591
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = "swagger-petstore-okhttp-gson"
\ No newline at end of file
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/AndroidManifest.xml
new file mode 100644
index 00000000000..465dcb520c4
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/AndroidManifest.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiCallback.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiCallback.java
new file mode 100644
index 00000000000..a2460c37ee3
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiCallback.java
@@ -0,0 +1,74 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+import java.io.IOException;
+
+import java.util.Map;
+import java.util.List;
+
+/**
+ * Callback for asynchronous API call.
+ *
+ * @param The return type
+ */
+public interface ApiCallback {
+ /**
+ * This is called when the API call fails.
+ *
+ * @param e The exception causing the failure
+ * @param statusCode Status code of the response if available, otherwise it would be 0
+ * @param responseHeaders Headers of the response if available, otherwise it would be null
+ */
+ void onFailure(ApiException e, int statusCode, Map> responseHeaders);
+
+ /**
+ * This is called when the API call succeeded.
+ *
+ * @param result The result deserialized from response
+ * @param statusCode Status code of the response
+ * @param responseHeaders Headers of the response
+ */
+ void onSuccess(T result, int statusCode, Map> responseHeaders);
+
+ /**
+ * This is called when the API upload processing.
+ *
+ * @param bytesWritten bytes Written
+ * @param contentLength content length of request body
+ * @param done write end
+ */
+ void onUploadProgress(long bytesWritten, long contentLength, boolean done);
+
+ /**
+ * This is called when the API downlond processing.
+ *
+ * @param bytesRead bytes Read
+ * @param contentLength content lenngth of the response
+ * @param done Read end
+ */
+ void onDownloadProgress(long bytesRead, long contentLength, boolean done);
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiClient.java
new file mode 100644
index 00000000000..c4137dcb816
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiClient.java
@@ -0,0 +1,1327 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+import com.squareup.okhttp.Call;
+import com.squareup.okhttp.Callback;
+import com.squareup.okhttp.OkHttpClient;
+import com.squareup.okhttp.Request;
+import com.squareup.okhttp.Response;
+import com.squareup.okhttp.RequestBody;
+import com.squareup.okhttp.FormEncodingBuilder;
+import com.squareup.okhttp.MultipartBuilder;
+import com.squareup.okhttp.MediaType;
+import com.squareup.okhttp.Headers;
+import com.squareup.okhttp.internal.http.HttpMethod;
+import com.squareup.okhttp.logging.HttpLoggingInterceptor;
+import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level;
+
+import java.lang.reflect.Type;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import java.net.URLEncoder;
+import java.net.URLConnection;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.SecureRandom;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.text.ParseException;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+import okio.BufferedSink;
+import okio.Okio;
+
+import io.swagger.client.auth.Authentication;
+import io.swagger.client.auth.HttpBasicAuth;
+import io.swagger.client.auth.ApiKeyAuth;
+import io.swagger.client.auth.OAuth;
+
+public class ApiClient {
+ public static final double JAVA_VERSION;
+ public static final boolean IS_ANDROID;
+ public static final int ANDROID_SDK_VERSION;
+
+ static {
+ JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version"));
+ boolean isAndroid;
+ try {
+ Class.forName("android.app.Activity");
+ isAndroid = true;
+ } catch (ClassNotFoundException e) {
+ isAndroid = false;
+ }
+ IS_ANDROID = isAndroid;
+ int sdkVersion = 0;
+ if (IS_ANDROID) {
+ try {
+ sdkVersion = Class.forName("android.os.Build$VERSION").getField("SDK_INT").getInt(null);
+ } catch (Exception e) {
+ try {
+ sdkVersion = Integer.parseInt((String) Class.forName("android.os.Build$VERSION").getField("SDK").get(null));
+ } catch (Exception e2) { }
+ }
+ }
+ ANDROID_SDK_VERSION = sdkVersion;
+ }
+
+ /**
+ * The datetime format to be used when lenientDatetimeFormat is enabled.
+ */
+ public static final String LENIENT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
+
+ private String basePath = "http://petstore.swagger.io/v2";
+ private boolean lenientOnJson = false;
+ private boolean debugging = false;
+ private Map defaultHeaderMap = new HashMap();
+ private String tempFolderPath = null;
+
+ private Map authentications;
+
+ private DateFormat dateFormat;
+ private DateFormat datetimeFormat;
+ private boolean lenientDatetimeFormat;
+ private int dateLength;
+
+ private InputStream sslCaCert;
+ private boolean verifyingSsl;
+
+ private OkHttpClient httpClient;
+ private JSON json;
+
+ private HttpLoggingInterceptor loggingInterceptor;
+
+ /*
+ * Constructor for ApiClient
+ */
+ public ApiClient() {
+ httpClient = new OkHttpClient();
+
+ verifyingSsl = true;
+
+ json = new JSON(this);
+
+ /*
+ * Use RFC3339 format for date and datetime.
+ * See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14
+ */
+ this.dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ // Always use UTC as the default time zone when dealing with date (without time).
+ this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ initDatetimeFormat();
+
+ // Be lenient on datetime formats when parsing datetime from string.
+ // See parseDatetime.
+ this.lenientDatetimeFormat = true;
+
+ // Set default User-Agent.
+ setUserAgent("Swagger-Codegen/1.0.0/java");
+
+ // Setup authentications (key: authentication name, value: authentication).
+ authentications = new HashMap();
+ authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
+ authentications.put("http_basic_test", new HttpBasicAuth());
+ authentications.put("petstore_auth", new OAuth());
+ // Prevent the authentications from being modified.
+ authentications = Collections.unmodifiableMap(authentications);
+ }
+
+ /**
+ * Get base path
+ *
+ * @return Baes path
+ */
+ public String getBasePath() {
+ return basePath;
+ }
+
+ /**
+ * Set base path
+ *
+ * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2
+ * @return An instance of OkHttpClient
+ */
+ public ApiClient setBasePath(String basePath) {
+ this.basePath = basePath;
+ return this;
+ }
+
+ /**
+ * Get HTTP client
+ *
+ * @return An instance of OkHttpClient
+ */
+ public OkHttpClient getHttpClient() {
+ return httpClient;
+ }
+
+ /**
+ * Set HTTP client
+ *
+ * @param httpClient An instance of OkHttpClient
+ * @return Api Client
+ */
+ public ApiClient setHttpClient(OkHttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /**
+ * Get JSON
+ *
+ * @return JSON object
+ */
+ public JSON getJSON() {
+ return json;
+ }
+
+ /**
+ * Set JSON
+ *
+ * @param json JSON object
+ * @return Api client
+ */
+ public ApiClient setJSON(JSON json) {
+ this.json = json;
+ return this;
+ }
+
+ /**
+ * True if isVerifyingSsl flag is on
+ *
+ * @return True if isVerifySsl flag is on
+ */
+ public boolean isVerifyingSsl() {
+ return verifyingSsl;
+ }
+
+ /**
+ * Configure whether to verify certificate and hostname when making https requests.
+ * Default to true.
+ * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks.
+ *
+ * @param verifyingSsl True to verify TLS/SSL connection
+ * @return ApiClient
+ */
+ public ApiClient setVerifyingSsl(boolean verifyingSsl) {
+ this.verifyingSsl = verifyingSsl;
+ applySslSettings();
+ return this;
+ }
+
+ /**
+ * Get SSL CA cert.
+ *
+ * @return Input stream to the SSL CA cert
+ */
+ public InputStream getSslCaCert() {
+ return sslCaCert;
+ }
+
+ /**
+ * Configure the CA certificate to be trusted when making https requests.
+ * Use null to reset to default.
+ *
+ * @param sslCaCert input stream for SSL CA cert
+ * @return ApiClient
+ */
+ public ApiClient setSslCaCert(InputStream sslCaCert) {
+ this.sslCaCert = sslCaCert;
+ applySslSettings();
+ return this;
+ }
+
+ public DateFormat getDateFormat() {
+ return dateFormat;
+ }
+
+ public ApiClient setDateFormat(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ this.dateLength = this.dateFormat.format(new Date()).length();
+ return this;
+ }
+
+ public DateFormat getDatetimeFormat() {
+ return datetimeFormat;
+ }
+
+ public ApiClient setDatetimeFormat(DateFormat datetimeFormat) {
+ this.datetimeFormat = datetimeFormat;
+ return this;
+ }
+
+ /**
+ * Whether to allow various ISO 8601 datetime formats when parsing a datetime string.
+ * @see #parseDatetime(String)
+ * @return True if lenientDatetimeFormat flag is set to true
+ */
+ public boolean isLenientDatetimeFormat() {
+ return lenientDatetimeFormat;
+ }
+
+ public ApiClient setLenientDatetimeFormat(boolean lenientDatetimeFormat) {
+ this.lenientDatetimeFormat = lenientDatetimeFormat;
+ return this;
+ }
+
+ /**
+ * Parse the given date string into Date object.
+ * The default dateFormat supports these ISO 8601 date formats:
+ * 2015-08-16
+ * 2015-8-16
+ * @param str String to be parsed
+ * @return Date
+ */
+ public Date parseDate(String str) {
+ if (str == null)
+ return null;
+ try {
+ return dateFormat.parse(str);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Parse the given datetime string into Date object.
+ * When lenientDatetimeFormat is enabled, the following ISO 8601 datetime formats are supported:
+ * 2015-08-16T08:20:05Z
+ * 2015-8-16T8:20:05Z
+ * 2015-08-16T08:20:05+00:00
+ * 2015-08-16T08:20:05+0000
+ * 2015-08-16T08:20:05.376Z
+ * 2015-08-16T08:20:05.376+00:00
+ * 2015-08-16T08:20:05.376+00
+ * Note: The 3-digit milli-seconds is optional. Time zone is required and can be in one of
+ * these formats:
+ * Z (same with +0000)
+ * +08:00 (same with +0800)
+ * -02 (same with -0200)
+ * -0200
+ * @see ISO 8601
+ * @param str Date time string to be parsed
+ * @return Date representation of the string
+ */
+ public Date parseDatetime(String str) {
+ if (str == null)
+ return null;
+
+ DateFormat format;
+ if (lenientDatetimeFormat) {
+ /*
+ * When lenientDatetimeFormat is enabled, normalize the date string
+ * into LENIENT_DATETIME_FORMAT to support various formats
+ * defined by ISO 8601.
+ */
+ // normalize time zone
+ // trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+0000
+ str = str.replaceAll("[zZ]\\z", "+0000");
+ // remove colon in time zone: 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05+0000
+ str = str.replaceAll("([+-]\\d{2}):(\\d{2})\\z", "$1$2");
+ // expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+0000
+ str = str.replaceAll("([+-]\\d{2})\\z", "$100");
+ // add milliseconds when missing
+ // 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05.000+0000
+ str = str.replaceAll("(:\\d{1,2})([+-]\\d{4})\\z", "$1.000$2");
+ format = new SimpleDateFormat(LENIENT_DATETIME_FORMAT);
+ } else {
+ format = this.datetimeFormat;
+ }
+
+ try {
+ return format.parse(str);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /*
+ * Parse date or date time in string format into Date object.
+ *
+ * @param str Date time string to be parsed
+ * @return Date representation of the string
+ */
+ public Date parseDateOrDatetime(String str) {
+ if (str == null)
+ return null;
+ else if (str.length() <= dateLength)
+ return parseDate(str);
+ else
+ return parseDatetime(str);
+ }
+
+ /**
+ * Format the given Date object into string (Date format).
+ *
+ * @param date Date object
+ * @return Formatted date in string representation
+ */
+ public String formatDate(Date date) {
+ return dateFormat.format(date);
+ }
+
+ /**
+ * Format the given Date object into string (Datetime format).
+ *
+ * @param date Date object
+ * @return Formatted datetime in string representation
+ */
+ public String formatDatetime(Date date) {
+ return datetimeFormat.format(date);
+ }
+
+ /**
+ * Get authentications (key: authentication name, value: authentication).
+ *
+ * @return Map of authentication objects
+ */
+ public Map getAuthentications() {
+ return authentications;
+ }
+
+ /**
+ * Get authentication for the given name.
+ *
+ * @param authName The authentication name
+ * @return The authentication, null if not found
+ */
+ public Authentication getAuthentication(String authName) {
+ return authentications.get(authName);
+ }
+
+ /**
+ * Helper method to set username for the first HTTP basic authentication.
+ *
+ * @param username Username
+ */
+ public void setUsername(String username) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBasicAuth) {
+ ((HttpBasicAuth) auth).setUsername(username);
+ return;
+ }
+ }
+ throw new RuntimeException("No HTTP basic authentication configured!");
+ }
+
+ /**
+ * Helper method to set password for the first HTTP basic authentication.
+ *
+ * @param password Password
+ */
+ public void setPassword(String password) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBasicAuth) {
+ ((HttpBasicAuth) auth).setPassword(password);
+ return;
+ }
+ }
+ throw new RuntimeException("No HTTP basic authentication configured!");
+ }
+
+ /**
+ * Helper method to set API key value for the first API key authentication.
+ *
+ * @param apiKey API key
+ */
+ public void setApiKey(String apiKey) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof ApiKeyAuth) {
+ ((ApiKeyAuth) auth).setApiKey(apiKey);
+ return;
+ }
+ }
+ throw new RuntimeException("No API key authentication configured!");
+ }
+
+ /**
+ * Helper method to set API key prefix for the first API key authentication.
+ *
+ * @param apiKeyPrefix API key prefix
+ */
+ public void setApiKeyPrefix(String apiKeyPrefix) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof ApiKeyAuth) {
+ ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
+ return;
+ }
+ }
+ throw new RuntimeException("No API key authentication configured!");
+ }
+
+ /**
+ * Helper method to set access token for the first OAuth2 authentication.
+ *
+ * @param accessToken Access token
+ */
+ public void setAccessToken(String accessToken) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof OAuth) {
+ ((OAuth) auth).setAccessToken(accessToken);
+ return;
+ }
+ }
+ throw new RuntimeException("No OAuth2 authentication configured!");
+ }
+
+ /**
+ * Set the User-Agent header's value (by adding to the default header map).
+ *
+ * @param userAgent HTTP request's user agent
+ * @return ApiClient
+ */
+ public ApiClient setUserAgent(String userAgent) {
+ addDefaultHeader("User-Agent", userAgent);
+ return this;
+ }
+
+ /**
+ * Add a default header.
+ *
+ * @param key The header's key
+ * @param value The header's value
+ * @return ApiClient
+ */
+ public ApiClient addDefaultHeader(String key, String value) {
+ defaultHeaderMap.put(key, value);
+ return this;
+ }
+
+ /**
+ * @see setLenient
+ *
+ * @return True if lenientOnJson is enabled, false otherwise.
+ */
+ public boolean isLenientOnJson() {
+ return lenientOnJson;
+ }
+
+ /**
+ * Set LenientOnJson
+ *
+ * @param lenient True to enable lenientOnJson
+ * @return ApiClient
+ */
+ public ApiClient setLenientOnJson(boolean lenient) {
+ this.lenientOnJson = lenient;
+ return this;
+ }
+
+ /**
+ * Check that whether debugging is enabled for this API client.
+ *
+ * @return True if debugging is enabled, false otherwise.
+ */
+ public boolean isDebugging() {
+ return debugging;
+ }
+
+ /**
+ * Enable/disable debugging for this API client.
+ *
+ * @param debugging To enable (true) or disable (false) debugging
+ * @return ApiClient
+ */
+ public ApiClient setDebugging(boolean debugging) {
+ if (debugging != this.debugging) {
+ if (debugging) {
+ loggingInterceptor = new HttpLoggingInterceptor();
+ loggingInterceptor.setLevel(Level.BODY);
+ httpClient.interceptors().add(loggingInterceptor);
+ } else {
+ httpClient.interceptors().remove(loggingInterceptor);
+ loggingInterceptor = null;
+ }
+ }
+ this.debugging = debugging;
+ return this;
+ }
+
+ /**
+ * The path of temporary folder used to store downloaded files from endpoints
+ * with file response. The default value is null, i.e. using
+ * the system's default tempopary folder.
+ *
+ * @see createTempFile
+ * @return Temporary folder path
+ */
+ public String getTempFolderPath() {
+ return tempFolderPath;
+ }
+
+ /**
+ * Set the tempoaray folder path (for downloading files)
+ *
+ * @param tempFolderPath Temporary folder path
+ * @return ApiClient
+ */
+ public ApiClient setTempFolderPath(String tempFolderPath) {
+ this.tempFolderPath = tempFolderPath;
+ return this;
+ }
+
+ /**
+ * Get connection timeout (in milliseconds).
+ *
+ * @return Timeout in milliseconds
+ */
+ public int getConnectTimeout() {
+ return httpClient.getConnectTimeout();
+ }
+
+ /**
+ * Sets the connect timeout (in milliseconds).
+ * A value of 0 means no timeout, otherwise values must be between 1 and
+ *
+ * @param connectionTimeout connection timeout in milliseconds
+ * @return Api client
+ */
+ public ApiClient setConnectTimeout(int connectionTimeout) {
+ httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS);
+ return this;
+ }
+
+ /**
+ * Format the given parameter object into string.
+ *
+ * @param param Parameter
+ * @return String representation of the parameter
+ */
+ public String parameterToString(Object param) {
+ if (param == null) {
+ return "";
+ } else if (param instanceof Date) {
+ return formatDatetime((Date) param);
+ } else if (param instanceof Collection) {
+ StringBuilder b = new StringBuilder();
+ for (Object o : (Collection)param) {
+ if (b.length() > 0) {
+ b.append(",");
+ }
+ b.append(String.valueOf(o));
+ }
+ return b.toString();
+ } else {
+ return String.valueOf(param);
+ }
+ }
+
+ /**
+ * Format to {@code Pair} objects.
+ *
+ * @param collectionFormat collection format (e.g. csv, tsv)
+ * @param name Name
+ * @param value Value
+ * @return A list of Pair objects
+ */
+ public List parameterToPairs(String collectionFormat, String name, Object value){
+ List params = new ArrayList();
+
+ // preconditions
+ if (name == null || name.isEmpty() || value == null) return params;
+
+ Collection valueCollection = null;
+ if (value instanceof Collection) {
+ valueCollection = (Collection) value;
+ } else {
+ params.add(new Pair(name, parameterToString(value)));
+ return params;
+ }
+
+ if (valueCollection.isEmpty()){
+ return params;
+ }
+
+ // get the collection format
+ collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv
+
+ // create the params based on the collection format
+ if (collectionFormat.equals("multi")) {
+ for (Object item : valueCollection) {
+ params.add(new Pair(name, parameterToString(item)));
+ }
+
+ return params;
+ }
+
+ String delimiter = ",";
+
+ if (collectionFormat.equals("csv")) {
+ delimiter = ",";
+ } else if (collectionFormat.equals("ssv")) {
+ delimiter = " ";
+ } else if (collectionFormat.equals("tsv")) {
+ delimiter = "\t";
+ } else if (collectionFormat.equals("pipes")) {
+ delimiter = "|";
+ }
+
+ StringBuilder sb = new StringBuilder() ;
+ for (Object item : valueCollection) {
+ sb.append(delimiter);
+ sb.append(parameterToString(item));
+ }
+
+ params.add(new Pair(name, sb.substring(1)));
+
+ return params;
+ }
+
+ /**
+ * Sanitize filename by removing path.
+ * e.g. ../../sun.gif becomes sun.gif
+ *
+ * @param filename The filename to be sanitized
+ * @return The sanitized filename
+ */
+ public String sanitizeFilename(String filename) {
+ return filename.replaceAll(".*[/\\\\]", "");
+ }
+
+ /**
+ * Check if the given MIME is a JSON MIME.
+ * JSON MIME examples:
+ * application/json
+ * application/json; charset=UTF8
+ * APPLICATION/JSON
+ *
+ * @param mime MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
+ */
+ public boolean isJsonMime(String mime) {
+ return mime != null && mime.matches("(?i)application\\/json(;.*)?");
+ }
+
+ /**
+ * Select the Accept header's value from the given accepts array:
+ * if JSON exists in the given array, use it;
+ * otherwise use all of them (joining into a string)
+ *
+ * @param accepts The accepts array to select from
+ * @return The Accept header to use. If the given array is empty,
+ * null will be returned (not to set the Accept header explicitly).
+ */
+ public String selectHeaderAccept(String[] accepts) {
+ if (accepts.length == 0) {
+ return null;
+ }
+ for (String accept : accepts) {
+ if (isJsonMime(accept)) {
+ return accept;
+ }
+ }
+ return StringUtil.join(accepts, ",");
+ }
+
+ /**
+ * Select the Content-Type header's value from the given array:
+ * if JSON exists in the given array, use it;
+ * otherwise use the first one of the array.
+ *
+ * @param contentTypes The Content-Type array to select from
+ * @return The Content-Type header to use. If the given array is empty,
+ * JSON will be used.
+ */
+ public String selectHeaderContentType(String[] contentTypes) {
+ if (contentTypes.length == 0) {
+ return "application/json";
+ }
+ for (String contentType : contentTypes) {
+ if (isJsonMime(contentType)) {
+ return contentType;
+ }
+ }
+ return contentTypes[0];
+ }
+
+ /**
+ * Escape the given string to be used as URL query value.
+ *
+ * @param str String to be escaped
+ * @return Escaped string
+ */
+ public String escapeString(String str) {
+ try {
+ return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20");
+ } catch (UnsupportedEncodingException e) {
+ return str;
+ }
+ }
+
+ /**
+ * Deserialize response body to Java object, according to the return type and
+ * the Content-Type response header.
+ *
+ * @param Type
+ * @param response HTTP response
+ * @param returnType The type of the Java object
+ * @return The deserialized Java object
+ * @throws ApiException If fail to deserialize response body, i.e. cannot read response body
+ * or the Content-Type of the response is not supported.
+ */
+ @SuppressWarnings("unchecked")
+ public T deserialize(Response response, Type returnType) throws ApiException {
+ if (response == null || returnType == null) {
+ return null;
+ }
+
+ if ("byte[]".equals(returnType.toString())) {
+ // Handle binary response (byte array).
+ try {
+ return (T) response.body().bytes();
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+ } else if (returnType.equals(File.class)) {
+ // Handle file downloading.
+ return (T) downloadFileFromResponse(response);
+ }
+
+ String respBody;
+ try {
+ if (response.body() != null)
+ respBody = response.body().string();
+ else
+ respBody = null;
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+
+ if (respBody == null || "".equals(respBody)) {
+ return null;
+ }
+
+ String contentType = response.headers().get("Content-Type");
+ if (contentType == null) {
+ // ensuring a default content type
+ contentType = "application/json";
+ }
+ if (isJsonMime(contentType)) {
+ return json.deserialize(respBody, returnType);
+ } else if (returnType.equals(String.class)) {
+ // Expecting string, return the raw response body.
+ return (T) respBody;
+ } else {
+ throw new ApiException(
+ "Content type \"" + contentType + "\" is not supported for type: " + returnType,
+ response.code(),
+ response.headers().toMultimap(),
+ respBody);
+ }
+ }
+
+ /**
+ * Serialize the given Java object into request body according to the object's
+ * class and the request Content-Type.
+ *
+ * @param obj The Java object
+ * @param contentType The request Content-Type
+ * @return The serialized request body
+ * @throws ApiException If fail to serialize the given object
+ */
+ public RequestBody serialize(Object obj, String contentType) throws ApiException {
+ if (obj instanceof byte[]) {
+ // Binary (byte array) body parameter support.
+ return RequestBody.create(MediaType.parse(contentType), (byte[]) obj);
+ } else if (obj instanceof File) {
+ // File body parameter support.
+ return RequestBody.create(MediaType.parse(contentType), (File) obj);
+ } else if (isJsonMime(contentType)) {
+ String content;
+ if (obj != null) {
+ content = json.serialize(obj);
+ } else {
+ content = null;
+ }
+ return RequestBody.create(MediaType.parse(contentType), content);
+ } else {
+ throw new ApiException("Content type \"" + contentType + "\" is not supported");
+ }
+ }
+
+ /**
+ * Download file from the given response.
+ *
+ * @param response An instance of the Response object
+ * @throws ApiException If fail to read file content from response and write to disk
+ * @return Downloaded file
+ */
+ public File downloadFileFromResponse(Response response) throws ApiException {
+ try {
+ File file = prepareDownloadFile(response);
+ BufferedSink sink = Okio.buffer(Okio.sink(file));
+ sink.writeAll(response.body().source());
+ sink.close();
+ return file;
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+ }
+
+ /**
+ * Prepare file for download
+ *
+ * @param response An instance of the Response object
+ * @throws IOException If fail to prepare file for download
+ * @return Prepared file for the download
+ */
+ public File prepareDownloadFile(Response response) throws IOException {
+ String filename = null;
+ String contentDisposition = response.header("Content-Disposition");
+ if (contentDisposition != null && !"".equals(contentDisposition)) {
+ // Get filename from the Content-Disposition header.
+ Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
+ Matcher matcher = pattern.matcher(contentDisposition);
+ if (matcher.find()) {
+ filename = sanitizeFilename(matcher.group(1));
+ }
+ }
+
+ String prefix = null;
+ String suffix = null;
+ if (filename == null) {
+ prefix = "download-";
+ suffix = "";
+ } else {
+ int pos = filename.lastIndexOf(".");
+ if (pos == -1) {
+ prefix = filename + "-";
+ } else {
+ prefix = filename.substring(0, pos) + "-";
+ suffix = filename.substring(pos);
+ }
+ // File.createTempFile requires the prefix to be at least three characters long
+ if (prefix.length() < 3)
+ prefix = "download-";
+ }
+
+ if (tempFolderPath == null)
+ return File.createTempFile(prefix, suffix);
+ else
+ return File.createTempFile(prefix, suffix, new File(tempFolderPath));
+ }
+
+ /**
+ * {@link #execute(Call, Type)}
+ *
+ * @param Type
+ * @param call An instance of the Call object
+ * @throws ApiException If fail to execute the call
+ * @return ApiResponse<T>
+ */
+ public ApiResponse execute(Call call) throws ApiException {
+ return execute(call, null);
+ }
+
+ /**
+ * Execute HTTP call and deserialize the HTTP response body into the given return type.
+ *
+ * @param returnType The return type used to deserialize HTTP response body
+ * @param The return type corresponding to (same with) returnType
+ * @param call Call
+ * @return ApiResponse object containing response status, headers and
+ * data, which is a Java object deserialized from response body and would be null
+ * when returnType is null.
+ * @throws ApiException If fail to execute the call
+ */
+ public ApiResponse execute(Call call, Type returnType) throws ApiException {
+ try {
+ Response response = call.execute();
+ T data = handleResponse(response, returnType);
+ return new ApiResponse(response.code(), response.headers().toMultimap(), data);
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+ }
+
+ /**
+ * {@link #executeAsync(Call, Type, ApiCallback)}
+ *
+ * @param Type
+ * @param call An instance of the Call object
+ * @param callback ApiCallback<T>
+ */
+ public void executeAsync(Call call, ApiCallback callback) {
+ executeAsync(call, null, callback);
+ }
+
+ /**
+ * Execute HTTP call asynchronously.
+ *
+ * @see #execute(Call, Type)
+ * @param Type
+ * @param call The callback to be executed when the API call finishes
+ * @param returnType Return type
+ * @param callback ApiCallback
+ */
+ @SuppressWarnings("unchecked")
+ public void executeAsync(Call call, final Type returnType, final ApiCallback callback) {
+ call.enqueue(new Callback() {
+ @Override
+ public void onFailure(Request request, IOException e) {
+ callback.onFailure(new ApiException(e), 0, null);
+ }
+
+ @Override
+ public void onResponse(Response response) throws IOException {
+ T result;
+ try {
+ result = (T) handleResponse(response, returnType);
+ } catch (ApiException e) {
+ callback.onFailure(e, response.code(), response.headers().toMultimap());
+ return;
+ }
+ callback.onSuccess(result, response.code(), response.headers().toMultimap());
+ }
+ });
+ }
+
+ /**
+ * Handle the given response, return the deserialized object when the response is successful.
+ *
+ * @param Type
+ * @param response Response
+ * @param returnType Return type
+ * @throws ApiException If the response has a unsuccessful status code or
+ * fail to deserialize the response body
+ * @return Type
+ */
+ public T handleResponse(Response response, Type returnType) throws ApiException {
+ if (response.isSuccessful()) {
+ if (returnType == null || response.code() == 204) {
+ // returning null if the returnType is not defined,
+ // or the status code is 204 (No Content)
+ return null;
+ } else {
+ return deserialize(response, returnType);
+ }
+ } else {
+ String respBody = null;
+ if (response.body() != null) {
+ try {
+ respBody = response.body().string();
+ } catch (IOException e) {
+ throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
+ }
+ }
+ throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody);
+ }
+ }
+
+ /**
+ * Build HTTP call with the given options.
+ *
+ * @param path The sub-path of the HTTP URL
+ * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE"
+ * @param queryParams The query parameters
+ * @param body The request body object
+ * @param headerParams The header parameters
+ * @param formParams The form parameters
+ * @param authNames The authentications to apply
+ * @param progressRequestListener Progress request listener
+ * @return The HTTP call
+ * @throws ApiException If fail to serialize the request body object
+ */
+ public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ updateParamsForAuth(authNames, queryParams, headerParams);
+
+ final String url = buildUrl(path, queryParams);
+ final Request.Builder reqBuilder = new Request.Builder().url(url);
+ processHeaderParams(headerParams, reqBuilder);
+
+ String contentType = (String) headerParams.get("Content-Type");
+ // ensuring a default content type
+ if (contentType == null) {
+ contentType = "application/json";
+ }
+
+ RequestBody reqBody;
+ if (!HttpMethod.permitsRequestBody(method)) {
+ reqBody = null;
+ } else if ("application/x-www-form-urlencoded".equals(contentType)) {
+ reqBody = buildRequestBodyFormEncoding(formParams);
+ } else if ("multipart/form-data".equals(contentType)) {
+ reqBody = buildRequestBodyMultipart(formParams);
+ } else if (body == null) {
+ if ("DELETE".equals(method)) {
+ // allow calling DELETE without sending a request body
+ reqBody = null;
+ } else {
+ // use an empty request body (for POST, PUT and PATCH)
+ reqBody = RequestBody.create(MediaType.parse(contentType), "");
+ }
+ } else {
+ reqBody = serialize(body, contentType);
+ }
+
+ Request request = null;
+
+ if(progressRequestListener != null && reqBody != null) {
+ ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener);
+ request = reqBuilder.method(method, progressRequestBody).build();
+ } else {
+ request = reqBuilder.method(method, reqBody).build();
+ }
+
+ return httpClient.newCall(request);
+ }
+
+ /**
+ * Build full URL by concatenating base path, the given sub path and query parameters.
+ *
+ * @param path The sub path
+ * @param queryParams The query parameters
+ * @return The full URL
+ */
+ public String buildUrl(String path, List queryParams) {
+ final StringBuilder url = new StringBuilder();
+ url.append(basePath).append(path);
+
+ if (queryParams != null && !queryParams.isEmpty()) {
+ // support (constant) query string in `path`, e.g. "/posts?draft=1"
+ String prefix = path.contains("?") ? "&" : "?";
+ for (Pair param : queryParams) {
+ if (param.getValue() != null) {
+ if (prefix != null) {
+ url.append(prefix);
+ prefix = null;
+ } else {
+ url.append("&");
+ }
+ String value = parameterToString(param.getValue());
+ url.append(escapeString(param.getName())).append("=").append(escapeString(value));
+ }
+ }
+ }
+
+ return url.toString();
+ }
+
+ /**
+ * Set header parameters to the request builder, including default headers.
+ *
+ * @param headerParams Header parameters in the ofrm of Map
+ * @param reqBuilder Reqeust.Builder
+ */
+ public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) {
+ for (Entry param : headerParams.entrySet()) {
+ reqBuilder.header(param.getKey(), parameterToString(param.getValue()));
+ }
+ for (Entry header : defaultHeaderMap.entrySet()) {
+ if (!headerParams.containsKey(header.getKey())) {
+ reqBuilder.header(header.getKey(), parameterToString(header.getValue()));
+ }
+ }
+ }
+
+ /**
+ * Update query and header parameters based on authentication settings.
+ *
+ * @param authNames The authentications to apply
+ * @param queryParams List of query parameters
+ * @param headerParams Map of header parameters
+ */
+ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) {
+ for (String authName : authNames) {
+ Authentication auth = authentications.get(authName);
+ if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
+ auth.applyToParams(queryParams, headerParams);
+ }
+ }
+
+ /**
+ * Build a form-encoding request body with the given form parameters.
+ *
+ * @param formParams Form parameters in the form of Map
+ * @return RequestBody
+ */
+ public RequestBody buildRequestBodyFormEncoding(Map formParams) {
+ FormEncodingBuilder formBuilder = new FormEncodingBuilder();
+ for (Entry param : formParams.entrySet()) {
+ formBuilder.add(param.getKey(), parameterToString(param.getValue()));
+ }
+ return formBuilder.build();
+ }
+
+ /**
+ * Build a multipart (file uploading) request body with the given form parameters,
+ * which could contain text fields and file fields.
+ *
+ * @param formParams Form parameters in the form of Map
+ * @return RequestBody
+ */
+ public RequestBody buildRequestBodyMultipart(Map formParams) {
+ MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM);
+ for (Entry param : formParams.entrySet()) {
+ if (param.getValue() instanceof File) {
+ File file = (File) param.getValue();
+ Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\"");
+ MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
+ mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file));
+ } else {
+ Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"");
+ mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue())));
+ }
+ }
+ return mpBuilder.build();
+ }
+
+ /**
+ * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+ *
+ * @param file The given file
+ * @return The guessed Content-Type
+ */
+ public String guessContentTypeFromFile(File file) {
+ String contentType = URLConnection.guessContentTypeFromName(file.getName());
+ if (contentType == null) {
+ return "application/octet-stream";
+ } else {
+ return contentType;
+ }
+ }
+
+ /**
+ * Initialize datetime format according to the current environment, e.g. Java 1.7 and Android.
+ */
+ private void initDatetimeFormat() {
+ String formatWithTimeZone = null;
+ if (IS_ANDROID) {
+ if (ANDROID_SDK_VERSION >= 18) {
+ // The time zone format "ZZZZZ" is available since Android 4.3 (SDK version 18)
+ formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ";
+ }
+ } else if (JAVA_VERSION >= 1.7) {
+ // The time zone format "XXX" is available since Java 1.7
+ formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
+ }
+ if (formatWithTimeZone != null) {
+ this.datetimeFormat = new SimpleDateFormat(formatWithTimeZone);
+ // NOTE: Use the system's default time zone (mainly for datetime formatting).
+ } else {
+ // Use a common format that works across all systems.
+ this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ // Always use the UTC time zone as we are using a constant trailing "Z" here.
+ this.datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ }
+ }
+
+ /**
+ * Apply SSL related settings to httpClient according to the current values of
+ * verifyingSsl and sslCaCert.
+ */
+ private void applySslSettings() {
+ try {
+ KeyManager[] keyManagers = null;
+ TrustManager[] trustManagers = null;
+ HostnameVerifier hostnameVerifier = null;
+ if (!verifyingSsl) {
+ TrustManager trustAll = new X509TrustManager() {
+ @Override
+ public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
+ @Override
+ public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
+ @Override
+ public X509Certificate[] getAcceptedIssuers() { return null; }
+ };
+ SSLContext sslContext = SSLContext.getInstance("TLS");
+ trustManagers = new TrustManager[]{ trustAll };
+ hostnameVerifier = new HostnameVerifier() {
+ @Override
+ public boolean verify(String hostname, SSLSession session) { return true; }
+ };
+ } else if (sslCaCert != null) {
+ char[] password = null; // Any password will work.
+ CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
+ Collection extends Certificate> certificates = certificateFactory.generateCertificates(sslCaCert);
+ if (certificates.isEmpty()) {
+ throw new IllegalArgumentException("expected non-empty set of trusted certificates");
+ }
+ KeyStore caKeyStore = newEmptyKeyStore(password);
+ int index = 0;
+ for (Certificate certificate : certificates) {
+ String certificateAlias = "ca" + Integer.toString(index++);
+ caKeyStore.setCertificateEntry(certificateAlias, certificate);
+ }
+ TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ trustManagerFactory.init(caKeyStore);
+ trustManagers = trustManagerFactory.getTrustManagers();
+ }
+
+ if (keyManagers != null || trustManagers != null) {
+ SSLContext sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(keyManagers, trustManagers, new SecureRandom());
+ httpClient.setSslSocketFactory(sslContext.getSocketFactory());
+ } else {
+ httpClient.setSslSocketFactory(null);
+ }
+ httpClient.setHostnameVerifier(hostnameVerifier);
+ } catch (GeneralSecurityException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
+ try {
+ KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ keyStore.load(null, password);
+ return keyStore;
+ } catch (IOException e) {
+ throw new AssertionError(e);
+ }
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiException.java
new file mode 100644
index 00000000000..02a967d8373
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiException.java
@@ -0,0 +1,103 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+import java.util.Map;
+import java.util.List;
+
+
+public class ApiException extends Exception {
+ private int code = 0;
+ private Map> responseHeaders = null;
+ private String responseBody = null;
+
+ public ApiException() {}
+
+ public ApiException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public ApiException(String message) {
+ super(message);
+ }
+
+ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) {
+ super(message, throwable);
+ this.code = code;
+ this.responseHeaders = responseHeaders;
+ this.responseBody = responseBody;
+ }
+
+ public ApiException(String message, int code, Map> responseHeaders, String responseBody) {
+ this(message, (Throwable) null, code, responseHeaders, responseBody);
+ }
+
+ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) {
+ this(message, throwable, code, responseHeaders, null);
+ }
+
+ public ApiException(int code, Map> responseHeaders, String responseBody) {
+ this((String) null, (Throwable) null, code, responseHeaders, responseBody);
+ }
+
+ public ApiException(int code, String message) {
+ super(message);
+ this.code = code;
+ }
+
+ public ApiException(int code, String message, Map> responseHeaders, String responseBody) {
+ this(code, message);
+ this.responseHeaders = responseHeaders;
+ this.responseBody = responseBody;
+ }
+
+ /**
+ * Get the HTTP status code.
+ *
+ * @return HTTP status code
+ */
+ public int getCode() {
+ return code;
+ }
+
+ /**
+ * Get the HTTP response headers.
+ *
+ * @return A map of list of string
+ */
+ public Map> getResponseHeaders() {
+ return responseHeaders;
+ }
+
+ /**
+ * Get the HTTP response body.
+ *
+ * @return Response body in the form of string
+ */
+ public String getResponseBody() {
+ return responseBody;
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiResponse.java
new file mode 100644
index 00000000000..b87ea49a02e
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiResponse.java
@@ -0,0 +1,71 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * API response returned by API call.
+ *
+ * @param The type of data that is deserialized from response body
+ */
+public class ApiResponse {
+ final private int statusCode;
+ final private Map> headers;
+ final private T data;
+
+ /**
+ * @param statusCode The status code of HTTP response
+ * @param headers The headers of HTTP response
+ */
+ public ApiResponse(int statusCode, Map> headers) {
+ this(statusCode, headers, null);
+ }
+
+ /**
+ * @param statusCode The status code of HTTP response
+ * @param headers The headers of HTTP response
+ * @param data The object deserialized from response bod
+ */
+ public ApiResponse(int statusCode, Map> headers, T data) {
+ this.statusCode = statusCode;
+ this.headers = headers;
+ this.data = data;
+ }
+
+ public int getStatusCode() {
+ return statusCode;
+ }
+
+ public Map> getHeaders() {
+ return headers;
+ }
+
+ public T getData() {
+ return data;
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/Configuration.java
new file mode 100644
index 00000000000..57e53b2d598
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/Configuration.java
@@ -0,0 +1,51 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+
+public class Configuration {
+ private static ApiClient defaultApiClient = new ApiClient();
+
+ /**
+ * Get the default API client, which would be used when creating API
+ * instances without providing an API client.
+ *
+ * @return Default API client
+ */
+ public static ApiClient getDefaultApiClient() {
+ return defaultApiClient;
+ }
+
+ /**
+ * Set the default API client, which would be used when creating API
+ * instances without providing an API client.
+ *
+ * @param apiClient API client
+ */
+ public static void setDefaultApiClient(ApiClient apiClient) {
+ defaultApiClient = apiClient;
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/JSON.java
new file mode 100644
index 00000000000..a734bec47f1
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/JSON.java
@@ -0,0 +1,236 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonNull;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import com.google.gson.TypeAdapter;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.lang.reflect.Type;
+import java.util.Date;
+
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+import org.joda.time.format.DateTimeFormatter;
+import org.joda.time.format.ISODateTimeFormat;
+
+public class JSON {
+ private ApiClient apiClient;
+ private Gson gson;
+
+ /**
+ * JSON constructor.
+ *
+ * @param apiClient An instance of ApiClient
+ */
+ public JSON(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ gson = new GsonBuilder()
+ .registerTypeAdapter(Date.class, new DateAdapter(apiClient))
+ .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter())
+ .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter())
+ .create();
+ }
+
+ /**
+ * Get Gson.
+ *
+ * @return Gson
+ */
+ public Gson getGson() {
+ return gson;
+ }
+
+ /**
+ * Set Gson.
+ *
+ * @param gson Gson
+ */
+ public void setGson(Gson gson) {
+ this.gson = gson;
+ }
+
+ /**
+ * Serialize the given Java object into JSON string.
+ *
+ * @param obj Object
+ * @return String representation of the JSON
+ */
+ public String serialize(Object obj) {
+ return gson.toJson(obj);
+ }
+
+ /**
+ * Deserialize the given JSON string to Java object.
+ *
+ * @param Type
+ * @param body The JSON string
+ * @param returnType The type to deserialize into
+ * @return The deserialized Java object
+ */
+ @SuppressWarnings("unchecked")
+ public T deserialize(String body, Type returnType) {
+ try {
+ if (apiClient.isLenientOnJson()) {
+ JsonReader jsonReader = new JsonReader(new StringReader(body));
+ // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean)
+ jsonReader.setLenient(true);
+ return gson.fromJson(jsonReader, returnType);
+ } else {
+ return gson.fromJson(body, returnType);
+ }
+ } catch (JsonParseException e) {
+ // Fallback processing when failed to parse JSON form response body:
+ // return the response body string directly for the String return type;
+ // parse response body into date or datetime for the Date return type.
+ if (returnType.equals(String.class))
+ return (T) body;
+ else if (returnType.equals(Date.class))
+ return (T) apiClient.parseDateOrDatetime(body);
+ else throw(e);
+ }
+ }
+}
+
+class DateAdapter implements JsonSerializer, JsonDeserializer {
+ private final ApiClient apiClient;
+
+ /**
+ * Constructor for DateAdapter
+ *
+ * @param apiClient Api client
+ */
+ public DateAdapter(ApiClient apiClient) {
+ super();
+ this.apiClient = apiClient;
+ }
+
+ /**
+ * Serialize
+ *
+ * @param src Date
+ * @param typeOfSrc Type
+ * @param context Json Serialization Context
+ * @return Json Element
+ */
+ @Override
+ public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) {
+ if (src == null) {
+ return JsonNull.INSTANCE;
+ } else {
+ return new JsonPrimitive(apiClient.formatDatetime(src));
+ }
+ }
+
+ /**
+ * Deserialize
+ *
+ * @param json Json element
+ * @param date Type
+ * @param context Json Serialization Context
+ * @return Date
+ * @throws JsonParseException if fail to parse
+ */
+ @Override
+ public Date deserialize(JsonElement json, Type date, JsonDeserializationContext context) throws JsonParseException {
+ String str = json.getAsJsonPrimitive().getAsString();
+ try {
+ return apiClient.parseDateOrDatetime(str);
+ } catch (RuntimeException e) {
+ throw new JsonParseException(e);
+ }
+ }
+}
+
+/**
+ * Gson TypeAdapter for Joda DateTime type
+ */
+class DateTimeTypeAdapter extends TypeAdapter {
+
+ private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime();
+
+ @Override
+ public void write(JsonWriter out, DateTime date) throws IOException {
+ if (date == null) {
+ out.nullValue();
+ } else {
+ out.value(formatter.print(date));
+ }
+ }
+
+ @Override
+ public DateTime read(JsonReader in) throws IOException {
+ switch (in.peek()) {
+ case NULL:
+ in.nextNull();
+ return null;
+ default:
+ String date = in.nextString();
+ return formatter.parseDateTime(date);
+ }
+ }
+}
+
+/**
+ * Gson TypeAdapter for Joda LocalDate type
+ */
+class LocalDateTypeAdapter extends TypeAdapter {
+
+ private final DateTimeFormatter formatter = ISODateTimeFormat.date();
+
+ @Override
+ public void write(JsonWriter out, LocalDate date) throws IOException {
+ if (date == null) {
+ out.nullValue();
+ } else {
+ out.value(formatter.print(date));
+ }
+ }
+
+ @Override
+ public LocalDate read(JsonReader in) throws IOException {
+ switch (in.peek()) {
+ case NULL:
+ in.nextNull();
+ return null;
+ default:
+ String date = in.nextString();
+ return formatter.parseLocalDate(date);
+ }
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/Pair.java
new file mode 100644
index 00000000000..9ad2d246519
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/Pair.java
@@ -0,0 +1,64 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+
+public class Pair {
+ private String name = "";
+ private String value = "";
+
+ public Pair (String name, String value) {
+ setName(name);
+ setValue(value);
+ }
+
+ private void setName(String name) {
+ if (!isValidString(name)) return;
+
+ this.name = name;
+ }
+
+ private void setValue(String value) {
+ if (!isValidString(value)) return;
+
+ this.value = value;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ private boolean isValidString(String arg) {
+ if (arg == null) return false;
+ if (arg.trim().isEmpty()) return false;
+
+ return true;
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ProgressRequestBody.java
new file mode 100644
index 00000000000..fee9da83ddd
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ProgressRequestBody.java
@@ -0,0 +1,95 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+import com.squareup.okhttp.MediaType;
+import com.squareup.okhttp.RequestBody;
+
+import java.io.IOException;
+
+import okio.Buffer;
+import okio.BufferedSink;
+import okio.ForwardingSink;
+import okio.Okio;
+import okio.Sink;
+
+public class ProgressRequestBody extends RequestBody {
+
+ public interface ProgressRequestListener {
+ void onRequestProgress(long bytesWritten, long contentLength, boolean done);
+ }
+
+ private final RequestBody requestBody;
+
+ private final ProgressRequestListener progressListener;
+
+ private BufferedSink bufferedSink;
+
+ public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
+ this.requestBody = requestBody;
+ this.progressListener = progressListener;
+ }
+
+ @Override
+ public MediaType contentType() {
+ return requestBody.contentType();
+ }
+
+ @Override
+ public long contentLength() throws IOException {
+ return requestBody.contentLength();
+ }
+
+ @Override
+ public void writeTo(BufferedSink sink) throws IOException {
+ if (bufferedSink == null) {
+ bufferedSink = Okio.buffer(sink(sink));
+ }
+
+ requestBody.writeTo(bufferedSink);
+ bufferedSink.flush();
+
+ }
+
+ private Sink sink(Sink sink) {
+ return new ForwardingSink(sink) {
+
+ long bytesWritten = 0L;
+ long contentLength = 0L;
+
+ @Override
+ public void write(Buffer source, long byteCount) throws IOException {
+ super.write(source, byteCount);
+ if (contentLength == 0) {
+ contentLength = contentLength();
+ }
+
+ bytesWritten += byteCount;
+ progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength);
+ }
+ };
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ProgressResponseBody.java
new file mode 100644
index 00000000000..761a23a2869
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ProgressResponseBody.java
@@ -0,0 +1,88 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+import com.squareup.okhttp.MediaType;
+import com.squareup.okhttp.ResponseBody;
+
+import java.io.IOException;
+
+import okio.Buffer;
+import okio.BufferedSource;
+import okio.ForwardingSource;
+import okio.Okio;
+import okio.Source;
+
+public class ProgressResponseBody extends ResponseBody {
+
+ public interface ProgressListener {
+ void update(long bytesRead, long contentLength, boolean done);
+ }
+
+ private final ResponseBody responseBody;
+ private final ProgressListener progressListener;
+ private BufferedSource bufferedSource;
+
+ public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
+ this.responseBody = responseBody;
+ this.progressListener = progressListener;
+ }
+
+ @Override
+ public MediaType contentType() {
+ return responseBody.contentType();
+ }
+
+ @Override
+ public long contentLength() throws IOException {
+ return responseBody.contentLength();
+ }
+
+ @Override
+ public BufferedSource source() throws IOException {
+ if (bufferedSource == null) {
+ bufferedSource = Okio.buffer(source(responseBody.source()));
+ }
+ return bufferedSource;
+ }
+
+ private Source source(Source source) {
+ return new ForwardingSource(source) {
+ long totalBytesRead = 0L;
+
+ @Override
+ public long read(Buffer sink, long byteCount) throws IOException {
+ long bytesRead = super.read(sink, byteCount);
+ // read() returns the number of bytes read, or -1 if this source is exhausted.
+ totalBytesRead += bytesRead != -1 ? bytesRead : 0;
+ progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
+ return bytesRead;
+ }
+ };
+ }
+}
+
+
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/StringUtil.java
new file mode 100644
index 00000000000..31140c76df4
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/StringUtil.java
@@ -0,0 +1,67 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client;
+
+
+public class StringUtil {
+ /**
+ * Check if the given array contains the given value (with case-insensitive comparison).
+ *
+ * @param array The array
+ * @param value The value to search
+ * @return true if the array contains the value
+ */
+ public static boolean containsIgnoreCase(String[] array, String value) {
+ for (String str : array) {
+ if (value == null && str == null) return true;
+ if (value != null && value.equalsIgnoreCase(str)) return true;
+ }
+ return false;
+ }
+
+ /**
+ * Join an array of strings with the given separator.
+ *
+ * Note: This might be replaced by utility method from commons-lang or guava someday
+ * if one of those libraries is added as dependency.
+ *
+ *
+ * @param array The array of strings
+ * @param separator The separator
+ * @return the resulting string
+ */
+ public static String join(String[] array, String separator) {
+ int len = array.length;
+ if (len == 0) return "";
+
+ StringBuilder out = new StringBuilder();
+ out.append(array[0]);
+ for (int i = 1; i < len; i++) {
+ out.append(separator).append(array[i]);
+ }
+ return out.toString();
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java
new file mode 100644
index 00000000000..975bd34004c
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java
@@ -0,0 +1,495 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client.api;
+
+import io.swagger.client.ApiCallback;
+import io.swagger.client.ApiClient;
+import io.swagger.client.ApiException;
+import io.swagger.client.ApiResponse;
+import io.swagger.client.Configuration;
+import io.swagger.client.Pair;
+import io.swagger.client.ProgressRequestBody;
+import io.swagger.client.ProgressResponseBody;
+
+import com.google.gson.reflect.TypeToken;
+
+import java.io.IOException;
+
+import io.swagger.client.model.Client;
+import org.joda.time.LocalDate;
+import org.joda.time.DateTime;
+import java.math.BigDecimal;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class FakeApi {
+ private ApiClient apiClient;
+
+ public FakeApi() {
+ this(Configuration.getDefaultApiClient());
+ }
+
+ public FakeApi(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /* Build call for testClientModel */
+ private com.squareup.okhttp.Call testClientModelCall(Client 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 testClientModel(Async)");
+ }
+
+
+ // create path and map variables
+ String localVarPath = "/fake".replaceAll("\\{format\\}","json");
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
+
+ final String[] localVarContentTypes = {
+ "application/json"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { };
+ return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ /**
+ * To test \"client\" model
+ *
+ * @param body client model (required)
+ * @return Client
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public Client testClientModel(Client body) throws ApiException {
+ ApiResponse resp = testClientModelWithHttpInfo(body);
+ return resp.getData();
+ }
+
+ /**
+ * To test \"client\" model
+ *
+ * @param body client model (required)
+ * @return ApiResponse<Client>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiException {
+ com.squareup.okhttp.Call call = testClientModelCall(body, null, null);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return apiClient.execute(call, localVarReturnType);
+ }
+
+ /**
+ * To test \"client\" model (asynchronously)
+ *
+ * @param body client model (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 com.squareup.okhttp.Call testClientModelAsync(Client 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = testClientModelCall(body, progressListener, progressRequestListener);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ apiClient.executeAsync(call, localVarReturnType, callback);
+ return call;
+ }
+ /* Build call for testEndpointParameters */
+ private com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+ // verify the required parameter 'number' is set
+ if (number == null) {
+ throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)");
+ }
+
+ // verify the required parameter '_double' is set
+ if (_double == null) {
+ throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)");
+ }
+
+ // verify the required parameter 'patternWithoutDelimiter' is set
+ if (patternWithoutDelimiter == null) {
+ throw new ApiException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters(Async)");
+ }
+
+ // verify the required parameter '_byte' is set
+ if (_byte == null) {
+ throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)");
+ }
+
+
+ // create path and map variables
+ String localVarPath = "/fake".replaceAll("\\{format\\}","json");
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+ if (integer != null)
+ localVarFormParams.put("integer", integer);
+ if (int32 != null)
+ localVarFormParams.put("int32", int32);
+ if (int64 != null)
+ localVarFormParams.put("int64", int64);
+ if (number != null)
+ localVarFormParams.put("number", number);
+ if (_float != null)
+ localVarFormParams.put("float", _float);
+ if (_double != null)
+ localVarFormParams.put("double", _double);
+ if (string != null)
+ localVarFormParams.put("string", string);
+ if (patternWithoutDelimiter != null)
+ localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter);
+ if (_byte != null)
+ localVarFormParams.put("byte", _byte);
+ if (binary != null)
+ localVarFormParams.put("binary", binary);
+ if (date != null)
+ localVarFormParams.put("date", date);
+ if (dateTime != null)
+ localVarFormParams.put("dateTime", dateTime);
+ if (password != null)
+ localVarFormParams.put("password", password);
+ if (paramCallback != null)
+ localVarFormParams.put("callback", paramCallback);
+
+ final String[] localVarAccepts = {
+ "application/xml; charset=utf-8", "application/json; charset=utf-8"
+ };
+ final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
+
+ final String[] localVarContentTypes = {
+ "application/xml; charset=utf-8", "application/json; charset=utf-8"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { "http_basic_test" };
+ return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ /**
+ * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ * @param number None (required)
+ * @param _double None (required)
+ * @param patternWithoutDelimiter None (required)
+ * @param _byte None (required)
+ * @param integer None (optional)
+ * @param int32 None (optional)
+ * @param int64 None (optional)
+ * @param _float None (optional)
+ * @param string None (optional)
+ * @param binary None (optional)
+ * @param date None (optional)
+ * @param dateTime None (optional)
+ * @param password None (optional)
+ * @param paramCallback None (optional)
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password, String paramCallback) throws ApiException {
+ testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
+ }
+
+ /**
+ * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ * @param number None (required)
+ * @param _double None (required)
+ * @param patternWithoutDelimiter None (required)
+ * @param _byte None (required)
+ * @param integer None (optional)
+ * @param int32 None (optional)
+ * @param int64 None (optional)
+ * @param _float None (optional)
+ * @param string None (optional)
+ * @param binary None (optional)
+ * @param date None (optional)
+ * @param dateTime None (optional)
+ * @param password None (optional)
+ * @param paramCallback None (optional)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password, String paramCallback) throws ApiException {
+ com.squareup.okhttp.Call call = testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously)
+ * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ * @param number None (required)
+ * @param _double None (required)
+ * @param patternWithoutDelimiter None (required)
+ * @param _byte None (required)
+ * @param integer None (optional)
+ * @param int32 None (optional)
+ * @param int64 None (optional)
+ * @param _float None (optional)
+ * @param string None (optional)
+ * @param binary None (optional)
+ * @param date None (optional)
+ * @param dateTime None (optional)
+ * @param password None (optional)
+ * @param paramCallback None (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 com.squareup.okhttp.Call testEndpointParametersAsync(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password, String paramCallback, 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+ /* Build call for testEnumParameters */
+ private com.squareup.okhttp.Call testEnumParametersCall(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+
+ // create path and map variables
+ String localVarPath = "/fake".replaceAll("\\{format\\}","json");
+
+ List localVarQueryParams = new ArrayList();
+ if (enumQueryStringArray != null)
+ localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray));
+ if (enumQueryString != null)
+ localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString));
+ if (enumQueryInteger != null)
+ localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger));
+
+ Map localVarHeaderParams = new HashMap();
+ if (enumHeaderStringArray != null)
+ localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray));
+ if (enumHeaderString != null)
+ localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString));
+
+ Map localVarFormParams = new HashMap();
+ if (enumFormStringArray != null)
+ localVarFormParams.put("enum_form_string_array", enumFormStringArray);
+ if (enumFormString != null)
+ localVarFormParams.put("enum_form_string", enumFormString);
+ if (enumQueryDouble != null)
+ localVarFormParams.put("enum_query_double", enumQueryDouble);
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
+
+ final String[] localVarContentTypes = {
+ "application/json"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { };
+ return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ /**
+ * To test enum parameters
+ *
+ * @param enumFormStringArray Form parameter enum test (string array) (optional)
+ * @param enumFormString Form parameter enum test (string) (optional, default to -efg)
+ * @param enumHeaderStringArray Header parameter enum test (string array) (optional)
+ * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryStringArray Query parameter enum test (string array) (optional)
+ * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryInteger Query parameter enum test (double) (optional)
+ * @param enumQueryDouble Query parameter enum test (double) (optional)
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public void testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble) throws ApiException {
+ testEnumParametersWithHttpInfo(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
+ }
+
+ /**
+ * To test enum parameters
+ *
+ * @param enumFormStringArray Form parameter enum test (string array) (optional)
+ * @param enumFormString Form parameter enum test (string) (optional, default to -efg)
+ * @param enumHeaderStringArray Header parameter enum test (string array) (optional)
+ * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryStringArray Query parameter enum test (string array) (optional)
+ * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryInteger Query parameter enum test (double) (optional)
+ * @param enumQueryDouble Query parameter enum test (double) (optional)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse testEnumParametersWithHttpInfo(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble) throws ApiException {
+ com.squareup.okhttp.Call call = testEnumParametersCall(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * To test enum parameters (asynchronously)
+ *
+ * @param enumFormStringArray Form parameter enum test (string array) (optional)
+ * @param enumFormString Form parameter enum test (string) (optional, default to -efg)
+ * @param enumHeaderStringArray Header parameter enum test (string array) (optional)
+ * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryStringArray Query parameter enum test (string array) (optional)
+ * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryInteger Query parameter enum test (double) (optional)
+ * @param enumQueryDouble Query parameter enum test (double) (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 com.squareup.okhttp.Call testEnumParametersAsync(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble, 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = testEnumParametersCall(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/PetApi.java
new file mode 100644
index 00000000000..aca7f0b02b0
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/PetApi.java
@@ -0,0 +1,935 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client.api;
+
+import io.swagger.client.ApiCallback;
+import io.swagger.client.ApiClient;
+import io.swagger.client.ApiException;
+import io.swagger.client.ApiResponse;
+import io.swagger.client.Configuration;
+import io.swagger.client.Pair;
+import io.swagger.client.ProgressRequestBody;
+import io.swagger.client.ProgressResponseBody;
+
+import com.google.gson.reflect.TypeToken;
+
+import java.io.IOException;
+
+import io.swagger.client.model.Pet;
+import java.io.File;
+import io.swagger.client.model.ModelApiResponse;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class PetApi {
+ private ApiClient apiClient;
+
+ public PetApi() {
+ this(Configuration.getDefaultApiClient());
+ }
+
+ public PetApi(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /* Build call for addPet */
+ private com.squareup.okhttp.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");
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ 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 com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.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);
+ }
+
+ /**
+ * Add a new pet to the store
+ *
+ * @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 {
+ addPetWithHttpInfo(body);
+ }
+
+ /**
+ * Add a new pet to the store
+ *
+ * @param body Pet object that needs to be added to the store (required)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException {
+ com.squareup.okhttp.Call call = addPetCall(body, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * Add a new pet to the store (asynchronously)
+ *
+ * @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
+ */
+ public com.squareup.okhttp.Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException {
+
+ ProgressResponseBody.ProgressListener progressListener = null;
+ ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
+
+ if (callback != null) {
+ progressListener = new ProgressResponseBody.ProgressListener() {
+ @Override
+ public void update(long bytesRead, long contentLength, boolean done) {
+ callback.onDownloadProgress(bytesRead, contentLength, done);
+ }
+ };
+
+ progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
+ @Override
+ public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
+ callback.onUploadProgress(bytesWritten, contentLength, done);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = addPetCall(body, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+ /* Build call for deletePet */
+ private com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+ // verify the required parameter 'petId' is set
+ if (petId == null) {
+ throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)");
+ }
+
+
+ // create path and map variables
+ String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json")
+ .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+ if (apiKey != null)
+ localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey));
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ 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 com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { "petstore_auth" };
+ return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ /**
+ * Deletes a pet
+ *
+ * @param petId Pet id to delete (required)
+ * @param apiKey (optional)
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public void deletePet(Long petId, String apiKey) throws ApiException {
+ deletePetWithHttpInfo(petId, apiKey);
+ }
+
+ /**
+ * Deletes a pet
+ *
+ * @param petId Pet id to delete (required)
+ * @param apiKey (optional)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException {
+ com.squareup.okhttp.Call call = deletePetCall(petId, apiKey, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * Deletes a pet (asynchronously)
+ *
+ * @param petId Pet id to delete (required)
+ * @param apiKey (optional)
+ * @param callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ */
+ public com.squareup.okhttp.Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException {
+
+ ProgressResponseBody.ProgressListener progressListener = null;
+ ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
+
+ if (callback != null) {
+ progressListener = new ProgressResponseBody.ProgressListener() {
+ @Override
+ public void update(long bytesRead, long contentLength, boolean done) {
+ callback.onDownloadProgress(bytesRead, contentLength, done);
+ }
+ };
+
+ progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
+ @Override
+ public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
+ callback.onUploadProgress(bytesWritten, contentLength, done);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+ /* Build call for findPetsByStatus */
+ private com.squareup.okhttp.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("csv", "status", status));
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ 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 com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.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, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ /**
+ * Finds Pets by status
+ * Multiple status values can be provided with comma separated strings
+ * @param status Status values that need to be considered for filter (required)
+ * @return List<Pet>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public List findPetsByStatus(List status) throws ApiException {
+ ApiResponse> resp = findPetsByStatusWithHttpInfo(status);
+ return resp.getData();
+ }
+
+ /**
+ * Finds Pets by status
+ * Multiple status values can be provided with comma separated strings
+ * @param status Status values that need to be considered for filter (required)
+ * @return ApiResponse<List<Pet>>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException {
+ com.squareup.okhttp.Call call = findPetsByStatusCall(status, null, null);
+ Type localVarReturnType = new TypeToken>(){}.getType();
+ return apiClient.execute(call, localVarReturnType);
+ }
+
+ /**
+ * 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 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
+ */
+ public com.squareup.okhttp.Call findPetsByStatusAsync(List 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = findPetsByStatusCall(status, progressListener, progressRequestListener);
+ Type localVarReturnType = new TypeToken>(){}.getType();
+ apiClient.executeAsync(call, localVarReturnType, callback);
+ return call;
+ }
+ /* Build call for findPetsByTags */
+ private com.squareup.okhttp.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("csv", "tags", tags));
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ 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 com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.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, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ /**
+ * Finds Pets by tags
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * @param tags Tags to filter by (required)
+ * @return List<Pet>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public List findPetsByTags(List tags) throws ApiException {
+ ApiResponse> resp = findPetsByTagsWithHttpInfo(tags);
+ return resp.getData();
+ }
+
+ /**
+ * Finds Pets by tags
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * @param tags Tags to filter by (required)
+ * @return ApiResponse<List<Pet>>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException {
+ com.squareup.okhttp.Call call = findPetsByTagsCall(tags, null, null);
+ Type localVarReturnType = new TypeToken>(){}.getType();
+ return apiClient.execute(call, localVarReturnType);
+ }
+
+ /**
+ * Finds Pets by tags (asynchronously)
+ * 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
+ */
+ public com.squareup.okhttp.Call findPetsByTagsAsync(List tags, 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener);
+ Type localVarReturnType = new TypeToken>(){}.getType();
+ apiClient.executeAsync(call, localVarReturnType, callback);
+ return call;
+ }
+ /* Build call for getPetById */
+ private com.squareup.okhttp.Call getPetByIdCall(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 getPetById(Async)");
+ }
+
+
+ // create path and map variables
+ String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json")
+ .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ 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 com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.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);
+ }
+
+ /**
+ * Find pet by ID
+ * 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
+ */
+ public Pet getPetById(Long petId) throws ApiException {
+ ApiResponse resp = getPetByIdWithHttpInfo(petId);
+ return resp.getData();
+ }
+
+ /**
+ * Find pet by ID
+ * Returns a single pet
+ * @param petId ID of pet to return (required)
+ * @return ApiResponse<Pet>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException {
+ com.squareup.okhttp.Call call = getPetByIdCall(petId, null, null);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return apiClient.execute(call, localVarReturnType);
+ }
+
+ /**
+ * Find pet by ID (asynchronously)
+ * 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
+ */
+ public com.squareup.okhttp.Call getPetByIdAsync(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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = getPetByIdCall(petId, progressListener, progressRequestListener);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ apiClient.executeAsync(call, localVarReturnType, callback);
+ return call;
+ }
+ /* Build call for updatePet */
+ private com.squareup.okhttp.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");
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ 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 com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { "petstore_auth" };
+ return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ /**
+ * Update an existing pet
+ *
+ * @param body Pet object that needs to be added to the store (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 {
+ updatePetWithHttpInfo(body);
+ }
+
+ /**
+ * Update an existing pet
+ *
+ * @param body Pet object that needs to be added to the store (required)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException {
+ com.squareup.okhttp.Call call = updatePetCall(body, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * Update an existing pet (asynchronously)
+ *
+ * @param body Pet object that needs to be added to the store (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 com.squareup.okhttp.Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException {
+
+ ProgressResponseBody.ProgressListener progressListener = null;
+ ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
+
+ if (callback != null) {
+ progressListener = new ProgressResponseBody.ProgressListener() {
+ @Override
+ public void update(long bytesRead, long contentLength, boolean done) {
+ callback.onDownloadProgress(bytesRead, contentLength, done);
+ }
+ };
+
+ progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
+ @Override
+ public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
+ callback.onUploadProgress(bytesWritten, contentLength, done);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = updatePetCall(body, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+ /* Build call for updatePetWithForm */
+ private com.squareup.okhttp.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
+ if (petId == null) {
+ throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)");
+ }
+
+
+ // create path and map variables
+ String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json")
+ .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+ if (name != null)
+ localVarFormParams.put("name", name);
+ if (status != null)
+ localVarFormParams.put("status", status);
+
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
+
+ final String[] localVarContentTypes = {
+ "application/x-www-form-urlencoded"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.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);
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ *
+ * @param petId ID of pet that needs to be updated (required)
+ * @param name Updated name of the pet (optional)
+ * @param status Updated status of the pet (optional)
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public void updatePetWithForm(Long petId, String name, String status) throws ApiException {
+ updatePetWithFormWithHttpInfo(petId, name, status);
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ *
+ * @param petId ID of pet that needs to be updated (required)
+ * @param name Updated name of the pet (optional)
+ * @param status Updated status of the pet (optional)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException {
+ com.squareup.okhttp.Call call = updatePetWithFormCall(petId, name, status, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * Updates a pet in the store with form data (asynchronously)
+ *
+ * @param petId ID of pet that needs to be updated (required)
+ * @param name Updated name of the pet (optional)
+ * @param status Updated status of the pet (optional)
+ * @param callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ */
+ public com.squareup.okhttp.Call updatePetWithFormAsync(Long petId, String name, 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+ /* Build call for uploadFile */
+ private com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMetadata, File file, 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 uploadFile(Async)");
+ }
+
+
+ // create path and map variables
+ String localVarPath = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json")
+ .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+ if (additionalMetadata != null)
+ localVarFormParams.put("additionalMetadata", additionalMetadata);
+ if (file != null)
+ localVarFormParams.put("file", file);
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
+
+ final String[] localVarContentTypes = {
+ "multipart/form-data"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.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);
+ }
+
+ /**
+ * uploads an image
+ *
+ * @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 ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
+ ApiResponse resp = uploadFileWithHttpInfo(petId, additionalMetadata, file);
+ return resp.getData();
+ }
+
+ /**
+ * uploads an image
+ *
+ * @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<ModelApiResponse>
+ * @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 {
+ com.squareup.okhttp.Call call = uploadFileCall(petId, additionalMetadata, file, null, null);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return apiClient.execute(call, localVarReturnType);
+ }
+
+ /**
+ * uploads an image (asynchronously)
+ *
+ * @param petId ID of pet to update (required)
+ * @param additionalMetadata Additional data to pass to server (optional)
+ * @param file file to upload (optional)
+ * @param callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ */
+ public com.squareup.okhttp.Call uploadFileAsync(Long petId, String additionalMetadata, File file, 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ apiClient.executeAsync(call, localVarReturnType, callback);
+ return call;
+ }
+}
diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/StoreApi.java
new file mode 100644
index 00000000000..04ad8deb2a6
--- /dev/null
+++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/StoreApi.java
@@ -0,0 +1,482 @@
+/*
+ * Swagger Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.swagger.client.api;
+
+import io.swagger.client.ApiCallback;
+import io.swagger.client.ApiClient;
+import io.swagger.client.ApiException;
+import io.swagger.client.ApiResponse;
+import io.swagger.client.Configuration;
+import io.swagger.client.Pair;
+import io.swagger.client.ProgressRequestBody;
+import io.swagger.client.ProgressResponseBody;
+
+import com.google.gson.reflect.TypeToken;
+
+import java.io.IOException;
+
+import io.swagger.client.model.Order;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class StoreApi {
+ private ApiClient apiClient;
+
+ public StoreApi() {
+ this(Configuration.getDefaultApiClient());
+ }
+
+ public StoreApi(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /* Build call for deleteOrder */
+ private com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+ // verify the required parameter 'orderId' is set
+ if (orderId == null) {
+ throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)");
+ }
+
+
+ // create path and map variables
+ String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json")
+ .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ 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 com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { };
+ return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ /**
+ * Delete purchase order by ID
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * @param orderId ID of the order that needs to be deleted (required)
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public void deleteOrder(String orderId) throws ApiException {
+ deleteOrderWithHttpInfo(orderId);
+ }
+
+ /**
+ * Delete purchase order by ID
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * @param orderId ID of the order that needs to be deleted (required)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException {
+ com.squareup.okhttp.Call call = deleteOrderCall(orderId, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * Delete purchase order by ID (asynchronously)
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * @param orderId ID of the order that needs to be deleted (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 com.squareup.okhttp.Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException {
+
+ ProgressResponseBody.ProgressListener progressListener = null;
+ ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
+
+ if (callback != null) {
+ progressListener = new ProgressResponseBody.ProgressListener() {
+ @Override
+ public void update(long bytesRead, long contentLength, boolean done) {
+ callback.onDownloadProgress(bytesRead, contentLength, done);
+ }
+ };
+
+ progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
+ @Override
+ public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
+ callback.onUploadProgress(bytesWritten, contentLength, done);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = deleteOrderCall(orderId, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+ /* Build call for getInventory */
+ private com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+
+ // create path and map variables
+ String localVarPath = "/store/inventory".replaceAll("\\{format\\}","json");
+
+ List localVarQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ 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 com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.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);
+ }
+
+ /**
+ * Returns pet inventories by status
+ * Returns a map of status codes to quantities
+ * @return Map<String, Integer>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public Map getInventory() throws ApiException {
+ ApiResponse