Class ApiClient


  • @Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
               date="2020-01-01T18:24:23.294947664-03:00[America/Argentina/Buenos_Aires]")
    public class ApiClient
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ApiClient​(io.vertx.core.Vertx vertx, io.vertx.core.json.JsonObject config)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ApiClient addDefaultHeader​(java.lang.String key, java.lang.String value)  
      protected <T> io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.web.client.HttpResponse<io.vertx.core.buffer.Buffer>>> buildResponseHandler​(com.fasterxml.jackson.core.type.TypeReference<T> returnType, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
      Build a response handler for the HttpResponse.
      protected io.vertx.ext.web.client.WebClient buildWebClient​(io.vertx.core.Vertx vertx, io.vertx.core.json.JsonObject config)
      Build the WebClient used to make HTTP requests.
      java.lang.String formatDate​(java.util.Date date)
      Format the given Date object into string.
      protected java.lang.String generateFilename​(io.vertx.core.MultiMap headers)
      Create a filename from the given headers.
      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()  
      io.vertx.core.MultiMap getDefaultHeaders()  
      java.lang.String getDownloadsDir()  
      com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()  
      io.vertx.core.Vertx getVertx()  
      io.vertx.ext.web.client.WebClient getWebClient()  
      protected <T> void handleFileDownload​(io.vertx.ext.web.client.HttpResponse<io.vertx.core.buffer.Buffer> response, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
      File Download handling.
      <T> void invokeAPI​(java.lang.String path, java.lang.String method, java.util.List<Pair> queryParams, java.lang.Object body, io.vertx.core.MultiMap headerParams, java.util.Map<java.lang.String,​java.lang.Object> formParams, java.lang.String[] accepts, java.lang.String[] contentTypes, java.lang.String[] authNames, com.fasterxml.jackson.core.type.TypeReference<T> returnType, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> resultHandler)
      Invoke API by sending HTTP request with the given options.
      java.util.List<Pair> parameterToPairs​(java.lang.String collectionFormat, java.lang.String name, java.lang.Object value)  
      java.lang.String parameterToString​(java.lang.Object param)
      Format the given parameter object into string.
      protected java.lang.String sanitizeFilename​(java.lang.String filename)
      Sanitize filename by removing path.
      protected 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)
      protected 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 sendBody​(io.vertx.ext.web.client.HttpRequest<io.vertx.core.buffer.Buffer> request, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.web.client.HttpResponse<io.vertx.core.buffer.Buffer>>> responseHandler, java.lang.Object body)  
      ApiClient setApiKey​(java.lang.String apiKey)
      Helper method to set API key value for the first API key authentication.
      ApiClient setApiKeyPrefix​(java.lang.String apiKeyPrefix)
      Helper method to set API key prefix for the first API key authentication.
      ApiClient setBasePath​(java.lang.String basePath)  
      ApiClient setBearerToken​(java.lang.String bearerToken)
      Helper method to set access token for the first Bearer authentication.
      ApiClient setDownloadsDir​(java.lang.String downloadsDir)  
      ApiClient setObjectMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)  
      ApiClient setPassword​(java.lang.String password)
      Helper method to set password for the first HTTP basic authentication.
      ApiClient setUsername​(java.lang.String username)
      Helper method to set username for the first HTTP basic authentication.
      protected void updateParamsForAuth​(java.lang.String[] authNames, java.util.List<Pair> queryParams, io.vertx.core.MultiMap headerParams)
      Update query and header parameters based on authentication settings.
      • Methods inherited from class java.lang.Object

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

      • ApiClient

        public ApiClient​(io.vertx.core.Vertx vertx,
                         io.vertx.core.json.JsonObject config)
    • Method Detail

      • getVertx

        public io.vertx.core.Vertx getVertx()
      • getObjectMapper

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

        public ApiClient setObjectMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      • getWebClient

        public io.vertx.ext.web.client.WebClient getWebClient()
      • getBasePath

        public java.lang.String getBasePath()
      • setBasePath

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

        public java.lang.String getDownloadsDir()
      • setDownloadsDir

        public ApiClient setDownloadsDir​(java.lang.String downloadsDir)
      • getDefaultHeaders

        public io.vertx.core.MultiMap getDefaultHeaders()
      • addDefaultHeader

        public ApiClient addDefaultHeader​(java.lang.String key,
                                          java.lang.String value)
      • getAuthentications

        public java.util.Map<java.lang.String,​Authentication> getAuthentications()
        Get authentications (key: authentication name, value: authentication).
        Returns:
        Map of authentication object
      • 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 ApiClient setBearerToken​(java.lang.String bearerToken)
        Helper method to set access token for the first Bearer authentication.
        Parameters:
        bearerToken - Bearer token
      • setUsername

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

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

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

        public ApiClient setApiKeyPrefix​(java.lang.String apiKeyPrefix)
        Helper method to set API key prefix for the first API key authentication.
        Parameters:
        apiKeyPrefix - API key prefix
      • formatDate

        public java.lang.String formatDate​(java.util.Date date)
        Format the given Date object into string.
        Parameters:
        date - Date
        Returns:
        Date in string format
      • parameterToString

        public java.lang.String parameterToString​(java.lang.Object param)
        Format the given parameter object into string.
        Parameters:
        param - Object
        Returns:
        Object in string format
      • parameterToPairs

        public java.util.List<Pair> parameterToPairs​(java.lang.String collectionFormat,
                                                     java.lang.String name,
                                                     java.lang.Object value)
      • selectHeaderAccept

        protected 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

        protected 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.
      • sendBody

        public void sendBody​(io.vertx.ext.web.client.HttpRequest<io.vertx.core.buffer.Buffer> request,
                             io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.web.client.HttpResponse<io.vertx.core.buffer.Buffer>>> responseHandler,
                             java.lang.Object body)
      • invokeAPI

        public <T> void invokeAPI​(java.lang.String path,
                                  java.lang.String method,
                                  java.util.List<Pair> queryParams,
                                  java.lang.Object body,
                                  io.vertx.core.MultiMap headerParams,
                                  java.util.Map<java.lang.String,​java.lang.Object> formParams,
                                  java.lang.String[] accepts,
                                  java.lang.String[] contentTypes,
                                  java.lang.String[] authNames,
                                  com.fasterxml.jackson.core.type.TypeReference<T> returnType,
                                  io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> resultHandler)
        Invoke API by sending HTTP request with the given options.
        Type Parameters:
        T - Type
        Parameters:
        path - The sub-path of the HTTP URL
        method - The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
        queryParams - The query parameters
        body - The request body object
        headerParams - The header parameters
        formParams - The form parameters
        accepts - The request's Accept headers
        contentTypes - The request's Content-Type headers
        authNames - The authentications to apply
        returnType - The return type into which to deserialize the response
        resultHandler - The asynchronous response handler
      • sanitizeFilename

        protected java.lang.String sanitizeFilename​(java.lang.String filename)
        Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif
        Parameters:
        filename - The filename to be sanitized
        Returns:
        The sanitized filename
      • generateFilename

        protected java.lang.String generateFilename​(io.vertx.core.MultiMap headers)
        Create a filename from the given headers. When the headers have no "Content-Disposition" information, a random UUID name is generated.
        Parameters:
        headers - The HTTP response headers
        Returns:
        The filename
      • handleFileDownload

        protected <T> void handleFileDownload​(io.vertx.ext.web.client.HttpResponse<io.vertx.core.buffer.Buffer> response,
                                              io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
        File Download handling.
        Parameters:
        response - The HTTP response
        handler - The response handler
      • buildResponseHandler

        protected <T> io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.web.client.HttpResponse<io.vertx.core.buffer.Buffer>>> buildResponseHandler​(com.fasterxml.jackson.core.type.TypeReference<T> returnType,
                                                                                                                                                               io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
        Build a response handler for the HttpResponse.
        Parameters:
        returnType - The return type
        handler - The response handler
        Returns:
        The HTTP response handler
      • buildWebClient

        protected io.vertx.ext.web.client.WebClient buildWebClient​(io.vertx.core.Vertx vertx,
                                                                   io.vertx.core.json.JsonObject config)
        Build the WebClient used to make HTTP requests.
        Parameters:
        vertx - Vertx
        Returns:
        WebClient
      • updateParamsForAuth

        protected void updateParamsForAuth​(java.lang.String[] authNames,
                                           java.util.List<Pair> queryParams,
                                           io.vertx.core.MultiMap headerParams)
        Update query and header parameters based on authentication settings.
        Parameters:
        authNames - The authentications to apply