@Generated(value="io.swagger.codegen.languages.JavaClientCodegen", date="2019-09-24T08:47:37.022+02:00") @Component(value="org.appng.api.rest.ApiClient") public class ApiClient extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ApiClient.CollectionFormat |
Constructor and Description |
---|
ApiClient() |
ApiClient(org.springframework.web.client.RestTemplate restTemplate) |
Modifier and Type | Method and Description |
---|---|
ApiClient |
addDefaultHeader(String name,
String value)
Add a default header.
|
protected void |
addHeadersToRequest(org.springframework.http.HttpHeaders headers,
org.springframework.http.RequestEntity.BodyBuilder requestBuilder)
Add headers to the request that is being built
|
protected org.springframework.web.client.RestTemplate |
buildRestTemplate()
Build the RestTemplate used to make HTTP requests.
|
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()
Get the current base path
|
DateFormat |
getDateFormat()
Get the date format used to parse/format date parameters.
|
org.springframework.util.MultiValueMap<String,String> |
getResponseHeaders()
Gets the response headers of the previous request
|
org.springframework.http.HttpStatus |
getStatusCode()
Gets the status code of the previous request
|
protected void |
init() |
<T> T |
invokeAPI(String path,
org.springframework.http.HttpMethod method,
org.springframework.util.MultiValueMap<String,String> queryParams,
Object body,
org.springframework.http.HttpHeaders headerParams,
org.springframework.util.MultiValueMap<String,Object> formParams,
List<org.springframework.http.MediaType> accept,
org.springframework.http.MediaType contentType,
String[] authNames,
org.springframework.core.ParameterizedTypeReference<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(org.springframework.http.MediaType mediaType)
Check if the given MIME is a JSON MIME.
|
boolean |
isJsonMime(String mediaType)
Check if the given
String is a JSON MIME. |
org.springframework.util.MultiValueMap<String,String> |
parameterToMultiValueMap(ApiClient.CollectionFormat collectionFormat,
String name,
Object value)
Converts a parameter to a
MultiValueMap for use in REST requests |
String |
parameterToString(Object param)
Format the given parameter object into string.
|
Date |
parseDate(String str)
Parse the given string into Date object.
|
protected Object |
selectBody(Object obj,
org.springframework.util.MultiValueMap<String,Object> formParams,
org.springframework.http.MediaType contentType)
Select the body to use for the request
|
List<org.springframework.http.MediaType> |
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)
|
org.springframework.http.MediaType |
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.
|
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)
Set the base path, which should include the host
|
ApiClient |
setDateFormat(DateFormat dateFormat)
Set the date format used to parse/format date parameters.
|
void |
setDebugging(boolean debugging) |
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()
@Autowired public ApiClient(org.springframework.web.client.RestTemplate restTemplate)
protected void init()
public String getBasePath()
public ApiClient setBasePath(String basePath)
basePath
- the base pathpublic org.springframework.http.HttpStatus getStatusCode()
public org.springframework.util.MultiValueMap<String,String> getResponseHeaders()
public Map<String,Authentication> getAuthentications()
public Authentication getAuthentication(String authName)
authName
- The authentication namepublic void setUsername(String username)
username
- the usernamepublic void setPassword(String password)
password
- the passwordpublic void setApiKey(String apiKey)
apiKey
- the API keypublic void setApiKeyPrefix(String apiKeyPrefix)
apiKeyPrefix
- the API key prefixpublic void setAccessToken(String accessToken)
accessToken
- the access tokenpublic ApiClient setUserAgent(String userAgent)
userAgent
- the user agent stringpublic ApiClient addDefaultHeader(String name, String value)
name
- The header's namevalue
- The header's valuepublic void setDebugging(boolean debugging)
public boolean isDebugging()
public DateFormat getDateFormat()
public ApiClient setDateFormat(DateFormat dateFormat)
dateFormat
- Date formatpublic String parameterToString(Object param)
param
- the object to convertpublic org.springframework.util.MultiValueMap<String,String> parameterToMultiValueMap(ApiClient.CollectionFormat collectionFormat, String name, Object value)
MultiValueMap
for use in REST requestscollectionFormat
- The format to convert toname
- The name of the parametervalue
- The parameter's valuepublic boolean isJsonMime(String mediaType)
String
is a JSON MIME.mediaType
- the input MediaTypepublic boolean isJsonMime(org.springframework.http.MediaType mediaType)
mediaType
- the input MediaTypepublic List<org.springframework.http.MediaType> selectHeaderAccept(String[] accepts)
accepts
- The accepts array to select frompublic org.springframework.http.MediaType selectHeaderContentType(String[] contentTypes)
contentTypes
- The Content-Type array to select fromprotected Object selectBody(Object obj, org.springframework.util.MultiValueMap<String,Object> formParams, org.springframework.http.MediaType contentType)
obj
- the body objectformParams
- the form parameterscontentType
- the content type of the requestpublic <T> T invokeAPI(String path, org.springframework.http.HttpMethod method, org.springframework.util.MultiValueMap<String,String> queryParams, Object body, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<String,Object> formParams, List<org.springframework.http.MediaType> accept, org.springframework.http.MediaType contentType, String[] authNames, org.springframework.core.ParameterizedTypeReference<T> returnType) throws org.springframework.web.client.RestClientException
T
- the return type to usepath
- The sub-path of the HTTP URLmethod
- The request methodqueryParams
- The query parametersbody
- The request body objectheaderParams
- The header 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 responseorg.springframework.web.client.RestClientException
protected void addHeadersToRequest(org.springframework.http.HttpHeaders headers, org.springframework.http.RequestEntity.BodyBuilder requestBuilder)
headers
- The headers to addrequestBuilder
- The current requestprotected org.springframework.web.client.RestTemplate buildRestTemplate()
Copyright © 2011–2019 aiticon GmbH. All rights reserved.