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 |
|---|---|
TaskABTest |
addABTest(ABTest abtest) |
CreateUpdateKey |
addApiKey(ApiKey key)
Create a new key
|
CreateUpdateKey |
addApiKey(ApiKey key,
RequestOptions requestOptions)
Create a new key
|
CreateUpdateKey |
addKey(ApiKey key)
Deprecated.
|
AssignUserID |
assignUserID(String userID,
String clusterName) |
AssignUserID |
assignUserID(String userID,
String clusterName,
RequestOptions requestOptions) |
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
|
Task |
copyIndex(String srcIndexName,
String dstIndexName)
Copy an existing index
|
Task |
copyIndex(String srcIndexName,
String dstIndexName,
List<String> scope)
Copy an existing index
|
Task |
copyIndex(String srcIndexName,
String dstIndexName,
List<String> scope,
RequestOptions requestOptions)
Copy an existing index
|
Task |
copyIndex(String srcIndexName,
String dstIndexName,
RequestOptions requestOptions)
Copy an existing index
|
TaskABTest |
deleteABTest(long id) |
DeleteKey |
deleteApiKey(String key)
Delete an existing key
|
DeleteKey |
deleteApiKey(String key,
RequestOptions requestOptions)
Delete an existing key
|
Task |
deleteIndex(String indexName)
Delete an existing index
|
Task |
deleteIndex(String indexName,
RequestOptions requestOptions)
Delete an existing index
|
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
|
ABTest |
getABTest(long id) |
ABTests |
getABTests(int offset,
int limit) |
Optional<ApiKey> |
getApiKey(String key)
Get a Key from its name
|
Optional<ApiKey> |
getApiKey(String key,
RequestOptions requestOptions)
Get a Key from its name
|
Optional<ApiKey> |
getKey(String key)
Deprecated.
|
List<Log> |
getLogs()
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
|
List<Log> |
getLogs(RequestOptions requestOptions)
Return 10 last log entries.
|
Map<String,List<UserID>> |
getTopUserID() |
Map<String,List<UserID>> |
getTopUserID(RequestOptions requestOptions) |
UserID |
getUserID(String userID) |
UserID |
getUserID(String userID,
RequestOptions requestOptions) |
Analytics |
initAnalytics() |
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<Cluster> |
listClusters() |
List<Cluster> |
listClusters(RequestOptions requestOptions) |
List<Index.Attributes> |
listIndexes()
List all existing indexes
|
List<Index.Attributes> |
listIndexes(RequestOptions requestOptions)
List all existing indexes
|
List<Index.Attributes> |
listIndices()
Deprecated.
|
List<Index.Attributes> |
listIndices(RequestOptions requestOptions)
Deprecated.
|
List<ApiKey> |
listKeys()
Deprecated.
|
UserIDs |
listUserIDs() |
UserIDs |
listUserIDs(Integer page,
Integer hitsPerPage) |
UserIDs |
listUserIDs(Integer page,
Integer hitsPerPage,
RequestOptions requestOptions) |
Task |
moveIndex(String srcIndexName,
String dstIndexName)
Moves an existing index
|
Task |
moveIndex(String srcIndexName,
String dstIndexName,
RequestOptions requestOptions)
Moves an existing index
|
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
|
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 |
DeleteUserID |
removeUserID(String userID) |
DeleteUserID |
removeUserID(String userID,
RequestOptions requestOptions) |
SearchUserIDs |
searchUserIDs(String query,
String clusterName) |
SearchUserIDs |
searchUserIDs(String query,
String clusterName,
int page,
int hitsPerPage) |
SearchUserIDs |
searchUserIDs(String query,
String clusterName,
int page,
int hitsPerPage,
RequestOptions requestOptions) |
SearchUserIDs |
searchUserIDs(String query,
String clusterName,
RequestOptions requestOptions) |
TaskABTest |
stopABTest(long id) |
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)
Wait for the completion of this task
|
<T> void |
waitTask(GenericTask<T> task,
long timeToWait)
Wait for the completion of this task
|
<T> void |
waitTask(GenericTask<T> task,
long timeToWait,
RequestOptions requestOptions)
Wait for the completion of this task
|
protected final AlgoliaHttpClient httpClient
protected final APIClientConfiguration configuration
public void close()
throws AlgoliaException
AlgoliaExceptionpublic List<Index.Attributes> listIndexes() throws AlgoliaException
AlgoliaExceptionpublic List<Index.Attributes> listIndexes(@Nonnull RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaException@Deprecated public List<Index.Attributes> listIndices() throws AlgoliaException
listIndexes()AlgoliaException@Deprecated public List<Index.Attributes> listIndices(@Nonnull RequestOptions requestOptions) throws AlgoliaException
listIndexes(RequestOptions)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 Analytics initAnalytics()
public Task moveIndex(@Nonnull String srcIndexName, @Nonnull String dstIndexName) throws AlgoliaException
srcIndexName - the index name that will be the source of the copydstIndexName - the new index name that will contains a copy of srcIndexName (destination
will be overwritten if it already exist)AlgoliaExceptionpublic Task moveIndex(@Nonnull String srcIndexName, @Nonnull String dstIndexName, @Nonnull RequestOptions requestOptions) throws AlgoliaException
srcIndexName - the index name that will be the source of the copydstIndexName - the new index name that will contains a copy of srcIndexName (destination
will be overwritten if it already exist)requestOptions - Options to pass to this requestAlgoliaExceptionpublic Task copyIndex(@Nonnull String srcIndexName, @Nonnull String dstIndexName) throws AlgoliaException
srcIndexName - the index name that will be the source of the copydstIndexName - the new index name that will contains a copy of srcIndexName (destination
will be overwritten if it already exist)AlgoliaExceptionpublic Task copyIndex(@Nonnull String srcIndexName, @Nonnull String dstIndexName, @Nonnull RequestOptions requestOptions) throws AlgoliaException
srcIndexName - the index name that will be the source of the copydstIndexName - the new index name that will contains a copy of srcIndexName (destination
will be overwritten if it already exist)requestOptions - Options to pass to this requestAlgoliaExceptionpublic Task copyIndex(@Nonnull String srcIndexName, @Nonnull String dstIndexName, List<String> scope, @Nonnull RequestOptions requestOptions) throws AlgoliaException
srcIndexName - the index name that will be the source of the copydstIndexName - the new index name that will contains a copy of srcIndexName (destination
will be overwritten if it already exist)scope - the list of scope to copyrequestOptions - Options to pass to this requestAlgoliaExceptionpublic Task copyIndex(@Nonnull String srcIndexName, @Nonnull String dstIndexName, @Nonnull List<String> scope) throws AlgoliaException
srcIndexName - the index name that will be the source of the copydstIndexName - the new index name that will contains a copy of srcIndexName (destination
will be overwritten if it already exist)scope - the list of scope to copyAlgoliaExceptionpublic Task deleteIndex(@Nonnull String indexName) throws AlgoliaException
indexName - The index name that will be deletedAlgoliaExceptionpublic Task deleteIndex(@Nonnull String indexName, @Nonnull RequestOptions requestOptions) throws AlgoliaException
indexName - The index name that will be deletedrequestOptions - Options to pass to this requestAlgoliaExceptionpublic 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
listApiKeys()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
getApiKey(String)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
deleteApiKey(String)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
addApiKey(ApiKey)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
updateApiKey(String, ApiKey)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) throws AlgoliaException
task - the task to waitAlgoliaExceptionpublic <T> void waitTask(@Nonnull GenericTask<T> task, long timeToWait) throws AlgoliaException
task - the task to waittimeToWait - the time to wait in millisecondsAlgoliaExceptionpublic <T> void waitTask(@Nonnull GenericTask<T> task, long timeToWait, @Nonnull RequestOptions requestOptions) throws AlgoliaException
task - the task to waittimeToWait - the time to wait in millisecondsrequestOptions - Options to pass to this requestAlgoliaExceptionpublic 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) throws AlgoliaException
queries - the queriesstrategy - the strategy to apply to this multiple queriesAlgoliaExceptionpublic 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
AlgoliaExceptionpublic TaskABTest addABTest(ABTest abtest) throws AlgoliaException
AlgoliaExceptionpublic TaskABTest stopABTest(long id) throws AlgoliaException
AlgoliaExceptionpublic TaskABTest deleteABTest(long id) throws AlgoliaException
AlgoliaExceptionpublic ABTest getABTest(long id) throws AlgoliaException
AlgoliaExceptionpublic ABTests getABTests(int offset, int limit) throws AlgoliaException
AlgoliaExceptionpublic List<Cluster> listClusters() throws AlgoliaException
AlgoliaExceptionpublic List<Cluster> listClusters(@Nonnull RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic UserIDs listUserIDs() throws AlgoliaException
AlgoliaExceptionpublic UserIDs listUserIDs(Integer page, Integer hitsPerPage) throws AlgoliaException
AlgoliaExceptionpublic UserIDs listUserIDs(@Nonnull Integer page, @Nonnull Integer hitsPerPage, @Nonnull RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic Map<String,List<UserID>> getTopUserID() throws AlgoliaException
AlgoliaExceptionpublic Map<String,List<UserID>> getTopUserID(RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic AssignUserID assignUserID(@Nonnull String userID, @Nonnull String clusterName) throws AlgoliaException
AlgoliaExceptionpublic AssignUserID assignUserID(@Nonnull String userID, @Nonnull String clusterName, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic UserID getUserID(@Nonnull String userID) throws AlgoliaException
AlgoliaExceptionpublic UserID getUserID(@Nonnull String userID, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic DeleteUserID removeUserID(@Nonnull String userID) throws AlgoliaException
AlgoliaExceptionpublic DeleteUserID removeUserID(@Nonnull String userID, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic SearchUserIDs searchUserIDs(@Nonnull String query, @Nonnull String clusterName) throws AlgoliaException
AlgoliaExceptionpublic SearchUserIDs searchUserIDs(@Nonnull String query, @Nonnull String clusterName, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic SearchUserIDs searchUserIDs(@Nonnull String query, @Nonnull String clusterName, int page, int hitsPerPage) throws AlgoliaException
AlgoliaExceptionpublic SearchUserIDs searchUserIDs(@Nonnull String query, @Nonnull String clusterName, int page, int hitsPerPage, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionCopyright © 2018. All rights reserved.