@Generated(value="class io.swagger.codegen.languages.JavaClientCodegen", date="2017-03-06T16:42:36.211-08:00") public class ApiClient extends Object
| Modifier and Type | Method and Description |
|---|---|
ApiClient |
addDefaultHeader(String key,
String value)
Add a default header.
|
String |
escapeString(String str)
Escape the given string to be used as URL query value.
|
String |
formatDate(Date date)
Format the given Date object into string.
|
Authentication |
getAuthentication(String authName)
Get authentication for the given name.
|
Map<String,Authentication> |
getAuthentications()
Get authentications (key: authentication name, value: authentication).
|
String |
getBasePath() |
int |
getConnectTimeout()
Connect timeout (in milliseconds).
|
DateFormat |
getDateFormat()
Get the date format used to parse/format date parameters.
|
Map<String,List<String>> |
getResponseHeaders()
Gets the response headers of the previous request
|
int |
getStatusCode()
Gets the status code of the previous request
|
<T> T |
invokeAPI(String path,
String method,
List<Pair> queryParams,
Object body,
Map<String,String> headerParams,
Map<String,Object> formParams,
String accept,
String contentType,
String[] authNames,
com.sun.jersey.api.client.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(String mime)
Check if the given MIME is a JSON MIME.
|
List<Pair> |
parameterToPairs(String collectionFormat,
String name,
Object value) |
String |
parameterToString(Object param)
Format the given parameter object into string.
|
Date |
parseDate(String str)
Parse the given string into Date object.
|
String |
selectHeaderAccept(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)
|
String |
selectHeaderContentType(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.
|
Object |
serialize(Object obj,
String contentType,
Map<String,Object> formParams)
Serialize the given Java object into string according the given Content-Type (only JSON is supported for now).
|
void |
setAccessToken(String accessToken)
Helper method to set access token for the first OAuth2 authentication.
|
void |
setApiKey(String apiKey)
Helper method to set API key value for the first API key authentication.
|
void |
setApiKeyPrefix(String apiKeyPrefix)
Helper method to set API key prefix for the first API key authentication.
|
ApiClient |
setBasePath(String basePath) |
ApiClient |
setConnectTimeout(int connectionTimeout)
Set the connect timeout (in milliseconds).
|
ApiClient |
setDateFormat(DateFormat dateFormat)
Set the date format used to parse/format date parameters.
|
ApiClient |
setDebugging(boolean debugging)
Enable/disable debugging for this API client.
|
void |
setPassword(String password)
Helper method to set password for the first HTTP basic authentication.
|
ApiClient |
setUserAgent(String userAgent)
Set the User-Agent header’s value (by adding to the default header map).
|
void |
setUsername(String username)
Helper method to set username for the first HTTP basic authentication.
|
public ApiClient()
public ApiClient(String basePath)
public String getBasePath()
public int getStatusCode()
Gets the status code of the previous request
public Map<String,List<String>> getResponseHeaders()
Gets the response headers of the previous request
public Map<String,Authentication> getAuthentications()
Get authentications (key: authentication name, value: authentication).
public Authentication getAuthentication(String authName)
Get authentication for the given name.
authName - The authentication namepublic void setUsername(String username)
Helper method to set username for the first HTTP basic authentication.
public void setPassword(String password)
Helper method to set password for the first HTTP basic authentication.
public void setApiKey(String apiKey)
Helper method to set API key value for the first API key authentication.
public void setApiKeyPrefix(String apiKeyPrefix)
Helper method to set API key prefix for the first API key authentication.
public void setAccessToken(String accessToken)
Helper method to set access token for the first OAuth2 authentication.
public ApiClient setUserAgent(String userAgent)
Set the User-Agent header’s value (by adding to the default header map).
public ApiClient addDefaultHeader(String key, String value)
Add a default header.
key - The header’s keyvalue - The header’s valuepublic boolean isDebugging()
Check that whether debugging is enabled for this API client.
public ApiClient setDebugging(boolean debugging)
Enable/disable debugging for this API client.
debugging - To enable (true) or disable (false) debuggingpublic int getConnectTimeout()
Connect timeout (in milliseconds).
public ApiClient setConnectTimeout(int connectionTimeout)
Set the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values must be between 1 and Integer.MAX_VALUE.
public DateFormat getDateFormat()
Get the date format used to parse/format date parameters.
public ApiClient setDateFormat(DateFormat dateFormat)
Set the date format used to parse/format date parameters.
public String parameterToString(Object param)
Format the given parameter object into string.
public List<Pair> parameterToPairs(String collectionFormat, String name, Object value)
public boolean isJsonMime(String mime)
Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON
public String selectHeaderAccept(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)
accepts - The accepts array to select frompublic String selectHeaderContentType(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.
contentTypes - The Content-Type array to select frompublic String escapeString(String str)
Escape the given string to be used as URL query value.
public Object serialize(Object obj, String contentType, Map<String,Object> formParams) throws ApiException
Serialize the given Java object into string according the given Content-Type (only JSON is supported for now).
ApiExceptionpublic <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String,String> headerParams, Map<String,Object> formParams, String accept, String contentType, String[] authNames, com.sun.jersey.api.client.GenericType<T> returnType) throws ApiException
Invoke API by sending HTTP request with the given options.
path - The sub-path of the HTTP URLmethod - The request method, one of “GET”, “POST”, “PUT”, and “DELETE”queryParams - The query parametersbody - The request body object - if it is not binary, otherwise nullheaderParams - The header parametersformParams - The form parametersaccept - The request’s Accept headercontentType - The request’s Content-Type headerauthNames - The authentications to applyApiExceptionCopyright © 2017. All Rights Reserved.