buffer method
- BufferTaskRequest request,
- String queue,
- String taskId, {
- String? $fields,
Creates and buffers a new task without the need to explicitly define a Task message.
The queue must have HTTP target. To create the task with a custom ID, use the following format and set TASK_ID to your desired ID: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer To create the task with an automatically generated ID, use the following format: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.
request
- The metadata request object.
Request parameters:
queue
- Required. The parent queue name. For example:
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` The queue must
already exist.
Value must have pattern
^projects/\[^/\]+/locations/\[^/\]+/queues/\[^/\]+$
.
taskId
- Optional. Task ID for the task being created. If not provided,
Cloud Tasks generates an ID for the task.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a BufferTaskResponse.
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<BufferTaskResponse> buffer(
BufferTaskRequest request,
core.String queue,
core.String taskId, {
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_ = 'v2/' +
core.Uri.encodeFull('$queue') +
'/tasks/' +
commons.escapeVariable('$taskId') +
':buffer';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return BufferTaskResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}