getTask method
Future<GetTaskResponse>
getTask({
- required String indexName,
- required int taskID,
- RequestOptions? requestOptions,
Checks the status of a given task. Indexing tasks are asynchronous. When you add, update, or delete records or indices, a task is created on a queue and completed depending on the load on the server. The indexing tasks' responses include a task ID that you can use to check the status.
Required API Key ACLs:
- addObject
Parameters:
indexNameName of the index on which to perform the operation.taskIDUnique task identifier.requestOptionsadditional request configuration.
Implementation
Future<GetTaskResponse> getTask({
required String indexName,
required int taskID,
RequestOptions? requestOptions,
}) async {
assert(
indexName.isNotEmpty,
'Parameter `indexName` is required when calling `getTask`.',
);
final request = ApiRequest(
method: RequestMethod.get,
path: r'/1/indexes/{indexName}/task/{taskID}'
.replaceAll(
'{' r'indexName' '}', Uri.encodeComponent(indexName.toString()))
.replaceAll(
'{' r'taskID' '}', Uri.encodeComponent(taskID.toString())),
);
final response = await _retryStrategy.execute(
request: request,
options: requestOptions,
);
return deserialize<GetTaskResponse, GetTaskResponse>(
response,
'GetTaskResponse',
growable: true,
);
}