delete method

Future<void> delete(
  1. String bucket,
  2. String folder, {
  3. String? ifMetagenerationMatch,
  4. String? ifMetagenerationNotMatch,
  5. String? $fields,
})

Permanently deletes a folder.

Only applicable to buckets with hierarchical namespace enabled.

Request parameters:

bucket - Name of the bucket in which the folder resides.

folder - Name of a folder.

ifMetagenerationMatch - If set, only deletes the folder if its metageneration matches this value.

ifMetagenerationNotMatch - If set, only deletes the folder if its metageneration does not match this value.

$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 bucket,
  core.String folder, {
  core.String? ifMetagenerationMatch,
  core.String? ifMetagenerationNotMatch,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (ifMetagenerationMatch != null)
      'ifMetagenerationMatch': [ifMetagenerationMatch],
    if (ifMetagenerationNotMatch != null)
      'ifMetagenerationNotMatch': [ifMetagenerationNotMatch],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'b/' +
      commons.escapeVariable('$bucket') +
      '/folders/' +
      commons.escapeVariable('$folder');

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