Port of @ngaya-ll 's pull request from swagger to openapi. (#2356)

See https://github.com/swagger-api/swagger-codegen/pull/8053
This commit is contained in:
Jens Oberender 2019-03-12 04:57:57 +01:00 committed by William Cheng
parent b1dc2eeaac
commit fde3252924
52 changed files with 984 additions and 3466 deletions

View File

@ -136,7 +136,9 @@ public class ApiClient {
{{/oauthMethods}}
{{/hasOAuthMethods}}
private void init() {
httpClient = new OkHttpClient();
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(getProgressInterceptor());
httpClient = builder.build();
{{#useGzipFeature}}
// Enable gzip request compression
@ -189,7 +191,7 @@ public class ApiClient {
* @return Api Client
*/
public ApiClient setHttpClient(OkHttpClient httpClient) {
this.httpClient = httpClient;
this.httpClient = httpClient.newBuilder().addInterceptor(getProgressInterceptor()).build();
return this;
}
@ -1066,12 +1068,12 @@ public class ApiClient {
* @param headerParams The header parameters
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @param callback Callback for upload/download progress
* @return The HTTP call
* @throws ApiException If fail to serialize the request body object
*/
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener);
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, callback);
return httpClient.newCall(request);
}
@ -1087,11 +1089,11 @@ public class ApiClient {
* @param headerParams The header parameters
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @param callback Callback for upload/download progress
* @return The HTTP request
* @throws ApiException If fail to serialize the request body object
*/
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);
final String url = buildUrl(path, queryParams, collectionQueryParams);
@ -1123,10 +1125,14 @@ public class ApiClient {
reqBody = serialize(body, contentType);
}
// Associate callback with request (if not null) so interceptor can
// access it when creating ProgressResponseBody
reqBuilder.tag(callback);
Request request = null;
if (progressRequestListener != null && reqBody != null) {
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener);
if (callback != null && reqBody != null) {
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback);
request = reqBuilder.method(method, progressRequestBody).build();
} else {
request = reqBuilder.method(method, reqBody).build();
@ -1270,6 +1276,27 @@ public class ApiClient {
}
}
/**
* Get network interceptor to add it to the httpClient to track download progress for
* async requests.
*/
private Interceptor getProgressInterceptor() {
return new Interceptor() {
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
final Request request = chain.request();
final Response originalResponse = chain.proceed(request);
if (request.tag() instanceof ApiCallback) {
final ApiCallback callback = (ApiCallback) request.tag();
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), callback))
.build();
}
return originalResponse;
}
};
}
/**
* Apply SSL related settings to httpClient according to the current values of
* verifyingSsl and sslCaCert.

View File

@ -15,17 +15,13 @@ 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 final ApiCallback callback;
public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) {
this.requestBody = requestBody;
this.progressListener = progressListener;
this.callback = callback;
}
@Override
@ -59,7 +55,7 @@ public class ProgressRequestBody extends RequestBody {
}
bytesWritten += byteCount;
progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength);
callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength);
}
};
}

View File

@ -15,17 +15,13 @@ 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 final ApiCallback callback;
private BufferedSource bufferedSource;
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) {
this.responseBody = responseBody;
this.progressListener = progressListener;
this.callback = callback;
}
@Override
@ -55,7 +51,7 @@ public class ProgressResponseBody extends ResponseBody {
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);
callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
return bytesRead;
}
};

View File

@ -66,8 +66,7 @@ public class {{classname}} {
{{^vendorExtensions.x-group-parameters}}/**
* Build call for {{operationId}}{{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
{{#isDeprecated}}
@ -81,7 +80,7 @@ public class {{classname}} {
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException {
Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}};
// create path and map variables
@ -124,27 +123,15 @@ public class {{classname}} {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
return localVarApiClient.buildCall(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
@SuppressWarnings("rawtypes")
private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException {
{{^performBeanValidation}}
{{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set
@ -153,7 +140,7 @@ public class {{classname}} {
}
{{/required}}{{/allParams}}
okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback);
return localVarCall;
{{/performBeanValidation}}
@ -168,7 +155,7 @@ public class {{classname}} {
parameterValues);
if (violations.size() == 0) {
okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback);
return localVarCall;
} else {
@ -227,7 +214,7 @@ public class {{classname}} {
@Deprecated
{{/isDeprecated}}
public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null, null);
okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null);
{{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return localVarApiClient.execute(localVarCall);{{/returnType}}
}
@ -252,26 +239,7 @@ public class {{classname}} {
{{/isDeprecated}}
public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> _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);
}
};
}
okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback);
{{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}}
return localVarCall;
@ -317,8 +285,8 @@ public class {{classname}} {
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public okhttp3.Call buildCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_progressListener, _progressRequestListener);
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback);
}
/**

View File

@ -1 +1 @@
3.3.4-SNAPSHOT
4.0.0-SNAPSHOT

View File

@ -84,9 +84,9 @@ public class FakeApiExample {
public static void main(String[] args) {
FakeApi apiInstance = new FakeApi();
Object UNKNOWN_BASE_TYPE = new UNKNOWN_BASE_TYPE(); // Object |
String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR = "testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR_example"; // String | To test code injection *_/ ' \\\" =end -- \\\\r\\\\n \\\\n \\\\r
try {
apiInstance.testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE);
apiInstance.testCodeInjectEndRnNR(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testCodeInjectEndRnNR");
e.printStackTrace();
@ -98,7 +98,7 @@ public class FakeApiExample {
## Documentation for API Endpoints
All URIs are relative to *petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
All URIs are relative to *http://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------

View File

@ -1,11 +1,13 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'java'
group = 'org.openapitools'
version = '1.0.0'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
@ -17,7 +19,9 @@ buildscript {
repositories {
jcenter()
}
sourceSets {
main.java.srcDirs = ['src/main/java']
}
if(hasProperty('target') && target == 'android') {
@ -94,12 +98,13 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
compile 'io.swagger:swagger-annotations:1.5.17'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.okhttp:logging-interceptor:2.7.5'
compile 'com.google.code.gson:gson:2.8.1'
compile 'io.swagger:swagger-annotations:1.5.21'
compile 'com.squareup.okhttp3:okhttp:3.12.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.12.1'
compile 'com.google.code.gson:gson:2.8.5'
compile 'io.gsonfire:gson-fire:1.8.0'
compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
compile 'org.threeten:threetenbp:1.3.5'
testCompile 'junit:junit:4.12'
}

View File

@ -9,10 +9,12 @@ lazy val root = (project in file(".")).
publishArtifact in (Compile, packageDoc) := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.17",
"com.squareup.okhttp" % "okhttp" % "2.7.5",
"com.squareup.okhttp" % "logging-interceptor" % "2.7.5",
"com.google.code.gson" % "gson" % "2.8.1",
"io.swagger" % "swagger-annotations" % "1.5.21",
"com.squareup.okhttp3" % "okhttp" % "3.12.1",
"com.squareup.okhttp3" % "logging-interceptor" % "3.12.1",
"com.google.code.gson" % "gson" % "2.8.5",
"org.apache.commons" % "commons-lang3" % "3.8.1",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
"org.threeten" % "threetenbp" % "1.3.5" % "compile",
"io.gsonfire" % "gson-fire" % "1.8.0" % "compile",
"junit" % "junit" % "4.12" % "test",

View File

@ -9,7 +9,7 @@ Method | HTTP request | Description
<a name="testCodeInjectEndRnNR"></a>
# **testCodeInjectEndRnNR**
> testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE)
> testCodeInjectEndRnNR(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR)
To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
@ -23,9 +23,9 @@ To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
FakeApi apiInstance = new FakeApi();
UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE = new UNKNOWN_BASE_TYPE(); // UNKNOWN_BASE_TYPE |
String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR = "testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR_example"; // String | To test code injection *_/ ' \\\" =end -- \\\\r\\\\n \\\\n \\\\r
try {
apiInstance.testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE);
apiInstance.testCodeInjectEndRnNR(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testCodeInjectEndRnNR");
e.printStackTrace();
@ -36,7 +36,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**UNKNOWN_BASE_TYPE** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | [optional]
**testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR** | **String**| To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r | [optional]
### Return type
@ -48,6 +48,6 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json, *_/ ' =end --
- **Content-Type**: application/x-www-form-urlencoded, *_/ ' =end --
- **Accept**: Not defined

View File

@ -24,9 +24,9 @@
<developers>
<developer>
<name>OpenAPI</name>
<name>OpenAPI-Generator Contributors</name>
<email>team@openapitools.org</email>
<organization>OpenAPI</organization>
<organization>OpenAPITools.org</organization>
<organizationUrl>http://openapitools.org</organizationUrl>
</developer>
</developers>
@ -114,8 +114,7 @@
</goals>
<configuration>
<sources>
<source>
src/main/java</source>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
@ -127,8 +126,7 @@
</goals>
<configuration>
<sources>
<source>
src/test/java</source>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
@ -194,12 +192,12 @@
<version>${swagger-core-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>${okhttp-version}</version>
</dependency>
@ -218,11 +216,16 @@
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>${threetenbp-version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3-version}</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>${threetenbp-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
@ -236,10 +239,11 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<gson-fire-version>1.8.0</gson-fire-version>
<swagger-core-version>1.5.18</swagger-core-version>
<okhttp-version>2.7.5</okhttp-version>
<gson-version>2.8.1</gson-version>
<threetenbp-version>1.3.5</threetenbp-version>
<swagger-core-version>1.5.21</swagger-core-version>
<okhttp-version>3.12.1</okhttp-version>
<gson-version>2.8.5</gson-version>
<commons-lang3-version>3.8.1</commons-lang3-version>
<threetenbp-version>1.3.5</threetenbp-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.12</junit-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -13,16 +13,15 @@
package org.openapitools.client;
import com.squareup.okhttp.*;
import com.squareup.okhttp.internal.http.HttpMethod;
import com.squareup.okhttp.logging.HttpLoggingInterceptor;
import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level;
import okhttp3.*;
import okhttp3.internal.http.HttpMethod;
import okhttp3.logging.HttpLoggingInterceptor;
import okhttp3.logging.HttpLoggingInterceptor.Level;
import okio.BufferedSink;
import okio.Okio;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.format.DateTimeFormatter;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
import org.apache.oltu.oauth2.common.message.types.GrantType;
@ -123,7 +122,9 @@ public class ApiClient {
}
private void init() {
httpClient = new OkHttpClient();
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(getProgressInterceptor());
httpClient = builder.build();
verifyingSsl = true;
@ -172,7 +173,7 @@ public class ApiClient {
* @return Api Client
*/
public ApiClient setHttpClient(OkHttpClient httpClient) {
this.httpClient = httpClient;
this.httpClient = httpClient.newBuilder().addInterceptor(getProgressInterceptor()).build();
return this;
}
@ -424,7 +425,7 @@ public class ApiClient {
if (debugging) {
loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(Level.BODY);
httpClient.interceptors().add(loggingInterceptor);
httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build();
} else {
httpClient.interceptors().remove(loggingInterceptor);
loggingInterceptor = null;
@ -463,7 +464,7 @@ public class ApiClient {
* @return Timeout in milliseconds
*/
public int getConnectTimeout() {
return httpClient.getConnectTimeout();
return httpClient.connectTimeoutMillis();
}
/**
@ -475,7 +476,7 @@ public class ApiClient {
* @return Api client
*/
public ApiClient setConnectTimeout(int connectionTimeout) {
httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS);
httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build();
return this;
}
@ -485,7 +486,7 @@ public class ApiClient {
* @return Timeout in milliseconds
*/
public int getReadTimeout() {
return httpClient.getReadTimeout();
return httpClient.readTimeoutMillis();
}
/**
@ -497,7 +498,7 @@ public class ApiClient {
* @return Api client
*/
public ApiClient setReadTimeout(int readTimeout) {
httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS);
httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build();
return this;
}
@ -507,7 +508,7 @@ public class ApiClient {
* @return Timeout in milliseconds
*/
public int getWriteTimeout() {
return httpClient.getWriteTimeout();
return httpClient.writeTimeoutMillis();
}
/**
@ -519,12 +520,13 @@ public class ApiClient {
* @return Api client
*/
public ApiClient setWriteTimeout(int writeTimeout) {
httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS);
httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build();
return this;
}
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
*
* @return Token request builder
*/
public TokenRequestBuilder getTokenEndPoint() {
@ -635,6 +637,40 @@ public class ApiClient {
return params;
}
/**
* Formats the specified collection path parameter to a string value.
*
* @param collectionFormat The collection format of the parameter.
* @param value The value of the parameter.
* @return String representation of the parameter
*/
public String collectionPathParameterToString(String collectionFormat, Collection value) {
// create the value based on the collection format
if ("multi".equals(collectionFormat)) {
// not valid for path params
return parameterToString(value);
}
// collectionFormat is assumed to be "csv" by default
String delimiter = ",";
if ("ssv".equals(collectionFormat)) {
delimiter = " ";
} else if ("tsv".equals(collectionFormat)) {
delimiter = "\t";
} else if ("pipes".equals(collectionFormat)) {
delimiter = "|";
}
StringBuilder sb = new StringBuilder() ;
for (Object item : value) {
sb.append(delimiter);
sb.append(parameterToString(item));
}
return sb.substring(delimiter.length());
}
/**
* Sanitize filename by removing path.
* e.g. ../../sun.gif becomes sun.gif
@ -658,8 +694,8 @@ public class ApiClient {
* @return True if the given MIME is JSON, false otherwise.
*/
public boolean isJsonMime(String mime) {
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && (mime.matches(jsonMime) || mime.equals("*/*"));
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && (mime.matches(jsonMime) || mime.equals("*/*"));
}
/**
@ -832,8 +868,8 @@ public class ApiClient {
* 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
* @throws IOException If fail to prepare file for download
*/
public File prepareDownloadFile(Response response) throws IOException {
String filename = null;
@ -876,8 +912,8 @@ public class ApiClient {
*
* @param <T> Type
* @param call An instance of the Call object
* @throws ApiException If fail to execute the call
* @return ApiResponse&lt;T&gt;
* @throws ApiException If fail to execute the call
*/
public <T> ApiResponse<T> execute(Call call) throws ApiException {
return execute(call, null);
@ -918,22 +954,22 @@ public class ApiClient {
/**
* Execute HTTP call asynchronously.
*
* @see #execute(Call, Type)
* @param <T> Type
* @param call The callback to be executed when the API call finishes
* @param returnType Return type
* @param callback ApiCallback
* @see #execute(Call, Type)
*/
@SuppressWarnings("unchecked")
public <T> void executeAsync(Call call, final Type returnType, final ApiCallback<T> callback) {
call.enqueue(new Callback() {
@Override
public void onFailure(Request request, IOException e) {
public void onFailure(Call call, IOException e) {
callback.onFailure(new ApiException(e), 0, null);
}
@Override
public void onResponse(Response response) throws IOException {
public void onResponse(Call call, Response response) throws IOException {
T result;
try {
result = (T) handleResponse(response, returnType);
@ -952,9 +988,9 @@ public class ApiClient {
* @param <T> Type
* @param response Response
* @param returnType Return type
* @throws ApiException If the response has an unsuccessful status code or
* fail to deserialize the response body
* @return Type
* @throws ApiException If the response has an unsuccessful status code or
* fail to deserialize the response body
*/
public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) {
@ -964,7 +1000,7 @@ public class ApiClient {
if (response.body() != null) {
try {
response.body().close();
} catch (IOException e) {
} catch (Exception e) {
throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
}
}
@ -996,12 +1032,12 @@ public class ApiClient {
* @param headerParams The header parameters
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @param callback Callback for upload/download progress
* @return The HTTP call
* @throws ApiException If fail to serialize the request body object
*/
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener);
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, callback);
return httpClient.newCall(request);
}
@ -1017,11 +1053,11 @@ public class ApiClient {
* @param headerParams The header parameters
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @param callback Callback for upload/download progress
* @return The HTTP request
* @throws ApiException If fail to serialize the request body object
*/
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);
final String url = buildUrl(path, queryParams, collectionQueryParams);
@ -1053,10 +1089,14 @@ public class ApiClient {
reqBody = serialize(body, contentType);
}
// Associate callback with request (if not null) so interceptor can
// access it when creating ProgressResponseBody
reqBuilder.tag(callback);
Request request = null;
if(progressRequestListener != null && reqBody != null) {
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener);
if (callback != null && reqBody != null) {
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback);
request = reqBuilder.method(method, progressRequestBody).build();
} else {
request = reqBuilder.method(method, reqBody).build();
@ -1155,7 +1195,7 @@ public class ApiClient {
* @return RequestBody
*/
public RequestBody buildRequestBodyFormEncoding(Map<String, Object> formParams) {
FormEncodingBuilder formBuilder = new FormEncodingBuilder();
okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder();
for (Entry<String, Object> param : formParams.entrySet()) {
formBuilder.add(param.getKey(), parameterToString(param.getValue()));
}
@ -1170,7 +1210,7 @@ public class ApiClient {
* @return RequestBody
*/
public RequestBody buildRequestBodyMultipart(Map<String, Object> formParams) {
MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM);
MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);
for (Entry<String, Object> param : formParams.entrySet()) {
if (param.getValue() instanceof File) {
File file = (File) param.getValue();
@ -1200,6 +1240,27 @@ public class ApiClient {
}
}
/**
* Get network interceptor to add it to the httpClient to track download progress for
* async requests.
*/
private Interceptor getProgressInterceptor() {
return new Interceptor() {
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
final Request request = chain.request();
final Response originalResponse = chain.proceed(request);
if (request.tag() instanceof ApiCallback) {
final ApiCallback callback = (ApiCallback) request.tag();
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), callback))
.build();
}
return originalResponse;
}
};
}
/**
* Apply SSL related settings to httpClient according to the current values of
* verifyingSsl and sslCaCert.
@ -1209,16 +1270,23 @@ public class ApiClient {
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; }
trustManagers = new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[]{};
}
}
};
SSLContext sslContext = SSLContext.getInstance("TLS");
trustManagers = new TrustManager[] {trustAll};
hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
@ -1246,11 +1314,12 @@ public class ApiClient {
if (keyManagers != null || trustManagers != null) {
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(keyManagers, trustManagers, new SecureRandom());
httpClient.setSslSocketFactory(sslContext.getSocketFactory());
httpClient = httpClient.newBuilder().sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]).build();
} else {
httpClient.setSslSocketFactory(null);
httpClient = httpClient.newBuilder().sslSocketFactory(null, (X509TrustManager) trustManagers[0]).build();
}
httpClient.setHostnameVerifier(hostnameVerifier);
httpClient = httpClient.newBuilder().hostnameVerifier(hostnameVerifier).build();
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}

View File

@ -13,7 +13,7 @@
package org.openapitools.client;
import com.squareup.okhttp.*;
import okhttp3.*;
import okio.Buffer;
import okio.BufferedSink;
import okio.GzipSink;

View File

@ -13,8 +13,8 @@
package org.openapitools.client;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.RequestBody;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import java.io.IOException;
@ -26,17 +26,13 @@ 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 final ApiCallback callback;
public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) {
this.requestBody = requestBody;
this.progressListener = progressListener;
this.callback = callback;
}
@Override
@ -70,7 +66,7 @@ public class ProgressRequestBody extends RequestBody {
}
bytesWritten += byteCount;
progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength);
callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength);
}
};
}

View File

@ -13,8 +13,8 @@
package org.openapitools.client;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.ResponseBody;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import java.io.IOException;
@ -26,17 +26,13 @@ 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 final ApiCallback callback;
private BufferedSource bufferedSource;
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) {
this.responseBody = responseBody;
this.progressListener = progressListener;
this.callback = callback;
}
@Override
@ -45,12 +41,12 @@ public class ProgressResponseBody extends ResponseBody {
}
@Override
public long contentLength() throws IOException {
public long contentLength() {
return responseBody.contentLength();
}
@Override
public BufferedSource source() throws IOException {
public BufferedSource source() {
if (bufferedSource == null) {
bufferedSource = Okio.buffer(source(responseBody.source()));
}
@ -66,7 +62,7 @@ public class ProgressResponseBody extends ResponseBody {
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);
callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
return bytesRead;
}
};

View File

@ -27,7 +27,6 @@ import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import org.openapitools.client.model.UNKNOWN_BASE_TYPE;
import java.lang.reflect.Type;
import java.util.ArrayList;
@ -36,34 +35,33 @@ import java.util.List;
import java.util.Map;
public class FakeApi {
private ApiClient apiClient;
private ApiClient localVarApiClient;
public FakeApi() {
this(Configuration.getDefaultApiClient());
}
public FakeApi(ApiClient apiClient) {
this.apiClient = apiClient;
this.localVarApiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
return localVarApiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
this.localVarApiClient = apiClient;
}
/**
* Build call for testCodeInjectEndRnNR
* @param UNKNOWN_BASE_TYPE (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @param testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call testCodeInjectEndRnNRCall(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = UNKNOWN_BASE_TYPE;
public okhttp3.Call testCodeInjectEndRnNRCall(String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
String localVarPath = "/fake";
@ -72,98 +70,71 @@ public class FakeApi {
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR != null) {
localVarFormParams.put("test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r", testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR);
}
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json", "*_/ ' =end -- "
"application/x-www-form-urlencoded", "*_/ ' =end -- "
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
final String localVarContentType = localVarApiClient.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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call testCodeInjectEndRnNRValidateBeforeCall(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
private okhttp3.Call testCodeInjectEndRnNRValidateBeforeCall(String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR, final ApiCallback _callback) throws ApiException {
com.squareup.okhttp.Call call = testCodeInjectEndRnNRCall(UNKNOWN_BASE_TYPE, progressListener, progressRequestListener);
return call;
okhttp3.Call localVarCall = testCodeInjectEndRnNRCall(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR, _callback);
return localVarCall;
}
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param UNKNOWN_BASE_TYPE (optional)
* @param testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r (optional)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE) throws ApiException {
testCodeInjectEndRnNRWithHttpInfo(UNKNOWN_BASE_TYPE);
public void testCodeInjectEndRnNR(String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR) throws ApiException {
testCodeInjectEndRnNRWithHttpInfo(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR);
}
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param UNKNOWN_BASE_TYPE (optional)
* @param testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r (optional)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> testCodeInjectEndRnNRWithHttpInfo(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE) throws ApiException {
com.squareup.okhttp.Call call = testCodeInjectEndRnNRValidateBeforeCall(UNKNOWN_BASE_TYPE, null, null);
return apiClient.execute(call);
public ApiResponse<Void> testCodeInjectEndRnNRWithHttpInfo(String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR) throws ApiException {
okhttp3.Call localVarCall = testCodeInjectEndRnNRValidateBeforeCall(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR, null);
return localVarApiClient.execute(localVarCall);
}
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r (asynchronously)
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param UNKNOWN_BASE_TYPE (optional)
* @param callback The callback to be executed when the API call finishes
* @param testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r (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 testCodeInjectEndRnNRAsync(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ApiCallback<Void> callback) throws ApiException {
public okhttp3.Call testCodeInjectEndRnNRAsync(String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR, final ApiCallback<Void> _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 = testCodeInjectEndRnNRValidateBeforeCall(UNKNOWN_BASE_TYPE, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
okhttp3.Call localVarCall = testCodeInjectEndRnNRValidateBeforeCall(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
}

View File

@ -15,7 +15,7 @@ package org.openapitools.client.auth;
import org.openapitools.client.Pair;
import com.squareup.okhttp.Credentials;
import okhttp3.Credentials;
import java.util.Map;
import java.util.List;

View File

@ -1,39 +0,0 @@
/*
* OpenAPI 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 -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.auth;
import org.openapitools.client.Pair;
import java.util.Map;
import java.util.List;
public class OAuth implements Authentication {
private String accessToken;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
if (accessToken != null) {
headerParams.put("Authorization", "Bearer " + accessToken);
}
}
}

View File

@ -1,18 +0,0 @@
/*
* OpenAPI 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 -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.auth;
public enum OAuthFlow {
accessCode, implicit, password, application
}

View File

@ -1,68 +0,0 @@
package org.openapitools.client.auth;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import org.apache.oltu.oauth2.client.HttpClient;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest;
import org.apache.oltu.oauth2.client.response.OAuthClientResponse;
import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory;
import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
public class OAuthOkHttpClient implements HttpClient {
private OkHttpClient client;
public OAuthOkHttpClient() {
this.client = new OkHttpClient();
}
public OAuthOkHttpClient(OkHttpClient client) {
this.client = client;
}
@Override
public <T extends OAuthClientResponse> T execute(OAuthClientRequest request, Map<String, String> headers,
String requestMethod, Class<T> responseClass)
throws OAuthSystemException, OAuthProblemException {
MediaType mediaType = MediaType.parse("application/json");
Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri());
if(headers != null) {
for (Entry<String, String> entry : headers.entrySet()) {
if (entry.getKey().equalsIgnoreCase("Content-Type")) {
mediaType = MediaType.parse(entry.getValue());
} else {
requestBuilder.addHeader(entry.getKey(), entry.getValue());
}
}
}
RequestBody body = request.getBody() != null ? RequestBody.create(mediaType, request.getBody()) : null;
requestBuilder.method(requestMethod, body);
try {
Response response = client.newCall(requestBuilder.build()).execute();
return OAuthClientResponseFactory.createCustomResponse(
response.body().string(),
response.body().contentType().toString(),
response.code(),
responseClass);
} catch (IOException e) {
throw new OAuthSystemException(e);
}
}
@Override
public void shutdown() {
// Nothing to do here
}
}

View File

@ -1,174 +0,0 @@
package org.openapitools.client.auth;
import org.openapitools.client.Pair;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import org.apache.oltu.oauth2.client.OAuthClient;
import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse;
import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.apache.oltu.oauth2.common.message.types.GrantType;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.Map;
import java.util.List;
public class RetryingOAuth extends OAuth implements Interceptor {
private OAuthClient oAuthClient;
private TokenRequestBuilder tokenRequestBuilder;
public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) {
this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client));
this.tokenRequestBuilder = tokenRequestBuilder;
}
public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) {
this(new OkHttpClient(), tokenRequestBuilder);
}
public RetryingOAuth(
String tokenUrl,
String clientId,
OAuthFlow flow,
String clientSecret,
Map<String, String> parameters
) {
this(OAuthClientRequest.tokenLocation(tokenUrl)
.setClientId(clientId)
.setClientSecret(clientSecret));
setFlow(flow);
if (parameters != null) {
for (String paramName : parameters.keySet()) {
tokenRequestBuilder.setParameter(paramName, parameters.get(paramName));
}
}
}
public void setFlow(OAuthFlow flow) {
switch(flow) {
case accessCode:
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
break;
case implicit:
tokenRequestBuilder.setGrantType(GrantType.IMPLICIT);
break;
case password:
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
break;
case application:
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
break;
default:
break;
}
}
@Override
public Response intercept(Chain chain) throws IOException {
return retryingIntercept(chain, true);
}
private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException {
Request request = chain.request();
// If the request already has an authorization (e.g. Basic auth), proceed with the request as is
if (request.header("Authorization") != null) {
return chain.proceed(request);
}
// Get the token if it has not yet been acquired
if (getAccessToken() == null) {
updateAccessToken(null);
}
OAuthClientRequest oAuthRequest;
if (getAccessToken() != null) {
// Build the request
Request.Builder requestBuilder = request.newBuilder();
String requestAccessToken = getAccessToken();
try {
oAuthRequest =
new OAuthBearerClientRequest(request.urlString()).
setAccessToken(requestAccessToken).
buildHeaderMessage();
} catch (OAuthSystemException e) {
throw new IOException(e);
}
Map<String, String> headers = oAuthRequest.getHeaders();
for (String headerName : headers.keySet()) {
requestBuilder.addHeader(headerName, headers.get(headerName));
}
requestBuilder.url(oAuthRequest.getLocationUri());
// Execute the request
Response response = chain.proceed(requestBuilder.build());
// 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row
if (
response != null &&
( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED ||
response.code() == HttpURLConnection.HTTP_FORBIDDEN ) &&
updateTokenAndRetryOnAuthorizationFailure
) {
try {
if (updateAccessToken(requestAccessToken)) {
response.body().close();
return retryingIntercept(chain, false);
}
} catch (Exception e) {
response.body().close();
throw e;
}
}
return response;
}
else {
return chain.proceed(chain.request());
}
}
/*
* Returns true if the access token has been updated
*/
public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException {
if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) {
try {
OAuthJSONAccessTokenResponse accessTokenResponse =
oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage());
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
setAccessToken(accessTokenResponse.getAccessToken());
return !getAccessToken().equals(requestAccessToken);
}
} catch (OAuthSystemException | OAuthProblemException e) {
throw new IOException(e);
}
}
return false;
}
public TokenRequestBuilder getTokenRequestBuilder() {
return tokenRequestBuilder;
}
public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) {
this.tokenRequestBuilder = tokenRequestBuilder;
}
// Applying authorization to parameters is performed in the retryingIntercept method
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
// No implementation necessary
}
}

View File

@ -75,7 +75,6 @@ public class ModelReturn {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ModelReturn {\n");
sb.append(" _return: ").append(toIndentedString(_return)).append("\n");
sb.append("}");
return sb.toString();

View File

@ -34,15 +34,15 @@ public class FakeApiTest {
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*
*
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testCodeInjectEndRnNRTest() throws ApiException {
Object UNKNOWN_BASE_TYPE = null;
api.testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE);
String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR = null;
api.testCodeInjectEndRnNR(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR);
// TODO: test validations
}

View File

@ -124,7 +124,9 @@ public class ApiClient {
}
private void init() {
httpClient = new OkHttpClient();
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(getProgressInterceptor());
httpClient = builder.build();
verifyingSsl = true;
@ -173,7 +175,7 @@ public class ApiClient {
* @return Api Client
*/
public ApiClient setHttpClient(OkHttpClient httpClient) {
this.httpClient = httpClient;
this.httpClient = httpClient.newBuilder().addInterceptor(getProgressInterceptor()).build();
return this;
}
@ -1032,12 +1034,12 @@ public class ApiClient {
* @param headerParams The header parameters
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @param callback Callback for upload/download progress
* @return The HTTP call
* @throws ApiException If fail to serialize the request body object
*/
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener);
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, callback);
return httpClient.newCall(request);
}
@ -1053,11 +1055,11 @@ public class ApiClient {
* @param headerParams The header parameters
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @param callback Callback for upload/download progress
* @return The HTTP request
* @throws ApiException If fail to serialize the request body object
*/
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);
final String url = buildUrl(path, queryParams, collectionQueryParams);
@ -1089,10 +1091,14 @@ public class ApiClient {
reqBody = serialize(body, contentType);
}
// Associate callback with request (if not null) so interceptor can
// access it when creating ProgressResponseBody
reqBuilder.tag(callback);
Request request = null;
if (progressRequestListener != null && reqBody != null) {
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener);
if (callback != null && reqBody != null) {
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback);
request = reqBuilder.method(method, progressRequestBody).build();
} else {
request = reqBuilder.method(method, reqBody).build();
@ -1236,6 +1242,27 @@ public class ApiClient {
}
}
/**
* Get network interceptor to add it to the httpClient to track download progress for
* async requests.
*/
private Interceptor getProgressInterceptor() {
return new Interceptor() {
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
final Request request = chain.request();
final Response originalResponse = chain.proceed(request);
if (request.tag() instanceof ApiCallback) {
final ApiCallback callback = (ApiCallback) request.tag();
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), callback))
.build();
}
return originalResponse;
}
};
}
/**
* Apply SSL related settings to httpClient according to the current values of
* verifyingSsl and sslCaCert.

View File

@ -26,17 +26,13 @@ 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 final ApiCallback callback;
public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) {
this.requestBody = requestBody;
this.progressListener = progressListener;
this.callback = callback;
}
@Override
@ -70,7 +66,7 @@ public class ProgressRequestBody extends RequestBody {
}
bytesWritten += byteCount;
progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength);
callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength);
}
};
}

View File

@ -26,17 +26,13 @@ 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 final ApiCallback callback;
private BufferedSource bufferedSource;
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) {
this.responseBody = responseBody;
this.progressListener = progressListener;
this.callback = callback;
}
@Override
@ -66,7 +62,7 @@ public class ProgressResponseBody extends ResponseBody {
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);
callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
return bytesRead;
}
};

View File

@ -57,12 +57,11 @@ public class AnotherFakeApi {
/**
* Build call for call123testSpecialTags
* @param body client model (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call call123testSpecialTagsCall(Client body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call call123testSpecialTagsCall(Client body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -86,24 +85,12 @@ public class AnotherFakeApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call call123testSpecialTagsValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call call123testSpecialTagsValidateBeforeCall(Client body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -111,7 +98,7 @@ public class AnotherFakeApi {
}
okhttp3.Call localVarCall = call123testSpecialTagsCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = call123testSpecialTagsCall(body, _callback);
return localVarCall;
}
@ -136,7 +123,7 @@ public class AnotherFakeApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client body) throws ApiException {
okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, null);
Type localVarReturnType = new TypeToken<Client>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -151,26 +138,7 @@ public class AnotherFakeApi {
*/
public okhttp3.Call call123testSpecialTagsAsync(Client body, final ApiCallback<Client> _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);
}
};
}
okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, _callback);
Type localVarReturnType = new TypeToken<Client>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;

View File

@ -57,12 +57,11 @@ public class FakeClassnameTags123Api {
/**
* Build call for testClassname
* @param body client model (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call testClassnameCall(Client body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call testClassnameCall(Client body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -86,24 +85,12 @@ public class FakeClassnameTags123Api {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "api_key_query" };
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call testClassnameValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call testClassnameValidateBeforeCall(Client body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -111,7 +98,7 @@ public class FakeClassnameTags123Api {
}
okhttp3.Call localVarCall = testClassnameCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = testClassnameCall(body, _callback);
return localVarCall;
}
@ -136,7 +123,7 @@ public class FakeClassnameTags123Api {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Client> testClassnameWithHttpInfo(Client body) throws ApiException {
okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, null);
Type localVarReturnType = new TypeToken<Client>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -151,26 +138,7 @@ public class FakeClassnameTags123Api {
*/
public okhttp3.Call testClassnameAsync(Client body, final ApiCallback<Client> _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);
}
};
}
okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, _callback);
Type localVarReturnType = new TypeToken<Client>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;

View File

@ -59,12 +59,11 @@ public class PetApi {
/**
* Build call for addPet
* @param body Pet object that needs to be added to the store (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call addPetCall(Pet body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -88,24 +87,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call addPetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call addPetValidateBeforeCall(Pet body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -113,7 +100,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = addPetCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = addPetCall(body, _callback);
return localVarCall;
}
@ -136,7 +123,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> addPetWithHttpInfo(Pet body) throws ApiException {
okhttp3.Call localVarCall = addPetValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = addPetValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -150,26 +137,7 @@ public class PetApi {
*/
public okhttp3.Call addPetAsync(Pet body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = addPetValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = addPetValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
@ -177,12 +145,11 @@ public class PetApi {
* Build call for deletePet
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -211,24 +178,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -236,7 +191,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = deletePetCall(petId, apiKey, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deletePetCall(petId, apiKey, _callback);
return localVarCall;
}
@ -261,7 +216,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException {
okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null, null);
okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null);
return localVarApiClient.execute(localVarCall);
}
@ -276,38 +231,18 @@ public class PetApi {
*/
public okhttp3.Call deletePetAsync(Long petId, String apiKey, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for findPetsByStatus
* @param status Status values that need to be considered for filter (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call findPetsByStatusCall(List<String> status, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call findPetsByStatusCall(List<String> status, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -335,24 +270,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call findPetsByStatusValidateBeforeCall(List<String> status, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call findPetsByStatusValidateBeforeCall(List<String> status, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'status' is set
if (status == null) {
@ -360,7 +283,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = findPetsByStatusCall(status, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = findPetsByStatusCall(status, _callback);
return localVarCall;
}
@ -385,7 +308,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException {
okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null, null);
okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null);
Type localVarReturnType = new TypeToken<List<Pet>>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -400,26 +323,7 @@ public class PetApi {
*/
public okhttp3.Call findPetsByStatusAsync(List<String> status, final ApiCallback<List<Pet>> _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);
}
};
}
okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback);
Type localVarReturnType = new TypeToken<List<Pet>>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -427,14 +331,13 @@ public class PetApi {
/**
* Build call for findPetsByTags
* @param tags Tags to filter by (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @deprecated
*/
@Deprecated
public okhttp3.Call findPetsByTagsCall(List<String> tags, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call findPetsByTagsCall(List<String> tags, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -462,25 +365,13 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@Deprecated
@SuppressWarnings("rawtypes")
private okhttp3.Call findPetsByTagsValidateBeforeCall(List<String> tags, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call findPetsByTagsValidateBeforeCall(List<String> tags, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'tags' is set
if (tags == null) {
@ -488,7 +379,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = findPetsByTagsCall(tags, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = findPetsByTagsCall(tags, _callback);
return localVarCall;
}
@ -517,7 +408,7 @@ public class PetApi {
*/
@Deprecated
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException {
okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null, null);
okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null);
Type localVarReturnType = new TypeToken<List<Pet>>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -534,26 +425,7 @@ public class PetApi {
@Deprecated
public okhttp3.Call findPetsByTagsAsync(List<String> tags, final ApiCallback<List<Pet>> _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);
}
};
}
okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback);
Type localVarReturnType = new TypeToken<List<Pet>>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -561,12 +433,11 @@ public class PetApi {
/**
* Build call for getPetById
* @param petId ID of pet to return (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call getPetByIdCall(Long petId, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -591,24 +462,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "api_key" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getPetByIdValidateBeforeCall(Long petId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call getPetByIdValidateBeforeCall(Long petId, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -616,7 +475,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = getPetByIdCall(petId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getPetByIdCall(petId, _callback);
return localVarCall;
}
@ -641,7 +500,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException {
okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null, null);
okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null);
Type localVarReturnType = new TypeToken<Pet>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -656,26 +515,7 @@ public class PetApi {
*/
public okhttp3.Call getPetByIdAsync(Long petId, final ApiCallback<Pet> _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);
}
};
}
okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback);
Type localVarReturnType = new TypeToken<Pet>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -683,12 +523,11 @@ public class PetApi {
/**
* Build call for updatePet
* @param body Pet object that needs to be added to the store (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call updatePetCall(Pet body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -712,24 +551,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updatePetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call updatePetValidateBeforeCall(Pet body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -737,7 +564,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = updatePetCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updatePetCall(body, _callback);
return localVarCall;
}
@ -760,7 +587,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updatePetWithHttpInfo(Pet body) throws ApiException {
okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -774,26 +601,7 @@ public class PetApi {
*/
public okhttp3.Call updatePetAsync(Pet body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
@ -802,12 +610,11 @@ public class PetApi {
* @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 _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call updatePetWithFormCall(Long petId, String name, String status, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -840,24 +647,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -865,7 +660,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = updatePetWithFormCall(petId, name, status, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updatePetWithFormCall(petId, name, status, _callback);
return localVarCall;
}
@ -892,7 +687,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException {
okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null, null);
okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null);
return localVarApiClient.execute(localVarCall);
}
@ -908,26 +703,7 @@ public class PetApi {
*/
public okhttp3.Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
@ -936,12 +712,11 @@ public class PetApi {
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -974,24 +749,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File file, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -999,7 +762,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = uploadFileCall(petId, additionalMetadata, file, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = uploadFileCall(petId, additionalMetadata, file, _callback);
return localVarCall;
}
@ -1028,7 +791,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException {
okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null, null);
okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -1045,26 +808,7 @@ public class PetApi {
*/
public okhttp3.Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback<ModelApiResponse> _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);
}
};
}
okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, _callback);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -1074,12 +818,11 @@ public class PetApi {
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -1112,24 +855,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, String additionalMetadata, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -1142,7 +873,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback);
return localVarCall;
}
@ -1171,7 +902,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException {
okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null, null);
okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -1188,26 +919,7 @@ public class PetApi {
*/
public okhttp3.Call uploadFileWithRequiredFileAsync(Long petId, File requiredFile, String additionalMetadata, final ApiCallback<ModelApiResponse> _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);
}
};
}
okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _callback);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;

View File

@ -57,12 +57,11 @@ public class StoreApi {
/**
* Build call for deleteOrder
* @param orderId ID of the order that needs to be deleted (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call deleteOrderCall(String orderId, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -87,24 +86,12 @@ public class StoreApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deleteOrderValidateBeforeCall(String orderId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call deleteOrderValidateBeforeCall(String orderId, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'orderId' is set
if (orderId == null) {
@ -112,7 +99,7 @@ public class StoreApi {
}
okhttp3.Call localVarCall = deleteOrderCall(orderId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deleteOrderCall(orderId, _callback);
return localVarCall;
}
@ -135,7 +122,7 @@ public class StoreApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException {
okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null, null);
okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null);
return localVarApiClient.execute(localVarCall);
}
@ -149,37 +136,17 @@ public class StoreApi {
*/
public okhttp3.Call deleteOrderAsync(String orderId, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for getInventory
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getInventoryCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -203,27 +170,15 @@ public class StoreApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "api_key" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getInventoryValidateBeforeCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getInventoryCall(_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getInventoryCall(_callback);
return localVarCall;
}
@ -246,7 +201,7 @@ public class StoreApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null, null);
okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null);
Type localVarReturnType = new TypeToken<Map<String, Integer>>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -260,26 +215,7 @@ public class StoreApi {
*/
public okhttp3.Call getInventoryAsync(final ApiCallback<Map<String, Integer>> _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);
}
};
}
okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback);
Type localVarReturnType = new TypeToken<Map<String, Integer>>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -287,12 +223,11 @@ public class StoreApi {
/**
* Build call for getOrderById
* @param orderId ID of pet that needs to be fetched (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call getOrderByIdCall(Long orderId, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -317,24 +252,12 @@ public class StoreApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getOrderByIdValidateBeforeCall(Long orderId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call getOrderByIdValidateBeforeCall(Long orderId, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'orderId' is set
if (orderId == null) {
@ -342,7 +265,7 @@ public class StoreApi {
}
okhttp3.Call localVarCall = getOrderByIdCall(orderId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getOrderByIdCall(orderId, _callback);
return localVarCall;
}
@ -367,7 +290,7 @@ public class StoreApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiException {
okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null, null);
okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null);
Type localVarReturnType = new TypeToken<Order>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -382,26 +305,7 @@ public class StoreApi {
*/
public okhttp3.Call getOrderByIdAsync(Long orderId, final ApiCallback<Order> _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);
}
};
}
okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback);
Type localVarReturnType = new TypeToken<Order>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -409,12 +313,11 @@ public class StoreApi {
/**
* Build call for placeOrder
* @param body order placed for purchasing the pet (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call placeOrderCall(Order body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -438,24 +341,12 @@ public class StoreApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call placeOrderValidateBeforeCall(Order body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call placeOrderValidateBeforeCall(Order body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -463,7 +354,7 @@ public class StoreApi {
}
okhttp3.Call localVarCall = placeOrderCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = placeOrderCall(body, _callback);
return localVarCall;
}
@ -488,7 +379,7 @@ public class StoreApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Order> placeOrderWithHttpInfo(Order body) throws ApiException {
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, null);
Type localVarReturnType = new TypeToken<Order>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -503,26 +394,7 @@ public class StoreApi {
*/
public okhttp3.Call placeOrderAsync(Order body, final ApiCallback<Order> _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);
}
};
}
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, _callback);
Type localVarReturnType = new TypeToken<Order>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;

View File

@ -57,12 +57,11 @@ public class UserApi {
/**
* Build call for createUser
* @param body Created user object (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call createUserCall(User body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call createUserCall(User body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -86,24 +85,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createUserValidateBeforeCall(User body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call createUserValidateBeforeCall(User body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -111,7 +98,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = createUserCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUserCall(body, _callback);
return localVarCall;
}
@ -134,7 +121,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUserWithHttpInfo(User body) throws ApiException {
okhttp3.Call localVarCall = createUserValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = createUserValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -148,38 +135,18 @@ public class UserApi {
*/
public okhttp3.Call createUserAsync(User body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = createUserValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUserValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for createUsersWithArrayInput
* @param body List of user object (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call createUsersWithArrayInputCall(List<User> body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call createUsersWithArrayInputCall(List<User> body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -203,24 +170,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(List<User> body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(List<User> body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -228,7 +183,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = createUsersWithArrayInputCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUsersWithArrayInputCall(body, _callback);
return localVarCall;
}
@ -251,7 +206,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body) throws ApiException {
okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -265,38 +220,18 @@ public class UserApi {
*/
public okhttp3.Call createUsersWithArrayInputAsync(List<User> body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for createUsersWithListInput
* @param body List of user object (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call createUsersWithListInputCall(List<User> body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call createUsersWithListInputCall(List<User> body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -320,24 +255,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createUsersWithListInputValidateBeforeCall(List<User> body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call createUsersWithListInputValidateBeforeCall(List<User> body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -345,7 +268,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = createUsersWithListInputCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUsersWithListInputCall(body, _callback);
return localVarCall;
}
@ -368,7 +291,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body) throws ApiException {
okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -382,38 +305,18 @@ public class UserApi {
*/
public okhttp3.Call createUsersWithListInputAsync(List<User> body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for deleteUser
* @param username The name that needs to be deleted (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call deleteUserCall(String username, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -438,24 +341,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deleteUserValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call deleteUserValidateBeforeCall(String username, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
@ -463,7 +354,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = deleteUserCall(username, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deleteUserCall(username, _callback);
return localVarCall;
}
@ -486,7 +377,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException {
okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null, null);
okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null);
return localVarApiClient.execute(localVarCall);
}
@ -500,38 +391,18 @@ public class UserApi {
*/
public okhttp3.Call deleteUserAsync(String username, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for getUserByName
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call getUserByNameCall(String username, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -556,24 +427,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getUserByNameValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call getUserByNameValidateBeforeCall(String username, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
@ -581,7 +440,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = getUserByNameCall(username, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getUserByNameCall(username, _callback);
return localVarCall;
}
@ -606,7 +465,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException {
okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null, null);
okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null);
Type localVarReturnType = new TypeToken<User>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -621,26 +480,7 @@ public class UserApi {
*/
public okhttp3.Call getUserByNameAsync(String username, final ApiCallback<User> _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);
}
};
}
okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback);
Type localVarReturnType = new TypeToken<User>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -649,12 +489,11 @@ public class UserApi {
* Build call for loginUser
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call loginUserCall(String username, String password, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -686,24 +525,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call loginUserValidateBeforeCall(String username, String password, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call loginUserValidateBeforeCall(String username, String password, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
@ -716,7 +543,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = loginUserCall(username, password, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = loginUserCall(username, password, _callback);
return localVarCall;
}
@ -743,7 +570,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException {
okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null, null);
okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null);
Type localVarReturnType = new TypeToken<String>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -759,38 +586,18 @@ public class UserApi {
*/
public okhttp3.Call loginUserAsync(String username, String password, final ApiCallback<String> _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);
}
};
}
okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback);
Type localVarReturnType = new TypeToken<String>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for logoutUser
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call logoutUserCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -814,27 +621,15 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call logoutUserValidateBeforeCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = logoutUserCall(_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = logoutUserCall(_callback);
return localVarCall;
}
@ -855,7 +650,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null, null);
okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null);
return localVarApiClient.execute(localVarCall);
}
@ -868,26 +663,7 @@ public class UserApi {
*/
public okhttp3.Call logoutUserAsync(final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
@ -895,12 +671,11 @@ public class UserApi {
* Build call for updateUser
* @param username name that need to be deleted (required)
* @param body Updated user object (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call updateUserCall(String username, User body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -925,24 +700,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updateUserValidateBeforeCall(String username, User body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call updateUserValidateBeforeCall(String username, User body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
@ -955,7 +718,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = updateUserCall(username, body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updateUserCall(username, body, _callback);
return localVarCall;
}
@ -980,7 +743,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updateUserWithHttpInfo(String username, User body) throws ApiException {
okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, null, null);
okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, null);
return localVarApiClient.execute(localVarCall);
}
@ -995,26 +758,7 @@ public class UserApi {
*/
public okhttp3.Call updateUserAsync(String username, User body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}

View File

@ -35,15 +35,15 @@ public class AnotherFakeApiTest {
/**
* To test special tags
*
* To test special tags
* To test special tags and operation ID starting with number
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testSpecialTagsTest() throws ApiException {
Client client = null;
Client response = api.testSpecialTags(client);
public void call123testSpecialTagsTest() throws ApiException {
Client body = null;
Client response = api.call123testSpecialTags(body);
// TODO: test validations
}

View File

@ -22,6 +22,7 @@ import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import org.openapitools.client.model.XmlItem;
import org.junit.Test;
import org.junit.Ignore;
@ -39,6 +40,22 @@ public class FakeApiTest {
private final FakeApi api = new FakeApi();
/**
* creates an XmlItem
*
* this route creates an XmlItem
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createXmlItemTest() throws ApiException {
XmlItem xmlItem = null;
api.createXmlItem(xmlItem);
// TODO: test validations
}
/**
*
*
@ -65,8 +82,8 @@ public class FakeApiTest {
*/
@Test
public void fakeOuterCompositeSerializeTest() throws ApiException {
OuterComposite outerComposite = null;
OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite);
OuterComposite body = null;
OuterComposite response = api.fakeOuterCompositeSerialize(body);
// TODO: test validations
}
@ -113,8 +130,8 @@ public class FakeApiTest {
*/
@Test
public void testBodyWithFileSchemaTest() throws ApiException {
FileSchemaTestClass fileSchemaTestClass = null;
api.testBodyWithFileSchema(fileSchemaTestClass);
FileSchemaTestClass body = null;
api.testBodyWithFileSchema(body);
// TODO: test validations
}
@ -130,8 +147,8 @@ public class FakeApiTest {
@Test
public void testBodyWithQueryParamsTest() throws ApiException {
String query = null;
User user = null;
api.testBodyWithQueryParams(query, user);
User body = null;
api.testBodyWithQueryParams(query, body);
// TODO: test validations
}
@ -146,8 +163,8 @@ public class FakeApiTest {
*/
@Test
public void testClientModelTest() throws ApiException {
Client client = null;
Client response = api.testClientModel(client);
Client body = null;
Client response = api.testClientModel(body);
// TODO: test validations
}
@ -239,8 +256,8 @@ public class FakeApiTest {
*/
@Test
public void testInlineAdditionalPropertiesTest() throws ApiException {
Map<String, String> requestBody = null;
api.testInlineAdditionalProperties(requestBody);
Map<String, String> param = null;
api.testInlineAdditionalProperties(param);
// TODO: test validations
}

View File

@ -42,8 +42,8 @@ public class FakeClassnameTags123ApiTest {
*/
@Test
public void testClassnameTest() throws ApiException {
Client client = null;
Client response = api.testClassname(client);
Client body = null;
Client response = api.testClassname(body);
// TODO: test validations
}

View File

@ -44,8 +44,8 @@ public class PetApiTest {
*/
@Test
public void addPetTest() throws ApiException {
Pet pet = null;
api.addPet(pet);
Pet body = null;
api.addPet(body);
// TODO: test validations
}
@ -125,8 +125,8 @@ public class PetApiTest {
*/
@Test
public void updatePetTest() throws ApiException {
Pet pet = null;
api.updatePet(pet);
Pet body = null;
api.updatePet(body);
// TODO: test validations
}
@ -167,4 +167,22 @@ public class PetApiTest {
// TODO: test validations
}
/**
* uploads an image (required)
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void uploadFileWithRequiredFileTest() throws ApiException {
Long petId = null;
File requiredFile = null;
String additionalMetadata = null;
ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
// TODO: test validations
}
}

View File

@ -89,8 +89,8 @@ public class StoreApiTest {
*/
@Test
public void placeOrderTest() throws ApiException {
Order order = null;
Order response = api.placeOrder(order);
Order body = null;
Order response = api.placeOrder(body);
// TODO: test validations
}

View File

@ -42,8 +42,8 @@ public class UserApiTest {
*/
@Test
public void createUserTest() throws ApiException {
User user = null;
api.createUser(user);
User body = null;
api.createUser(body);
// TODO: test validations
}
@ -58,8 +58,8 @@ public class UserApiTest {
*/
@Test
public void createUsersWithArrayInputTest() throws ApiException {
List<User> user = null;
api.createUsersWithArrayInput(user);
List<User> body = null;
api.createUsersWithArrayInput(body);
// TODO: test validations
}
@ -74,8 +74,8 @@ public class UserApiTest {
*/
@Test
public void createUsersWithListInputTest() throws ApiException {
List<User> user = null;
api.createUsersWithListInput(user);
List<User> body = null;
api.createUsersWithListInput(body);
// TODO: test validations
}
@ -155,8 +155,8 @@ public class UserApiTest {
@Test
public void updateUserTest() throws ApiException {
String username = null;
User user = null;
api.updateUser(username, user);
User body = null;
api.updateUser(username, body);
// TODO: test validations
}

View File

@ -124,7 +124,9 @@ public class ApiClient {
}
private void init() {
httpClient = new OkHttpClient();
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(getProgressInterceptor());
httpClient = builder.build();
verifyingSsl = true;
@ -173,7 +175,7 @@ public class ApiClient {
* @return Api Client
*/
public ApiClient setHttpClient(OkHttpClient httpClient) {
this.httpClient = httpClient;
this.httpClient = httpClient.newBuilder().addInterceptor(getProgressInterceptor()).build();
return this;
}
@ -1032,12 +1034,12 @@ public class ApiClient {
* @param headerParams The header parameters
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @param callback Callback for upload/download progress
* @return The HTTP call
* @throws ApiException If fail to serialize the request body object
*/
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener);
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, callback);
return httpClient.newCall(request);
}
@ -1053,11 +1055,11 @@ public class ApiClient {
* @param headerParams The header parameters
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @param callback Callback for upload/download progress
* @return The HTTP request
* @throws ApiException If fail to serialize the request body object
*/
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);
final String url = buildUrl(path, queryParams, collectionQueryParams);
@ -1089,10 +1091,14 @@ public class ApiClient {
reqBody = serialize(body, contentType);
}
// Associate callback with request (if not null) so interceptor can
// access it when creating ProgressResponseBody
reqBuilder.tag(callback);
Request request = null;
if (progressRequestListener != null && reqBody != null) {
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener);
if (callback != null && reqBody != null) {
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback);
request = reqBuilder.method(method, progressRequestBody).build();
} else {
request = reqBuilder.method(method, reqBody).build();
@ -1236,6 +1242,27 @@ public class ApiClient {
}
}
/**
* Get network interceptor to add it to the httpClient to track download progress for
* async requests.
*/
private Interceptor getProgressInterceptor() {
return new Interceptor() {
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
final Request request = chain.request();
final Response originalResponse = chain.proceed(request);
if (request.tag() instanceof ApiCallback) {
final ApiCallback callback = (ApiCallback) request.tag();
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), callback))
.build();
}
return originalResponse;
}
};
}
/**
* Apply SSL related settings to httpClient according to the current values of
* verifyingSsl and sslCaCert.

View File

@ -26,17 +26,13 @@ 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 final ApiCallback callback;
public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) {
this.requestBody = requestBody;
this.progressListener = progressListener;
this.callback = callback;
}
@Override
@ -70,7 +66,7 @@ public class ProgressRequestBody extends RequestBody {
}
bytesWritten += byteCount;
progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength);
callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength);
}
};
}

View File

@ -26,17 +26,13 @@ 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 final ApiCallback callback;
private BufferedSource bufferedSource;
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) {
this.responseBody = responseBody;
this.progressListener = progressListener;
this.callback = callback;
}
@Override
@ -66,7 +62,7 @@ public class ProgressResponseBody extends ResponseBody {
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);
callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
return bytesRead;
}
};

View File

@ -57,12 +57,11 @@ public class AnotherFakeApi {
/**
* Build call for call123testSpecialTags
* @param body client model (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call call123testSpecialTagsCall(Client body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call call123testSpecialTagsCall(Client body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -86,24 +85,12 @@ public class AnotherFakeApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call call123testSpecialTagsValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call call123testSpecialTagsValidateBeforeCall(Client body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -111,7 +98,7 @@ public class AnotherFakeApi {
}
okhttp3.Call localVarCall = call123testSpecialTagsCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = call123testSpecialTagsCall(body, _callback);
return localVarCall;
}
@ -136,7 +123,7 @@ public class AnotherFakeApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client body) throws ApiException {
okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, null);
Type localVarReturnType = new TypeToken<Client>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -151,26 +138,7 @@ public class AnotherFakeApi {
*/
public okhttp3.Call call123testSpecialTagsAsync(Client body, final ApiCallback<Client> _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);
}
};
}
okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(body, _callback);
Type localVarReturnType = new TypeToken<Client>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;

View File

@ -57,12 +57,11 @@ public class FakeClassnameTags123Api {
/**
* Build call for testClassname
* @param body client model (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call testClassnameCall(Client body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call testClassnameCall(Client body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -86,24 +85,12 @@ public class FakeClassnameTags123Api {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "api_key_query" };
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call testClassnameValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call testClassnameValidateBeforeCall(Client body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -111,7 +98,7 @@ public class FakeClassnameTags123Api {
}
okhttp3.Call localVarCall = testClassnameCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = testClassnameCall(body, _callback);
return localVarCall;
}
@ -136,7 +123,7 @@ public class FakeClassnameTags123Api {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Client> testClassnameWithHttpInfo(Client body) throws ApiException {
okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, null);
Type localVarReturnType = new TypeToken<Client>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -151,26 +138,7 @@ public class FakeClassnameTags123Api {
*/
public okhttp3.Call testClassnameAsync(Client body, final ApiCallback<Client> _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);
}
};
}
okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, _callback);
Type localVarReturnType = new TypeToken<Client>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;

View File

@ -59,12 +59,11 @@ public class PetApi {
/**
* Build call for addPet
* @param body Pet object that needs to be added to the store (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call addPetCall(Pet body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -88,24 +87,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call addPetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call addPetValidateBeforeCall(Pet body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -113,7 +100,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = addPetCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = addPetCall(body, _callback);
return localVarCall;
}
@ -136,7 +123,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> addPetWithHttpInfo(Pet body) throws ApiException {
okhttp3.Call localVarCall = addPetValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = addPetValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -150,26 +137,7 @@ public class PetApi {
*/
public okhttp3.Call addPetAsync(Pet body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = addPetValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = addPetValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
@ -177,12 +145,11 @@ public class PetApi {
* Build call for deletePet
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -211,24 +178,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -236,7 +191,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = deletePetCall(petId, apiKey, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deletePetCall(petId, apiKey, _callback);
return localVarCall;
}
@ -261,7 +216,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException {
okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null, null);
okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null);
return localVarApiClient.execute(localVarCall);
}
@ -276,38 +231,18 @@ public class PetApi {
*/
public okhttp3.Call deletePetAsync(Long petId, String apiKey, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for findPetsByStatus
* @param status Status values that need to be considered for filter (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call findPetsByStatusCall(List<String> status, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call findPetsByStatusCall(List<String> status, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -335,24 +270,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call findPetsByStatusValidateBeforeCall(List<String> status, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call findPetsByStatusValidateBeforeCall(List<String> status, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'status' is set
if (status == null) {
@ -360,7 +283,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = findPetsByStatusCall(status, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = findPetsByStatusCall(status, _callback);
return localVarCall;
}
@ -385,7 +308,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException {
okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null, null);
okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null);
Type localVarReturnType = new TypeToken<List<Pet>>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -400,26 +323,7 @@ public class PetApi {
*/
public okhttp3.Call findPetsByStatusAsync(List<String> status, final ApiCallback<List<Pet>> _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);
}
};
}
okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback);
Type localVarReturnType = new TypeToken<List<Pet>>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -427,14 +331,13 @@ public class PetApi {
/**
* Build call for findPetsByTags
* @param tags Tags to filter by (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @deprecated
*/
@Deprecated
public okhttp3.Call findPetsByTagsCall(List<String> tags, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call findPetsByTagsCall(List<String> tags, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -462,25 +365,13 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@Deprecated
@SuppressWarnings("rawtypes")
private okhttp3.Call findPetsByTagsValidateBeforeCall(List<String> tags, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call findPetsByTagsValidateBeforeCall(List<String> tags, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'tags' is set
if (tags == null) {
@ -488,7 +379,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = findPetsByTagsCall(tags, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = findPetsByTagsCall(tags, _callback);
return localVarCall;
}
@ -517,7 +408,7 @@ public class PetApi {
*/
@Deprecated
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException {
okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null, null);
okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null);
Type localVarReturnType = new TypeToken<List<Pet>>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -534,26 +425,7 @@ public class PetApi {
@Deprecated
public okhttp3.Call findPetsByTagsAsync(List<String> tags, final ApiCallback<List<Pet>> _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);
}
};
}
okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback);
Type localVarReturnType = new TypeToken<List<Pet>>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -561,12 +433,11 @@ public class PetApi {
/**
* Build call for getPetById
* @param petId ID of pet to return (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call getPetByIdCall(Long petId, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -591,24 +462,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "api_key" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getPetByIdValidateBeforeCall(Long petId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call getPetByIdValidateBeforeCall(Long petId, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -616,7 +475,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = getPetByIdCall(petId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getPetByIdCall(petId, _callback);
return localVarCall;
}
@ -641,7 +500,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException {
okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null, null);
okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null);
Type localVarReturnType = new TypeToken<Pet>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -656,26 +515,7 @@ public class PetApi {
*/
public okhttp3.Call getPetByIdAsync(Long petId, final ApiCallback<Pet> _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);
}
};
}
okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback);
Type localVarReturnType = new TypeToken<Pet>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -683,12 +523,11 @@ public class PetApi {
/**
* Build call for updatePet
* @param body Pet object that needs to be added to the store (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call updatePetCall(Pet body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -712,24 +551,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updatePetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call updatePetValidateBeforeCall(Pet body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -737,7 +564,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = updatePetCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updatePetCall(body, _callback);
return localVarCall;
}
@ -760,7 +587,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updatePetWithHttpInfo(Pet body) throws ApiException {
okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -774,26 +601,7 @@ public class PetApi {
*/
public okhttp3.Call updatePetAsync(Pet body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
@ -802,12 +610,11 @@ public class PetApi {
* @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 _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call updatePetWithFormCall(Long petId, String name, String status, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -840,24 +647,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -865,7 +660,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = updatePetWithFormCall(petId, name, status, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updatePetWithFormCall(petId, name, status, _callback);
return localVarCall;
}
@ -892,7 +687,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException {
okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null, null);
okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null);
return localVarApiClient.execute(localVarCall);
}
@ -908,26 +703,7 @@ public class PetApi {
*/
public okhttp3.Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
@ -936,12 +712,11 @@ public class PetApi {
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -974,24 +749,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File file, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -999,7 +762,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = uploadFileCall(petId, additionalMetadata, file, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = uploadFileCall(petId, additionalMetadata, file, _callback);
return localVarCall;
}
@ -1028,7 +791,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException {
okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null, null);
okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -1045,26 +808,7 @@ public class PetApi {
*/
public okhttp3.Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback<ModelApiResponse> _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);
}
};
}
okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, _callback);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -1074,12 +818,11 @@ public class PetApi {
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -1112,24 +855,12 @@ public class PetApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "petstore_auth" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, String additionalMetadata, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
@ -1142,7 +873,7 @@ public class PetApi {
}
okhttp3.Call localVarCall = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback);
return localVarCall;
}
@ -1171,7 +902,7 @@ public class PetApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException {
okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null, null);
okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -1188,26 +919,7 @@ public class PetApi {
*/
public okhttp3.Call uploadFileWithRequiredFileAsync(Long petId, File requiredFile, String additionalMetadata, final ApiCallback<ModelApiResponse> _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);
}
};
}
okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _callback);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;

View File

@ -57,12 +57,11 @@ public class StoreApi {
/**
* Build call for deleteOrder
* @param orderId ID of the order that needs to be deleted (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call deleteOrderCall(String orderId, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -87,24 +86,12 @@ public class StoreApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deleteOrderValidateBeforeCall(String orderId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call deleteOrderValidateBeforeCall(String orderId, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'orderId' is set
if (orderId == null) {
@ -112,7 +99,7 @@ public class StoreApi {
}
okhttp3.Call localVarCall = deleteOrderCall(orderId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deleteOrderCall(orderId, _callback);
return localVarCall;
}
@ -135,7 +122,7 @@ public class StoreApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException {
okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null, null);
okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null);
return localVarApiClient.execute(localVarCall);
}
@ -149,37 +136,17 @@ public class StoreApi {
*/
public okhttp3.Call deleteOrderAsync(String orderId, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for getInventory
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getInventoryCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -203,27 +170,15 @@ public class StoreApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { "api_key" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getInventoryValidateBeforeCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getInventoryCall(_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getInventoryCall(_callback);
return localVarCall;
}
@ -246,7 +201,7 @@ public class StoreApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null, null);
okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null);
Type localVarReturnType = new TypeToken<Map<String, Integer>>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -260,26 +215,7 @@ public class StoreApi {
*/
public okhttp3.Call getInventoryAsync(final ApiCallback<Map<String, Integer>> _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);
}
};
}
okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback);
Type localVarReturnType = new TypeToken<Map<String, Integer>>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -287,12 +223,11 @@ public class StoreApi {
/**
* Build call for getOrderById
* @param orderId ID of pet that needs to be fetched (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call getOrderByIdCall(Long orderId, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -317,24 +252,12 @@ public class StoreApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getOrderByIdValidateBeforeCall(Long orderId, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call getOrderByIdValidateBeforeCall(Long orderId, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'orderId' is set
if (orderId == null) {
@ -342,7 +265,7 @@ public class StoreApi {
}
okhttp3.Call localVarCall = getOrderByIdCall(orderId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getOrderByIdCall(orderId, _callback);
return localVarCall;
}
@ -367,7 +290,7 @@ public class StoreApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiException {
okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null, null);
okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null);
Type localVarReturnType = new TypeToken<Order>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -382,26 +305,7 @@ public class StoreApi {
*/
public okhttp3.Call getOrderByIdAsync(Long orderId, final ApiCallback<Order> _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);
}
};
}
okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback);
Type localVarReturnType = new TypeToken<Order>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -409,12 +313,11 @@ public class StoreApi {
/**
* Build call for placeOrder
* @param body order placed for purchasing the pet (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call placeOrderCall(Order body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -438,24 +341,12 @@ public class StoreApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call placeOrderValidateBeforeCall(Order body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call placeOrderValidateBeforeCall(Order body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -463,7 +354,7 @@ public class StoreApi {
}
okhttp3.Call localVarCall = placeOrderCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = placeOrderCall(body, _callback);
return localVarCall;
}
@ -488,7 +379,7 @@ public class StoreApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Order> placeOrderWithHttpInfo(Order body) throws ApiException {
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, null);
Type localVarReturnType = new TypeToken<Order>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -503,26 +394,7 @@ public class StoreApi {
*/
public okhttp3.Call placeOrderAsync(Order body, final ApiCallback<Order> _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);
}
};
}
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, _callback);
Type localVarReturnType = new TypeToken<Order>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;

View File

@ -57,12 +57,11 @@ public class UserApi {
/**
* Build call for createUser
* @param body Created user object (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call createUserCall(User body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call createUserCall(User body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -86,24 +85,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createUserValidateBeforeCall(User body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call createUserValidateBeforeCall(User body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -111,7 +98,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = createUserCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUserCall(body, _callback);
return localVarCall;
}
@ -134,7 +121,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUserWithHttpInfo(User body) throws ApiException {
okhttp3.Call localVarCall = createUserValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = createUserValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -148,38 +135,18 @@ public class UserApi {
*/
public okhttp3.Call createUserAsync(User body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = createUserValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUserValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for createUsersWithArrayInput
* @param body List of user object (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call createUsersWithArrayInputCall(List<User> body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call createUsersWithArrayInputCall(List<User> body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -203,24 +170,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(List<User> body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(List<User> body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -228,7 +183,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = createUsersWithArrayInputCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUsersWithArrayInputCall(body, _callback);
return localVarCall;
}
@ -251,7 +206,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body) throws ApiException {
okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -265,38 +220,18 @@ public class UserApi {
*/
public okhttp3.Call createUsersWithArrayInputAsync(List<User> body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for createUsersWithListInput
* @param body List of user object (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call createUsersWithListInputCall(List<User> body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call createUsersWithListInputCall(List<User> body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -320,24 +255,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createUsersWithListInputValidateBeforeCall(List<User> body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call createUsersWithListInputValidateBeforeCall(List<User> body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
@ -345,7 +268,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = createUsersWithListInputCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUsersWithListInputCall(body, _callback);
return localVarCall;
}
@ -368,7 +291,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body) throws ApiException {
okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, null, null);
okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, null);
return localVarApiClient.execute(localVarCall);
}
@ -382,38 +305,18 @@ public class UserApi {
*/
public okhttp3.Call createUsersWithListInputAsync(List<User> body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for deleteUser
* @param username The name that needs to be deleted (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call deleteUserCall(String username, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -438,24 +341,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deleteUserValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call deleteUserValidateBeforeCall(String username, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
@ -463,7 +354,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = deleteUserCall(username, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deleteUserCall(username, _callback);
return localVarCall;
}
@ -486,7 +377,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException {
okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null, null);
okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null);
return localVarApiClient.execute(localVarCall);
}
@ -500,38 +391,18 @@ public class UserApi {
*/
public okhttp3.Call deleteUserAsync(String username, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for getUserByName
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call getUserByNameCall(String username, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -556,24 +427,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getUserByNameValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call getUserByNameValidateBeforeCall(String username, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
@ -581,7 +440,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = getUserByNameCall(username, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getUserByNameCall(username, _callback);
return localVarCall;
}
@ -606,7 +465,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException {
okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null, null);
okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null);
Type localVarReturnType = new TypeToken<User>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -621,26 +480,7 @@ public class UserApi {
*/
public okhttp3.Call getUserByNameAsync(String username, final ApiCallback<User> _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);
}
};
}
okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback);
Type localVarReturnType = new TypeToken<User>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
@ -649,12 +489,11 @@ public class UserApi {
* Build call for loginUser
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call loginUserCall(String username, String password, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -686,24 +525,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call loginUserValidateBeforeCall(String username, String password, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call loginUserValidateBeforeCall(String username, String password, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
@ -716,7 +543,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = loginUserCall(username, password, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = loginUserCall(username, password, _callback);
return localVarCall;
}
@ -743,7 +570,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException {
okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null, null);
okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null);
Type localVarReturnType = new TypeToken<String>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@ -759,38 +586,18 @@ public class UserApi {
*/
public okhttp3.Call loginUserAsync(String username, String password, final ApiCallback<String> _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);
}
};
}
okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback);
Type localVarReturnType = new TypeToken<String>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for logoutUser
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call logoutUserCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException {
Object localVarPostBody = new Object();
// create path and map variables
@ -814,27 +621,15 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call logoutUserValidateBeforeCall(final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = logoutUserCall(_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = logoutUserCall(_callback);
return localVarCall;
}
@ -855,7 +650,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null, null);
okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null);
return localVarApiClient.execute(localVarCall);
}
@ -868,26 +663,7 @@ public class UserApi {
*/
public okhttp3.Call logoutUserAsync(final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_progressListener, _progressRequestListener);
okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
@ -895,12 +671,11 @@ public class UserApi {
* Build call for updateUser
* @param username name that need to be deleted (required)
* @param body Updated user object (required)
* @param _progressListener Progress listener
* @param _progressRequestListener Progress request listener
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
public okhttp3.Call updateUserCall(String username, User body, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
@ -925,24 +700,12 @@ public class UserApi {
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if (_progressListener != null) {
localVarApiClient.setHttpClient(localVarApiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), _progressListener))
.build();
}
}).build());
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _progressRequestListener);
return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updateUserValidateBeforeCall(String username, User body, final ProgressResponseBody.ProgressListener _progressListener, final ProgressRequestBody.ProgressRequestListener _progressRequestListener) throws ApiException {
private okhttp3.Call updateUserValidateBeforeCall(String username, User body, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
@ -955,7 +718,7 @@ public class UserApi {
}
okhttp3.Call localVarCall = updateUserCall(username, body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updateUserCall(username, body, _callback);
return localVarCall;
}
@ -980,7 +743,7 @@ public class UserApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updateUserWithHttpInfo(String username, User body) throws ApiException {
okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, null, null);
okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, null);
return localVarApiClient.execute(localVarCall);
}
@ -995,26 +758,7 @@ public class UserApi {
*/
public okhttp3.Call updateUserAsync(String username, User body, final ApiCallback<Void> _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);
}
};
}
okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, _progressListener, _progressRequestListener);
okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}

View File

@ -42,8 +42,8 @@ public class AnotherFakeApiTest {
*/
@Test
public void call123testSpecialTagsTest() throws ApiException {
Client client = null;
Client response = api.call123testSpecialTags(client);
Client body = null;
Client response = api.call123testSpecialTags(body);
// TODO: test validations
}

View File

@ -22,6 +22,7 @@ import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import org.openapitools.client.model.XmlItem;
import org.junit.Test;
import org.junit.Ignore;
@ -39,6 +40,22 @@ public class FakeApiTest {
private final FakeApi api = new FakeApi();
/**
* creates an XmlItem
*
* this route creates an XmlItem
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createXmlItemTest() throws ApiException {
XmlItem xmlItem = null;
api.createXmlItem(xmlItem);
// TODO: test validations
}
/**
*
*
@ -65,8 +82,8 @@ public class FakeApiTest {
*/
@Test
public void fakeOuterCompositeSerializeTest() throws ApiException {
OuterComposite outerComposite = null;
OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite);
OuterComposite body = null;
OuterComposite response = api.fakeOuterCompositeSerialize(body);
// TODO: test validations
}
@ -113,8 +130,8 @@ public class FakeApiTest {
*/
@Test
public void testBodyWithFileSchemaTest() throws ApiException {
FileSchemaTestClass fileSchemaTestClass = null;
api.testBodyWithFileSchema(fileSchemaTestClass);
FileSchemaTestClass body = null;
api.testBodyWithFileSchema(body);
// TODO: test validations
}
@ -130,8 +147,8 @@ public class FakeApiTest {
@Test
public void testBodyWithQueryParamsTest() throws ApiException {
String query = null;
User user = null;
api.testBodyWithQueryParams(query, user);
User body = null;
api.testBodyWithQueryParams(query, body);
// TODO: test validations
}
@ -146,8 +163,8 @@ public class FakeApiTest {
*/
@Test
public void testClientModelTest() throws ApiException {
Client client = null;
Client response = api.testClientModel(client);
Client body = null;
Client response = api.testClientModel(body);
// TODO: test validations
}
@ -239,8 +256,8 @@ public class FakeApiTest {
*/
@Test
public void testInlineAdditionalPropertiesTest() throws ApiException {
Map<String, String> requestBody = null;
api.testInlineAdditionalProperties(requestBody);
Map<String, String> param = null;
api.testInlineAdditionalProperties(param);
// TODO: test validations
}

View File

@ -42,8 +42,8 @@ public class FakeClassnameTags123ApiTest {
*/
@Test
public void testClassnameTest() throws ApiException {
Client client = null;
Client response = api.testClassname(client);
Client body = null;
Client response = api.testClassname(body);
// TODO: test validations
}

View File

@ -89,8 +89,8 @@ public class StoreApiTest {
*/
@Test
public void placeOrderTest() throws ApiException {
Order order = null;
Order response = api.placeOrder(order);
Order body = null;
Order response = api.placeOrder(body);
// TODO: test validations
}

View File

@ -42,8 +42,8 @@ public class UserApiTest {
*/
@Test
public void createUserTest() throws ApiException {
User user = null;
api.createUser(user);
User body = null;
api.createUser(body);
// TODO: test validations
}
@ -58,8 +58,8 @@ public class UserApiTest {
*/
@Test
public void createUsersWithArrayInputTest() throws ApiException {
List<User> user = null;
api.createUsersWithArrayInput(user);
List<User> body = null;
api.createUsersWithArrayInput(body);
// TODO: test validations
}
@ -74,8 +74,8 @@ public class UserApiTest {
*/
@Test
public void createUsersWithListInputTest() throws ApiException {
List<User> user = null;
api.createUsersWithListInput(user);
List<User> body = null;
api.createUsersWithListInput(body);
// TODO: test validations
}
@ -155,8 +155,8 @@ public class UserApiTest {
@Test
public void updateUserTest() throws ApiException {
String username = null;
User user = null;
api.updateUser(username, user);
User body = null;
api.updateUser(username, body);
// TODO: test validations
}

View File

@ -228,51 +228,51 @@ public class XmlItemTest {
}
/**
* Test the property 'prefixNamespaceString'
* Test the property 'prefixNsString'
*/
@Test
public void prefixNamespaceStringTest() {
// TODO: test prefixNamespaceString
public void prefixNsStringTest() {
// TODO: test prefixNsString
}
/**
* Test the property 'prefixNamespaceNumber'
* Test the property 'prefixNsNumber'
*/
@Test
public void prefixNamespaceNumberTest() {
// TODO: test prefixNamespaceNumber
public void prefixNsNumberTest() {
// TODO: test prefixNsNumber
}
/**
* Test the property 'prefixNamespaceInteger'
* Test the property 'prefixNsInteger'
*/
@Test
public void prefixNamespaceIntegerTest() {
// TODO: test prefixNamespaceInteger
public void prefixNsIntegerTest() {
// TODO: test prefixNsInteger
}
/**
* Test the property 'prefixNamespaceBoolean'
* Test the property 'prefixNsBoolean'
*/
@Test
public void prefixNamespaceBooleanTest() {
// TODO: test prefixNamespaceBoolean
public void prefixNsBooleanTest() {
// TODO: test prefixNsBoolean
}
/**
* Test the property 'prefixNamespaceArray'
* Test the property 'prefixNsArray'
*/
@Test
public void prefixNamespaceArrayTest() {
// TODO: test prefixNamespaceArray
public void prefixNsArrayTest() {
// TODO: test prefixNsArray
}
/**
* Test the property 'prefixNamespaceWrappedArray'
* Test the property 'prefixNsWrappedArray'
*/
@Test
public void prefixNamespaceWrappedArrayTest() {
// TODO: test prefixNamespaceWrappedArray
public void prefixNsWrappedArrayTest() {
// TODO: test prefixNsWrappedArray
}
}