delete method

Future<void> delete(
  1. String fileId, {
  2. bool? enforceSingleParent,
  3. bool? supportsAllDrives,
  4. bool? supportsTeamDrives,
  5. String? $fields,
})

Permanently deletes a file owned by the user without moving it to the trash.

If the file belongs to a shared drive, the user must be an organizer on the parent folder. If the target is a folder, all descendants owned by the user are also deleted.

Request parameters:

fileId - The ID of the file to delete.

enforceSingleParent - Deprecated: If an item is not in a shared drive and its last parent is deleted but the item itself is not, the item is placed under its owner's root.

supportsAllDrives - Whether the requesting application supports both My Drives and shared drives.

supportsTeamDrives - Deprecated: Use supportsAllDrives instead.

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

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<void> delete(
  core.String fileId, {
  core.bool? enforceSingleParent,
  core.bool? supportsAllDrives,
  core.bool? supportsTeamDrives,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (enforceSingleParent != null)
      'enforceSingleParent': ['${enforceSingleParent}'],
    if (supportsAllDrives != null)
      'supportsAllDrives': ['${supportsAllDrives}'],
    if (supportsTeamDrives != null)
      'supportsTeamDrives': ['${supportsTeamDrives}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'files/' + commons.escapeVariable('$fileId');

  await _requester.request(
    url_,
    'DELETE',
    queryParams: queryParams_,
    downloadOptions: null,
  );
}