Package app.keyconnect.rippled
Class ApiClient
java.lang.Object
app.keyconnect.rippled.JavaTimeFormatter
app.keyconnect.rippled.ApiClient
@Generated("org.openapitools.codegen.languages.JavaClientCodegen")
@Component("app.keyconnect.rippled.ApiClient")
public class ApiClient
extends JavaTimeFormatter
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classApiClient.CollectionFormat -
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected voidaddCookiesToRequest(org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> cookies, org.springframework.http.RequestEntity.BodyBuilder requestBuilder)Add cookies to the request that is being builtApiClientaddDefaultCookie(java.lang.String name, java.lang.String value)Add a default cookie.ApiClientaddDefaultHeader(java.lang.String name, java.lang.String value)Add a default header.protected voidaddHeadersToRequest(org.springframework.http.HttpHeaders headers, org.springframework.http.RequestEntity.BodyBuilder requestBuilder)Add headers to the request that is being builtprotected org.springframework.web.client.RestTemplatebuildRestTemplate()Build the RestTemplate used to make HTTP requests.java.lang.StringcollectionPathParameterToString(ApiClient.CollectionFormat collectionFormat, java.util.Collection<?> values)Formats the specified collection path parameter to a string value.java.lang.StringexpandPath(java.lang.String pathTemplate, java.util.Map<java.lang.String,java.lang.Object> variables)Expand path template with variablesjava.lang.StringformatDate(java.util.Date date)Format the given Date object into string.AuthenticationgetAuthentication(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.StringgetBasePath()Get the current base pathjava.text.DateFormatgetDateFormat()Get the date format used to parse/format date parameters.protected voidinit()<T> org.springframework.http.ResponseEntity<T>invokeAPI(java.lang.String path, org.springframework.http.HttpMethod method, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> queryParams, java.lang.Object body, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> cookieParams, org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object> formParams, java.util.List<org.springframework.http.MediaType> accept, org.springframework.http.MediaType contentType, java.lang.String[] authNames, org.springframework.core.ParameterizedTypeReference<T> returnType)Invoke API by sending HTTP request with the given options.booleanisDebugging()Check that whether debugging is enabled for this API client.booleanisJsonMime(java.lang.String mediaType)Check if the givenStringis a JSON MIME.booleanisJsonMime(org.springframework.http.MediaType mediaType)Check if the given MIME is a JSON MIME.org.springframework.util.MultiValueMap<java.lang.String,java.lang.String>parameterToMultiValueMap(ApiClient.CollectionFormat collectionFormat, java.lang.String name, java.lang.Object value)Converts a parameter to aMultiValueMapfor use in REST requestsjava.lang.StringparameterToString(java.lang.Object param)Format the given parameter object into string.java.util.DateparseDate(java.lang.String str)Parse the given string into Date object.protected java.lang.ObjectselectBody(java.lang.Object obj, org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object> formParams, org.springframework.http.MediaType contentType)Select the body to use for the requestjava.util.List<org.springframework.http.MediaType>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)org.springframework.http.MediaTypeselectHeaderContentType(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.ApiClientsetBasePath(java.lang.String basePath)Set the base path, which should include the hostApiClientsetDateFormat(java.text.DateFormat dateFormat)Set the date format used to parse/format date parameters.voidsetDebugging(boolean debugging)ApiClientsetUserAgent(java.lang.String userAgent)Set the User-Agent header's value (by adding to the default header map).protected voidupdateParamsForAuth(java.lang.String[] authNames, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> queryParams, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> cookieParams)Update query and header parameters based on authentication settings.Methods inherited from class app.keyconnect.rippled.JavaTimeFormatter
formatOffsetDateTime, getOffsetDateTimeFormatter, parseOffsetDateTime, setOffsetDateTimeFormatterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ApiClient
public ApiClient() -
ApiClient
@Autowired public ApiClient(org.springframework.web.client.RestTemplate restTemplate)
-
-
Method Details
-
init
protected void init() -
getBasePath
public java.lang.String getBasePath()Get the current base path- Returns:
- String the base path
-
setBasePath
Set the base path, which should include the host- Parameters:
basePath- the base path- Returns:
- ApiClient this client
-
getAuthentications
Get authentications (key: authentication name, value: authentication).- Returns:
- Map the currently configured authentication types
-
getAuthentication
Get authentication for the given name.- Parameters:
authName- The authentication name- Returns:
- The authentication, null if not found
-
setUserAgent
Set the User-Agent header's value (by adding to the default header map).- Parameters:
userAgent- the user agent string- Returns:
- ApiClient this client
-
addDefaultHeader
Add a default header.- Parameters:
name- The header's namevalue- The header's value- Returns:
- ApiClient this client
-
addDefaultCookie
Add a default cookie.- Parameters:
name- The cookie's namevalue- The cookie's value- Returns:
- ApiClient this client
-
setDebugging
public void setDebugging(boolean debugging) -
isDebugging
public boolean isDebugging()Check that whether debugging is enabled for this API client.- Returns:
- boolean true if this client is enabled for debugging, false otherwise
-
getDateFormat
public java.text.DateFormat getDateFormat()Get the date format used to parse/format date parameters.- Returns:
- DateFormat format
-
setDateFormat
Set the date format used to parse/format date parameters.- Parameters:
dateFormat- Date format- Returns:
- API client
-
parseDate
public java.util.Date parseDate(java.lang.String str)Parse the given string into Date object.- Parameters:
str- the string to parse- Returns:
- the Date parsed from the string
-
formatDate
public java.lang.String formatDate(java.util.Date date)Format the given Date object into string.- Parameters:
date- the date to format- Returns:
- the formatted date as string
-
parameterToString
public java.lang.String parameterToString(java.lang.Object param)Format the given parameter object into string.- Parameters:
param- the object to convert- Returns:
- String the parameter represented as a String
-
collectionPathParameterToString
public java.lang.String collectionPathParameterToString(ApiClient.CollectionFormat collectionFormat, java.util.Collection<?> values)Formats the specified collection path parameter to a string value.- Parameters:
collectionFormat- The collection format of the parameter.values- The values of the parameter.- Returns:
- String representation of the parameter
-
parameterToMultiValueMap
public org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> parameterToMultiValueMap(ApiClient.CollectionFormat collectionFormat, java.lang.String name, java.lang.Object value)Converts a parameter to aMultiValueMapfor use in REST requests- Parameters:
collectionFormat- The format to convert toname- The name of the parametervalue- The parameter's value- Returns:
- a Map containing the String value(s) of the input parameter
-
isJsonMime
public boolean isJsonMime(java.lang.String mediaType)Check if the givenStringis a JSON MIME.- Parameters:
mediaType- the input MediaType- Returns:
- boolean true if the MediaType represents JSON, false otherwise
-
isJsonMime
public boolean isJsonMime(org.springframework.http.MediaType mediaType)Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON- Parameters:
mediaType- the input MediaType- Returns:
- boolean true if the MediaType represents JSON, false otherwise
-
selectHeaderAccept
public java.util.List<org.springframework.http.MediaType> 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)- Parameters:
accepts- The accepts array to select from- Returns:
- List The list of MediaTypes to use for the Accept header
-
selectHeaderContentType
public org.springframework.http.MediaType 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.- Parameters:
contentTypes- The Content-Type array to select from- Returns:
- MediaType The Content-Type header to use. If the given array is empty, JSON will be used.
-
selectBody
protected java.lang.Object selectBody(java.lang.Object obj, org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object> formParams, org.springframework.http.MediaType contentType)Select the body to use for the request- Parameters:
obj- the body objectformParams- the form parameterscontentType- the content type of the request- Returns:
- Object the selected body
-
expandPath
public java.lang.String expandPath(java.lang.String pathTemplate, java.util.Map<java.lang.String,java.lang.Object> variables)Expand path template with variables- Parameters:
pathTemplate- path template with placeholdersvariables- variables to replace- Returns:
- path with placeholders replaced by variables
-
invokeAPI
public <T> org.springframework.http.ResponseEntity<T> invokeAPI(java.lang.String path, org.springframework.http.HttpMethod method, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> queryParams, java.lang.Object body, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> cookieParams, org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object> formParams, java.util.List<org.springframework.http.MediaType> accept, org.springframework.http.MediaType contentType, java.lang.String[] authNames, org.springframework.core.ParameterizedTypeReference<T> returnType) throws org.springframework.web.client.RestClientExceptionInvoke API by sending HTTP request with the given options.- Type Parameters:
T- the return type to use- Parameters:
path- The sub-path of the HTTP URLmethod- The request methodqueryParams- 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 response- Returns:
- ResponseEntity<T> The response of the chosen type
- Throws:
org.springframework.web.client.RestClientException
-
addHeadersToRequest
protected void addHeadersToRequest(org.springframework.http.HttpHeaders headers, org.springframework.http.RequestEntity.BodyBuilder requestBuilder)Add headers to the request that is being built- Parameters:
headers- The headers to addrequestBuilder- The current request
-
addCookiesToRequest
protected void addCookiesToRequest(org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> cookies, org.springframework.http.RequestEntity.BodyBuilder requestBuilder)Add cookies to the request that is being built- Parameters:
cookies- The cookies to addrequestBuilder- The current request
-
buildRestTemplate
protected org.springframework.web.client.RestTemplate buildRestTemplate()Build the RestTemplate used to make HTTP requests.- Returns:
- RestTemplate
-
updateParamsForAuth
protected void updateParamsForAuth(java.lang.String[] authNames, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> queryParams, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> cookieParams)Update query and header parameters based on authentication settings.- Parameters:
authNames- The authentications to applyqueryParams- The query parametersheaderParams- The header parameters
-