java.lang.Object
com.irurueta.authserver.serviceclient.infrastructure.resourceserver.v1.generated.JavaTimeFormatter
com.irurueta.authserver.serviceclient.infrastructure.resourceserver.v1.generated.ApiClient

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", comments="Generator version: 7.27.0") public class ApiClient extends JavaTimeFormatter
  • Field Details

  • Constructor Details

    • ApiClient

      public ApiClient()
    • ApiClient

      public ApiClient(org.springframework.web.client.RestClient restClient)
    • ApiClient

      public ApiClient(tools.jackson.databind.json.JsonMapper mapper, DateFormat format)
    • ApiClient

      public ApiClient(org.springframework.web.client.RestClient restClient, tools.jackson.databind.json.JsonMapper mapper, DateFormat format)
    • ApiClient

      protected ApiClient(org.springframework.web.client.RestClient restClient, DateFormat format)
  • Method Details

    • createDefaultDateFormat

      public static DateFormat 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

      public String getBasePath()
      Get the current base path
      Returns:
      String the base path
    • setBasePath

      public ApiClient setBasePath(String basePath)
      Set the base path, which should include the host
      Parameters:
      basePath - the base path
      Returns:
      ApiClient this client
    • getServers

      public List<ServerConfiguration> getServers()
    • setServers

      public ApiClient setServers(List<ServerConfiguration> servers)
    • getServerIndex

      public Integer getServerIndex()
    • setServerIndex

      public ApiClient setServerIndex(Integer serverIndex)
    • getServerVariables

      public Map<String,String> getServerVariables()
    • setServerVariables

      public ApiClient setServerVariables(Map<String,String> serverVariables)
    • getAuthentications

      public Map<String,Authentication> getAuthentications()
      Get authentications (key: authentication name, value: authentication).
      Returns:
      Map the currently configured authentication types
    • getExceptionProvider

      public ExceptionProvider getExceptionProvider()
      Get the current ExceptionProvider.
      Returns:
      the exception provider
    • setExceptionProvider

      public ApiClient setExceptionProvider(ExceptionProvider exceptionProvider)
      Set a custom ExceptionProvider to control which exception types are thrown by this client.
      Parameters:
      exceptionProvider - the exception provider
      Returns:
      this client instance
    • getAuthentication

      public Authentication getAuthentication(String authName)
      Get authentication for the given name.
      Parameters:
      authName - The authentication name
      Returns:
      The authentication, null if not found
    • setBearerToken

      public void setBearerToken(String bearerToken)
      Helper method to set access token for the first Bearer authentication.
      Parameters:
      bearerToken - Bearer token
    • setBearerToken

      public void setBearerToken(Supplier<String> tokenSupplier)
      Helper method to set the supplier of access tokens for Bearer authentication.
      Parameters:
      tokenSupplier - the token supplier function
    • setUsername

      public void setUsername(String username)
      Helper method to set username for the first HTTP basic authentication.
      Parameters:
      username - the username
    • setPassword

      public void setPassword(String password)
      Helper method to set password for the first HTTP basic authentication.
      Parameters:
      password - the password
    • setApiKey

      public void setApiKey(String apiKey)
      Helper method to set API key value for the first API key authentication.
      Parameters:
      apiKey - the API key
    • setApiKeyPrefix

      public void setApiKeyPrefix(String apiKeyPrefix)
      Helper method to set API key prefix for the first API key authentication.
      Parameters:
      apiKeyPrefix - the API key prefix
    • setUserAgent

      public ApiClient setUserAgent(String userAgent)
      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

      public ApiClient addDefaultHeader(String name, String value)
      Add a default header.
      Parameters:
      name - The header's name
      value - The header's value
      Returns:
      ApiClient this client
    • addDefaultCookie

      public ApiClient addDefaultCookie(String name, String value)
      Add a default cookie.
      Parameters:
      name - The cookie's name
      value - The cookie's value
      Returns:
      ApiClient this client
    • getDateFormat

      public DateFormat getDateFormat()
      Get the date format used to parse/format date parameters.
      Returns:
      DateFormat format
    • parseDate

      public Date parseDate(String str)
      Parse the given string into Date object.
    • formatDate

      public String formatDate(Date date)
      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

      public String parameterToString(Object param)
      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 a MultiValueMap containing Json-serialized values for use in REST requests
      Parameters:
      collectionFormat - The format to convert to
      name - The name of the parameter
      value - 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 a MultiValueMap for use in REST requests
      Parameters:
      collectionFormat - The format to convert to
      name - The name of the parameter
      value - The parameter's value
      Returns:
      a Map containing the String value(s) of the input parameter
    • isJsonMime

      public boolean isJsonMime(String mediaType)
      Check if the given String is 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

      public boolean isProblemJsonMime(String mediaType)
      Check if the given String is a Problem JSON MIME (RFC-7807).
      Parameters:
      mediaType - the input MediaType
      Returns:
      boolean true if the MediaType represents Problem JSON, false otherwise
    • selectHeaderAccept

      public 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)
      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(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.
      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 object
      formParams - the form parameters
      contentType - 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,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) throws org.springframework.web.client.RestClientException
      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 URL
      method - The request method
      pathParams - The path parameters
      queryParams - The query parameters
      body - The request body object
      headerParams - The header parameters
      formParams - The form parameters
      accept - The request's Accept header
      contentType - The request's Content-Type header
      authNames - The authentications to apply
      returnType - 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 parameters
      uriParams - 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 add
      requestBuilder - 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 add
      requestBuilder - The current request
    • buildCookieHeader

      protected String buildCookieHeader(org.springframework.util.MultiValueMap<String,String> cookies)
      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 apply
      queryParams - The query parameters
      headerParams - The header parameters
      cookieParams - 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