Merge pull request #1670 from xhh/java-api-with-http-info

Add WithHttpInfo API methods to Java okhttp-gson client
This commit is contained in:
wing328 2015-12-08 15:17:03 +08:00
commit d7fe8e5505
18 changed files with 503 additions and 124 deletions

View File

@ -232,6 +232,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
if ("okhttp-gson".equals(getLibrary())) { if ("okhttp-gson".equals(getLibrary())) {
// the "okhttp-gson" library template requires "ApiCallback.mustache" for async call // the "okhttp-gson" library template requires "ApiCallback.mustache" for async call
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java")); supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
supportingFiles.add(new SupportingFile("ProgressRequestBody.mustache", invokerFolder, "ProgressRequestBody.java")); supportingFiles.add(new SupportingFile("ProgressRequestBody.mustache", invokerFolder, "ProgressRequestBody.java"));
supportingFiles.add(new SupportingFile("ProgressResponseBody.mustache", invokerFolder, "ProgressResponseBody.java")); supportingFiles.add(new SupportingFile("ProgressResponseBody.mustache", invokerFolder, "ProgressResponseBody.java"));
// "build.sbt" is for development with SBT // "build.sbt" is for development with SBT

View File

@ -104,9 +104,6 @@ public class ApiClient {
private Map<String, Authentication> authentications; private Map<String, Authentication> authentications;
private int statusCode;
private Map<String, List<String>> responseHeaders;
private DateFormat dateFormat; private DateFormat dateFormat;
private DateFormat datetimeFormat; private DateFormat datetimeFormat;
private boolean lenientDatetimeFormat; private boolean lenientDatetimeFormat;
@ -177,24 +174,6 @@ public class ApiClient {
return this; return this;
} }
/**
* Gets the status code of the previous request.
* NOTE: Status code of last async response is not recorded here, it is
* passed to the callback methods instead.
*/
public int getStatusCode() {
return statusCode;
}
/**
* Gets the response headers of the previous request.
* NOTE: Headers of last async response is not recorded here, it is passed
* to callback methods instead.
*/
public Map<String, List<String>> getResponseHeaders() {
return responseHeaders;
}
public boolean isVerifyingSsl() { public boolean isVerifyingSsl() {
return verifyingSsl; return verifyingSsl;
} }
@ -618,6 +597,8 @@ public class ApiClient {
* @param response HTTP response * @param response HTTP response
* @param returnType The type of the Java object * @param returnType The type of the Java object
* @return The deserialized Java object * @return The deserialized Java object
* @throws ApiException If fail to deserialize response body, i.e. cannot read response body
* or the Content-Type of the response is not supported.
*/ */
public <T> T deserialize(Response response, Type returnType) throws ApiException { public <T> T deserialize(Response response, Type returnType) throws ApiException {
if (response == null || returnType == null) if (response == null || returnType == null)
@ -666,6 +647,7 @@ public class ApiClient {
* @param obj The Java object * @param obj The Java object
* @param contentType The request Content-Type * @param contentType The request Content-Type
* @return The serialized string * @return The serialized string
* @throws ApiException If fail to serialize the given object
*/ */
public String serialize(Object obj, String contentType) throws ApiException { public String serialize(Object obj, String contentType) throws ApiException {
if (contentType.startsWith("application/json")) { if (contentType.startsWith("application/json")) {
@ -680,6 +662,7 @@ public class ApiClient {
/** /**
* Download file from the given response. * Download file from the given response.
* @throws ApiException If fail to read file content from response and write to disk
*/ */
public File downloadFileFromResponse(Response response) throws ApiException { public File downloadFileFromResponse(Response response) throws ApiException {
try { try {
@ -731,7 +714,7 @@ public class ApiClient {
/** /**
* @see #execute(Call, Type) * @see #execute(Call, Type)
*/ */
public <T> T execute(Call call) throws ApiException { public <T> ApiResponse<T> execute(Call call) throws ApiException {
return execute(call, null); return execute(call, null);
} }
@ -740,14 +723,16 @@ public class ApiClient {
* *
* @param returnType The return type used to deserialize HTTP response body * @param returnType The return type used to deserialize HTTP response body
* @param <T> The return type corresponding to (same with) returnType * @param <T> The return type corresponding to (same with) returnType
* @return The Java object deserialized from response body. Returns null if returnType is null. * @return <code>ApiResponse</code> object containing response status, headers and
* data, which is a Java object deserialized from response body and would be null
* when returnType is null.
* @throws ApiException If fail to execute the call
*/ */
public <T> T execute(Call call, Type returnType) throws ApiException { public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
try { try {
Response response = call.execute(); Response response = call.execute();
this.statusCode = response.code(); T data = handleResponse(response, returnType);
this.responseHeaders = response.headers().toMultimap(); return new ApiResponse<T>(response.code(), response.headers().toMultimap(), data);
return handleResponse(response, returnType);
} catch (IOException e) { } catch (IOException e) {
throw new ApiException(e); throw new ApiException(e);
} }
@ -756,7 +741,7 @@ public class ApiClient {
/** /**
* #see executeAsync(Call, Type, ApiCallback) * #see executeAsync(Call, Type, ApiCallback)
*/ */
public <T> void executeAsync(Call call, ApiCallback<T> callback) throws ApiException { public <T> void executeAsync(Call call, ApiCallback<T> callback) {
executeAsync(call, null, callback); executeAsync(call, null, callback);
} }
@ -787,6 +772,12 @@ public class ApiClient {
}); });
} }
/**
* Handle the given response, return the deserialized object when the response is successful.
*
* @throws ApiException If the response has a unsuccessful status code or
* fail to deserialize the response body
*/
public <T> T handleResponse(Response response, Type returnType) throws ApiException { public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) { if (response.isSuccessful()) {
if (returnType == null || response.code() == 204) { if (returnType == null || response.code() == 204) {
@ -820,6 +811,7 @@ public class ApiClient {
* @param formParams The form parameters * @param formParams The form parameters
* @param authNames The authentications to apply * @param authNames The authentications to apply
* @return The HTTP call * @return The HTTP call
* @throws ApiException If fail to serialize the request body object
*/ */
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 { 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);

View File

@ -0,0 +1,46 @@
package {{invokerPackage}};
import java.util.List;
import java.util.Map;
/**
* API response returned by API call.
*
* @param T The type of data that is deserialized from response body
*/
public class ApiResponse<T> {
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;
this.data = data;
}
public int getStatusCode() {
return statusCode;
}
public Map<String, List<String>> getHeaders() {
return headers;
}
public T getData() {
return data;
}
}

View File

@ -3,6 +3,7 @@ package {{package}};
import {{invokerPackage}}.ApiCallback; import {{invokerPackage}}.ApiCallback;
import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.ApiClient;
import {{invokerPackage}}.ApiException; import {{invokerPackage}}.ApiException;
import {{invokerPackage}}.ApiResponse;
import {{invokerPackage}}.Configuration; import {{invokerPackage}}.Configuration;
import {{invokerPackage}}.Pair; import {{invokerPackage}}.Pair;
import {{invokerPackage}}.ProgressRequestBody; import {{invokerPackage}}.ProgressRequestBody;
@ -104,11 +105,24 @@ public class {{classname}} {
* {{notes}}{{#allParams}} * {{notes}}{{#allParams}}
* @param {{paramName}} {{description}}{{/allParams}}{{#returnType}} * @param {{paramName}} {{description}}{{/allParams}}{{#returnType}}
* @return {{{returnType}}}{{/returnType}} * @return {{{returnType}}}{{/returnType}}
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
{{#returnType}}ApiResponse<{{{returnType}}}> {{localVariablePrefix}}resp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
return {{localVariablePrefix}}resp.getData();{{/returnType}}
}
/**
* {{summary}}
* {{notes}}{{#allParams}}
* @param {{paramName}} {{description}}{{/allParams}}
* @return ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}null, null); Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}null, null);
{{#returnType}}Type {{localVariablePrefix}}returnType = new TypeToken<{{{returnType}}}>(){}.getType(); {{#returnType}}Type {{localVariablePrefix}}returnType = new TypeToken<{{{returnType}}}>(){}.getType();
return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call, {{localVariablePrefix}}returnType);{{/returnType}}{{^returnType}}{{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call);{{/returnType}} return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call, {{localVariablePrefix}}returnType);{{/returnType}}{{^returnType}}return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call);{{/returnType}}
} }
/** /**
@ -117,6 +131,7 @@ public class {{classname}} {
* @param {{paramName}} {{description}}{{/allParams}} * @param {{paramName}} {{description}}{{/allParams}}
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException { public Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException {

View File

@ -104,9 +104,6 @@ public class ApiClient {
private Map<String, Authentication> authentications; private Map<String, Authentication> authentications;
private int statusCode;
private Map<String, List<String>> responseHeaders;
private DateFormat dateFormat; private DateFormat dateFormat;
private DateFormat datetimeFormat; private DateFormat datetimeFormat;
private boolean lenientDatetimeFormat; private boolean lenientDatetimeFormat;
@ -143,8 +140,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("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("petstore_auth", new OAuth()); authentications.put("petstore_auth", new OAuth());
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }
@ -176,24 +173,6 @@ public class ApiClient {
return this; return this;
} }
/**
* Gets the status code of the previous request.
* NOTE: Status code of last async response is not recorded here, it is
* passed to the callback methods instead.
*/
public int getStatusCode() {
return statusCode;
}
/**
* Gets the response headers of the previous request.
* NOTE: Headers of last async response is not recorded here, it is passed
* to callback methods instead.
*/
public Map<String, List<String>> getResponseHeaders() {
return responseHeaders;
}
public boolean isVerifyingSsl() { public boolean isVerifyingSsl() {
return verifyingSsl; return verifyingSsl;
} }
@ -617,6 +596,8 @@ public class ApiClient {
* @param response HTTP response * @param response HTTP response
* @param returnType The type of the Java object * @param returnType The type of the Java object
* @return The deserialized Java object * @return The deserialized Java object
* @throws ApiException If fail to deserialize response body, i.e. cannot read response body
* or the Content-Type of the response is not supported.
*/ */
public <T> T deserialize(Response response, Type returnType) throws ApiException { public <T> T deserialize(Response response, Type returnType) throws ApiException {
if (response == null || returnType == null) if (response == null || returnType == null)
@ -665,6 +646,7 @@ public class ApiClient {
* @param obj The Java object * @param obj The Java object
* @param contentType The request Content-Type * @param contentType The request Content-Type
* @return The serialized string * @return The serialized string
* @throws ApiException If fail to serialize the given object
*/ */
public String serialize(Object obj, String contentType) throws ApiException { public String serialize(Object obj, String contentType) throws ApiException {
if (contentType.startsWith("application/json")) { if (contentType.startsWith("application/json")) {
@ -679,6 +661,7 @@ public class ApiClient {
/** /**
* Download file from the given response. * Download file from the given response.
* @throws ApiException If fail to read file content from response and write to disk
*/ */
public File downloadFileFromResponse(Response response) throws ApiException { public File downloadFileFromResponse(Response response) throws ApiException {
try { try {
@ -730,7 +713,7 @@ public class ApiClient {
/** /**
* @see #execute(Call, Type) * @see #execute(Call, Type)
*/ */
public <T> T execute(Call call) throws ApiException { public <T> ApiResponse<T> execute(Call call) throws ApiException {
return execute(call, null); return execute(call, null);
} }
@ -739,14 +722,16 @@ public class ApiClient {
* *
* @param returnType The return type used to deserialize HTTP response body * @param returnType The return type used to deserialize HTTP response body
* @param <T> The return type corresponding to (same with) returnType * @param <T> The return type corresponding to (same with) returnType
* @return The Java object deserialized from response body. Returns null if returnType is null. * @return <code>ApiResponse</code> object containing response status, headers and
* data, which is a Java object deserialized from response body and would be null
* when returnType is null.
* @throws ApiException If fail to execute the call
*/ */
public <T> T execute(Call call, Type returnType) throws ApiException { public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
try { try {
Response response = call.execute(); Response response = call.execute();
this.statusCode = response.code(); T data = handleResponse(response, returnType);
this.responseHeaders = response.headers().toMultimap(); return new ApiResponse<T>(response.code(), response.headers().toMultimap(), data);
return handleResponse(response, returnType);
} catch (IOException e) { } catch (IOException e) {
throw new ApiException(e); throw new ApiException(e);
} }
@ -755,7 +740,7 @@ public class ApiClient {
/** /**
* #see executeAsync(Call, Type, ApiCallback) * #see executeAsync(Call, Type, ApiCallback)
*/ */
public <T> void executeAsync(Call call, ApiCallback<T> callback) throws ApiException { public <T> void executeAsync(Call call, ApiCallback<T> callback) {
executeAsync(call, null, callback); executeAsync(call, null, callback);
} }
@ -786,6 +771,12 @@ public class ApiClient {
}); });
} }
/**
* Handle the given response, return the deserialized object when the response is successful.
*
* @throws ApiException If the response has a unsuccessful status code or
* fail to deserialize the response body
*/
public <T> T handleResponse(Response response, Type returnType) throws ApiException { public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) { if (response.isSuccessful()) {
if (returnType == null || response.code() == 204) { if (returnType == null || response.code() == 204) {
@ -819,6 +810,7 @@ public class ApiClient {
* @param formParams The form parameters * @param formParams The form parameters
* @param authNames The authentications to apply * @param authNames The authentications to apply
* @return The HTTP call * @return The HTTP call
* @throws ApiException If fail to serialize the request body object
*/ */
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 { 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);

View File

@ -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-11-29T00:18:08.052+08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+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;

View File

@ -0,0 +1,46 @@
package io.swagger.client;
import java.util.List;
import java.util.Map;
/**
* API response returned by API call.
*
* @param T The type of data that is deserialized from response body
*/
public class ApiResponse<T> {
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;
this.data = data;
}
public int getStatusCode() {
return statusCode;
}
public Map<String, List<String>> getHeaders() {
return headers;
}
public T getData() {
return data;
}
}

View File

@ -1,6 +1,6 @@
package io.swagger.client; package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class Configuration { public class Configuration {
private static ApiClient defaultApiClient = new ApiClient(); private static ApiClient defaultApiClient = new ApiClient();

View File

@ -1,6 +1,6 @@
package io.swagger.client; package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class Pair { public class Pair {
private String name = ""; private String name = "";
private String value = ""; private String value = "";

View File

@ -1,6 +1,6 @@
package io.swagger.client; package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+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).

View File

@ -3,6 +3,7 @@ package io.swagger.client.api;
import io.swagger.client.ApiCallback; import io.swagger.client.ApiCallback;
import io.swagger.client.ApiClient; import io.swagger.client.ApiClient;
import io.swagger.client.ApiException; import io.swagger.client.ApiException;
import io.swagger.client.ApiResponse;
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.ProgressRequestBody;
@ -88,10 +89,22 @@ public class PetApi {
* Update an existing pet * Update an existing pet
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void updatePet(Pet body) throws ApiException { public void updatePet(Pet body) throws ApiException {
updatePetWithHttpInfo(body);
}
/**
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updatePetWithHttpInfo(Pet body) throws ApiException {
Call call = updatePetCall(body, null, null); Call call = updatePetCall(body, null, null);
apiClient.execute(call); return apiClient.execute(call);
} }
/** /**
@ -100,13 +113,14 @@ 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
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call updatePetAsync(Pet body, final ApiCallback<Void> callback) throws ApiException { public Call updatePetAsync(Pet body, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -173,10 +187,22 @@ public class PetApi {
* Add a new pet to the store * Add a new pet to the store
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void addPet(Pet body) throws ApiException { public void addPet(Pet body) throws ApiException {
addPetWithHttpInfo(body);
}
/**
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> addPetWithHttpInfo(Pet body) throws ApiException {
Call call = addPetCall(body, null, null); Call call = addPetCall(body, null, null);
apiClient.execute(call); return apiClient.execute(call);
} }
/** /**
@ -185,13 +211,14 @@ 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
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call addPetAsync(Pet body, final ApiCallback<Void> callback) throws ApiException { public Call addPetAsync(Pet body, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -261,8 +288,21 @@ public class PetApi {
* Multiple status values can be provided with comma seperated strings * Multiple status values can be provided with comma seperated strings
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for filter
* @return List<Pet> * @return List<Pet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public List<Pet> findPetsByStatus(List<String> status) throws ApiException { public List<Pet> findPetsByStatus(List<String> status) throws ApiException {
ApiResponse<List<Pet>> resp = findPetsByStatusWithHttpInfo(status);
return resp.getData();
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma seperated strings
* @param status Status values that need to be considered for filter
* @return ApiResponse<List<Pet>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException {
Call call = findPetsByStatusCall(status, null, null); 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);
@ -274,13 +314,14 @@ public class PetApi {
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for filter
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call findPetsByStatusAsync(List<String> status, final ApiCallback<List<Pet>> callback) throws ApiException { public Call findPetsByStatusAsync(List<String> status, final ApiCallback<List<Pet>> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -351,8 +392,21 @@ public class PetApi {
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by * @param tags Tags to filter by
* @return List<Pet> * @return List<Pet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public List<Pet> findPetsByTags(List<String> tags) throws ApiException { public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
ApiResponse<List<Pet>> resp = findPetsByTagsWithHttpInfo(tags);
return resp.getData();
}
/**
* Finds Pets by tags
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiResponse<List<Pet>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException {
Call call = findPetsByTagsCall(tags, null, null); 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);
@ -364,13 +418,14 @@ public class PetApi {
* @param tags Tags to filter by * @param tags Tags to filter by
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call findPetsByTagsAsync(List<String> tags, final ApiCallback<List<Pet>> callback) throws ApiException { public Call findPetsByTagsAsync(List<String> tags, final ApiCallback<List<Pet>> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -445,8 +500,21 @@ public class PetApi {
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions * Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched * @param petId ID of pet that needs to be fetched
* @return Pet * @return Pet
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public Pet getPetById(Long petId) throws ApiException { public Pet getPetById(Long petId) throws ApiException {
ApiResponse<Pet> resp = getPetByIdWithHttpInfo(petId);
return resp.getData();
}
/**
* Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* @return ApiResponse<Pet>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException {
Call call = getPetByIdCall(petId, null, null); 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);
@ -458,13 +526,14 @@ public class PetApi {
* @param petId ID of pet that needs to be fetched * @param petId ID of pet that needs to be fetched
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call getPetByIdAsync(Long petId, final ApiCallback<Pet> callback) throws ApiException { public Call getPetByIdAsync(Long petId, final ApiCallback<Pet> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -487,7 +556,7 @@ public class PetApi {
} }
/* Build call for updatePetWithForm */ /* Build call for updatePetWithForm */
private Call updatePetWithFormCall(String petId,String name,String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { private Call updatePetWithFormCall(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
@ -544,10 +613,24 @@ public class PetApi {
* @param petId ID of pet that needs to be updated * @param petId ID of pet that needs to be updated
* @param name Updated name of the pet * @param name Updated name of the pet
* @param status Updated status of the pet * @param status Updated status of the pet
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void updatePetWithForm(String petId, String name, String status) throws ApiException { public void updatePetWithForm(String petId, String name, String status) throws ApiException {
Call call = updatePetWithFormCall(petId,name,status, null, null); updatePetWithFormWithHttpInfo(petId, name, status);
apiClient.execute(call); }
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet
* @param status Updated status of the pet
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updatePetWithFormWithHttpInfo(String petId, String name, String status) throws ApiException {
Call call = updatePetWithFormCall(petId, name, status, null, null);
return apiClient.execute(call);
} }
/** /**
@ -558,13 +641,14 @@ public class PetApi {
* @param status Updated status of the pet * @param status Updated status of the pet
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call updatePetWithFormAsync(String petId, String name, String status, final ApiCallback<Void> callback) throws ApiException { public Call updatePetWithFormAsync(String petId, String name, String status, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -580,13 +664,13 @@ public class PetApi {
}; };
} }
Call call = updatePetWithFormCall(petId,name,status, progressListener, progressRequestListener); 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, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) 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
@ -640,10 +724,23 @@ public class PetApi {
* *
* @param petId Pet id to delete * @param petId Pet id to delete
* @param apiKey * @param apiKey
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void deletePet(Long petId, String apiKey) throws ApiException { public void deletePet(Long petId, String apiKey) throws ApiException {
Call call = deletePetCall(petId,apiKey, null, null); deletePetWithHttpInfo(petId, apiKey);
apiClient.execute(call); }
/**
* Deletes a pet
*
* @param petId Pet id to delete
* @param apiKey
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException {
Call call = deletePetCall(petId, apiKey, null, null);
return apiClient.execute(call);
} }
/** /**
@ -653,13 +750,14 @@ public class PetApi {
* @param apiKey * @param apiKey
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call deletePetAsync(Long petId, String apiKey, final ApiCallback<Void> callback) throws ApiException { public Call deletePetAsync(Long petId, String apiKey, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -675,13 +773,13 @@ public class PetApi {
}; };
} }
Call call = deletePetCall(petId,apiKey, progressListener, progressRequestListener); 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, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) 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
@ -738,10 +836,24 @@ public class PetApi {
* @param petId ID of pet to update * @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server * @param additionalMetadata Additional data to pass to server
* @param file file to upload * @param file file to upload
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { public void uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
Call call = uploadFileCall(petId,additionalMetadata,file, null, null); uploadFileWithHttpInfo(petId, additionalMetadata, file);
apiClient.execute(call); }
/**
* uploads an image
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException {
Call call = uploadFileCall(petId, additionalMetadata, file, null, null);
return apiClient.execute(call);
} }
/** /**
@ -752,13 +864,14 @@ public class PetApi {
* @param file file to upload * @param file file to upload
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback<Void> callback) throws ApiException { public Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -774,7 +887,7 @@ public class PetApi {
}; };
} }
Call call = uploadFileCall(petId,additionalMetadata,file, progressListener, progressRequestListener); Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback); apiClient.executeAsync(call, callback);
return call; return call;
} }

View File

@ -3,6 +3,7 @@ package io.swagger.client.api;
import io.swagger.client.ApiCallback; import io.swagger.client.ApiCallback;
import io.swagger.client.ApiClient; import io.swagger.client.ApiClient;
import io.swagger.client.ApiException; import io.swagger.client.ApiException;
import io.swagger.client.ApiResponse;
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.ProgressRequestBody;
@ -43,7 +44,7 @@ public class StoreApi {
/* Build call for getInventory */ /* Build call for getInventory */
private Call getInventoryCall( final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { private Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object postBody = null; Object postBody = null;
@ -88,9 +89,21 @@ public class StoreApi {
* Returns pet inventories by status * Returns pet inventories by status
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
* @return Map<String, Integer> * @return Map<String, Integer>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public Map<String, Integer> getInventory() throws ApiException { public Map<String, Integer> getInventory() throws ApiException {
Call call = getInventoryCall( null, null); ApiResponse<Map<String, Integer>> resp = getInventoryWithHttpInfo();
return resp.getData();
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiResponse<Map<String, Integer>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException {
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);
} }
@ -100,13 +113,14 @@ public class StoreApi {
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call getInventoryAsync(final ApiCallback<Map<String, Integer>> callback) throws ApiException { public Call getInventoryAsync(final ApiCallback<Map<String, Integer>> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -122,7 +136,7 @@ public class StoreApi {
}; };
} }
Call call = getInventoryCall( progressListener, progressRequestListener); 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;
@ -175,8 +189,21 @@ public class StoreApi {
* *
* @param body order placed for purchasing the pet * @param body order placed for purchasing the pet
* @return Order * @return Order
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public Order placeOrder(Order body) throws ApiException { public Order placeOrder(Order body) throws ApiException {
ApiResponse<Order> resp = placeOrderWithHttpInfo(body);
return resp.getData();
}
/**
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiResponse<Order>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Order> placeOrderWithHttpInfo(Order body) throws ApiException {
Call call = placeOrderCall(body, null, null); 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);
@ -188,13 +215,14 @@ public class StoreApi {
* @param body order placed for purchasing the pet * @param body order placed for purchasing the pet
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call placeOrderAsync(Order body, final ApiCallback<Order> callback) throws ApiException { public Call placeOrderAsync(Order body, final ApiCallback<Order> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -269,8 +297,21 @@ public class StoreApi {
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions * For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched * @param orderId ID of pet that needs to be fetched
* @return Order * @return Order
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public Order getOrderById(String orderId) throws ApiException { public Order getOrderById(String orderId) throws ApiException {
ApiResponse<Order> resp = getOrderByIdWithHttpInfo(orderId);
return resp.getData();
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiResponse<Order>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(String orderId) throws ApiException {
Call call = getOrderByIdCall(orderId, null, null); 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);
@ -282,13 +323,14 @@ public class StoreApi {
* @param orderId ID of pet that needs to be fetched * @param orderId ID of pet that needs to be fetched
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call getOrderByIdAsync(String orderId, final ApiCallback<Order> callback) throws ApiException { public Call getOrderByIdAsync(String orderId, final ApiCallback<Order> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -362,10 +404,22 @@ public class StoreApi {
* Delete purchase order by ID * Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted * @param orderId ID of the order that needs to be deleted
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void deleteOrder(String orderId) throws ApiException { public void deleteOrder(String orderId) throws ApiException {
deleteOrderWithHttpInfo(orderId);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException {
Call call = deleteOrderCall(orderId, null, null); Call call = deleteOrderCall(orderId, null, null);
apiClient.execute(call); return apiClient.execute(call);
} }
/** /**
@ -374,13 +428,14 @@ 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
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call deleteOrderAsync(String orderId, final ApiCallback<Void> callback) throws ApiException { public Call deleteOrderAsync(String orderId, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {

View File

@ -3,6 +3,7 @@ package io.swagger.client.api;
import io.swagger.client.ApiCallback; import io.swagger.client.ApiCallback;
import io.swagger.client.ApiClient; import io.swagger.client.ApiClient;
import io.swagger.client.ApiException; import io.swagger.client.ApiException;
import io.swagger.client.ApiResponse;
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.ProgressRequestBody;
@ -88,10 +89,22 @@ public class UserApi {
* Create user * Create user
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param body Created user object * @param body Created user object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void createUser(User body) throws ApiException { public void createUser(User body) throws ApiException {
createUserWithHttpInfo(body);
}
/**
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUserWithHttpInfo(User body) throws ApiException {
Call call = createUserCall(body, null, null); Call call = createUserCall(body, null, null);
apiClient.execute(call); return apiClient.execute(call);
} }
/** /**
@ -100,13 +113,14 @@ public class UserApi {
* @param body Created user object * @param body Created user object
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call createUserAsync(User body, final ApiCallback<Void> callback) throws ApiException { public Call createUserAsync(User body, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -173,10 +187,22 @@ public class UserApi {
* Creates list of users with given input array * Creates list of users with given input array
* *
* @param body List of user object * @param body List of user object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void createUsersWithArrayInput(List<User> body) throws ApiException { public void createUsersWithArrayInput(List<User> body) throws ApiException {
createUsersWithArrayInputWithHttpInfo(body);
}
/**
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body) throws ApiException {
Call call = createUsersWithArrayInputCall(body, null, null); Call call = createUsersWithArrayInputCall(body, null, null);
apiClient.execute(call); return apiClient.execute(call);
} }
/** /**
@ -185,13 +211,14 @@ public class UserApi {
* @param body List of user object * @param body List of user object
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call createUsersWithArrayInputAsync(List<User> body, final ApiCallback<Void> callback) throws ApiException { public Call createUsersWithArrayInputAsync(List<User> body, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -258,10 +285,22 @@ public class UserApi {
* Creates list of users with given input array * Creates list of users with given input array
* *
* @param body List of user object * @param body List of user object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void createUsersWithListInput(List<User> body) throws ApiException { public void createUsersWithListInput(List<User> body) throws ApiException {
createUsersWithListInputWithHttpInfo(body);
}
/**
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body) throws ApiException {
Call call = createUsersWithListInputCall(body, null, null); Call call = createUsersWithListInputCall(body, null, null);
apiClient.execute(call); return apiClient.execute(call);
} }
/** /**
@ -270,13 +309,14 @@ public class UserApi {
* @param body List of user object * @param body List of user object
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call createUsersWithListInputAsync(List<User> body, final ApiCallback<Void> callback) throws ApiException { public Call createUsersWithListInputAsync(List<User> body, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -298,7 +338,7 @@ public class UserApi {
} }
/* Build call for loginUser */ /* Build call for loginUser */
private Call loginUserCall(String username,String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) 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;
@ -349,9 +389,23 @@ public class UserApi {
* @param username The user name for login * @param username The user name for login
* @param password The password for login in clear text * @param password The password for login in clear text
* @return String * @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public String loginUser(String username, String password) throws ApiException { public String loginUser(String username, String password) throws ApiException {
Call call = loginUserCall(username,password, null, null); ApiResponse<String> resp = loginUserWithHttpInfo(username, password);
return resp.getData();
}
/**
* Logs user into the system
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException {
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);
} }
@ -363,13 +417,14 @@ public class UserApi {
* @param password The password for login in clear text * @param password The password for login in clear text
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call loginUserAsync(String username, String password, final ApiCallback<String> callback) throws ApiException { public Call loginUserAsync(String username, String password, final ApiCallback<String> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -385,14 +440,14 @@ public class UserApi {
}; };
} }
Call call = loginUserCall(username,password, progressListener, progressRequestListener); 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( final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { private Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object postBody = null; Object postBody = null;
@ -436,10 +491,21 @@ public class UserApi {
/** /**
* Logs out current logged in user session * Logs out current logged in user session
* *
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void logoutUser() throws ApiException { public void logoutUser() throws ApiException {
Call call = logoutUserCall( null, null); logoutUserWithHttpInfo();
apiClient.execute(call); }
/**
* Logs out current logged in user session
*
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException {
Call call = logoutUserCall(null, null);
return apiClient.execute(call);
} }
/** /**
@ -447,13 +513,14 @@ 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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call logoutUserAsync(final ApiCallback<Void> callback) throws ApiException { public Call logoutUserAsync(final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -469,7 +536,7 @@ public class UserApi {
}; };
} }
Call call = logoutUserCall( progressListener, progressRequestListener); Call call = logoutUserCall(progressListener, progressRequestListener);
apiClient.executeAsync(call, callback); apiClient.executeAsync(call, callback);
return call; return call;
} }
@ -527,8 +594,21 @@ public class UserApi {
* *
* @param username The name that needs to be fetched. Use user1 for testing. * @param username The name that needs to be fetched. Use user1 for testing.
* @return User * @return User
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public User getUserByName(String username) throws ApiException { public User getUserByName(String username) throws ApiException {
ApiResponse<User> resp = getUserByNameWithHttpInfo(username);
return resp.getData();
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiResponse<User>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException {
Call call = getUserByNameCall(username, null, null); 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);
@ -540,13 +620,14 @@ public class UserApi {
* @param username The name that needs to be fetched. Use user1 for testing. * @param username The name that needs to be fetched. Use user1 for testing.
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call getUserByNameAsync(String username, final ApiCallback<User> callback) throws ApiException { public Call getUserByNameAsync(String username, final ApiCallback<User> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -569,7 +650,7 @@ public class UserApi {
} }
/* Build call for updateUser */ /* Build call for updateUser */
private Call updateUserCall(String username,User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) 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
@ -621,10 +702,23 @@ public class UserApi {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param body Updated user object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void updateUser(String username, User body) throws ApiException { public void updateUser(String username, User body) throws ApiException {
Call call = updateUserCall(username,body, null, null); updateUserWithHttpInfo(username, body);
apiClient.execute(call); }
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> updateUserWithHttpInfo(String username, User body) throws ApiException {
Call call = updateUserCall(username, body, null, null);
return apiClient.execute(call);
} }
/** /**
@ -634,13 +728,14 @@ public class UserApi {
* @param body Updated user object * @param body Updated user object
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call updateUserAsync(String username, User body, final ApiCallback<Void> callback) throws ApiException { public Call updateUserAsync(String username, User body, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {
@ -656,7 +751,7 @@ public class UserApi {
}; };
} }
Call call = updateUserCall(username,body, progressListener, progressRequestListener); Call call = updateUserCall(username, body, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback); apiClient.executeAsync(call, callback);
return call; return call;
} }
@ -713,10 +808,22 @@ public class UserApi {
* Delete user * Delete user
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param username The name that needs to be deleted * @param username The name that needs to be deleted
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public void deleteUser(String username) throws ApiException { public void deleteUser(String username) throws ApiException {
deleteUserWithHttpInfo(username);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException {
Call call = deleteUserCall(username, null, null); Call call = deleteUserCall(username, null, null);
apiClient.execute(call); return apiClient.execute(call);
} }
/** /**
@ -725,13 +832,14 @@ public class UserApi {
* @param username The name that needs to be deleted * @param username The name that needs to be deleted
* @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
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ */
public Call deleteUserAsync(String username, final ApiCallback<Void> callback) throws ApiException { public Call deleteUserAsync(String username, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null; ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if(callback != null) { if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() { progressListener = new ProgressResponseBody.ProgressListener() {
@Override @Override
public void update(long bytesRead, long contentLength, boolean done) { public void update(long bytesRead, long contentLength, boolean done) {

View File

@ -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-29T00:18:08.052+08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+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;

View File

@ -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-29T00:18:08.052+08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+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);

View File

@ -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-29T00:18:08.052+08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-12-07T12:21:33.403+08:00")
public class OAuth implements Authentication { public class OAuth implements Authentication {
private String accessToken; private String accessToken;

View File

@ -2,8 +2,8 @@ package io.swagger.client.model;
import io.swagger.client.StringUtil; import io.swagger.client.StringUtil;
import io.swagger.client.model.Category; import io.swagger.client.model.Category;
import io.swagger.client.model.Tag;
import java.util.*; import java.util.*;
import io.swagger.client.model.Tag;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;

View File

@ -1,10 +1,6 @@
package io.swagger.petstore.test; package io.swagger.petstore.test;
import io.swagger.client.ApiClient; import io.swagger.client.*;
import io.swagger.client.ApiException;
import io.swagger.client.Configuration;
import io.swagger.client.ApiCallback;
import io.swagger.client.api.*; import io.swagger.client.api.*;
import io.swagger.client.auth.*; import io.swagger.client.auth.*;
import io.swagger.client.model.*; import io.swagger.client.model.*;
@ -71,6 +67,21 @@ public class PetApiTest {
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
} }
@Test
public void testCreateAndGetPetWithHttpInfo() throws Exception {
Pet pet = createRandomPet();
api.addPetWithHttpInfo(pet);
ApiResponse<Pet> resp = api.getPetByIdWithHttpInfo(pet.getId());
assertEquals(200, resp.getStatusCode());
assertEquals("application/json", resp.getHeaders().get("Content-Type").get(0));
Pet fetched = resp.getData();
assertNotNull(fetched);
assertEquals(pet.getId(), fetched.getId());
assertNotNull(fetched.getCategory());
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
}
@Test @Test
public void testCreateAndGetPetAsync() throws Exception { public void testCreateAndGetPetAsync() throws Exception {
Pet pet = createRandomPet(); Pet pet = createRandomPet();