public class AsyncAPIClient extends Object
| Modifier and Type | Field | Description |
|---|---|---|
protected AsyncAPIClientConfiguration |
configuration |
|
protected Executor |
executor |
|
protected AsyncAlgoliaHttpClient |
httpClient |
Constructor & protected stuff
|
| Modifier and Type | Method | Description |
|---|---|---|
CompletableFuture<CreateUpdateKey> |
addApiKey(ApiKey key) |
Create a new key
|
CompletableFuture<CreateUpdateKey> |
addApiKey(ApiKey key,
RequestOptions requestOptions) |
Create a new key
|
CompletableFuture<CreateUpdateKey> |
addKey(ApiKey key) |
Deprecated.
|
CompletableFuture<AsyncTasksMultipleIndex> |
batch(List<BatchOperation> operations) |
Custom batch
|
CompletableFuture<AsyncTasksMultipleIndex> |
batch(List<BatchOperation> operations,
RequestOptions requestOptions) |
Custom batch
|
void |
close() |
Close the internal HTTP client
|
CompletableFuture<DeleteKey> |
deleteApiKey(String key) |
Delete an existing key
|
CompletableFuture<DeleteKey> |
deleteApiKey(String key,
RequestOptions requestOptions) |
Delete an existing key
|
CompletableFuture<DeleteKey> |
deleteKey(String key) |
Deprecated.
|
String |
generateSecuredApiKey(String privateApiKey,
Query query) |
Generate a secured and public API Key from a query and an optional user token identifying the
current user
|
String |
generateSecuredApiKey(String privateApiKey,
Query query,
String userToken) |
Generate a secured and public API Key from a query and an optional user token identifying the
current user
|
CompletableFuture<Optional<ApiKey>> |
getApiKey(String key) |
Get an Key from it's name
|
CompletableFuture<Optional<ApiKey>> |
getApiKey(String key,
RequestOptions requestOptions) |
Get an Key from it's name
|
CompletableFuture<Optional<ApiKey>> |
getKey(String key) |
Deprecated.
|
CompletableFuture<List<Log>> |
getLogs() |
Return 10 last log entries.
|
CompletableFuture<List<Log>> |
getLogs(RequestOptions requestOptions) |
Return 10 last log entries.
|
CompletableFuture<List<Log>> |
getLogs(Integer offset,
Integer length,
LogType logType) |
Return last logs entries
|
CompletableFuture<List<Log>> |
getLogs(Integer offset,
Integer length,
LogType logType,
RequestOptions requestOptions) |
Return last logs entries
|
AsyncIndex<?> |
initIndex(String name) |
Get the index object initialized (no server call needed for initialization)
|
<T> AsyncIndex<T> |
initIndex(String name,
Class<T> klass) |
Get the index object initialized (no server call needed for initialization)
|
CompletableFuture<List<ApiKey>> |
listApiKeys() |
List all existing user keys with their associated ACLs
|
CompletableFuture<List<ApiKey>> |
listApiKeys(RequestOptions requestOptions) |
List all existing user keys with their associated ACLs
|
CompletableFuture<List<Index.Attributes>> |
listIndices() |
List all existing indexes
|
CompletableFuture<List<Index.Attributes>> |
listIndices(RequestOptions requestOptions) |
List all existing indexes
|
CompletableFuture<List<ApiKey>> |
listKeys() |
Deprecated.
|
CompletableFuture<MultiQueriesResult> |
multipleQueries(List<IndexQuery> queries) |
Performs multiple searches on multiple indices with the strategy
MultiQueriesStrategy.NONE |
CompletableFuture<MultiQueriesResult> |
multipleQueries(List<IndexQuery> queries,
MultiQueriesStrategy strategy) |
Performs multiple searches on multiple indices
|
CompletableFuture<MultiQueriesResult> |
multipleQueries(List<IndexQuery> queries,
MultiQueriesStrategy strategy,
RequestOptions requestOptions) |
Performs multiple searches on multiple indices
|
CompletableFuture<MultiQueriesResult> |
multipleQueries(List<IndexQuery> queries,
RequestOptions requestOptions) |
Performs multiple searches on multiple indices with the strategy
MultiQueriesStrategy.NONE |
CompletableFuture<CreateUpdateKey> |
updateApiKey(String keyName,
ApiKey key) |
Update a key
|
CompletableFuture<CreateUpdateKey> |
updateApiKey(String keyName,
ApiKey key,
RequestOptions requestOptions) |
Update a key
|
CompletableFuture<CreateUpdateKey> |
updateKey(String keyName,
ApiKey key) |
Deprecated.
|
<T> void |
waitTask(AsyncGenericTask<T> task,
long timeToWait) |
Wait for the completion of this task /!\ WARNING /!\ This method is blocking
|
<T> void |
waitTask(AsyncGenericTask<T> task,
long timeToWait,
RequestOptions requestOptions) |
Wait for the completion of this task /!\ WARNING /!\ This method is blocking
|
protected final AsyncAlgoliaHttpClient httpClient
protected final AsyncAPIClientConfiguration configuration
protected final Executor executor
public void close()
throws AlgoliaException
AlgoliaExceptionpublic CompletableFuture<List<Index.Attributes>> listIndices()
public CompletableFuture<List<Index.Attributes>> listIndices(@Nonnull RequestOptions requestOptions)
requestOptions - Options to pass to this requestpublic <T> AsyncIndex<T> initIndex(@Nonnull String name, @Nonnull Class<T> klass)
T - the type of the objects in this indexname - name of the indexklass - class of the object in this indexpublic AsyncIndex<?> initIndex(@Nonnull String name)
name - name of the indexpublic CompletableFuture<List<Log>> getLogs()
public CompletableFuture<List<Log>> getLogs(@Nonnull RequestOptions requestOptions)
requestOptions - Options to pass to this requestpublic CompletableFuture<List<Log>> getLogs(@Nonnull Integer offset, @Nonnull Integer length, @Nonnull LogType logType)
offset - Specify the first entry to retrieve (0-based, 0 is the most recent log entry)length - Specify the maximum number of entries to retrieve starting at offset. Maximum
allowed value: 1000logType - Specify the type of log to retrievepublic CompletableFuture<List<Log>> getLogs(@Nonnull Integer offset, @Nonnull Integer length, @Nonnull LogType logType, @Nonnull RequestOptions requestOptions)
offset - Specify the first entry to retrieve (0-based, 0 is the most recent log entry)length - Specify the maximum number of entries to retrieve starting at offset. Maximum
allowed value: 1000logType - Specify the type of log to retrieverequestOptions - Options to pass to this request@Deprecated public CompletableFuture<List<ApiKey>> listKeys()
public CompletableFuture<List<ApiKey>> listApiKeys()
public CompletableFuture<List<ApiKey>> listApiKeys(@Nonnull RequestOptions requestOptions)
requestOptions - Options to pass to this request@Deprecated public CompletableFuture<Optional<ApiKey>> getKey(@Nonnull String key)
public CompletableFuture<Optional<ApiKey>> getApiKey(@Nonnull String key)
key - name of the keypublic CompletableFuture<Optional<ApiKey>> getApiKey(@Nonnull String key, @Nonnull RequestOptions requestOptions)
key - name of the keyrequestOptions - Options to pass to this request@Deprecated public CompletableFuture<DeleteKey> deleteKey(@Nonnull String key)
public CompletableFuture<DeleteKey> deleteApiKey(@Nonnull String key)
key - name of the keypublic CompletableFuture<DeleteKey> deleteApiKey(@Nonnull String key, @Nonnull RequestOptions requestOptions)
key - name of the keyrequestOptions - Options to pass to this request@Deprecated public CompletableFuture<CreateUpdateKey> addKey(@Nonnull ApiKey key)
public CompletableFuture<CreateUpdateKey> addApiKey(@Nonnull ApiKey key)
key - the key with the ACLspublic CompletableFuture<CreateUpdateKey> addApiKey(@Nonnull ApiKey key, @Nonnull RequestOptions requestOptions)
key - the key with the ACLsrequestOptions - Options to pass to this request@Deprecated public CompletableFuture<CreateUpdateKey> updateKey(@Nonnull String keyName, @Nonnull ApiKey key)
public CompletableFuture<CreateUpdateKey> updateApiKey(@Nonnull String keyName, @Nonnull ApiKey key)
keyName - name of the key to updatekey - the key with the ACLspublic CompletableFuture<CreateUpdateKey> updateApiKey(@Nonnull String keyName, @Nonnull ApiKey key, @Nonnull RequestOptions requestOptions)
keyName - name of the key to updatekey - the key with the ACLsrequestOptions - Options to pass to this requestpublic String generateSecuredApiKey(@Nonnull String privateApiKey, @Nonnull Query query) throws AlgoliaException
privateApiKey - your private API Keyquery - contains the parameter applied to the query (used as security)AlgoliaExceptionpublic String generateSecuredApiKey(@Nonnull String privateApiKey, @Nonnull Query query, String userToken) throws AlgoliaException
privateApiKey - your private API Keyquery - contains the parameter applied to the query (used as security)userToken - an optional token identifying the current userAlgoliaExceptionpublic <T> void waitTask(@Nonnull AsyncGenericTask<T> task, long timeToWait)
task - the task to waittimeToWait - the time to wait in millisecondspublic <T> void waitTask(@Nonnull AsyncGenericTask<T> task, long timeToWait, @Nonnull RequestOptions requestOptions)
task - the task to waittimeToWait - the time to wait in millisecondsrequestOptions - Options to pass to this requestpublic CompletableFuture<AsyncTasksMultipleIndex> batch(@Nonnull List<BatchOperation> operations)
All operations must have a valid index name (not null)
operations - the list of operations to performpublic CompletableFuture<AsyncTasksMultipleIndex> batch(@Nonnull List<BatchOperation> operations, @Nonnull RequestOptions requestOptions)
All operations must have a valid index name (not null)
operations - the list of operations to performrequestOptions - Options to pass to this requestpublic CompletableFuture<MultiQueriesResult> multipleQueries(@Nonnull List<IndexQuery> queries)
MultiQueriesStrategy.NONEqueries - the queriespublic CompletableFuture<MultiQueriesResult> multipleQueries(@Nonnull List<IndexQuery> queries, @Nonnull RequestOptions requestOptions)
MultiQueriesStrategy.NONEqueries - the queriesrequestOptions - Options to pass to this requestpublic CompletableFuture<MultiQueriesResult> multipleQueries(@Nonnull List<IndexQuery> queries, @Nonnull MultiQueriesStrategy strategy)
queries - the queriesstrategy - the strategy to apply to this multiple queriespublic CompletableFuture<MultiQueriesResult> multipleQueries(@Nonnull List<IndexQuery> queries, @Nonnull MultiQueriesStrategy strategy, @Nonnull RequestOptions requestOptions)
queries - the queriesstrategy - the strategy to apply to this multiple queriesrequestOptions - Options to pass to this requestCopyright © 2017. All rights reserved.