batchRemoveMediaItems method

Future<BatchRemoveMediaItemsFromAlbumResponse> batchRemoveMediaItems(
  1. BatchRemoveMediaItemsFromAlbumRequest request,
  2. String albumId, {
  3. String? $fields,
})

Removes one or more media items from a specified album.

The media items and the album must have been created by the developer via the API. For albums that are shared, this action is only supported for media items that were added to the album by this user, or for all media items if the album was created by this user. Partial success is not supported. The entire request will fail and no action will be performed on the album if an invalid media item or album is specified.

request - The metadata request object.

Request parameters:

albumId - Required. Identifier of the Album that the media items are to be removed from. Value must have pattern ^\[^/\]+$.

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

Completes with a BatchRemoveMediaItemsFromAlbumResponse.

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<BatchRemoveMediaItemsFromAlbumResponse> batchRemoveMediaItems(
  BatchRemoveMediaItemsFromAlbumRequest request,
  core.String albumId, {
  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_ = 'v1/albums/' +
      core.Uri.encodeFull('$albumId') +
      ':batchRemoveMediaItems';

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