get method

Future<Bucket> get(
  1. String bucket, {
  2. String? ifMetagenerationMatch,
  3. String? ifMetagenerationNotMatch,
  4. String? projection,
  5. String? userProject,
  6. String? $fields,
})

Returns metadata for the specified bucket.

Request parameters:

bucket - Name of a bucket.

ifMetagenerationMatch - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.

ifMetagenerationNotMatch - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.

projection - Set of properties to return. Defaults to noAcl. Possible string values are:

  • "full" : Include all properties.
  • "noAcl" : Omit owner, acl and defaultObjectAcl properties.

userProject - The project to be billed for this request. Required for Requester Pays buckets.

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

Completes with a Bucket.

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

  final _url = 'b/' + commons.escapeVariable('$bucket');

  final _response = await _requester.request(
    _url,
    'GET',
    queryParams: _queryParams,
  );
  return Bucket.fromJson(_response as core.Map<core.String, core.dynamic>);
}