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> |
addApiKey(ApiKey key)
Create a new key
|
CompletableFuture<CreateUpdateKey> |
addKey(ApiKey key)
Deprecated.
|
CompletableFuture<AsyncTasksMultipleIndex> |
batch(List<BatchOperation> operations)
Custom batch
|
CompletableFuture<DeleteKey> |
deleteApiKey(String key)
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>> |
getKey(String key)
Deprecated.
|
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<ApiKey>> |
listApiKeys()
List all existing user keys with their associated ACLs
|
CompletableFuture<List<Index.Attributes>> |
listIndices()
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<CreateUpdateKey> |
updateApiKey(String keyName,
ApiKey key)
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
|
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 retrieve@Deprecated public CompletableFuture<List<ApiKey>> listKeys()
public CompletableFuture<List<ApiKey>> listApiKeys()
@Deprecated public CompletableFuture<Optional<ApiKey>> getKey(@Nonnull String key)
public CompletableFuture<Optional<ApiKey>> getApiKey(@Nonnull String key)
key
- name of the key@Deprecated public CompletableFuture<DeleteKey> deleteKey(@Nonnull String key)
public CompletableFuture<DeleteKey> deleteApiKey(@Nonnull String key)
key
- name of the key@Deprecated public CompletableFuture<CreateUpdateKey> addKey(@Nonnull ApiKey key)
public CompletableFuture<CreateUpdateKey> addApiKey(@Nonnull ApiKey key)
key
- the key with the ACLs@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 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)AlgoliaException
public 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 userAlgoliaException
public <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.NONE
queries
- the queriespublic CompletableFuture<MultiQueriesResult> multipleQueries(@Nonnull List<IndexQuery> queries, @Nonnull MultiQueriesStrategy strategy)
queries
- the queriesstrategy
- the strategy to apply to this multiple queriesCopyright © 2017. All rights reserved.