Package com.algolia
Class ApiClient
java.lang.Object
com.algolia.ApiClient
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
AbtestingClient,AnalyticsClient,IngestionClient,InsightsClient,MonitoringClient,PersonalizationClient,QuerySuggestionsClient,RecommendClient,SearchClient
Represents a base client for making API requests. The client uses a
Requester for
executing requests and an ExecutorService for asynchronous operations. It is designed to
be extended by concrete API client implementations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected <T> CompletableFuture<T>executeAsync(HttpRequest httpRequest, RequestOptions requestOptions, com.fasterxml.jackson.core.type.TypeReference<T> returnType) Executes an HTTP request asynchronously and returns aCompletableFutureof the response deserialized into a specified type.protected <T> CompletableFuture<T>executeAsync(HttpRequest httpRequest, RequestOptions requestOptions, Class<?> returnType, Class<?> innerType) Executes an HTTP request asynchronously and returns aCompletableFutureof the response deserialized into a specified type.voidsetClientApiKey(String apiKey) Helper method to switch the API key used to authenticate the requests.
-
Constructor Details
-
Method Details
-
setClientApiKey
Helper method to switch the API key used to authenticate the requests.- Parameters:
apiKey- The new API key to be used from now on.
-
executeAsync
protected <T> CompletableFuture<T> executeAsync(HttpRequest httpRequest, RequestOptions requestOptions, com.fasterxml.jackson.core.type.TypeReference<T> returnType) Executes an HTTP request asynchronously and returns aCompletableFutureof the response deserialized into a specified type. -
executeAsync
protected <T> CompletableFuture<T> executeAsync(HttpRequest httpRequest, RequestOptions requestOptions, Class<?> returnType, Class<?> innerType) Executes an HTTP request asynchronously and returns aCompletableFutureof the response deserialized into a specified type. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-