Class ApiClient
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.github.v1.generated.JavaTimeFormatter
com.irurueta.authserver.authorization.infrastructure.github.v1.generated.ApiClient
@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
comments="Generator version: 7.27.0")
public class ApiClient
extends JavaTimeFormatter
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String, Authentication> protected Stringprotected final DateFormatprotected final org.springframework.http.HttpHeadersprotected ExceptionProviderTheExceptionProviderused to create exceptions thrown by this client.protected final tools.jackson.databind.json.JsonMapperprotected final org.springframework.web.client.RestClientprotected Integerprotected List<ServerConfiguration> -
Constructor Summary
ConstructorsModifierConstructorDescriptionApiClient(org.springframework.web.client.RestClient restClient) protectedApiClient(org.springframework.web.client.RestClient restClient, DateFormat format) ApiClient(org.springframework.web.client.RestClient restClient, tools.jackson.databind.json.JsonMapper mapper, DateFormat format) ApiClient(tools.jackson.databind.json.JsonMapper mapper, DateFormat format) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCookiesToRequest(org.springframework.util.MultiValueMap<String, String> cookies, org.springframework.web.client.RestClient.RequestBodySpec requestBuilder) Add cookies to the request that is being builtaddDefaultCookie(String name, String value) Add a default cookie.addDefaultHeader(String name, String value) Add a default header.protected voidaddHeadersToRequest(org.springframework.http.HttpHeaders headers, org.springframework.web.client.RestClient.RequestBodySpec requestBuilder) Add headers to the request that is being builtprotected StringbuildCookieHeader(org.springframework.util.MultiValueMap<String, String> cookies) Build cookie header.static org.springframework.web.client.RestClientBuild the RestClient used to make HTTP requests.static org.springframework.web.client.RestClientbuildRestClient(tools.jackson.databind.json.JsonMapper mapper) Build the RestClient used to make HTTP requests.static org.springframework.web.client.RestClient.BuilderBuild the RestClientBuilder used to make RestClient.static org.springframework.web.client.RestClient.BuilderbuildRestClientBuilder(tools.jackson.databind.json.JsonMapper mapper) Build the RestClientBuilder used to make RestClient.collectionPathParameterToString(ApiClient.CollectionFormat collectionFormat, Collection<?> values) Formats the specified collection path parameter to a string value.static DateFormatstatic tools.jackson.databind.json.JsonMappercreateDefaultMapper(DateFormat dateFormat) formatDate(Date date) Format the given Date object into string.protected StringgenerateQueryUri(org.springframework.util.MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) Include queryParams in uriParams taking into account the paramNamegetAuthentication(String authName) Get authentication for the given name.Get authentications (key: authentication name, value: authentication).Get the current base pathGet the date format used to parse/format date parameters.Get the currentExceptionProvider.tools.jackson.databind.json.JsonMapperGet the JsonMapper used to make HTTP requests.org.springframework.web.client.RestClientGet the RestClient used to make HTTP requests.protected voidinit()<T> org.springframework.web.client.RestClient.ResponseSpecinvokeAPI(String path, org.springframework.http.HttpMethod method, Map<String, Object> pathParams, org.springframework.util.MultiValueMap<String, String> queryParams, Object body, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<String, String> cookieParams, 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.booleanisJsonMime(String mediaType) Check if the givenStringis a JSON MIME.booleanisJsonMime(org.springframework.http.MediaType mediaType) Check if the given MIME is a JSON MIME.booleanisProblemJsonMime(String mediaType) Check if the givenStringis a Problem JSON MIME (RFC-7807).parameterToMultiValueMap(ApiClient.CollectionFormat collectionFormat, String name, Object value) Converts a parameter to aMultiValueMapfor use in REST requestsparameterToMultiValueMapJson(ApiClient.CollectionFormat collectionFormat, String name, Object value) Converts a parameter to aMultiValueMapcontaining Json-serialized values for use in REST requestsparameterToString(Object param) Format the given parameter object into string.Parse the given string into Date object.protected org.springframework.web.client.RestClient.RequestBodySpecprepareRequest(String path, org.springframework.http.HttpMethod method, Map<String, Object> pathParams, org.springframework.util.MultiValueMap<String, String> queryParams, Object body, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<String, String> cookieParams, org.springframework.util.MultiValueMap<String, Object> formParams, List<org.springframework.http.MediaType> accept, org.springframework.http.MediaType contentType, String[] authNames) protected ObjectselectBody(Object obj, org.springframework.util.MultiValueMap<String, Object> formParams, org.springframework.http.MediaType contentType) Select the body to use for the requestList<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.MediaTypeselectHeaderContentType(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 non-wildcard one of the array.voidHelper method to set API key value for the first API key authentication.voidsetApiKeyPrefix(String apiKeyPrefix) Helper method to set API key prefix for the first API key authentication.setBasePath(String basePath) Set the base path, which should include the hostvoidsetBearerToken(String bearerToken) Helper method to set access token for the first Bearer authentication.voidsetBearerToken(Supplier<String> tokenSupplier) Helper method to set the supplier of access tokens for Bearer authentication.setExceptionProvider(ExceptionProvider exceptionProvider) Set a customExceptionProviderto control which exception types are thrown by this client.voidsetPassword(String password) Helper method to set password for the first HTTP basic authentication.setServerIndex(Integer serverIndex) setServers(List<ServerConfiguration> servers) setServerVariables(Map<String, String> serverVariables) setUserAgent(String userAgent) Set the User-Agent header's value (by adding to the default header map).voidsetUsername(String username) Helper method to set username for the first HTTP basic authentication.protected voidupdateParamsForAuth(String[] authNames, org.springframework.util.MultiValueMap<String, String> queryParams, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<String, String> cookieParams) Update query and header parameters based on authentication settings.Methods inherited from class com.irurueta.authserver.authorization.infrastructure.github.v1.generated.JavaTimeFormatter
formatOffsetDateTime, getOffsetDateTimeFormatter, parseOffsetDateTime, setOffsetDateTimeFormatter
-
Field Details
-
defaultHeaders
protected final org.springframework.http.HttpHeaders defaultHeaders -
defaultCookies
-
basePath
-
servers
-
serverIndex
-
serverVariables
-
restClient
protected final org.springframework.web.client.RestClient restClient -
dateFormat
-
mapper
protected final tools.jackson.databind.json.JsonMapper mapper -
authentications
-
exceptionProvider
TheExceptionProviderused to create exceptions thrown by this client. Defaults toExceptionProvider.DEFAULT. Can be replaced to customize the exceptions thrown by this client by callingsetExceptionProvider(ExceptionProvider).
-
-
Constructor Details
-
ApiClient
public ApiClient() -
ApiClient
public ApiClient(org.springframework.web.client.RestClient restClient) -
ApiClient
-
ApiClient
public ApiClient(org.springframework.web.client.RestClient restClient, tools.jackson.databind.json.JsonMapper mapper, DateFormat format) -
ApiClient
-
-
Method Details
-
createDefaultDateFormat
-
createDefaultMapper
public static tools.jackson.databind.json.JsonMapper createDefaultMapper(@Nullable DateFormat dateFormat) -
init
protected void init() -
buildRestClientBuilder
public static org.springframework.web.client.RestClient.Builder buildRestClientBuilder(tools.jackson.databind.json.JsonMapper mapper) Build the RestClientBuilder used to make RestClient.- Parameters:
mapper- JsonMapper used for serialize/deserialize- Returns:
- RestClient
-
buildRestClientBuilder
public static org.springframework.web.client.RestClient.Builder buildRestClientBuilder()Build the RestClientBuilder used to make RestClient.- Returns:
- RestClient
-
buildRestClient
public static org.springframework.web.client.RestClient buildRestClient(tools.jackson.databind.json.JsonMapper mapper) Build the RestClient used to make HTTP requests.- Parameters:
mapper- JsonMapper used for serialize/deserialize- Returns:
- RestClient
-
buildRestClient
public static org.springframework.web.client.RestClient buildRestClient()Build the RestClient used to make HTTP requests.- Returns:
- RestClient
-
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
-
getServers
-
setServers
-
getServerIndex
-
setServerIndex
-
getServerVariables
-
setServerVariables
-
getAuthentications
Get authentications (key: authentication name, value: authentication).- Returns:
- Map the currently configured authentication types
-
getExceptionProvider
Get the currentExceptionProvider.- Returns:
- the exception provider
-
setExceptionProvider
Set a customExceptionProviderto control which exception types are thrown by this client.- Parameters:
exceptionProvider- the exception provider- Returns:
- this client instance
-
getAuthentication
Get authentication for the given name.- Parameters:
authName- The authentication name- Returns:
- The authentication, null if not found
-
setBearerToken
Helper method to set access token for the first Bearer authentication.- Parameters:
bearerToken- Bearer token
-
setBearerToken
Helper method to set the supplier of access tokens for Bearer authentication.- Parameters:
tokenSupplier- the token supplier function
-
setUsername
Helper method to set username for the first HTTP basic authentication.- Parameters:
username- the username
-
setPassword
Helper method to set password for the first HTTP basic authentication.- Parameters:
password- the password
-
setApiKey
Helper method to set API key value for the first API key authentication.- Parameters:
apiKey- the API key
-
setApiKeyPrefix
Helper method to set API key prefix for the first API key authentication.- Parameters:
apiKeyPrefix- the API key prefix
-
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
-
getDateFormat
Get the date format used to parse/format date parameters.- Returns:
- DateFormat format
-
parseDate
Parse the given string into Date object. -
formatDate
Format the given Date object into string. -
getJsonMapper
public tools.jackson.databind.json.JsonMapper getJsonMapper()Get the JsonMapper used to make HTTP requests.- Returns:
- JsonMapper mapper
-
getRestClient
public org.springframework.web.client.RestClient getRestClient()Get the RestClient used to make HTTP requests.- Returns:
- RestClient restClient
-
parameterToString
Format the given parameter object into string.- Parameters:
param- the object to convert- Returns:
- String the parameter represented as a String
-
parameterToMultiValueMapJson
public org.springframework.util.MultiValueMap<String,String> parameterToMultiValueMapJson(ApiClient.CollectionFormat collectionFormat, String name, Object value) Converts a parameter to aMultiValueMapcontaining Json-serialized values for 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 Json-serialized String value(s) of the input parameter
-
parameterToMultiValueMap
public org.springframework.util.MultiValueMap<String,String> parameterToMultiValueMap(ApiClient.CollectionFormat collectionFormat, String name, 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
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
-
isProblemJsonMime
Check if the givenStringis a Problem JSON MIME (RFC-7807).- Parameters:
mediaType- the input MediaType- Returns:
- boolean true if the MediaType represents Problem JSON, false otherwise
-
selectHeaderAccept
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
Select the Content-Type header's value from the given array: if JSON exists in the given array, use it; otherwise use the first non-wildcard 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, null will be returned; if it only contains wildcard media types, JSON will be used.
-
selectBody
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- Parameters:
obj- the body objectformParams- the form parameterscontentType- the content type of the request- Returns:
- Object the selected body
-
invokeAPI
public <T> org.springframework.web.client.RestClient.ResponseSpec invokeAPI(String path, org.springframework.http.HttpMethod method, Map<String, Object> pathParams, org.springframework.util.MultiValueMap<String, throws org.springframework.web.client.RestClientExceptionString> queryParams, Object body, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<String, String> cookieParams, 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.- Type Parameters:
T- the return type to use- Parameters:
path- The sub-path of the HTTP URLmethod- The request methodpathParams- The path parametersqueryParams- 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 response- Returns:
- The response body in chosen type
- Throws:
org.springframework.web.client.RestClientException
-
generateQueryUri
protected String generateQueryUri(org.springframework.util.MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) Include queryParams in uriParams taking into account the paramName- Parameters:
queryParams- The query parametersuriParams- The path parameters return templatized query string
-
prepareRequest
protected org.springframework.web.client.RestClient.RequestBodySpec prepareRequest(String path, org.springframework.http.HttpMethod method, Map<String, Object> pathParams, org.springframework.util.MultiValueMap<String, String> queryParams, Object body, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<String, String> cookieParams, org.springframework.util.MultiValueMap<String, Object> formParams, List<org.springframework.http.MediaType> accept, org.springframework.http.MediaType contentType, String[] authNames) -
addHeadersToRequest
protected void addHeadersToRequest(org.springframework.http.HttpHeaders headers, org.springframework.web.client.RestClient.RequestBodySpec 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<String, String> cookies, org.springframework.web.client.RestClient.RequestBodySpec requestBuilder) Add cookies to the request that is being built- Parameters:
cookies- The cookies to addrequestBuilder- The current request
-
buildCookieHeader
Build cookie header. Keeps a single value per cookie (as per RFC6265 section 5.3).- Parameters:
cookies- map all cookies- Returns:
- header string for cookies.
-
updateParamsForAuth
protected void updateParamsForAuth(String[] authNames, org.springframework.util.MultiValueMap<String, String> queryParams, org.springframework.http.HttpHeaders headerParams, org.springframework.util.MultiValueMap<String, String> cookieParams) Update query and header parameters based on authentication settings.- Parameters:
authNames- The authentications to applyqueryParams- The query parametersheaderParams- The header parameterscookieParams- the cookie parameters
-
collectionPathParameterToString
public String collectionPathParameterToString(ApiClient.CollectionFormat collectionFormat, 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
-