Package com.loop54.http
Class RequestManager
java.lang.Object
com.loop54.http.RequestManager
- All Implemented Interfaces:
IRequestManager,Closeable,AutoCloseable
Handles the request to the Loop54 API. This can be used as a singleton.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Response>
CompletableFuture<T>callEngineAsync(String action, Request requestData, UserMetaData metaData, Class<T> responseType) Calls the loop54 search engine and returns a deserialized response object.voidclose()Closes the underlying HTTP client and releases any system resources associated with it.
-
Constructor Details
-
RequestManager
- Parameters:
settings- The settings for this instance to use when calling Loop54.
-
-
Method Details
-
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:IRequestManagerCalls the loop54 search engine and returns a deserialized response object.- Specified by:
callEngineAsyncin interfaceIRequestManager- Type Parameters:
T- The expected response type. E.g. if making a search call the expected type would beSearchResponse- 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 beSearchResponse- Returns:
- The deserialized response.
-
close
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if an I/O error occurs while closing the HTTP client
-