forked from loafle/openapi-generator-original
update okhttp-gson samples
This commit is contained in:
parent
b9cf790d1c
commit
dc65b5647f
@ -28,4 +28,22 @@ public interface ApiCallback<T> {
|
|||||||
* @param responseHeaders Headers of the response
|
* @param responseHeaders Headers of the response
|
||||||
*/
|
*/
|
||||||
void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders);
|
void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the API upload processing.
|
||||||
|
*
|
||||||
|
* @param bytesWritten bytes Written
|
||||||
|
* @param contentLength content length of request body
|
||||||
|
* @param done write end
|
||||||
|
*/
|
||||||
|
void onUploadProgress(long bytesWritten, long contentLength, boolean done);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the API downlond processing.
|
||||||
|
*
|
||||||
|
* @param bytesRead bytes Read
|
||||||
|
* @param contentLength content lenngth of the response
|
||||||
|
* @param done Read end
|
||||||
|
*/
|
||||||
|
void onDownloadProgress(long bytesRead, long contentLength, boolean done);
|
||||||
}
|
}
|
||||||
|
@ -143,8 +143,8 @@ public class ApiClient {
|
|||||||
|
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
authentications = new HashMap<String, Authentication>();
|
authentications = new HashMap<String, Authentication>();
|
||||||
authentications.put("petstore_auth", new OAuth());
|
|
||||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||||
|
authentications.put("petstore_auth", new OAuth());
|
||||||
// Prevent the authentications from being modified.
|
// Prevent the authentications from being modified.
|
||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
@ -820,7 +820,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @return The HTTP call
|
* @return The HTTP call
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||||
|
|
||||||
final String url = buildUrl(path, queryParams);
|
final String url = buildUrl(path, queryParams);
|
||||||
@ -850,7 +850,15 @@ public class ApiClient {
|
|||||||
reqBody = RequestBody.create(MediaType.parse(contentType), serialize(body, contentType));
|
reqBody = RequestBody.create(MediaType.parse(contentType), serialize(body, contentType));
|
||||||
}
|
}
|
||||||
|
|
||||||
Request request = reqBuilder.method(method, reqBody).build();
|
Request request = null;
|
||||||
|
|
||||||
|
if(progressRequestListener != null) {
|
||||||
|
ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener);
|
||||||
|
request = reqBuilder.method(method, progressRequestBody).build();
|
||||||
|
} else {
|
||||||
|
request = reqBuilder.method(method, reqBody).build();
|
||||||
|
}
|
||||||
|
|
||||||
return httpClient.newCall(request);
|
return httpClient.newCall(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package io.swagger.client;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-21T19:41:14.431+08:00")
|
||||||
public class ApiException extends Exception {
|
public class ApiException extends Exception {
|
||||||
private int code = 0;
|
private int code = 0;
|
||||||
private Map<String, List<String>> responseHeaders = null;
|
private Map<String, List<String>> responseHeaders = null;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.swagger.client;
|
package io.swagger.client;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-21T19:41:14.431+08:00")
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
private static ApiClient defaultApiClient = new ApiClient();
|
private static ApiClient defaultApiClient = new ApiClient();
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.swagger.client;
|
package io.swagger.client;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-21T19:41:14.431+08:00")
|
||||||
public class Pair {
|
public class Pair {
|
||||||
private String name = "";
|
private String name = "";
|
||||||
private String value = "";
|
private String value = "";
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
package io.swagger.client;
|
||||||
|
|
||||||
|
import com.squareup.okhttp.MediaType;
|
||||||
|
import com.squareup.okhttp.RequestBody;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okio.Buffer;
|
||||||
|
import okio.BufferedSink;
|
||||||
|
import okio.ForwardingSink;
|
||||||
|
import okio.Okio;
|
||||||
|
import okio.Sink;
|
||||||
|
|
||||||
|
public class ProgressRequestBody extends RequestBody {
|
||||||
|
|
||||||
|
public interface ProgressRequestListener {
|
||||||
|
void onRequestProgress(long bytesWritten, long contentLength, boolean done);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final RequestBody requestBody;
|
||||||
|
|
||||||
|
private final ProgressRequestListener progressListener;
|
||||||
|
|
||||||
|
private BufferedSink bufferedSink;
|
||||||
|
|
||||||
|
public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
|
||||||
|
this.requestBody = requestBody;
|
||||||
|
this.progressListener = progressListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MediaType contentType() {
|
||||||
|
return requestBody.contentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long contentLength() throws IOException {
|
||||||
|
return requestBody.contentLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(BufferedSink sink) throws IOException {
|
||||||
|
if (bufferedSink == null) {
|
||||||
|
bufferedSink = Okio.buffer(sink(sink));
|
||||||
|
}
|
||||||
|
|
||||||
|
requestBody.writeTo(bufferedSink);
|
||||||
|
bufferedSink.flush();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Sink sink(Sink sink) {
|
||||||
|
return new ForwardingSink(sink) {
|
||||||
|
|
||||||
|
long bytesWritten = 0L;
|
||||||
|
long contentLength = 0L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(Buffer source, long byteCount) throws IOException {
|
||||||
|
super.write(source, byteCount);
|
||||||
|
if (contentLength == 0) {
|
||||||
|
contentLength = contentLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
bytesWritten += byteCount;
|
||||||
|
progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package io.swagger.client;
|
||||||
|
|
||||||
|
import com.squareup.okhttp.MediaType;
|
||||||
|
import com.squareup.okhttp.ResponseBody;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okio.Buffer;
|
||||||
|
import okio.BufferedSource;
|
||||||
|
import okio.ForwardingSource;
|
||||||
|
import okio.Okio;
|
||||||
|
import okio.Source;
|
||||||
|
|
||||||
|
public class ProgressResponseBody extends ResponseBody {
|
||||||
|
|
||||||
|
public interface ProgressListener {
|
||||||
|
void update(long bytesRead, long contentLength, boolean done);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ResponseBody responseBody;
|
||||||
|
private final ProgressListener progressListener;
|
||||||
|
private BufferedSource bufferedSource;
|
||||||
|
|
||||||
|
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
|
||||||
|
this.responseBody = responseBody;
|
||||||
|
this.progressListener = progressListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MediaType contentType() {
|
||||||
|
return responseBody.contentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long contentLength() throws IOException {
|
||||||
|
return responseBody.contentLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BufferedSource source() throws IOException {
|
||||||
|
if (bufferedSource == null) {
|
||||||
|
bufferedSource = Okio.buffer(source(responseBody.source()));
|
||||||
|
}
|
||||||
|
return bufferedSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Source source(Source source) {
|
||||||
|
return new ForwardingSource(source) {
|
||||||
|
long totalBytesRead = 0L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long read(Buffer sink, long byteCount) throws IOException {
|
||||||
|
long bytesRead = super.read(sink, byteCount);
|
||||||
|
// read() returns the number of bytes read, or -1 if this source is exhausted.
|
||||||
|
totalBytesRead += bytesRead != -1 ? bytesRead : 0;
|
||||||
|
progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
|
||||||
|
return bytesRead;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package io.swagger.client;
|
package io.swagger.client;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-21T19:41:14.431+08:00")
|
||||||
public class StringUtil {
|
public class StringUtil {
|
||||||
/**
|
/**
|
||||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||||
|
@ -5,10 +5,16 @@ import io.swagger.client.ApiClient;
|
|||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import io.swagger.client.Configuration;
|
import io.swagger.client.Configuration;
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
import io.swagger.client.ProgressRequestBody;
|
||||||
|
import io.swagger.client.ProgressResponseBody;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import com.squareup.okhttp.Call;
|
import com.squareup.okhttp.Call;
|
||||||
|
import com.squareup.okhttp.Interceptor;
|
||||||
|
import com.squareup.okhttp.Response;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.swagger.client.model.Pet;
|
import io.swagger.client.model.Pet;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -37,7 +43,7 @@ public class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
/* Build call for updatePet */
|
/* Build call for updatePet */
|
||||||
private Call updatePetCall(Pet body) throws ApiException {
|
private Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = body;
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
@ -62,8 +68,20 @@ public class PetApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
return apiClient.buildCall(path, "PUT", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "PUT", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +90,7 @@ public class PetApi {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
*/
|
*/
|
||||||
public void updatePet(Pet body) throws ApiException {
|
public void updatePet(Pet body) throws ApiException {
|
||||||
Call call = updatePetCall(body);
|
Call call = updatePetCall(body, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,14 +101,34 @@ public class PetApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call updatePetAsync(Pet body, ApiCallback<Void> callback) throws ApiException {
|
public Call updatePetAsync(Pet body, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = updatePetCall(body);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = updatePetCall(body, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for addPet */
|
/* Build call for addPet */
|
||||||
private Call addPetCall(Pet body) throws ApiException {
|
private Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = body;
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
@ -115,8 +153,20 @@ public class PetApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,7 +175,7 @@ public class PetApi {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
*/
|
*/
|
||||||
public void addPet(Pet body) throws ApiException {
|
public void addPet(Pet body) throws ApiException {
|
||||||
Call call = addPetCall(body);
|
Call call = addPetCall(body, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,14 +186,34 @@ public class PetApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call addPetAsync(Pet body, ApiCallback<Void> callback) throws ApiException {
|
public Call addPetAsync(Pet body, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = addPetCall(body);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = addPetCall(body, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for findPetsByStatus */
|
/* Build call for findPetsByStatus */
|
||||||
private Call findPetsByStatusCall(List<String> status) throws ApiException {
|
private Call findPetsByStatusCall(List<String> status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
@ -170,8 +240,20 @@ public class PetApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,7 +263,7 @@ public class PetApi {
|
|||||||
* @return List<Pet>
|
* @return List<Pet>
|
||||||
*/
|
*/
|
||||||
public List<Pet> findPetsByStatus(List<String> status) throws ApiException {
|
public List<Pet> findPetsByStatus(List<String> status) throws ApiException {
|
||||||
Call call = findPetsByStatusCall(status);
|
Call call = findPetsByStatusCall(status, null, null);
|
||||||
Type returnType = new TypeToken<List<Pet>>(){}.getType();
|
Type returnType = new TypeToken<List<Pet>>(){}.getType();
|
||||||
return apiClient.execute(call, returnType);
|
return apiClient.execute(call, returnType);
|
||||||
}
|
}
|
||||||
@ -193,15 +275,35 @@ public class PetApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call findPetsByStatusAsync(List<String> status, ApiCallback<List<Pet>> callback) throws ApiException {
|
public Call findPetsByStatusAsync(List<String> status, final ApiCallback<List<Pet>> callback) throws ApiException {
|
||||||
Call call = findPetsByStatusCall(status);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = findPetsByStatusCall(status, progressListener, progressRequestListener);
|
||||||
Type returnType = new TypeToken<List<Pet>>(){}.getType();
|
Type returnType = new TypeToken<List<Pet>>(){}.getType();
|
||||||
apiClient.executeAsync(call, returnType, callback);
|
apiClient.executeAsync(call, returnType, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for findPetsByTags */
|
/* Build call for findPetsByTags */
|
||||||
private Call findPetsByTagsCall(List<String> tags) throws ApiException {
|
private Call findPetsByTagsCall(List<String> tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
@ -228,8 +330,20 @@ public class PetApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,7 +353,7 @@ public class PetApi {
|
|||||||
* @return List<Pet>
|
* @return List<Pet>
|
||||||
*/
|
*/
|
||||||
public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
|
public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
|
||||||
Call call = findPetsByTagsCall(tags);
|
Call call = findPetsByTagsCall(tags, null, null);
|
||||||
Type returnType = new TypeToken<List<Pet>>(){}.getType();
|
Type returnType = new TypeToken<List<Pet>>(){}.getType();
|
||||||
return apiClient.execute(call, returnType);
|
return apiClient.execute(call, returnType);
|
||||||
}
|
}
|
||||||
@ -251,15 +365,35 @@ public class PetApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call findPetsByTagsAsync(List<String> tags, ApiCallback<List<Pet>> callback) throws ApiException {
|
public Call findPetsByTagsAsync(List<String> tags, final ApiCallback<List<Pet>> callback) throws ApiException {
|
||||||
Call call = findPetsByTagsCall(tags);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener);
|
||||||
Type returnType = new TypeToken<List<Pet>>(){}.getType();
|
Type returnType = new TypeToken<List<Pet>>(){}.getType();
|
||||||
apiClient.executeAsync(call, returnType, callback);
|
apiClient.executeAsync(call, returnType, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for getPetById */
|
/* Build call for getPetById */
|
||||||
private Call getPetByIdCall(Long petId) throws ApiException {
|
private Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'petId' is set
|
// verify the required parameter 'petId' is set
|
||||||
@ -290,8 +424,20 @@ public class PetApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "api_key" };
|
String[] authNames = new String[] { "api_key" };
|
||||||
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -301,7 +447,7 @@ public class PetApi {
|
|||||||
* @return Pet
|
* @return Pet
|
||||||
*/
|
*/
|
||||||
public Pet getPetById(Long petId) throws ApiException {
|
public Pet getPetById(Long petId) throws ApiException {
|
||||||
Call call = getPetByIdCall(petId);
|
Call call = getPetByIdCall(petId, null, null);
|
||||||
Type returnType = new TypeToken<Pet>(){}.getType();
|
Type returnType = new TypeToken<Pet>(){}.getType();
|
||||||
return apiClient.execute(call, returnType);
|
return apiClient.execute(call, returnType);
|
||||||
}
|
}
|
||||||
@ -313,15 +459,35 @@ public class PetApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call getPetByIdAsync(Long petId, ApiCallback<Pet> callback) throws ApiException {
|
public Call getPetByIdAsync(Long petId, final ApiCallback<Pet> callback) throws ApiException {
|
||||||
Call call = getPetByIdCall(petId);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = getPetByIdCall(petId, progressListener, progressRequestListener);
|
||||||
Type returnType = new TypeToken<Pet>(){}.getType();
|
Type returnType = new TypeToken<Pet>(){}.getType();
|
||||||
apiClient.executeAsync(call, returnType, callback);
|
apiClient.executeAsync(call, returnType, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for updatePetWithForm */
|
/* Build call for updatePetWithForm */
|
||||||
private Call updatePetWithFormCall(String petId, String name, String status) throws ApiException {
|
private Call updatePetWithFormCall(String petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'petId' is set
|
// verify the required parameter 'petId' is set
|
||||||
@ -356,8 +522,20 @@ public class PetApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -368,7 +546,7 @@ public class PetApi {
|
|||||||
* @param status Updated status of the pet
|
* @param status Updated status of the pet
|
||||||
*/
|
*/
|
||||||
public void updatePetWithForm(String petId, String name, String status) throws ApiException {
|
public void updatePetWithForm(String petId, String name, String status) throws ApiException {
|
||||||
Call call = updatePetWithFormCall(petId, name, status);
|
Call call = updatePetWithFormCall(petId, name, status, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,14 +559,34 @@ public class PetApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call updatePetWithFormAsync(String petId, String name, String status, ApiCallback<Void> callback) throws ApiException {
|
public Call updatePetWithFormAsync(String petId, String name, String status, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = updatePetWithFormCall(petId, name, status);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for deletePet */
|
/* Build call for deletePet */
|
||||||
private Call deletePetCall(Long petId, String apiKey) throws ApiException {
|
private Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'petId' is set
|
// verify the required parameter 'petId' is set
|
||||||
@ -421,8 +619,20 @@ public class PetApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
return apiClient.buildCall(path, "DELETE", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "DELETE", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -432,7 +642,7 @@ public class PetApi {
|
|||||||
* @param apiKey
|
* @param apiKey
|
||||||
*/
|
*/
|
||||||
public void deletePet(Long petId, String apiKey) throws ApiException {
|
public void deletePet(Long petId, String apiKey) throws ApiException {
|
||||||
Call call = deletePetCall(petId, apiKey);
|
Call call = deletePetCall(petId, apiKey, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,14 +654,34 @@ public class PetApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call deletePetAsync(Long petId, String apiKey, ApiCallback<Void> callback) throws ApiException {
|
public Call deletePetAsync(Long petId, String apiKey, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = deletePetCall(petId, apiKey);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for uploadFile */
|
/* Build call for uploadFile */
|
||||||
private Call uploadFileCall(Long petId, String additionalMetadata, File file) throws ApiException {
|
private Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'petId' is set
|
// verify the required parameter 'petId' is set
|
||||||
@ -486,8 +716,20 @@ public class PetApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -498,7 +740,7 @@ public class PetApi {
|
|||||||
* @param file file to upload
|
* @param file file to upload
|
||||||
*/
|
*/
|
||||||
public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
|
public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
|
||||||
Call call = uploadFileCall(petId, additionalMetadata, file);
|
Call call = uploadFileCall(petId, additionalMetadata, file, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,8 +753,28 @@ public class PetApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call uploadFileAsync(Long petId, String additionalMetadata, File file, ApiCallback<Void> callback) throws ApiException {
|
public Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = uploadFileCall(petId, additionalMetadata, file);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,16 @@ import io.swagger.client.ApiClient;
|
|||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import io.swagger.client.Configuration;
|
import io.swagger.client.Configuration;
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
import io.swagger.client.ProgressRequestBody;
|
||||||
|
import io.swagger.client.ProgressResponseBody;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import com.squareup.okhttp.Call;
|
import com.squareup.okhttp.Call;
|
||||||
|
import com.squareup.okhttp.Interceptor;
|
||||||
|
import com.squareup.okhttp.Response;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import io.swagger.client.model.Order;
|
import io.swagger.client.model.Order;
|
||||||
@ -37,7 +43,7 @@ public class StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
/* Build call for getInventory */
|
/* Build call for getInventory */
|
||||||
private Call getInventoryCall() throws ApiException {
|
private Call getInventoryCall(, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
@ -62,8 +68,20 @@ public class StoreApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { "api_key" };
|
String[] authNames = new String[] { "api_key" };
|
||||||
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +90,7 @@ public class StoreApi {
|
|||||||
* @return Map<String, Integer>
|
* @return Map<String, Integer>
|
||||||
*/
|
*/
|
||||||
public Map<String, Integer> getInventory() throws ApiException {
|
public Map<String, Integer> getInventory() throws ApiException {
|
||||||
Call call = getInventoryCall();
|
Call call = getInventoryCall(, null, null);
|
||||||
Type returnType = new TypeToken<Map<String, Integer>>(){}.getType();
|
Type returnType = new TypeToken<Map<String, Integer>>(){}.getType();
|
||||||
return apiClient.execute(call, returnType);
|
return apiClient.execute(call, returnType);
|
||||||
}
|
}
|
||||||
@ -83,15 +101,35 @@ public class StoreApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call getInventoryAsync(ApiCallback<Map<String, Integer>> callback) throws ApiException {
|
public Call getInventoryAsync(final ApiCallback<Map<String, Integer>> callback) throws ApiException {
|
||||||
Call call = getInventoryCall();
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = getInventoryCall(, progressListener, progressRequestListener);
|
||||||
Type returnType = new TypeToken<Map<String, Integer>>(){}.getType();
|
Type returnType = new TypeToken<Map<String, Integer>>(){}.getType();
|
||||||
apiClient.executeAsync(call, returnType, callback);
|
apiClient.executeAsync(call, returnType, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for placeOrder */
|
/* Build call for placeOrder */
|
||||||
private Call placeOrderCall(Order body) throws ApiException {
|
private Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = body;
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
@ -116,8 +154,20 @@ public class StoreApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,7 +177,7 @@ public class StoreApi {
|
|||||||
* @return Order
|
* @return Order
|
||||||
*/
|
*/
|
||||||
public Order placeOrder(Order body) throws ApiException {
|
public Order placeOrder(Order body) throws ApiException {
|
||||||
Call call = placeOrderCall(body);
|
Call call = placeOrderCall(body, null, null);
|
||||||
Type returnType = new TypeToken<Order>(){}.getType();
|
Type returnType = new TypeToken<Order>(){}.getType();
|
||||||
return apiClient.execute(call, returnType);
|
return apiClient.execute(call, returnType);
|
||||||
}
|
}
|
||||||
@ -139,15 +189,35 @@ public class StoreApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call placeOrderAsync(Order body, ApiCallback<Order> callback) throws ApiException {
|
public Call placeOrderAsync(Order body, final ApiCallback<Order> callback) throws ApiException {
|
||||||
Call call = placeOrderCall(body);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = placeOrderCall(body, progressListener, progressRequestListener);
|
||||||
Type returnType = new TypeToken<Order>(){}.getType();
|
Type returnType = new TypeToken<Order>(){}.getType();
|
||||||
apiClient.executeAsync(call, returnType, callback);
|
apiClient.executeAsync(call, returnType, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for getOrderById */
|
/* Build call for getOrderById */
|
||||||
private Call getOrderByIdCall(String orderId) throws ApiException {
|
private Call getOrderByIdCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'orderId' is set
|
// verify the required parameter 'orderId' is set
|
||||||
@ -178,8 +248,20 @@ public class StoreApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -189,7 +271,7 @@ public class StoreApi {
|
|||||||
* @return Order
|
* @return Order
|
||||||
*/
|
*/
|
||||||
public Order getOrderById(String orderId) throws ApiException {
|
public Order getOrderById(String orderId) throws ApiException {
|
||||||
Call call = getOrderByIdCall(orderId);
|
Call call = getOrderByIdCall(orderId, null, null);
|
||||||
Type returnType = new TypeToken<Order>(){}.getType();
|
Type returnType = new TypeToken<Order>(){}.getType();
|
||||||
return apiClient.execute(call, returnType);
|
return apiClient.execute(call, returnType);
|
||||||
}
|
}
|
||||||
@ -201,15 +283,35 @@ public class StoreApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call getOrderByIdAsync(String orderId, ApiCallback<Order> callback) throws ApiException {
|
public Call getOrderByIdAsync(String orderId, final ApiCallback<Order> callback) throws ApiException {
|
||||||
Call call = getOrderByIdCall(orderId);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener);
|
||||||
Type returnType = new TypeToken<Order>(){}.getType();
|
Type returnType = new TypeToken<Order>(){}.getType();
|
||||||
apiClient.executeAsync(call, returnType, callback);
|
apiClient.executeAsync(call, returnType, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for deleteOrder */
|
/* Build call for deleteOrder */
|
||||||
private Call deleteOrderCall(String orderId) throws ApiException {
|
private Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'orderId' is set
|
// verify the required parameter 'orderId' is set
|
||||||
@ -240,8 +342,20 @@ public class StoreApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "DELETE", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "DELETE", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,7 +364,7 @@ public class StoreApi {
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
*/
|
*/
|
||||||
public void deleteOrder(String orderId) throws ApiException {
|
public void deleteOrder(String orderId) throws ApiException {
|
||||||
Call call = deleteOrderCall(orderId);
|
Call call = deleteOrderCall(orderId, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,8 +375,28 @@ public class StoreApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call deleteOrderAsync(String orderId, ApiCallback<Void> callback) throws ApiException {
|
public Call deleteOrderAsync(String orderId, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = deleteOrderCall(orderId);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = deleteOrderCall(orderId, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,16 @@ import io.swagger.client.ApiClient;
|
|||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import io.swagger.client.Configuration;
|
import io.swagger.client.Configuration;
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
import io.swagger.client.ProgressRequestBody;
|
||||||
|
import io.swagger.client.ProgressResponseBody;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import com.squareup.okhttp.Call;
|
import com.squareup.okhttp.Call;
|
||||||
|
import com.squareup.okhttp.Interceptor;
|
||||||
|
import com.squareup.okhttp.Response;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.swagger.client.model.User;
|
import io.swagger.client.model.User;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -37,7 +43,7 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
/* Build call for createUser */
|
/* Build call for createUser */
|
||||||
private Call createUserCall(User body) throws ApiException {
|
private Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = body;
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
@ -62,8 +68,20 @@ public class UserApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +90,7 @@ public class UserApi {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
*/
|
*/
|
||||||
public void createUser(User body) throws ApiException {
|
public void createUser(User body) throws ApiException {
|
||||||
Call call = createUserCall(body);
|
Call call = createUserCall(body, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,14 +101,34 @@ public class UserApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call createUserAsync(User body, ApiCallback<Void> callback) throws ApiException {
|
public Call createUserAsync(User body, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = createUserCall(body);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = createUserCall(body, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for createUsersWithArrayInput */
|
/* Build call for createUsersWithArrayInput */
|
||||||
private Call createUsersWithArrayInputCall(List<User> body) throws ApiException {
|
private Call createUsersWithArrayInputCall(List<User> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = body;
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
@ -115,8 +153,20 @@ public class UserApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,7 +175,7 @@ public class UserApi {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
*/
|
*/
|
||||||
public void createUsersWithArrayInput(List<User> body) throws ApiException {
|
public void createUsersWithArrayInput(List<User> body) throws ApiException {
|
||||||
Call call = createUsersWithArrayInputCall(body);
|
Call call = createUsersWithArrayInputCall(body, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,14 +186,34 @@ public class UserApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call createUsersWithArrayInputAsync(List<User> body, ApiCallback<Void> callback) throws ApiException {
|
public Call createUsersWithArrayInputAsync(List<User> body, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = createUsersWithArrayInputCall(body);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for createUsersWithListInput */
|
/* Build call for createUsersWithListInput */
|
||||||
private Call createUsersWithListInputCall(List<User> body) throws ApiException {
|
private Call createUsersWithListInputCall(List<User> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = body;
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
@ -168,8 +238,20 @@ public class UserApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,7 +260,7 @@ public class UserApi {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
*/
|
*/
|
||||||
public void createUsersWithListInput(List<User> body) throws ApiException {
|
public void createUsersWithListInput(List<User> body) throws ApiException {
|
||||||
Call call = createUsersWithListInputCall(body);
|
Call call = createUsersWithListInputCall(body, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,14 +271,34 @@ public class UserApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call createUsersWithListInputAsync(List<User> body, ApiCallback<Void> callback) throws ApiException {
|
public Call createUsersWithListInputAsync(List<User> body, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = createUsersWithListInputCall(body);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for loginUser */
|
/* Build call for loginUser */
|
||||||
private Call loginUserCall(String username, String password) throws ApiException {
|
private Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
@ -225,8 +327,20 @@ public class UserApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -237,7 +351,7 @@ public class UserApi {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String loginUser(String username, String password) throws ApiException {
|
public String loginUser(String username, String password) throws ApiException {
|
||||||
Call call = loginUserCall(username, password);
|
Call call = loginUserCall(username, password, null, null);
|
||||||
Type returnType = new TypeToken<String>(){}.getType();
|
Type returnType = new TypeToken<String>(){}.getType();
|
||||||
return apiClient.execute(call, returnType);
|
return apiClient.execute(call, returnType);
|
||||||
}
|
}
|
||||||
@ -250,15 +364,35 @@ public class UserApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call loginUserAsync(String username, String password, ApiCallback<String> callback) throws ApiException {
|
public Call loginUserAsync(String username, String password, final ApiCallback<String> callback) throws ApiException {
|
||||||
Call call = loginUserCall(username, password);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = loginUserCall(username, password, progressListener, progressRequestListener);
|
||||||
Type returnType = new TypeToken<String>(){}.getType();
|
Type returnType = new TypeToken<String>(){}.getType();
|
||||||
apiClient.executeAsync(call, returnType, callback);
|
apiClient.executeAsync(call, returnType, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for logoutUser */
|
/* Build call for logoutUser */
|
||||||
private Call logoutUserCall() throws ApiException {
|
private Call logoutUserCall(, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
@ -283,8 +417,20 @@ public class UserApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -292,7 +438,7 @@ public class UserApi {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void logoutUser() throws ApiException {
|
public void logoutUser() throws ApiException {
|
||||||
Call call = logoutUserCall();
|
Call call = logoutUserCall(, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,14 +448,34 @@ public class UserApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call logoutUserAsync(ApiCallback<Void> callback) throws ApiException {
|
public Call logoutUserAsync(final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = logoutUserCall();
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = logoutUserCall(, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for getUserByName */
|
/* Build call for getUserByName */
|
||||||
private Call getUserByNameCall(String username) throws ApiException {
|
private Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'username' is set
|
// verify the required parameter 'username' is set
|
||||||
@ -340,8 +506,20 @@ public class UserApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -351,7 +529,7 @@ public class UserApi {
|
|||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public User getUserByName(String username) throws ApiException {
|
public User getUserByName(String username) throws ApiException {
|
||||||
Call call = getUserByNameCall(username);
|
Call call = getUserByNameCall(username, null, null);
|
||||||
Type returnType = new TypeToken<User>(){}.getType();
|
Type returnType = new TypeToken<User>(){}.getType();
|
||||||
return apiClient.execute(call, returnType);
|
return apiClient.execute(call, returnType);
|
||||||
}
|
}
|
||||||
@ -363,15 +541,35 @@ public class UserApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call getUserByNameAsync(String username, ApiCallback<User> callback) throws ApiException {
|
public Call getUserByNameAsync(String username, final ApiCallback<User> callback) throws ApiException {
|
||||||
Call call = getUserByNameCall(username);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = getUserByNameCall(username, progressListener, progressRequestListener);
|
||||||
Type returnType = new TypeToken<User>(){}.getType();
|
Type returnType = new TypeToken<User>(){}.getType();
|
||||||
apiClient.executeAsync(call, returnType, callback);
|
apiClient.executeAsync(call, returnType, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for updateUser */
|
/* Build call for updateUser */
|
||||||
private Call updateUserCall(String username, User body) throws ApiException {
|
private Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = body;
|
Object postBody = body;
|
||||||
|
|
||||||
// verify the required parameter 'username' is set
|
// verify the required parameter 'username' is set
|
||||||
@ -402,8 +600,20 @@ public class UserApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "PUT", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "PUT", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -413,7 +623,7 @@ public class UserApi {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
*/
|
*/
|
||||||
public void updateUser(String username, User body) throws ApiException {
|
public void updateUser(String username, User body) throws ApiException {
|
||||||
Call call = updateUserCall(username, body);
|
Call call = updateUserCall(username, body, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,14 +635,34 @@ public class UserApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call updateUserAsync(String username, User body, ApiCallback<Void> callback) throws ApiException {
|
public Call updateUserAsync(String username, User body, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = updateUserCall(username, body);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = updateUserCall(username, body, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build call for deleteUser */
|
/* Build call for deleteUser */
|
||||||
private Call deleteUserCall(String username) throws ApiException {
|
private Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'username' is set
|
// verify the required parameter 'username' is set
|
||||||
@ -463,8 +693,20 @@ public class UserApi {
|
|||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
headerParams.put("Content-Type", contentType);
|
headerParams.put("Content-Type", contentType);
|
||||||
|
|
||||||
|
if(progressListener != null) {
|
||||||
|
apiClient.getHttpClient().networkInterceptors().add(new Interceptor() {
|
||||||
|
@Override
|
||||||
|
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||||
|
Response originalResponse = chain.proceed(chain.request());
|
||||||
|
return originalResponse.newBuilder()
|
||||||
|
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
return apiClient.buildCall(path, "DELETE", queryParams, postBody, headerParams, formParams, authNames);
|
return apiClient.buildCall(path, "DELETE", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -473,7 +715,7 @@ public class UserApi {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
*/
|
*/
|
||||||
public void deleteUser(String username) throws ApiException {
|
public void deleteUser(String username) throws ApiException {
|
||||||
Call call = deleteUserCall(username);
|
Call call = deleteUserCall(username, null, null);
|
||||||
apiClient.execute(call);
|
apiClient.execute(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,8 +726,28 @@ public class UserApi {
|
|||||||
* @param callback The callback to be executed when the API call finishes
|
* @param callback The callback to be executed when the API call finishes
|
||||||
* @return The request call
|
* @return The request call
|
||||||
*/
|
*/
|
||||||
public Call deleteUserAsync(String username, ApiCallback<Void> callback) throws ApiException {
|
public Call deleteUserAsync(String username, final ApiCallback<Void> callback) throws ApiException {
|
||||||
Call call = deleteUserCall(username);
|
|
||||||
|
ProgressResponseBody.ProgressListener progressListener = null;
|
||||||
|
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||||
|
|
||||||
|
if(callback != null) {
|
||||||
|
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void update(long bytesRead, long contentLength, boolean done) {
|
||||||
|
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||||
|
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Call call = deleteUserCall(username, progressListener, progressRequestListener);
|
||||||
apiClient.executeAsync(call, callback);
|
apiClient.executeAsync(call, callback);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-21T19:41:14.431+08:00")
|
||||||
public class ApiKeyAuth implements Authentication {
|
public class ApiKeyAuth implements Authentication {
|
||||||
private final String location;
|
private final String location;
|
||||||
private final String paramName;
|
private final String paramName;
|
||||||
|
@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-21T19:41:14.431+08:00")
|
||||||
public interface Authentication {
|
public interface Authentication {
|
||||||
/** Apply authentication settings to header and query params. */
|
/** Apply authentication settings to header and query params. */
|
||||||
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
||||||
|
@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-02T22:14:00.422+08:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-21T19:41:14.431+08:00")
|
||||||
public class OAuth implements Authentication {
|
public class OAuth implements Authentication {
|
||||||
private String accessToken;
|
private String accessToken;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user