Class ApiClient


  • @Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
               date="2024-11-01T13:04:07.524035-07:00[America/Los_Angeles]")
    public class ApiClient
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ApiClient.Api  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.fasterxml.jackson.databind.ObjectMapper objectMapper  
    • Constructor Summary

      Constructors 
      Constructor Description
      ApiClient()  
      ApiClient​(java.lang.String authName)
      Basic constructor for single auth name
      ApiClient​(java.lang.String[] authNames)  
      ApiClient​(java.lang.String authName, java.lang.String apiKey)
      Helper constructor for single api key
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAuthorization​(java.lang.String authName, feign.RequestInterceptor authorization)
      Adds an authorization to be used by the client
      <T extends ApiClient.Api>
      T
      buildClient​(java.lang.Class<T> clientClass)
      Creates a feign client for given API interface.
      java.util.Map<java.lang.String,​feign.RequestInterceptor> getApiAuthorizations()  
      feign.RequestInterceptor getAuthorization​(java.lang.String authName)
      Gets request interceptor based on authentication name
      java.lang.String getBasePath()  
      feign.Feign.Builder getFeignBuilder()  
      com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()  
      java.lang.String 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)
      java.lang.String 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 setApiAuthorizations​(java.util.Map<java.lang.String,​feign.RequestInterceptor> apiAuthorizations)  
      void setApiKey​(java.lang.String apiKey)
      Helper method to configure the first api key found
      ApiClient setBasePath​(java.lang.String basePath)  
      void setBearerToken​(java.lang.String bearerToken)
      Helper method to configure the bearer token.
      void setCredentials​(java.lang.String username, java.lang.String password)
      Helper method to configure the username/password for basic auth
      ApiClient setFeignBuilder​(feign.Feign.Builder feignBuilder)  
      void setObjectMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)  
      • Methods inherited from class java.lang.Object

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

      • objectMapper

        protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • Constructor Detail

      • ApiClient

        public ApiClient()
      • ApiClient

        public ApiClient​(java.lang.String[] authNames)
      • ApiClient

        public ApiClient​(java.lang.String authName)
        Basic constructor for single auth name
        Parameters:
        authName -
      • ApiClient

        public ApiClient​(java.lang.String authName,
                         java.lang.String apiKey)
        Helper constructor for single api key
        Parameters:
        authName -
        apiKey -
    • Method Detail

      • getBasePath

        public java.lang.String getBasePath()
      • setBasePath

        public ApiClient setBasePath​(java.lang.String basePath)
      • getApiAuthorizations

        public java.util.Map<java.lang.String,​feign.RequestInterceptor> getApiAuthorizations()
      • setApiAuthorizations

        public void setApiAuthorizations​(java.util.Map<java.lang.String,​feign.RequestInterceptor> apiAuthorizations)
      • getFeignBuilder

        public feign.Feign.Builder getFeignBuilder()
      • setFeignBuilder

        public ApiClient setFeignBuilder​(feign.Feign.Builder feignBuilder)
      • getObjectMapper

        public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      • setObjectMapper

        public void setObjectMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      • buildClient

        public <T extends ApiClient.Api> T buildClient​(java.lang.Class<T> clientClass)
        Creates a feign client for given API interface. Usage: ApiClient apiClient = new ApiClient(); apiClient.setBasePath("http://localhost:8080"); XYZApi api = apiClient.buildClient(XYZApi.class); XYZResponse response = api.someMethod(...);
        Type Parameters:
        T - Type
        Parameters:
        clientClass - Client class
        Returns:
        The Client
      • selectHeaderAccept

        public java.lang.String 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:
        The Accept header to use. If the given array is empty, null will be returned (not to set the Accept header explicitly).
      • selectHeaderContentType

        public java.lang.String 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:
        The Content-Type header to use. If the given array is empty, JSON will be used.
      • setBearerToken

        public void setBearerToken​(java.lang.String bearerToken)
        Helper method to configure the bearer token.
        Parameters:
        bearerToken - the bearer token.
      • setApiKey

        public void setApiKey​(java.lang.String apiKey)
        Helper method to configure the first api key found
        Parameters:
        apiKey - API key
      • setCredentials

        public void setCredentials​(java.lang.String username,
                                   java.lang.String password)
        Helper method to configure the username/password for basic auth
        Parameters:
        username - Username
        password - Password
      • getAuthorization

        public feign.RequestInterceptor getAuthorization​(java.lang.String authName)
        Gets request interceptor based on authentication name
        Parameters:
        authName - Authentication name
        Returns:
        Request Interceptor
      • addAuthorization

        public void addAuthorization​(java.lang.String authName,
                                     feign.RequestInterceptor authorization)
        Adds an authorization to be used by the client
        Parameters:
        authName - Authentication name
        authorization - Request interceptor