forked from loafle/openapi-generator-original
[Java][okhttp] better docstring (#10741)
* better docstring in api client, exception, response * more docstring update
This commit is contained in:
@@ -72,6 +72,9 @@ import {{invokerPackage}}.auth.RetryingOAuth;
|
|||||||
import {{invokerPackage}}.auth.OAuthFlow;
|
import {{invokerPackage}}.auth.OAuthFlow;
|
||||||
{{/hasOAuthMethods}}
|
{{/hasOAuthMethods}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiClient class.</p>
|
||||||
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "{{{basePath}}}";
|
private String basePath = "{{{basePath}}}";
|
||||||
@@ -100,7 +103,7 @@ public class ApiClient {
|
|||||||
private Map<String, ApiOperation> operationLookupMap = new HashMap<>();
|
private Map<String, ApiOperation> operationLookupMap = new HashMap<>();
|
||||||
|
|
||||||
{{/dynamicOperations}}
|
{{/dynamicOperations}}
|
||||||
/*
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
*/
|
*/
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@@ -116,8 +119,10 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor with custom OkHttpClient
|
* Basic constructor with custom OkHttpClient
|
||||||
|
*
|
||||||
|
* @param client a {@link okhttp3.OkHttpClient} object
|
||||||
*/
|
*/
|
||||||
public ApiClient(OkHttpClient client) {
|
public ApiClient(OkHttpClient client) {
|
||||||
init();
|
init();
|
||||||
@@ -136,28 +141,28 @@ public class ApiClient {
|
|||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
{{#oauthMethods}}
|
{{#oauthMethods}}
|
||||||
{{#-first}}
|
{{#-first}}
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId) {
|
public ApiClient(String clientId) {
|
||||||
this(clientId, null, null);
|
this(clientId, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId, Map<String, String> parameters) {
|
public ApiClient(String clientId, Map<String, String> parameters) {
|
||||||
this(clientId, null, parameters);
|
this(clientId, null, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
|
public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
|
||||||
this(null, clientId, clientSecret, parameters);
|
this(null, clientId, clientSecret, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters) {
|
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters) {
|
||||||
@@ -264,7 +269,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param newHttpClient An instance of OkHttpClient
|
* @param newHttpClient An instance of OkHttpClient
|
||||||
* @return Api Client
|
* @return Api Client
|
||||||
* @throws NullPointerException when newHttpClient is null
|
* @throws java.lang.NullPointerException when newHttpClient is null
|
||||||
*/
|
*/
|
||||||
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
||||||
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
||||||
@@ -336,6 +341,11 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>keyManagers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return an array of {@link javax.net.ssl.KeyManager} objects
|
||||||
|
*/
|
||||||
public KeyManager[] getKeyManagers() {
|
public KeyManager[] getKeyManagers() {
|
||||||
return keyManagers;
|
return keyManagers;
|
||||||
}
|
}
|
||||||
@@ -353,15 +363,32 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.text.DateFormat} object
|
||||||
|
*/
|
||||||
public DateFormat getDateFormat() {
|
public DateFormat getDateFormat() {
|
||||||
return dateFormat;
|
return dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Setter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setDateFormat(DateFormat dateFormat) {
|
public ApiClient setDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setDateFormat(dateFormat);
|
this.json.setDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set SqlDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setSqlDateFormat(dateFormat);
|
this.json.setSqlDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
@@ -380,17 +407,35 @@ public class ApiClient {
|
|||||||
|
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
{{#jsr310}}
|
{{#jsr310}}
|
||||||
|
/**
|
||||||
|
* <p>Set OffsetDateTimeFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setOffsetDateTimeFormat(dateFormat);
|
this.json.setOffsetDateTimeFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LocalDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setLocalDateFormat(dateFormat);
|
this.json.setLocalDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/jsr310}}
|
{{/jsr310}}
|
||||||
|
/**
|
||||||
|
* <p>Set LenientOnJson.</p>
|
||||||
|
*
|
||||||
|
* @param lenientOnJson a boolean
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
||||||
this.json.setLenientOnJson(lenientOnJson);
|
this.json.setLenientOnJson(lenientOnJson);
|
||||||
return this;
|
return this;
|
||||||
@@ -610,7 +655,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the connect timeout (in milliseconds).
|
* Sets the connect timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param connectionTimeout connection timeout in milliseconds
|
* @param connectionTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -632,7 +677,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the read timeout (in milliseconds).
|
* Sets the read timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param readTimeout read timeout in milliseconds
|
* @param readTimeout read timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -654,7 +699,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the write timeout (in milliseconds).
|
* Sets the write timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param writeTimeout connection timeout in milliseconds
|
* @param writeTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -945,7 +990,7 @@ 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
|
* @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body
|
||||||
* or the Content-Type of the response is not supported.
|
* or the Content-Type of the response is not supported.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -1006,7 +1051,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 request body
|
* @return The serialized request body
|
||||||
* @throws ApiException If fail to serialize the given object
|
* @throws org.openapitools.client.ApiException If fail to serialize the given object
|
||||||
*/
|
*/
|
||||||
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
||||||
if (obj instanceof byte[]) {
|
if (obj instanceof byte[]) {
|
||||||
@@ -1032,7 +1077,7 @@ public class ApiClient {
|
|||||||
* Download file from the given response.
|
* Download file from the given response.
|
||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @throws ApiException If fail to read file content from response and write to disk
|
* @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk
|
||||||
* @return Downloaded file
|
* @return Downloaded file
|
||||||
*/
|
*/
|
||||||
public File downloadFileFromResponse(Response response) throws ApiException {
|
public File downloadFileFromResponse(Response response) throws ApiException {
|
||||||
@@ -1052,7 +1097,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @return Prepared file for the download
|
* @return Prepared file for the download
|
||||||
* @throws IOException If fail to prepare file for download
|
* @throws java.io.IOException If fail to prepare file for download
|
||||||
*/
|
*/
|
||||||
public File prepareDownloadFile(Response response) throws IOException {
|
public File prepareDownloadFile(Response response) throws IOException {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
@@ -1096,7 +1141,7 @@ public class ApiClient {
|
|||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
* @param call An instance of the Call object
|
* @param call An instance of the Call object
|
||||||
* @return ApiResponse<T>
|
* @return ApiResponse<T>
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
||||||
return execute(call, null);
|
return execute(call, null);
|
||||||
@@ -1111,7 +1156,7 @@ public class ApiClient {
|
|||||||
* @return ApiResponse object containing response status, headers and
|
* @return ApiResponse object containing response status, headers and
|
||||||
* data, which is a Java object deserialized from response body and would be null
|
* data, which is a Java object deserialized from response body and would be null
|
||||||
* when returnType is null.
|
* when returnType is null.
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
||||||
try {
|
try {
|
||||||
@@ -1124,6 +1169,14 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{#supportStreaming}}
|
{{#supportStreaming}}
|
||||||
|
/**
|
||||||
|
* <p>Execute stream.</p>
|
||||||
|
*
|
||||||
|
* @param call a {@link okhttp3.Call} object
|
||||||
|
* @param returnType a {@link java.lang.reflect.Type} object
|
||||||
|
* @return a {@link java.io.InputStream} object
|
||||||
|
* @throws org.openapitools.client.ApiException if any.
|
||||||
|
*/
|
||||||
public InputStream executeStream(Call call, Type returnType) throws ApiException {
|
public InputStream executeStream(Call call, Type returnType) throws ApiException {
|
||||||
try {
|
try {
|
||||||
Response response = call.execute();
|
Response response = call.execute();
|
||||||
@@ -1192,7 +1245,7 @@ public class ApiClient {
|
|||||||
* @param response Response
|
* @param response Response
|
||||||
* @param returnType Return type
|
* @param returnType Return type
|
||||||
* @return Type
|
* @return Type
|
||||||
* @throws ApiException If the response has an unsuccessful status code or
|
* @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or
|
||||||
* fail to deserialize the response body
|
* 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 {
|
||||||
@@ -1238,7 +1291,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP call
|
* @return The HTTP call
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
||||||
@@ -1260,7 +1313,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP request
|
* @return The HTTP request
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* API response returned by API call.
|
* API response returned by API call.
|
||||||
*
|
|
||||||
* @param <T> The type of data that is deserialized from response body
|
|
||||||
*/
|
*/
|
||||||
public class ApiResponse<T> {
|
public class ApiResponse<T> {
|
||||||
final private int statusCode;
|
final private int statusCode;
|
||||||
@@ -20,6 +18,8 @@ public class ApiResponse<T> {
|
|||||||
final private T data;
|
final private T data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
*/
|
*/
|
||||||
@@ -28,6 +28,8 @@ public class ApiResponse<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
* @param data The object deserialized from response bod
|
* @param data The object deserialized from response bod
|
||||||
@@ -44,14 +46,29 @@ public class ApiResponse<T> {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>status code</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the status code
|
||||||
|
*/
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>headers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.util.Map} of headers
|
||||||
|
*/
|
||||||
public Map<String, List<String>> getHeaders() {
|
public Map<String, List<String>> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>data</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the data
|
||||||
|
*/
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,22 +9,47 @@ import java.util.Map.Entry;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
{{/caseInsensitiveResponseHeaders}}
|
{{/caseInsensitiveResponseHeaders}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiException class.</p>
|
||||||
|
*/
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||||
private int code = 0;
|
private int code = 0;
|
||||||
private Map<String, List<String>> responseHeaders = null;
|
private Map<String, List<String>> responseHeaders = null;
|
||||||
private String responseBody = null;
|
private String responseBody = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*/
|
||||||
public ApiException() {}
|
public ApiException() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
*/
|
||||||
public ApiException(Throwable throwable) {
|
public ApiException(Throwable throwable) {
|
||||||
super(throwable);
|
super(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
*/
|
||||||
public ApiException(String message) {
|
public ApiException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
@@ -38,23 +63,60 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us
|
|||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
this(message, throwable, code, responseHeaders, null);
|
this(message, throwable, code, responseHeaders, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message a {@link java.lang.String} object
|
||||||
|
*/
|
||||||
public ApiException(int code, String message) {
|
public ApiException(int code, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message the error message
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(code, message);
|
this(code, message);
|
||||||
{{#caseInsensitiveResponseHeaders}}
|
{{#caseInsensitiveResponseHeaders}}
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ import org.openapitools.client.auth.HttpBasicAuth;
|
|||||||
import org.openapitools.client.auth.HttpBearerAuth;
|
import org.openapitools.client.auth.HttpBearerAuth;
|
||||||
import org.openapitools.client.auth.ApiKeyAuth;
|
import org.openapitools.client.auth.ApiKeyAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiClient class.</p>
|
||||||
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://localhost:8082";
|
private String basePath = "http://localhost:8082";
|
||||||
@@ -78,7 +81,7 @@ public class ApiClient {
|
|||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
private HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
*/
|
*/
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@@ -90,8 +93,10 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor with custom OkHttpClient
|
* Basic constructor with custom OkHttpClient
|
||||||
|
*
|
||||||
|
* @param client a {@link okhttp3.OkHttpClient} object
|
||||||
*/
|
*/
|
||||||
public ApiClient(OkHttpClient client) {
|
public ApiClient(OkHttpClient client) {
|
||||||
init();
|
init();
|
||||||
@@ -162,7 +167,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param newHttpClient An instance of OkHttpClient
|
* @param newHttpClient An instance of OkHttpClient
|
||||||
* @return Api Client
|
* @return Api Client
|
||||||
* @throws NullPointerException when newHttpClient is null
|
* @throws java.lang.NullPointerException when newHttpClient is null
|
||||||
*/
|
*/
|
||||||
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
||||||
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
||||||
@@ -234,6 +239,11 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>keyManagers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return an array of {@link javax.net.ssl.KeyManager} objects
|
||||||
|
*/
|
||||||
public KeyManager[] getKeyManagers() {
|
public KeyManager[] getKeyManagers() {
|
||||||
return keyManagers;
|
return keyManagers;
|
||||||
}
|
}
|
||||||
@@ -251,30 +261,65 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.text.DateFormat} object
|
||||||
|
*/
|
||||||
public DateFormat getDateFormat() {
|
public DateFormat getDateFormat() {
|
||||||
return dateFormat;
|
return dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Setter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setDateFormat(DateFormat dateFormat) {
|
public ApiClient setDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setDateFormat(dateFormat);
|
this.json.setDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set SqlDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setSqlDateFormat(dateFormat);
|
this.json.setSqlDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set OffsetDateTimeFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setOffsetDateTimeFormat(dateFormat);
|
this.json.setOffsetDateTimeFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LocalDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setLocalDateFormat(dateFormat);
|
this.json.setLocalDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LenientOnJson.</p>
|
||||||
|
*
|
||||||
|
* @param lenientOnJson a boolean
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
||||||
this.json.setLenientOnJson(lenientOnJson);
|
this.json.setLenientOnJson(lenientOnJson);
|
||||||
return this;
|
return this;
|
||||||
@@ -471,7 +516,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the connect timeout (in milliseconds).
|
* Sets the connect timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param connectionTimeout connection timeout in milliseconds
|
* @param connectionTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -493,7 +538,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the read timeout (in milliseconds).
|
* Sets the read timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param readTimeout read timeout in milliseconds
|
* @param readTimeout read timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -515,7 +560,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the write timeout (in milliseconds).
|
* Sets the write timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param writeTimeout connection timeout in milliseconds
|
* @param writeTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -749,7 +794,7 @@ 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
|
* @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body
|
||||||
* or the Content-Type of the response is not supported.
|
* or the Content-Type of the response is not supported.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -810,7 +855,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 request body
|
* @return The serialized request body
|
||||||
* @throws ApiException If fail to serialize the given object
|
* @throws org.openapitools.client.ApiException If fail to serialize the given object
|
||||||
*/
|
*/
|
||||||
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
||||||
if (obj instanceof byte[]) {
|
if (obj instanceof byte[]) {
|
||||||
@@ -836,7 +881,7 @@ public class ApiClient {
|
|||||||
* Download file from the given response.
|
* Download file from the given response.
|
||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @throws ApiException If fail to read file content from response and write to disk
|
* @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk
|
||||||
* @return Downloaded file
|
* @return Downloaded file
|
||||||
*/
|
*/
|
||||||
public File downloadFileFromResponse(Response response) throws ApiException {
|
public File downloadFileFromResponse(Response response) throws ApiException {
|
||||||
@@ -856,7 +901,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @return Prepared file for the download
|
* @return Prepared file for the download
|
||||||
* @throws IOException If fail to prepare file for download
|
* @throws java.io.IOException If fail to prepare file for download
|
||||||
*/
|
*/
|
||||||
public File prepareDownloadFile(Response response) throws IOException {
|
public File prepareDownloadFile(Response response) throws IOException {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
@@ -900,7 +945,7 @@ public class ApiClient {
|
|||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
* @param call An instance of the Call object
|
* @param call An instance of the Call object
|
||||||
* @return ApiResponse<T>
|
* @return ApiResponse<T>
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
||||||
return execute(call, null);
|
return execute(call, null);
|
||||||
@@ -915,7 +960,7 @@ public class ApiClient {
|
|||||||
* @return ApiResponse object containing response status, headers and
|
* @return ApiResponse object containing response status, headers and
|
||||||
* data, which is a Java object deserialized from response body and would be null
|
* data, which is a Java object deserialized from response body and would be null
|
||||||
* when returnType is null.
|
* when returnType is null.
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
||||||
try {
|
try {
|
||||||
@@ -927,6 +972,14 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Execute stream.</p>
|
||||||
|
*
|
||||||
|
* @param call a {@link okhttp3.Call} object
|
||||||
|
* @param returnType a {@link java.lang.reflect.Type} object
|
||||||
|
* @return a {@link java.io.InputStream} object
|
||||||
|
* @throws org.openapitools.client.ApiException if any.
|
||||||
|
*/
|
||||||
public InputStream executeStream(Call call, Type returnType) throws ApiException {
|
public InputStream executeStream(Call call, Type returnType) throws ApiException {
|
||||||
try {
|
try {
|
||||||
Response response = call.execute();
|
Response response = call.execute();
|
||||||
@@ -994,7 +1047,7 @@ public class ApiClient {
|
|||||||
* @param response Response
|
* @param response Response
|
||||||
* @param returnType Return type
|
* @param returnType Return type
|
||||||
* @return Type
|
* @return Type
|
||||||
* @throws ApiException If the response has an unsuccessful status code or
|
* @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or
|
||||||
* fail to deserialize the response body
|
* 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 {
|
||||||
@@ -1040,7 +1093,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP call
|
* @return The HTTP call
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
||||||
@@ -1062,7 +1115,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP request
|
* @return The HTTP request
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|||||||
@@ -16,22 +16,47 @@ package org.openapitools.client;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiException class.</p>
|
||||||
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
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;
|
||||||
private String responseBody = null;
|
private String responseBody = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*/
|
||||||
public ApiException() {}
|
public ApiException() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
*/
|
||||||
public ApiException(Throwable throwable) {
|
public ApiException(Throwable throwable) {
|
||||||
super(throwable);
|
super(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
*/
|
||||||
public ApiException(String message) {
|
public ApiException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
@@ -39,23 +64,60 @@ public class ApiException extends Exception {
|
|||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
this(message, throwable, code, responseHeaders, null);
|
this(message, throwable, code, responseHeaders, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message a {@link java.lang.String} object
|
||||||
|
*/
|
||||||
public ApiException(int code, String message) {
|
public ApiException(int code, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message the error message
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(code, message);
|
this(code, message);
|
||||||
this.responseHeaders = responseHeaders;
|
this.responseHeaders = responseHeaders;
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* API response returned by API call.
|
* API response returned by API call.
|
||||||
*
|
|
||||||
* @param <T> The type of data that is deserialized from response body
|
|
||||||
*/
|
*/
|
||||||
public class ApiResponse<T> {
|
public class ApiResponse<T> {
|
||||||
final private int statusCode;
|
final private int statusCode;
|
||||||
@@ -27,6 +25,8 @@ public class ApiResponse<T> {
|
|||||||
final private T data;
|
final private T data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
*/
|
*/
|
||||||
@@ -35,6 +35,8 @@ public class ApiResponse<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
* @param data The object deserialized from response bod
|
* @param data The object deserialized from response bod
|
||||||
@@ -45,14 +47,29 @@ public class ApiResponse<T> {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>status code</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the status code
|
||||||
|
*/
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>headers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.util.Map} of headers
|
||||||
|
*/
|
||||||
public Map<String, List<String>> getHeaders() {
|
public Map<String, List<String>> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>data</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the data
|
||||||
|
*/
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
import org.openapitools.client.auth.RetryingOAuth;
|
import org.openapitools.client.auth.RetryingOAuth;
|
||||||
import org.openapitools.client.auth.OAuthFlow;
|
import org.openapitools.client.auth.OAuthFlow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiClient class.</p>
|
||||||
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
private String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
@@ -91,7 +94,7 @@ public class ApiClient {
|
|||||||
|
|
||||||
private Map<String, ApiOperation> operationLookupMap = new HashMap<>();
|
private Map<String, ApiOperation> operationLookupMap = new HashMap<>();
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
*/
|
*/
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@@ -107,8 +110,10 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor with custom OkHttpClient
|
* Basic constructor with custom OkHttpClient
|
||||||
|
*
|
||||||
|
* @param client a {@link okhttp3.OkHttpClient} object
|
||||||
*/
|
*/
|
||||||
public ApiClient(OkHttpClient client) {
|
public ApiClient(OkHttpClient client) {
|
||||||
init();
|
init();
|
||||||
@@ -124,28 +129,28 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId) {
|
public ApiClient(String clientId) {
|
||||||
this(clientId, null, null);
|
this(clientId, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId, Map<String, String> parameters) {
|
public ApiClient(String clientId, Map<String, String> parameters) {
|
||||||
this(clientId, null, parameters);
|
this(clientId, null, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
|
public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
|
||||||
this(null, clientId, clientSecret, parameters);
|
this(null, clientId, clientSecret, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters) {
|
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters) {
|
||||||
@@ -241,7 +246,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param newHttpClient An instance of OkHttpClient
|
* @param newHttpClient An instance of OkHttpClient
|
||||||
* @return Api Client
|
* @return Api Client
|
||||||
* @throws NullPointerException when newHttpClient is null
|
* @throws java.lang.NullPointerException when newHttpClient is null
|
||||||
*/
|
*/
|
||||||
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
||||||
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
||||||
@@ -313,6 +318,11 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>keyManagers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return an array of {@link javax.net.ssl.KeyManager} objects
|
||||||
|
*/
|
||||||
public KeyManager[] getKeyManagers() {
|
public KeyManager[] getKeyManagers() {
|
||||||
return keyManagers;
|
return keyManagers;
|
||||||
}
|
}
|
||||||
@@ -330,30 +340,65 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.text.DateFormat} object
|
||||||
|
*/
|
||||||
public DateFormat getDateFormat() {
|
public DateFormat getDateFormat() {
|
||||||
return dateFormat;
|
return dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Setter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setDateFormat(DateFormat dateFormat) {
|
public ApiClient setDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setDateFormat(dateFormat);
|
this.json.setDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set SqlDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setSqlDateFormat(dateFormat);
|
this.json.setSqlDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set OffsetDateTimeFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setOffsetDateTimeFormat(dateFormat);
|
this.json.setOffsetDateTimeFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LocalDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setLocalDateFormat(dateFormat);
|
this.json.setLocalDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LenientOnJson.</p>
|
||||||
|
*
|
||||||
|
* @param lenientOnJson a boolean
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
||||||
this.json.setLenientOnJson(lenientOnJson);
|
this.json.setLenientOnJson(lenientOnJson);
|
||||||
return this;
|
return this;
|
||||||
@@ -556,7 +601,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the connect timeout (in milliseconds).
|
* Sets the connect timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param connectionTimeout connection timeout in milliseconds
|
* @param connectionTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -578,7 +623,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the read timeout (in milliseconds).
|
* Sets the read timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param readTimeout read timeout in milliseconds
|
* @param readTimeout read timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -600,7 +645,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the write timeout (in milliseconds).
|
* Sets the write timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param writeTimeout connection timeout in milliseconds
|
* @param writeTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -836,7 +881,7 @@ 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
|
* @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body
|
||||||
* or the Content-Type of the response is not supported.
|
* or the Content-Type of the response is not supported.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -897,7 +942,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 request body
|
* @return The serialized request body
|
||||||
* @throws ApiException If fail to serialize the given object
|
* @throws org.openapitools.client.ApiException If fail to serialize the given object
|
||||||
*/
|
*/
|
||||||
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
||||||
if (obj instanceof byte[]) {
|
if (obj instanceof byte[]) {
|
||||||
@@ -923,7 +968,7 @@ public class ApiClient {
|
|||||||
* Download file from the given response.
|
* Download file from the given response.
|
||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @throws ApiException If fail to read file content from response and write to disk
|
* @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk
|
||||||
* @return Downloaded file
|
* @return Downloaded file
|
||||||
*/
|
*/
|
||||||
public File downloadFileFromResponse(Response response) throws ApiException {
|
public File downloadFileFromResponse(Response response) throws ApiException {
|
||||||
@@ -943,7 +988,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @return Prepared file for the download
|
* @return Prepared file for the download
|
||||||
* @throws IOException If fail to prepare file for download
|
* @throws java.io.IOException If fail to prepare file for download
|
||||||
*/
|
*/
|
||||||
public File prepareDownloadFile(Response response) throws IOException {
|
public File prepareDownloadFile(Response response) throws IOException {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
@@ -987,7 +1032,7 @@ public class ApiClient {
|
|||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
* @param call An instance of the Call object
|
* @param call An instance of the Call object
|
||||||
* @return ApiResponse<T>
|
* @return ApiResponse<T>
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
||||||
return execute(call, null);
|
return execute(call, null);
|
||||||
@@ -1002,7 +1047,7 @@ public class ApiClient {
|
|||||||
* @return ApiResponse object containing response status, headers and
|
* @return ApiResponse object containing response status, headers and
|
||||||
* data, which is a Java object deserialized from response body and would be null
|
* data, which is a Java object deserialized from response body and would be null
|
||||||
* when returnType is null.
|
* when returnType is null.
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
||||||
try {
|
try {
|
||||||
@@ -1066,7 +1111,7 @@ public class ApiClient {
|
|||||||
* @param response Response
|
* @param response Response
|
||||||
* @param returnType Return type
|
* @param returnType Return type
|
||||||
* @return Type
|
* @return Type
|
||||||
* @throws ApiException If the response has an unsuccessful status code or
|
* @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or
|
||||||
* fail to deserialize the response body
|
* 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 {
|
||||||
@@ -1112,7 +1157,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP call
|
* @return The HTTP call
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
||||||
@@ -1134,7 +1179,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP request
|
* @return The HTTP request
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|||||||
@@ -16,22 +16,47 @@ package org.openapitools.client;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiException class.</p>
|
||||||
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
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;
|
||||||
private String responseBody = null;
|
private String responseBody = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*/
|
||||||
public ApiException() {}
|
public ApiException() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
*/
|
||||||
public ApiException(Throwable throwable) {
|
public ApiException(Throwable throwable) {
|
||||||
super(throwable);
|
super(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
*/
|
||||||
public ApiException(String message) {
|
public ApiException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
@@ -39,23 +64,60 @@ public class ApiException extends Exception {
|
|||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
this(message, throwable, code, responseHeaders, null);
|
this(message, throwable, code, responseHeaders, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message a {@link java.lang.String} object
|
||||||
|
*/
|
||||||
public ApiException(int code, String message) {
|
public ApiException(int code, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message the error message
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(code, message);
|
this(code, message);
|
||||||
this.responseHeaders = responseHeaders;
|
this.responseHeaders = responseHeaders;
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* API response returned by API call.
|
* API response returned by API call.
|
||||||
*
|
|
||||||
* @param <T> The type of data that is deserialized from response body
|
|
||||||
*/
|
*/
|
||||||
public class ApiResponse<T> {
|
public class ApiResponse<T> {
|
||||||
final private int statusCode;
|
final private int statusCode;
|
||||||
@@ -27,6 +25,8 @@ public class ApiResponse<T> {
|
|||||||
final private T data;
|
final private T data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
*/
|
*/
|
||||||
@@ -35,6 +35,8 @@ public class ApiResponse<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
* @param data The object deserialized from response bod
|
* @param data The object deserialized from response bod
|
||||||
@@ -45,14 +47,29 @@ public class ApiResponse<T> {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>status code</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the status code
|
||||||
|
*/
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>headers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.util.Map} of headers
|
||||||
|
*/
|
||||||
public Map<String, List<String>> getHeaders() {
|
public Map<String, List<String>> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>data</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the data
|
||||||
|
*/
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
import org.openapitools.client.auth.RetryingOAuth;
|
import org.openapitools.client.auth.RetryingOAuth;
|
||||||
import org.openapitools.client.auth.OAuthFlow;
|
import org.openapitools.client.auth.OAuthFlow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiClient class.</p>
|
||||||
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
private String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
@@ -83,7 +86,7 @@ public class ApiClient {
|
|||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
private HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
*/
|
*/
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@@ -99,8 +102,10 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor with custom OkHttpClient
|
* Basic constructor with custom OkHttpClient
|
||||||
|
*
|
||||||
|
* @param client a {@link okhttp3.OkHttpClient} object
|
||||||
*/
|
*/
|
||||||
public ApiClient(OkHttpClient client) {
|
public ApiClient(OkHttpClient client) {
|
||||||
init();
|
init();
|
||||||
@@ -116,28 +121,28 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId) {
|
public ApiClient(String clientId) {
|
||||||
this(clientId, null, null);
|
this(clientId, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId, Map<String, String> parameters) {
|
public ApiClient(String clientId, Map<String, String> parameters) {
|
||||||
this(clientId, null, parameters);
|
this(clientId, null, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
|
public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
|
||||||
this(null, clientId, clientSecret, parameters);
|
this(null, clientId, clientSecret, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters) {
|
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters) {
|
||||||
@@ -230,7 +235,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param newHttpClient An instance of OkHttpClient
|
* @param newHttpClient An instance of OkHttpClient
|
||||||
* @return Api Client
|
* @return Api Client
|
||||||
* @throws NullPointerException when newHttpClient is null
|
* @throws java.lang.NullPointerException when newHttpClient is null
|
||||||
*/
|
*/
|
||||||
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
||||||
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
||||||
@@ -302,6 +307,11 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>keyManagers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return an array of {@link javax.net.ssl.KeyManager} objects
|
||||||
|
*/
|
||||||
public KeyManager[] getKeyManagers() {
|
public KeyManager[] getKeyManagers() {
|
||||||
return keyManagers;
|
return keyManagers;
|
||||||
}
|
}
|
||||||
@@ -319,30 +329,65 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.text.DateFormat} object
|
||||||
|
*/
|
||||||
public DateFormat getDateFormat() {
|
public DateFormat getDateFormat() {
|
||||||
return dateFormat;
|
return dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Setter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setDateFormat(DateFormat dateFormat) {
|
public ApiClient setDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setDateFormat(dateFormat);
|
this.json.setDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set SqlDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setSqlDateFormat(dateFormat);
|
this.json.setSqlDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set OffsetDateTimeFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setOffsetDateTimeFormat(dateFormat);
|
this.json.setOffsetDateTimeFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LocalDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setLocalDateFormat(dateFormat);
|
this.json.setLocalDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LenientOnJson.</p>
|
||||||
|
*
|
||||||
|
* @param lenientOnJson a boolean
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
||||||
this.json.setLenientOnJson(lenientOnJson);
|
this.json.setLenientOnJson(lenientOnJson);
|
||||||
return this;
|
return this;
|
||||||
@@ -545,7 +590,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the connect timeout (in milliseconds).
|
* Sets the connect timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param connectionTimeout connection timeout in milliseconds
|
* @param connectionTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -567,7 +612,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the read timeout (in milliseconds).
|
* Sets the read timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param readTimeout read timeout in milliseconds
|
* @param readTimeout read timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -589,7 +634,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the write timeout (in milliseconds).
|
* Sets the write timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param writeTimeout connection timeout in milliseconds
|
* @param writeTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -837,7 +882,7 @@ 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
|
* @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body
|
||||||
* or the Content-Type of the response is not supported.
|
* or the Content-Type of the response is not supported.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -898,7 +943,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 request body
|
* @return The serialized request body
|
||||||
* @throws ApiException If fail to serialize the given object
|
* @throws org.openapitools.client.ApiException If fail to serialize the given object
|
||||||
*/
|
*/
|
||||||
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
||||||
if (obj instanceof byte[]) {
|
if (obj instanceof byte[]) {
|
||||||
@@ -924,7 +969,7 @@ public class ApiClient {
|
|||||||
* Download file from the given response.
|
* Download file from the given response.
|
||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @throws ApiException If fail to read file content from response and write to disk
|
* @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk
|
||||||
* @return Downloaded file
|
* @return Downloaded file
|
||||||
*/
|
*/
|
||||||
public File downloadFileFromResponse(Response response) throws ApiException {
|
public File downloadFileFromResponse(Response response) throws ApiException {
|
||||||
@@ -944,7 +989,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @return Prepared file for the download
|
* @return Prepared file for the download
|
||||||
* @throws IOException If fail to prepare file for download
|
* @throws java.io.IOException If fail to prepare file for download
|
||||||
*/
|
*/
|
||||||
public File prepareDownloadFile(Response response) throws IOException {
|
public File prepareDownloadFile(Response response) throws IOException {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
@@ -988,7 +1033,7 @@ public class ApiClient {
|
|||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
* @param call An instance of the Call object
|
* @param call An instance of the Call object
|
||||||
* @return ApiResponse<T>
|
* @return ApiResponse<T>
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
||||||
return execute(call, null);
|
return execute(call, null);
|
||||||
@@ -1003,7 +1048,7 @@ public class ApiClient {
|
|||||||
* @return ApiResponse object containing response status, headers and
|
* @return ApiResponse object containing response status, headers and
|
||||||
* data, which is a Java object deserialized from response body and would be null
|
* data, which is a Java object deserialized from response body and would be null
|
||||||
* when returnType is null.
|
* when returnType is null.
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
||||||
try {
|
try {
|
||||||
@@ -1067,7 +1112,7 @@ public class ApiClient {
|
|||||||
* @param response Response
|
* @param response Response
|
||||||
* @param returnType Return type
|
* @param returnType Return type
|
||||||
* @return Type
|
* @return Type
|
||||||
* @throws ApiException If the response has an unsuccessful status code or
|
* @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or
|
||||||
* fail to deserialize the response body
|
* 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 {
|
||||||
@@ -1113,7 +1158,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP call
|
* @return The HTTP call
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
||||||
@@ -1135,7 +1180,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP request
|
* @return The HTTP request
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|||||||
@@ -16,22 +16,47 @@ package org.openapitools.client;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiException class.</p>
|
||||||
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
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;
|
||||||
private String responseBody = null;
|
private String responseBody = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*/
|
||||||
public ApiException() {}
|
public ApiException() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
*/
|
||||||
public ApiException(Throwable throwable) {
|
public ApiException(Throwable throwable) {
|
||||||
super(throwable);
|
super(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
*/
|
||||||
public ApiException(String message) {
|
public ApiException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
@@ -39,23 +64,60 @@ public class ApiException extends Exception {
|
|||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
this(message, throwable, code, responseHeaders, null);
|
this(message, throwable, code, responseHeaders, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message a {@link java.lang.String} object
|
||||||
|
*/
|
||||||
public ApiException(int code, String message) {
|
public ApiException(int code, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message the error message
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(code, message);
|
this(code, message);
|
||||||
this.responseHeaders = responseHeaders;
|
this.responseHeaders = responseHeaders;
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* API response returned by API call.
|
* API response returned by API call.
|
||||||
*
|
|
||||||
* @param <T> The type of data that is deserialized from response body
|
|
||||||
*/
|
*/
|
||||||
public class ApiResponse<T> {
|
public class ApiResponse<T> {
|
||||||
final private int statusCode;
|
final private int statusCode;
|
||||||
@@ -27,6 +25,8 @@ public class ApiResponse<T> {
|
|||||||
final private T data;
|
final private T data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
*/
|
*/
|
||||||
@@ -35,6 +35,8 @@ public class ApiResponse<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
* @param data The object deserialized from response bod
|
* @param data The object deserialized from response bod
|
||||||
@@ -45,14 +47,29 @@ public class ApiResponse<T> {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>status code</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the status code
|
||||||
|
*/
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>headers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.util.Map} of headers
|
||||||
|
*/
|
||||||
public Map<String, List<String>> getHeaders() {
|
public Map<String, List<String>> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>data</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the data
|
||||||
|
*/
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ import org.openapitools.client.auth.OAuth;
|
|||||||
import org.openapitools.client.auth.RetryingOAuth;
|
import org.openapitools.client.auth.RetryingOAuth;
|
||||||
import org.openapitools.client.auth.OAuthFlow;
|
import org.openapitools.client.auth.OAuthFlow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiClient class.</p>
|
||||||
|
*/
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
private String basePath = "http://petstore.swagger.io:80/v2";
|
||||||
@@ -83,7 +86,7 @@ public class ApiClient {
|
|||||||
|
|
||||||
private HttpLoggingInterceptor loggingInterceptor;
|
private HttpLoggingInterceptor loggingInterceptor;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor for ApiClient
|
* Basic constructor for ApiClient
|
||||||
*/
|
*/
|
||||||
public ApiClient() {
|
public ApiClient() {
|
||||||
@@ -99,8 +102,10 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Basic constructor with custom OkHttpClient
|
* Basic constructor with custom OkHttpClient
|
||||||
|
*
|
||||||
|
* @param client a {@link okhttp3.OkHttpClient} object
|
||||||
*/
|
*/
|
||||||
public ApiClient(OkHttpClient client) {
|
public ApiClient(OkHttpClient client) {
|
||||||
init();
|
init();
|
||||||
@@ -116,28 +121,28 @@ public class ApiClient {
|
|||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId) {
|
public ApiClient(String clientId) {
|
||||||
this(clientId, null, null);
|
this(clientId, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId, Map<String, String> parameters) {
|
public ApiClient(String clientId, Map<String, String> parameters) {
|
||||||
this(clientId, null, parameters);
|
this(clientId, null, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
|
public ApiClient(String clientId, String clientSecret, Map<String, String> parameters) {
|
||||||
this(null, clientId, clientSecret, parameters);
|
this(null, clientId, clientSecret, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters
|
* Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters
|
||||||
*/
|
*/
|
||||||
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters) {
|
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters) {
|
||||||
@@ -230,7 +235,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param newHttpClient An instance of OkHttpClient
|
* @param newHttpClient An instance of OkHttpClient
|
||||||
* @return Api Client
|
* @return Api Client
|
||||||
* @throws NullPointerException when newHttpClient is null
|
* @throws java.lang.NullPointerException when newHttpClient is null
|
||||||
*/
|
*/
|
||||||
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
|
||||||
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
|
||||||
@@ -302,6 +307,11 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>keyManagers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return an array of {@link javax.net.ssl.KeyManager} objects
|
||||||
|
*/
|
||||||
public KeyManager[] getKeyManagers() {
|
public KeyManager[] getKeyManagers() {
|
||||||
return keyManagers;
|
return keyManagers;
|
||||||
}
|
}
|
||||||
@@ -319,30 +329,65 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.text.DateFormat} object
|
||||||
|
*/
|
||||||
public DateFormat getDateFormat() {
|
public DateFormat getDateFormat() {
|
||||||
return dateFormat;
|
return dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Setter for the field <code>dateFormat</code>.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setDateFormat(DateFormat dateFormat) {
|
public ApiClient setDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setDateFormat(dateFormat);
|
this.json.setDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set SqlDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link java.text.DateFormat} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
|
||||||
this.json.setSqlDateFormat(dateFormat);
|
this.json.setSqlDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set OffsetDateTimeFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setOffsetDateTimeFormat(dateFormat);
|
this.json.setOffsetDateTimeFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LocalDateFormat.</p>
|
||||||
|
*
|
||||||
|
* @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
|
||||||
this.json.setLocalDateFormat(dateFormat);
|
this.json.setLocalDateFormat(dateFormat);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Set LenientOnJson.</p>
|
||||||
|
*
|
||||||
|
* @param lenientOnJson a boolean
|
||||||
|
* @return a {@link org.openapitools.client.ApiClient} object
|
||||||
|
*/
|
||||||
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
public ApiClient setLenientOnJson(boolean lenientOnJson) {
|
||||||
this.json.setLenientOnJson(lenientOnJson);
|
this.json.setLenientOnJson(lenientOnJson);
|
||||||
return this;
|
return this;
|
||||||
@@ -545,7 +590,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the connect timeout (in milliseconds).
|
* Sets the connect timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param connectionTimeout connection timeout in milliseconds
|
* @param connectionTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -567,7 +612,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the read timeout (in milliseconds).
|
* Sets the read timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param readTimeout read timeout in milliseconds
|
* @param readTimeout read timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -589,7 +634,7 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Sets the write timeout (in milliseconds).
|
* Sets the write timeout (in milliseconds).
|
||||||
* A value of 0 means no timeout, otherwise values must be between 1 and
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
* {@link Integer#MAX_VALUE}.
|
* {@link java.lang.Integer#MAX_VALUE}.
|
||||||
*
|
*
|
||||||
* @param writeTimeout connection timeout in milliseconds
|
* @param writeTimeout connection timeout in milliseconds
|
||||||
* @return Api client
|
* @return Api client
|
||||||
@@ -837,7 +882,7 @@ 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
|
* @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body
|
||||||
* or the Content-Type of the response is not supported.
|
* or the Content-Type of the response is not supported.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -898,7 +943,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 request body
|
* @return The serialized request body
|
||||||
* @throws ApiException If fail to serialize the given object
|
* @throws org.openapitools.client.ApiException If fail to serialize the given object
|
||||||
*/
|
*/
|
||||||
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
public RequestBody serialize(Object obj, String contentType) throws ApiException {
|
||||||
if (obj instanceof byte[]) {
|
if (obj instanceof byte[]) {
|
||||||
@@ -924,7 +969,7 @@ public class ApiClient {
|
|||||||
* Download file from the given response.
|
* Download file from the given response.
|
||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @throws ApiException If fail to read file content from response and write to disk
|
* @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk
|
||||||
* @return Downloaded file
|
* @return Downloaded file
|
||||||
*/
|
*/
|
||||||
public File downloadFileFromResponse(Response response) throws ApiException {
|
public File downloadFileFromResponse(Response response) throws ApiException {
|
||||||
@@ -944,7 +989,7 @@ public class ApiClient {
|
|||||||
*
|
*
|
||||||
* @param response An instance of the Response object
|
* @param response An instance of the Response object
|
||||||
* @return Prepared file for the download
|
* @return Prepared file for the download
|
||||||
* @throws IOException If fail to prepare file for download
|
* @throws java.io.IOException If fail to prepare file for download
|
||||||
*/
|
*/
|
||||||
public File prepareDownloadFile(Response response) throws IOException {
|
public File prepareDownloadFile(Response response) throws IOException {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
@@ -988,7 +1033,7 @@ public class ApiClient {
|
|||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
* @param call An instance of the Call object
|
* @param call An instance of the Call object
|
||||||
* @return ApiResponse<T>
|
* @return ApiResponse<T>
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call) throws ApiException {
|
||||||
return execute(call, null);
|
return execute(call, null);
|
||||||
@@ -1003,7 +1048,7 @@ public class ApiClient {
|
|||||||
* @return ApiResponse object containing response status, headers and
|
* @return ApiResponse object containing response status, headers and
|
||||||
* data, which is a Java object deserialized from response body and would be null
|
* data, which is a Java object deserialized from response body and would be null
|
||||||
* when returnType is null.
|
* when returnType is null.
|
||||||
* @throws ApiException If fail to execute the call
|
* @throws org.openapitools.client.ApiException If fail to execute the call
|
||||||
*/
|
*/
|
||||||
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
||||||
try {
|
try {
|
||||||
@@ -1067,7 +1112,7 @@ public class ApiClient {
|
|||||||
* @param response Response
|
* @param response Response
|
||||||
* @param returnType Return type
|
* @param returnType Return type
|
||||||
* @return Type
|
* @return Type
|
||||||
* @throws ApiException If the response has an unsuccessful status code or
|
* @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or
|
||||||
* fail to deserialize the response body
|
* 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 {
|
||||||
@@ -1113,7 +1158,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP call
|
* @return The HTTP call
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback);
|
||||||
@@ -1135,7 +1180,7 @@ public class ApiClient {
|
|||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
* @param callback Callback for upload/download progress
|
* @param callback Callback for upload/download progress
|
||||||
* @return The HTTP request
|
* @return The HTTP request
|
||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
|||||||
@@ -16,22 +16,47 @@ package org.openapitools.client;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>ApiException class.</p>
|
||||||
|
*/
|
||||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
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;
|
||||||
private String responseBody = null;
|
private String responseBody = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*/
|
||||||
public ApiException() {}
|
public ApiException() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
*/
|
||||||
public ApiException(Throwable throwable) {
|
public ApiException(Throwable throwable) {
|
||||||
super(throwable);
|
super(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
*/
|
||||||
public ApiException(String message) {
|
public ApiException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
@@ -39,23 +64,60 @@ public class ApiException extends Exception {
|
|||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
* @param throwable a {@link java.lang.Throwable} object
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
*/
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
this(message, throwable, code, responseHeaders, null);
|
this(message, throwable, code, responseHeaders, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message a {@link java.lang.String} object
|
||||||
|
*/
|
||||||
public ApiException(int code, String message) {
|
public ApiException(int code, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Constructor for ApiException.</p>
|
||||||
|
*
|
||||||
|
* @param code HTTP status code
|
||||||
|
* @param message the error message
|
||||||
|
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
|
||||||
|
* @param responseBody the response body
|
||||||
|
*/
|
||||||
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(code, message);
|
this(code, message);
|
||||||
this.responseHeaders = responseHeaders;
|
this.responseHeaders = responseHeaders;
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* API response returned by API call.
|
* API response returned by API call.
|
||||||
*
|
|
||||||
* @param <T> The type of data that is deserialized from response body
|
|
||||||
*/
|
*/
|
||||||
public class ApiResponse<T> {
|
public class ApiResponse<T> {
|
||||||
final private int statusCode;
|
final private int statusCode;
|
||||||
@@ -27,6 +25,8 @@ public class ApiResponse<T> {
|
|||||||
final private T data;
|
final private T data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
*/
|
*/
|
||||||
@@ -35,6 +35,8 @@ public class ApiResponse<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* <p>Constructor for ApiResponse.</p>
|
||||||
|
*
|
||||||
* @param statusCode The status code of HTTP response
|
* @param statusCode The status code of HTTP response
|
||||||
* @param headers The headers of HTTP response
|
* @param headers The headers of HTTP response
|
||||||
* @param data The object deserialized from response bod
|
* @param data The object deserialized from response bod
|
||||||
@@ -45,14 +47,29 @@ public class ApiResponse<T> {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>status code</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the status code
|
||||||
|
*/
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>headers</code>.</p>
|
||||||
|
*
|
||||||
|
* @return a {@link java.util.Map} of headers
|
||||||
|
*/
|
||||||
public Map<String, List<String>> getHeaders() {
|
public Map<String, List<String>> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Get the <code>data</code>.</p>
|
||||||
|
*
|
||||||
|
* @return the data
|
||||||
|
*/
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user