Class ApiClient


  • @Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
               date="2023-02-27T13:53:41.971284Z[Etc/UTC]")
    public class ApiClient
    extends JavaTimeFormatter
    • Constructor Summary

      Constructors 
      Constructor Description
      ApiClient()  
      ApiClient​(com.fasterxml.jackson.databind.ObjectMapper mapper, java.text.DateFormat format)  
      ApiClient​(org.springframework.web.reactive.function.client.WebClient webClient)  
      ApiClient​(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper mapper, java.text.DateFormat format)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addCookiesToRequest​(org.springframework.util.MultiValueMap<java.lang.String,​java.lang.String> cookies, org.springframework.web.reactive.function.client.WebClient.RequestBodySpec requestBuilder)
      Add cookies to the request that is being built
      ApiClient addDefaultCookie​(java.lang.String name, java.lang.String value)
      Add a default cookie.
      ApiClient addDefaultHeader​(java.lang.String name, java.lang.String value)
      Add a default header.
      protected void addHeadersToRequest​(org.springframework.http.HttpHeaders headers, org.springframework.web.reactive.function.client.WebClient.RequestBodySpec requestBuilder)
      Add headers to the request that is being built
      static org.springframework.web.reactive.function.client.WebClient buildWebClient()
      Build the WebClient used to make HTTP requests.
      static org.springframework.web.reactive.function.client.WebClient buildWebClient​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Build the WebClient used to make HTTP requests.
      static org.springframework.web.reactive.function.client.WebClient.Builder buildWebClientBuilder()
      Build the WebClientBuilder used to make WebClient.
      static org.springframework.web.reactive.function.client.WebClient.Builder buildWebClientBuilder​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Build the WebClientBuilder used to make WebClient.
      java.lang.String collectionPathParameterToString​(ApiClient.CollectionFormat collectionFormat, java.util.Collection<?> values)
      Formats the specified collection path parameter to a string value.
      static java.text.DateFormat createDefaultDateFormat()  
      static com.fasterxml.jackson.databind.ObjectMapper createDefaultObjectMapper​(java.text.DateFormat dateFormat)  
      java.lang.String formatDate​(java.util.Date date)
      Format the given Date object into string.
      Authentication getAuthentication​(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.String getBasePath()
      Get the current base path
      java.text.DateFormat getDateFormat()
      Get the date format used to parse/format date parameters.
      com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Get the ObjectMapper used to make HTTP requests.
      org.springframework.web.reactive.function.client.WebClient getWebClient()
      Get the WebClient used to make HTTP requests.
      protected void init()  
      <T> org.springframework.web.reactive.function.client.WebClient.ResponseSpec invokeAPI​(java.lang.String path, org.springframework.http.HttpMethod method, java.util.Map<java.lang.String,​java.lang.Object> pathParams, 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.
      boolean isJsonMime​(java.lang.String mediaType)
      Check if the given String is a JSON MIME.
      boolean isJsonMime​(org.springframework.http.MediaType mediaType)
      Check if the given MIME is a JSON MIME.
      boolean isProblemJsonMime​(java.lang.String mediaType)
      Check if the given String is a Problem JSON MIME (RFC-7807).
      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 a MultiValueMap for use in REST requests
      java.lang.String parameterToString​(java.lang.Object param)
      Format the given parameter object into string.
      java.util.Date parseDate​(java.lang.String str)
      Parse the given string into Date object.
      protected org.springframework.web.reactive.function.BodyInserter<?,​? super org.springframework.http.client.reactive.ClientHttpRequest> 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
      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)
      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.
      void setApiKey​(java.lang.String apiKey)
      Helper method to set API key value for the first API key authentication.
      void setApiKeyPrefix​(java.lang.String apiKeyPrefix)
      Helper method to set API key prefix for the first API key authentication.
      ApiClient setBasePath​(java.lang.String basePath)
      Set the base path, which should include the host
      void setBearerToken​(java.lang.String bearerToken)
      Helper method to set access token for the first Bearer authentication.
      void setPassword​(java.lang.String password)
      Helper method to set password for the first HTTP basic authentication.
      ApiClient setUserAgent​(java.lang.String userAgent)
      Set the User-Agent header's value (by adding to the default header map).
      void setUsername​(java.lang.String username)
      Helper method to set username for the first HTTP basic authentication.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ApiClient

        public ApiClient()
      • ApiClient

        public ApiClient​(org.springframework.web.reactive.function.client.WebClient webClient)
      • ApiClient

        public ApiClient​(com.fasterxml.jackson.databind.ObjectMapper mapper,
                         java.text.DateFormat format)
      • ApiClient

        public ApiClient​(org.springframework.web.reactive.function.client.WebClient webClient,
                         com.fasterxml.jackson.databind.ObjectMapper mapper,
                         java.text.DateFormat format)
    • Method Detail

      • createDefaultDateFormat

        public static java.text.DateFormat createDefaultDateFormat()
      • createDefaultObjectMapper

        public static com.fasterxml.jackson.databind.ObjectMapper createDefaultObjectMapper​(@Nullable
                                                                                            java.text.DateFormat dateFormat)
      • init

        protected void init()
      • buildWebClientBuilder

        public static org.springframework.web.reactive.function.client.WebClient.Builder buildWebClientBuilder​(com.fasterxml.jackson.databind.ObjectMapper mapper)
        Build the WebClientBuilder used to make WebClient.
        Parameters:
        mapper - ObjectMapper used for serialize/deserialize
        Returns:
        WebClient
      • buildWebClientBuilder

        public static org.springframework.web.reactive.function.client.WebClient.Builder buildWebClientBuilder()
        Build the WebClientBuilder used to make WebClient.
        Returns:
        WebClient
      • buildWebClient

        public static org.springframework.web.reactive.function.client.WebClient buildWebClient​(com.fasterxml.jackson.databind.ObjectMapper mapper)
        Build the WebClient used to make HTTP requests.
        Parameters:
        mapper - ObjectMapper used for serialize/deserialize
        Returns:
        WebClient
      • buildWebClient

        public static org.springframework.web.reactive.function.client.WebClient buildWebClient()
        Build the WebClient used to make HTTP requests.
        Returns:
        WebClient
      • getBasePath

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

        public ApiClient setBasePath​(java.lang.String basePath)
        Set the base path, which should include the host
        Parameters:
        basePath - the base path
        Returns:
        ApiClient this client
      • getAuthentications

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

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

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

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

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

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

        public void setApiKeyPrefix​(java.lang.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​(java.lang.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​(java.lang.String name,
                                          java.lang.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​(java.lang.String name,
                                          java.lang.String value)
        Add a default cookie.
        Parameters:
        name - The cookie's name
        value - The cookie's value
        Returns:
        ApiClient this client
      • getDateFormat

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

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

        public java.lang.String formatDate​(java.util.Date date)
        Format the given Date object into string.
      • getObjectMapper

        public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
        Get the ObjectMapper used to make HTTP requests.
        Returns:
        ObjectMapper objectMapper
      • getWebClient

        public org.springframework.web.reactive.function.client.WebClient getWebClient()
        Get the WebClient used to make HTTP requests.
        Returns:
        WebClient webClient
      • 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
      • 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 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​(java.lang.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​(java.lang.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 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, null will be returned.
      • selectBody

        protected org.springframework.web.reactive.function.BodyInserter<?,​? super org.springframework.http.client.reactive.ClientHttpRequest> 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 object
        formParams - the form parameters
        contentType - the content type of the request
        Returns:
        Object the selected body
      • invokeAPI

        public <T> org.springframework.web.reactive.function.client.WebClient.ResponseSpec invokeAPI​(java.lang.String path,
                                                                                                     org.springframework.http.HttpMethod method,
                                                                                                     java.util.Map<java.lang.String,​java.lang.Object> pathParams,
                                                                                                     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.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
      • addHeadersToRequest

        protected void addHeadersToRequest​(org.springframework.http.HttpHeaders headers,
                                           org.springframework.web.reactive.function.client.WebClient.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<java.lang.String,​java.lang.String> cookies,
                                           org.springframework.web.reactive.function.client.WebClient.RequestBodySpec requestBuilder)
        Add cookies to the request that is being built
        Parameters:
        cookies - The cookies to add
        requestBuilder - The current request
      • 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