@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
date="2020-08-14T13:43:37.324Z[UTC]")
public class ApiClient
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
authenticationLookup |
protected java.util.Map<java.lang.String,Authentication> |
authentications |
protected java.lang.String |
basePath |
protected int |
connectionTimeout |
protected java.text.DateFormat |
dateFormat |
protected boolean |
debugging |
protected java.util.Map<java.lang.String,java.lang.String> |
defaultCookieMap |
protected java.util.Map<java.lang.String,java.lang.String> |
defaultHeaderMap |
protected javax.ws.rs.client.Client |
httpClient |
protected JSON |
json |
protected java.util.Map<java.lang.String,java.lang.Integer> |
operationServerIndex |
protected java.util.Map<java.lang.String,java.util.List<ServerConfiguration>> |
operationServers |
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> |
operationServerVariables |
protected java.lang.Integer |
serverIndex |
protected java.util.List<ServerConfiguration> |
servers |
protected java.util.Map<java.lang.String,java.lang.String> |
serverVariables |
protected java.lang.String |
tempFolderPath |
| Constructor and Description |
|---|
ApiClient() |
| Modifier and Type | Method and Description |
|---|---|
ApiClient |
addDefaultCookie(java.lang.String key,
java.lang.String value)
Add a default cookie.
|
ApiClient |
addDefaultHeader(java.lang.String key,
java.lang.String value)
Add a default header.
|
protected javax.ws.rs.client.Client |
buildHttpClient(boolean debugging)
Build the Client used to make HTTP requests.
|
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
buildResponseHeaders(javax.ws.rs.core.Response response) |
void |
configureApiKeys(java.util.HashMap<java.lang.String,java.lang.String> secrets)
Helper method to configure authentications which respects aliases of API keys.
|
<T> T |
deserialize(javax.ws.rs.core.Response response,
javax.ws.rs.core.GenericType<T> returnType)
Deserialize response body to Java object according to the Content-Type.
|
java.io.File |
downloadFileFromResponse(javax.ws.rs.core.Response response)
Download file from the given response.
|
java.lang.String |
escapeString(java.lang.String str)
Escape the given string to be used as URL query value.
|
java.lang.String |
formatDate(java.util.Date date)
Format the given Date object into string.
|
Authentication |
getAuthentication(java.lang.String authName)
Get authentication for the given name.
|
java.util.Map<java.lang.String,Authentication> |
getAuthentications()
Get authentications (key: authentication name, value: authentication).
|
java.lang.String |
getBasePath() |
int |
getConnectTimeout()
Connect timeout (in milliseconds).
|
java.text.DateFormat |
getDateFormat()
Get the date format used to parse/format date parameters.
|
javax.ws.rs.client.Client |
getHttpClient() |
JSON |
getJSON()
Gets the JSON instance to do JSON serialization and deserialization.
|
int |
getReadTimeout()
read timeout (in milliseconds).
|
java.lang.Integer |
getServerIndex() |
java.util.List<ServerConfiguration> |
getServers() |
java.util.Map<java.lang.String,java.lang.String> |
getServerVariables() |
java.lang.String |
getTempFolderPath()
The path of temporary folder used to store downloaded files from endpoints
with file response.
|
<T> ApiResponse<T> |
invokeAPI(java.lang.String path,
java.lang.String method,
java.util.List<Pair> queryParams,
java.lang.Object body,
java.util.Map<java.lang.String,java.lang.String> headerParams,
java.util.Map<java.lang.String,java.lang.String> cookieParams,
java.util.Map<java.lang.String,java.lang.Object> formParams,
java.lang.String accept,
java.lang.String contentType,
java.lang.String[] authNames,
javax.ws.rs.core.GenericType<T> returnType)
Deprecated.
Add qualified name of the operation as a first parameter.
|
<T> ApiResponse<T> |
invokeAPI(java.lang.String operation,
java.lang.String path,
java.lang.String method,
java.util.List<Pair> queryParams,
java.lang.Object body,
java.util.Map<java.lang.String,java.lang.String> headerParams,
java.util.Map<java.lang.String,java.lang.String> cookieParams,
java.util.Map<java.lang.String,java.lang.Object> formParams,
java.lang.String accept,
java.lang.String contentType,
java.lang.String[] authNames,
javax.ws.rs.core.GenericType<T> returnType)
Invoke API by sending HTTP request with the given options.
|
boolean |
isDebugging()
Check that whether debugging is enabled for this API client.
|
boolean |
isJsonMime(java.lang.String mime)
Check if the given MIME is a JSON MIME.
|
java.util.List<Pair> |
parameterToPairs(java.lang.String collectionFormat,
java.lang.String name,
java.lang.Object value) |
java.lang.String |
parameterToString(java.lang.Object param)
Format the given parameter object into string.
|
java.util.Date |
parseDate(java.lang.String str)
Parse the given string into Date object.
|
protected void |
performAdditionalClientConfiguration(org.glassfish.jersey.client.ClientConfig clientConfig) |
java.io.File |
prepareDownloadFile(javax.ws.rs.core.Response response) |
java.lang.String |
selectHeaderAccept(java.lang.String[] accepts)
Select the Accept header's value from the given accepts array:
if JSON exists in the given array, use it;
otherwise use all of them (joining into a string)
|
java.lang.String |
selectHeaderContentType(java.lang.String[] contentTypes)
Select the Content-Type header's value from the given array:
if JSON exists in the given array, use it;
otherwise use the first one of the array.
|
javax.ws.rs.client.Entity<?> |
serialize(java.lang.Object obj,
java.util.Map<java.lang.String,java.lang.Object> formParams,
java.lang.String contentType)
Serialize the given Java object into string entity according the given
Content-Type (only JSON is supported for now).
|
void |
setApiKey(java.lang.String apiKey)
Helper method to set API key value for the first API key authentication.
|
void |
setApiKeyPrefix(java.lang.String apiKeyPrefix)
Helper method to set API key prefix for the first API key authentication.
|
ApiClient |
setBasePath(java.lang.String basePath) |
void |
setBearerToken(java.lang.String bearerToken)
Helper method to set bearer token for the first Bearer authentication.
|
ApiClient |
setConnectTimeout(int connectionTimeout)
Set the connect timeout (in milliseconds).
|
ApiClient |
setDateFormat(java.text.DateFormat dateFormat)
Set the date format used to parse/format date parameters.
|
ApiClient |
setDebugging(boolean debugging)
Enable/disable debugging for this API client.
|
ApiClient |
setHttpClient(javax.ws.rs.client.Client httpClient) |
void |
setPassword(java.lang.String password)
Helper method to set password for the first HTTP basic authentication.
|
ApiClient |
setReadTimeout(int readTimeout)
Set the read timeout (in milliseconds).
|
ApiClient |
setServerIndex(java.lang.Integer serverIndex) |
ApiClient |
setServers(java.util.List<ServerConfiguration> servers) |
ApiClient |
setServerVariables(java.util.Map<java.lang.String,java.lang.String> serverVariables) |
ApiClient |
setTempFolderPath(java.lang.String tempFolderPath)
Set temp folder path
|
ApiClient |
setUserAgent(java.lang.String userAgent)
Set the User-Agent header's value (by adding to the default header map).
|
void |
setUsername(java.lang.String username)
Helper method to set username for the first HTTP basic authentication.
|
protected void |
updateParamsForAuth(java.lang.String[] authNames,
java.util.List<Pair> queryParams,
java.util.Map<java.lang.String,java.lang.String> headerParams,
java.util.Map<java.lang.String,java.lang.String> cookieParams)
Update query and header parameters based on authentication settings.
|
protected java.util.Map<java.lang.String,java.lang.String> defaultHeaderMap
protected java.util.Map<java.lang.String,java.lang.String> defaultCookieMap
protected java.lang.String basePath
protected java.util.List<ServerConfiguration> servers
protected java.lang.Integer serverIndex
protected java.util.Map<java.lang.String,java.lang.String> serverVariables
protected java.util.Map<java.lang.String,java.util.List<ServerConfiguration>> operationServers
protected java.util.Map<java.lang.String,java.lang.Integer> operationServerIndex
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> operationServerVariables
protected boolean debugging
protected int connectionTimeout
protected javax.ws.rs.client.Client httpClient
protected JSON json
protected java.lang.String tempFolderPath
protected java.util.Map<java.lang.String,Authentication> authentications
protected java.util.Map<java.lang.String,java.lang.String> authenticationLookup
protected java.text.DateFormat dateFormat
public JSON getJSON()
public javax.ws.rs.client.Client getHttpClient()
public ApiClient setHttpClient(javax.ws.rs.client.Client httpClient)
public java.lang.String getBasePath()
public ApiClient setBasePath(java.lang.String basePath)
public java.util.List<ServerConfiguration> getServers()
public ApiClient setServers(java.util.List<ServerConfiguration> servers)
public java.lang.Integer getServerIndex()
public ApiClient setServerIndex(java.lang.Integer serverIndex)
public java.util.Map<java.lang.String,java.lang.String> getServerVariables()
public ApiClient setServerVariables(java.util.Map<java.lang.String,java.lang.String> serverVariables)
public java.util.Map<java.lang.String,Authentication> getAuthentications()
public Authentication getAuthentication(java.lang.String authName)
authName - The authentication namepublic void setUsername(java.lang.String username)
username - Usernamepublic void setPassword(java.lang.String password)
password - Passwordpublic void setApiKey(java.lang.String apiKey)
apiKey - API keypublic void configureApiKeys(java.util.HashMap<java.lang.String,java.lang.String> secrets)
secrets - Hash map from authentication name to its secret.public void setApiKeyPrefix(java.lang.String apiKeyPrefix)
apiKeyPrefix - API key prefixpublic void setBearerToken(java.lang.String bearerToken)
bearerToken - Bearer tokenpublic ApiClient setUserAgent(java.lang.String userAgent)
userAgent - Http user agentpublic ApiClient addDefaultHeader(java.lang.String key, java.lang.String value)
key - The header's keyvalue - The header's valuepublic ApiClient addDefaultCookie(java.lang.String key, java.lang.String value)
key - The cookie's keyvalue - The cookie's valuepublic boolean isDebugging()
public ApiClient setDebugging(boolean debugging)
debugging - To enable (true) or disable (false) debuggingpublic java.lang.String getTempFolderPath()
null, i.e. using
the system's default tempopary folder.public ApiClient setTempFolderPath(java.lang.String tempFolderPath)
tempFolderPath - Temp folder pathpublic int getConnectTimeout()
public ApiClient setConnectTimeout(int connectionTimeout)
Integer.MAX_VALUE.connectionTimeout - Connection timeout in millisecondspublic int getReadTimeout()
public ApiClient setReadTimeout(int readTimeout)
Integer.MAX_VALUE.readTimeout - Read timeout in millisecondspublic java.text.DateFormat getDateFormat()
public ApiClient setDateFormat(java.text.DateFormat dateFormat)
dateFormat - Date formatpublic java.util.Date parseDate(java.lang.String str)
str - Stringpublic java.lang.String formatDate(java.util.Date date)
date - Datepublic java.lang.String parameterToString(java.lang.Object param)
param - Objectpublic java.util.List<Pair> parameterToPairs(java.lang.String collectionFormat, java.lang.String name, java.lang.Object value)
public boolean isJsonMime(java.lang.String mime)
mime - MIMEpublic java.lang.String selectHeaderAccept(java.lang.String[] accepts)
accepts - The accepts array to select frompublic java.lang.String selectHeaderContentType(java.lang.String[] contentTypes)
contentTypes - The Content-Type array to select frompublic java.lang.String escapeString(java.lang.String str)
str - Stringpublic javax.ws.rs.client.Entity<?> serialize(java.lang.Object obj,
java.util.Map<java.lang.String,java.lang.Object> formParams,
java.lang.String contentType)
throws ApiException
obj - ObjectformParams - Form parameterscontentType - Context typeApiException - API exceptionpublic <T> T deserialize(javax.ws.rs.core.Response response,
javax.ws.rs.core.GenericType<T> returnType)
throws ApiException
T - Typeresponse - ResponsereturnType - Return typeApiException - API exceptionpublic java.io.File downloadFileFromResponse(javax.ws.rs.core.Response response)
throws ApiException
response - ResponseApiException - If fail to read file content from response and write to diskpublic java.io.File prepareDownloadFile(javax.ws.rs.core.Response response)
throws java.io.IOException
java.io.IOExceptionpublic <T> ApiResponse<T> invokeAPI(java.lang.String operation, java.lang.String path, java.lang.String method, java.util.List<Pair> queryParams, java.lang.Object body, java.util.Map<java.lang.String,java.lang.String> headerParams, java.util.Map<java.lang.String,java.lang.String> cookieParams, java.util.Map<java.lang.String,java.lang.Object> formParams, java.lang.String accept, java.lang.String contentType, java.lang.String[] authNames, javax.ws.rs.core.GenericType<T> returnType) throws ApiException
T - Typeoperation - The qualified name of the operationpath - The sub-path of the HTTP URLmethod - The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"queryParams - The query parametersbody - The request body objectheaderParams - The header parameterscookieParams - The cookie parametersformParams - The form parametersaccept - The request's Accept headercontentType - The request's Content-Type headerauthNames - The authentications to applyreturnType - The return type into which to deserialize the responseApiException - API exception@Deprecated public <T> ApiResponse<T> invokeAPI(java.lang.String path, java.lang.String method, java.util.List<Pair> queryParams, java.lang.Object body, java.util.Map<java.lang.String,java.lang.String> headerParams, java.util.Map<java.lang.String,java.lang.String> cookieParams, java.util.Map<java.lang.String,java.lang.Object> formParams, java.lang.String accept, java.lang.String contentType, java.lang.String[] authNames, javax.ws.rs.core.GenericType<T> returnType) throws ApiException
ApiExceptionprotected javax.ws.rs.client.Client buildHttpClient(boolean debugging)
debugging - Debug settingprotected void performAdditionalClientConfiguration(org.glassfish.jersey.client.ClientConfig clientConfig)
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> buildResponseHeaders(javax.ws.rs.core.Response response)
protected void updateParamsForAuth(java.lang.String[] authNames,
java.util.List<Pair> queryParams,
java.util.Map<java.lang.String,java.lang.String> headerParams,
java.util.Map<java.lang.String,java.lang.String> cookieParams)
authNames - The authentications to applyqueryParams - List of query parametersheaderParams - Map of header parameterscookieParams - Map of cookie parameters