patch method

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

Update a case.

Only some fields can be updated. EXAMPLES: cURL: shell case="projects/some-project/cases/43595344" curl \ --request PATCH \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --header "Content-Type: application/json" \ --data '{ "priority": "P1" }' \ "https://cloudsupport.googleapis.com/v2/$case?updateMask=priority" Python: python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.cases().patch( name="projects/some-project/cases/43112854", body={ "displayName": "This is Now a New Title", "priority": "P2", }, ) print(request.execute())

request - The metadata request object.

Request parameters:

name - The resource name for the case. Value must have pattern ^\[^/\]+/\[^/\]+/cases/\[^/\]+$.

updateMask - A list of attributes of the case that should be updated. Supported values are priority, display_name, and subscriber_email_addresses. If no fields are specified, all supported fields are updated. Be careful - if you do not provide a field mask, then you might accidentally clear some fields. For example, if you leave the field mask empty and do not provide a value for subscriber_email_addresses, then subscriber_email_addresses is updated to empty.

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

Completes with a Case.

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<Case> patch(
  Case 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 Case.fromJson(response_ as core.Map<core.String, core.dynamic>);
}