public class APIClient extends Object
| Modifier and Type | Field and Description |
|---|---|
protected APIClientConfiguration |
configuration |
protected AlgoliaHttpClient |
httpClient
Constructor & protected stuff
|
| Modifier and Type | Method and Description |
|---|---|
CreateUpdateKey |
addKey(ApiKey key)
Create a new key
|
TasksMultipleIndex |
batch(List<BatchOperation> operations)
Custom batch
|
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
|
Optional<ApiKey> |
getKey(String key)
Get an Key from it's name
|
List<Log> |
getLogs()
Return 10 last log entries.
|
List<Log> |
getLogs(Integer offset,
Integer length,
LogType logType)
Return last logs entries
|
Index<?> |
initIndex(String name)
Get the index object initialized (no server call needed for initialization)
|
<T> Index<T> |
initIndex(String name,
Class<T> klass)
Get the index object initialized (no server call needed for initialization)
|
List<Index.Attributes> |
listIndices()
List all existing indexes
|
List<ApiKey> |
listKeys()
List all existing user keys with their associated ACLs
|
MultiQueriesResult |
multipleQueries(List<IndexQuery> queries)
Performs multiple searches on multiple indices with the strategy
MultiQueriesStrategy.NONE |
MultiQueriesResult |
multipleQueries(List<IndexQuery> queries,
MultiQueriesStrategy strategy)
Performs multiple searches on multiple indices
|
CreateUpdateKey |
updateKey(String keyName,
ApiKey key)
Update a key
|
<T> void |
waitTask(GenericTask<T> task,
long timeToWait) |
protected final AlgoliaHttpClient httpClient
protected final APIClientConfiguration configuration
public List<Index.Attributes> listIndices() throws AlgoliaException
AlgoliaExceptionpublic <T> Index<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 Index<?> initIndex(@Nonnull String name)
name - name of the indexpublic List<Log> getLogs() throws AlgoliaException
AlgoliaExceptionpublic List<Log> getLogs(@Nonnull Integer offset, @Nonnull Integer length, @Nonnull LogType logType) throws AlgoliaException
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 retrieveAlgoliaExceptionpublic List<ApiKey> listKeys() throws AlgoliaException
AlgoliaExceptionpublic Optional<ApiKey> getKey(@Nonnull String key) throws AlgoliaException
key - name of the keyAlgoliaExceptionpublic DeleteKey deleteKey(@Nonnull String key) throws AlgoliaException
key - name of the keyAlgoliaExceptionpublic CreateUpdateKey addKey(@Nonnull ApiKey key) throws AlgoliaException
key - the key with the ACLsAlgoliaExceptionpublic CreateUpdateKey updateKey(@Nonnull String keyName, @Nonnull ApiKey key) throws AlgoliaException
keyName - name of the key to updatekey - the key with the ACLsAlgoliaExceptionpublic 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 GenericTask<T> task, long timeToWait) throws AlgoliaException
AlgoliaExceptionpublic TasksMultipleIndex batch(@Nonnull List<BatchOperation> operations) throws AlgoliaException
All operations must have a valid index name (not null)
operations - the list of operations to performAlgoliaExceptionpublic MultiQueriesResult multipleQueries(@Nonnull List<IndexQuery> queries) throws AlgoliaException
MultiQueriesStrategy.NONEqueries - the queriesAlgoliaExceptionpublic MultiQueriesResult multipleQueries(@Nonnull List<IndexQuery> queries, @Nonnull MultiQueriesStrategy strategy) throws AlgoliaException
queries - the queriesstrategy - the strategy to apply to this multiple queriesAlgoliaExceptionCopyright © 2016. All rights reserved.