update method

Future<Photo> update(
  1. Photo request,
  2. String id, {
  3. String? updateMask,
  4. String? $fields,
})

Updates the metadata of a Photo, such as pose, place association, connections, etc.

Changing the pixels of a photo is not supported. Only the fields specified in the updateMask field are used. If updateMask is not present, the update applies to all fields. This method returns the following error codes: * google.rpc.Code.PERMISSION_DENIED if the requesting user did not create the requested photo. * google.rpc.Code.INVALID_ARGUMENT if the request is malformed. * google.rpc.Code.NOT_FOUND if the requested photo does not exist. * google.rpc.Code.UNAVAILABLE if the requested Photo is still being indexed.

request - The metadata request object.

Request parameters:

id - A unique identifier for a photo.

updateMask - Required. Mask that identifies fields on the photo metadata to update. If not present, the old Photo metadata is entirely replaced with the new Photo metadata in this request. The update fails if invalid fields are specified. Multiple fields can be specified in a comma-delimited list. The following fields are valid: * pose.heading * pose.lat_lng_pair * pose.pitch * pose.roll * pose.level * pose.altitude * connections * places > Note: When updateMask contains repeated fields, the entire set of repeated values get replaced with the new contents. For example, if updateMask contains connections and UpdatePhotoRequest.photo.connections is empty, all connections are removed.

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

Completes with a Photo.

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<Photo> update(
  Photo request,
  core.String id, {
  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_ = 'v1/photo/' + commons.escapeVariable('$id');

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