public class AsyncAPIClient extends Object
| Modifier and Type | Field and Description |
|---|---|
protected AsyncAPIClientConfiguration |
configuration |
protected Executor |
executor |
protected AsyncAlgoliaHttpClient |
httpClient
Constructor & protected stuff
|
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<CreateUpdateKey> |
addKey(ApiKey key)
Create a new key
|
CompletableFuture<AsyncTasksMultipleIndex> |
batch(List<BatchOperation> operations)
Custom batch
|
CompletableFuture<DeleteKey> |
deleteKey(String key)
Delete an existing key
|
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>> |
getKey(String key)
Get an Key from it's name
|
CompletableFuture<List<Log>> |
getLogs()
Return 10 last log entries.
|
CompletableFuture<List<Log>> |
getLogs(Integer offset,
Integer length,
LogType logType)
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<Index.Attributes>> |
listIndices()
List all existing indexes
|
CompletableFuture<List<ApiKey>> |
listKeys()
List all existing user keys with their associated ACLs
|
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<CreateUpdateKey> |
updateKey(String keyName,
ApiKey key)
Update a key
|
<T> void |
waitTask(AsyncGenericTask<T> task,
long timeToWait)
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 CompletableFuture<List<Index.Attributes>> listIndices()
public <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 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<ApiKey>> listKeys()
public CompletableFuture<Optional<ApiKey>> getKey(@Nonnull String key)
key - name of the keypublic CompletableFuture<DeleteKey> deleteKey(@Nonnull String key)
key - name of the keypublic CompletableFuture<CreateUpdateKey> addKey(@Nonnull ApiKey key)
key - the key with the ACLspublic CompletableFuture<CreateUpdateKey> updateKey(@Nonnull String keyName, @Nonnull ApiKey key)
keyName - name of the key to updatekey - the key with the ACLspublic 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 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<MultiQueriesResult> multipleQueries(@Nonnull List<IndexQuery> queries)
MultiQueriesStrategy.NONEqueries - the queriespublic CompletableFuture<MultiQueriesResult> multipleQueries(@Nonnull List<IndexQuery> queries, @Nonnull MultiQueriesStrategy strategy)
queries - the queriesstrategy - the strategy to apply to this multiple queriesCopyright © 2016. All rights reserved.