Interface ApiClient


@API(status=STABLE) public interface ApiClient
Interface used to perform HTTP requests performed by the generated Swagger code.
  • Method Details

    • invokeAPI

      <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String,String> headerParams, Map<String,String> cookieParams, Map<String,Object> formParams, String accept, String contentType, String[] authNames, TypeReference<T> returnType) throws ApiException
      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
      cookieParams - The cookie 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 type of string
      Throws:
      ApiException - API exception
    • getBasePath

      String getBasePath()
      Returns the API base path
      Returns:
      API base path
    • parameterToString

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

      List<Pair> parameterToPairs(String collectionFormat, String name, Object value)
      Format to Pair objects.
      Parameters:
      collectionFormat - Collection format
      name - Name
      value - Value
      Returns:
      List of pairs
    • selectHeaderAccept

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

      String 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 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.
    • escapeString

      String escapeString(String str)
      Escape the given string to be used as URL query value.
      Parameters:
      str - String
      Returns:
      Escaped string
    • getAuthentications

      Map<String,Authentication> getAuthentications()
      Get authentications (key: authentication name, value: authentication).
      Returns:
      Map of Authentication object
    • addEnforcedAuthenticationScheme

      void addEnforcedAuthenticationScheme(String name)
      Enforce an authentication scheme using the authentication name.
      Parameters:
      name - of the authentication
    • rotate

      default void rotate()
      Change target server according to the load balancing configuration, applies only for calls to the agent. Default implementation does nothing.