poll method
Polls for unreserved items from the indexing queue and marks a set as reserved, starting with items that have the oldest timestamp from the highest priority ItemStatus.
The priority order is as follows: ERROR MODIFIED NEW_ITEM ACCEPTED Reserving items ensures that polling from other threads cannot create overlapping sets. After handling the reserved items, the client should put items back into the unreserved state, either by calling index, or by calling push with the type REQUEUE. Items automatically become available (unreserved) after 4 hours even if no update or push method is called. This API requires an admin or service account to execute. The service account used is the one whitelisted in the corresponding data source.
request
- The metadata request object.
Request parameters:
name
- The name of the Data Source to poll items. Format:
datasources/{source_id}
Value must have pattern ^datasources/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a PollItemsResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<PollItemsResponse> poll(
PollItemsRequest request,
core.String name, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/indexing/' + core.Uri.encodeFull('$name') + '/items:poll';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return PollItemsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}