Helper methods
Helper methods extend or combine API operations to make using the Search API easier.
Wait until an API key is created
Waits for an API key to be created.
When you create a new API key, it might take a while before it is ready to use.
1
2
3
4
5
SearchClient.waitKeyCreation(
required String key,
WaitParams paramas,
RequestOptions? requestOptions,
)
Parameters
key
|
type: String
Required
The API key that was created. You can get this value from the API response. |
params
|
type: WaitParams
Parameters related to delays and retries. |
requestOptions
|
type: RequestOptions
default: None
Extra parameters, such as headers or query parameters. For more information, see Request options. |
Wait until an API key is deleted
Waits for an API key to be deleted.
When you delete API keys, it might take a while before the request is fulfilled.
1
2
3
4
5
SearchClient.waitKeyDelete(
required String key,
WaitParams params,
RequestOptions? requestOptions,
)
Parameters
key
|
type: String
Required
The API key that you deleted. |
params
|
type: WaitParams
Parameters related to delays and retries. |
requestOptions
|
type: RequestOptions
Extra parameters, such as headers or query parameters. For more information, see Request options. |
Wait for an API key update
Waits for an API key to be updated.
When you update API keys, it might take a while before the updates are applied.
1
2
3
4
5
6
SearchClient.waitKeyUpdate(
required String key,
required ApiKey apiKey,
WaitParams params,
RequestOptions? requestOptions,
)
Parameters
key
|
type: String
Required
The API key that you updated. |
apiKey
|
type: ApiKey
The original |
params
|
type: WaitParams
Parameters related to delays and retries. |
requestOptions
|
type: RequestOptions
Extra parameters, such as headers or query parameters. For more information, see Request options. |
Wait for application-level tasks
Waits for an application-level task to complete.
While indexing operations are index-level tasks,
some tasks, such as working with dictionaries,
are application-level tasks.
They’re asynchronous: when you make a request, Algolia adds the task to a queue
and runs it depending on the server load.
The response includes a taskID
property that you can use to wait until the task is complete.
This helper method polls the Check application task status
API operation and stops if the task’s status is published
.
1
2
3
4
5
SearchClient.waitAppTask(
required int taskID,
WaitParams params,
RequestOptions? requestOptions,
)
Parameters
taskID
|
type: int
Required
Task ID for which to wait. |
params
|
type: WaitParams
Parameters related to delays and retries. |
requestOptions
|
type: RequestOptions
Extra parameters, such as headers or query parameters. For more information, see Request options. |
Wait for index operations
Waits for an indexing task to complete.
Indexing operations are asynchronous.
When you make a request for an indexing operation, such as, adding or updating records,
Algolia adds a task to a queue and returns a taskID
property with the response.
The task itself runs separately, depending on the server load.
This helper method polls the Check task status
API operation and stops if the task’s status is published
.
1
2
3
4
5
6
SearchClient.waitTask(
required String indexName,
required int taskID,
WaitParams params,
RequestOptions? requestOptions
)
Parameters
indexName
|
type: String
Required
Index name for which to check the task. |
taskID
|
type: int
Required
Task ID for which to wait. |
params
|
type: WaitParams
Parameters related to delays and retries. |
requestOptions
|
type: RequestOptions
Extra parameters, such as headers or query parameters. For more information, see Request options. |
params ➔ WaitParams
maxRetries
|
type: int
default: 50
The maximum number of times to check for the task’s status. |
timeout
|
type: Duration
A timeout in milliseconds after which an exception is thrown. |
initialDelay
|
type: Duration
default: 200 ms
The initial delay after which the task’s status is checked for the first time. |
maxDelay
|
type: Duration
default: 5 s
The maximum delay between status checks. |