updateAttributes method

Future<Attributes> updateAttributes(
  1. Attributes request,
  2. String name, {
  3. String? attributeMask,
  4. String? $fields,
})

Update attributes for a given location.

request - The metadata request object.

Request parameters:

name - Required. Google identifier for this location in the form of locations/{location_id}/attributes. Value must have pattern ^locations/\[^/\]+/attributes$.

attributeMask - Required. Attribute name of attributes that you'd like to update. Represented by attributes/{attribute}. Updates: All attributes provided in the attributes field that you would like to update must be set in the attribute_mask. Attributes set in the above list but not in the attribute_mask will be ignored. Deletes: If you'd like to delete certain attributes, they must be specified in the attribute_mask with no matching entry in the attributes list. If you'd like to delete all attributes set on a location, you should look up all the applicable attributes for the location and then add them to the attribute_mask with an empty attributes field.

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

Completes with a Attributes.

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

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

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