public class APIClient extends Object
| Modifier and Type | Field | Description |
|---|---|---|
protected APIClientConfiguration |
configuration |
|
protected AlgoliaHttpClient |
httpClient |
Constructor & protected stuff
|
| Modifier and Type | Method | Description |
|---|---|---|
CreateUpdateKey |
addApiKey(ApiKey key) |
Create a new key
|
CreateUpdateKey |
addApiKey(ApiKey key,
RequestOptions requestOptions) |
Create a new key
|
CreateUpdateKey |
addKey(ApiKey key) |
Deprecated.
|
TasksMultipleIndex |
batch(List<BatchOperation> operations) |
Custom batch
|
TasksMultipleIndex |
batch(List<BatchOperation> operations,
RequestOptions requestOptions) |
Custom batch
|
<T> BrowseResult<T> |
browse(String indexName,
Query query,
String cursor,
Class<T> klass,
RequestOptions requestOptions) |
|
void |
close() |
Close the internal HTTP client
|
DeleteKey |
deleteApiKey(String key) |
Delete an existing key
|
DeleteKey |
deleteApiKey(String key,
RequestOptions requestOptions) |
Delete an existing key
|
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
|
Optional<ApiKey> |
getApiKey(String key) |
Get a Key from it's name
|
Optional<ApiKey> |
getApiKey(String key,
RequestOptions requestOptions) |
Get a Key from it's name
|
Optional<ApiKey> |
getKey(String key) |
Deprecated.
|
List<Log> |
getLogs() |
Return 10 last log entries.
|
List<Log> |
getLogs(RequestOptions requestOptions) |
Return 10 last log entries.
|
List<Log> |
getLogs(Integer offset,
Integer length,
LogType logType) |
Return last logs entries
|
List<Log> |
getLogs(Integer offset,
Integer length,
LogType logType,
RequestOptions requestOptions) |
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<ApiKey> |
listApiKeys() |
List all existing user keys with their associated ACLs
|
List<ApiKey> |
listApiKeys(RequestOptions requestOptions) |
List all existing user keys with their associated ACLs
|
List<Index.Attributes> |
listIndices() |
List all existing indexes
|
List<Index.Attributes> |
listIndices(RequestOptions requestOptions) |
List all existing indexes
|
List<ApiKey> |
listKeys() |
Deprecated.
|
MultiQueriesResult |
multipleQueries(List<IndexQuery> queries) |
Performs multiple searches on multiple indices with the strategy
MultiQueriesStrategy.NONE |
MultiQueriesResult |
multipleQueries(List<IndexQuery> queries,
MultiQueriesStrategy strategy,
RequestOptions requestOptions) |
Performs multiple searches on multiple indices
|
MultiQueriesResult |
multipleQueries(List<IndexQuery> queries,
RequestOptions requestOptions) |
Performs multiple searches on multiple indices with the strategy
MultiQueriesStrategy.NONE |
CreateUpdateKey |
updateApiKey(String keyName,
ApiKey key) |
Update a key
|
CreateUpdateKey |
updateApiKey(String keyName,
ApiKey key,
RequestOptions requestOptions) |
Update a key
|
CreateUpdateKey |
updateKey(String keyName,
ApiKey key) |
Deprecated.
|
<T> void |
waitTask(GenericTask<T> task,
long timeToWait) |
|
<T> void |
waitTask(GenericTask<T> task,
long timeToWait,
RequestOptions requestOptions) |
protected final AlgoliaHttpClient httpClient
protected final APIClientConfiguration configuration
public void close()
throws AlgoliaException
AlgoliaExceptionpublic List<Index.Attributes> listIndices() throws AlgoliaException
AlgoliaExceptionpublic List<Index.Attributes> listIndices(@Nonnull RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaExceptionpublic <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 RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaExceptionpublic 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<Log> getLogs(@Nonnull Integer offset, @Nonnull Integer length, @Nonnull LogType logType, @Nonnull RequestOptions requestOptions) 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 retrieverequestOptions - Options to pass to this requestAlgoliaException@Deprecated public List<ApiKey> listKeys() throws AlgoliaException
AlgoliaExceptionpublic List<ApiKey> listApiKeys() throws AlgoliaException
AlgoliaExceptionpublic List<ApiKey> listApiKeys(@Nonnull RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaException@Deprecated public Optional<ApiKey> getKey(@Nonnull String key) throws AlgoliaException
AlgoliaExceptionpublic Optional<ApiKey> getApiKey(@Nonnull String key) throws AlgoliaException
key - name of the keyAlgoliaExceptionpublic Optional<ApiKey> getApiKey(@Nonnull String key, @Nonnull RequestOptions requestOptions) throws AlgoliaException
key - name of the keyrequestOptions - Options to pass to this requestAlgoliaException@Deprecated public DeleteKey deleteKey(@Nonnull String key) throws AlgoliaException
AlgoliaExceptionpublic DeleteKey deleteApiKey(@Nonnull String key) throws AlgoliaException
key - name of the keyAlgoliaExceptionpublic DeleteKey deleteApiKey(@Nonnull String key, @Nonnull RequestOptions requestOptions) throws AlgoliaException
key - name of the keyrequestOptions - Options to pass to this requestAlgoliaException@Deprecated public CreateUpdateKey addKey(@Nonnull ApiKey key) throws AlgoliaException
AlgoliaExceptionpublic CreateUpdateKey addApiKey(@Nonnull ApiKey key) throws AlgoliaException
key - the key with the ACLsAlgoliaExceptionpublic CreateUpdateKey addApiKey(@Nonnull ApiKey key, @Nonnull RequestOptions requestOptions) throws AlgoliaException
key - the key with the ACLsrequestOptions - Options to pass to this requestAlgoliaException@Deprecated public CreateUpdateKey updateKey(@Nonnull String keyName, @Nonnull ApiKey key) throws AlgoliaException
AlgoliaExceptionpublic CreateUpdateKey updateApiKey(@Nonnull String keyName, @Nonnull ApiKey key) throws AlgoliaException
keyName - name of the key to updatekey - the key with the ACLsAlgoliaExceptionpublic CreateUpdateKey updateApiKey(@Nonnull String keyName, @Nonnull ApiKey key, @Nonnull RequestOptions requestOptions) throws AlgoliaException
keyName - name of the key to updatekey - the key with the ACLsrequestOptions - Options to pass to this requestAlgoliaExceptionpublic 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 <T> void waitTask(@Nonnull GenericTask<T> task, long timeToWait, @Nonnull RequestOptions requestOptions) 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 TasksMultipleIndex batch(@Nonnull List<BatchOperation> operations, @Nonnull RequestOptions requestOptions) throws AlgoliaException
All operations must have a valid index name (not null)
operations - the list of operations to performrequestOptions - Options to pass to this requestAlgoliaExceptionpublic MultiQueriesResult multipleQueries(@Nonnull List<IndexQuery> queries) throws AlgoliaException
MultiQueriesStrategy.NONEqueries - the queriesAlgoliaExceptionpublic MultiQueriesResult multipleQueries(@Nonnull List<IndexQuery> queries, @Nonnull RequestOptions requestOptions) throws AlgoliaException
MultiQueriesStrategy.NONEqueries - the queriesrequestOptions - Options to pass to this requestAlgoliaExceptionpublic MultiQueriesResult multipleQueries(@Nonnull List<IndexQuery> queries, @Nonnull MultiQueriesStrategy strategy, @Nonnull RequestOptions requestOptions) throws AlgoliaException
queries - the queriesstrategy - the strategy to apply to this multiple queriesrequestOptions - Options to pass to this requestAlgoliaExceptionpublic <T> BrowseResult<T> browse(String indexName, Query query, String cursor, Class<T> klass, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionCopyright © 2017. All rights reserved.