Class RequestManager

java.lang.Object
com.loop54.http.RequestManager
All Implemented Interfaces:
IRequestManager, Closeable, AutoCloseable

public class RequestManager extends Object implements IRequestManager
Handles the request to the Loop54 API. This can be used as a singleton.
  • Constructor Details

    • RequestManager

      public RequestManager(Loop54Settings settings)
      Parameters:
      settings - The settings for this instance to use when calling Loop54.
  • Method Details

    • getSettings

      public Loop54Settings getSettings()
      Returns:
      Settings used by this request manager.
    • callEngineAsync

      public <T extends Response> CompletableFuture<T> callEngineAsync(String action, Request requestData, UserMetaData metaData, Class<T> responseType)
      Description copied from interface: IRequestManager
      Calls the loop54 search engine and returns a deserialized response object.
      Specified by:
      callEngineAsync in interface IRequestManager
      Type Parameters:
      T - The expected response type. E.g. if making a search call the expected type would be SearchResponse
      Parameters:
      action - The type of request. This will translate into the resource on the actual HTTP request i.e. "endpoint/action". Must not be null.
      requestData - The query data to send to the engine. Must not be null.
      metaData - Data about the requesting user. Must not be null.
      responseType - The expected response type. E.g. if making a search call the expected type would be SearchResponse
      Returns:
      The deserialized response.
    • close

      public void close() throws IOException
      Closes the underlying HTTP client and releases any system resources associated with it. After calling this method, the RequestManager should no longer be used.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - if an I/O error occurs while closing the HTTP client