patch method

Future<GoogleCloudDialogflowV2Context> patch(
  1. GoogleCloudDialogflowV2Context request,
  2. String name, {
  3. String? updateMask,
  4. String? $fields,
})

Updates the specified context.

request - The metadata request object.

Request parameters:

name - Required. The unique identifier of the context. Format: projects//agent/sessions//contexts/, or projects//agent/environments//users//sessions//contexts/. The Context ID is always converted to lowercase, may only contain characters in a-zA-Z0-9_-% and may be at most 250 bytes long. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user. The following context names are reserved for internal use by Dialogflow. You should not use these contexts or create contexts with these names: * __system_counters__ * *_id_dialog_context * *_dialog_params_size Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/agent/environments/\[^/\]+/users/\[^/\]+/sessions/\[^/\]+/contexts/\[^/\]+$.

updateMask - Optional. The mask to control which fields get updated.

$fields - Selector specifying which fields to include in a partial response.

Completes with a GoogleCloudDialogflowV2Context.

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<GoogleCloudDialogflowV2Context> patch(
  GoogleCloudDialogflowV2Context request,
  core.String name, {
  core.String? updateMask,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (updateMask != null) 'updateMask': [updateMask],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v2/' + core.Uri.encodeFull('$name');

  final response_ = await _requester.request(
    url_,
    'PATCH',
    body: body_,
    queryParams: queryParams_,
  );
  return GoogleCloudDialogflowV2Context.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}