list method

Future<Objects> list(
  1. String bucket, {
  2. String? delimiter,
  3. String? endOffset,
  4. bool? includeTrailingDelimiter,
  5. int? maxResults,
  6. String? pageToken,
  7. String? prefix,
  8. String? projection,
  9. String? startOffset,
  10. String? userProject,
  11. bool? versions,
  12. String? $fields,
})

Retrieves a list of objects matching the criteria.

Request parameters:

bucket - Name of the bucket in which to look for objects.

delimiter - Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.

endOffset - Filter results to objects whose names are lexicographically before endOffset. If startOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).

includeTrailingDelimiter - If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.

maxResults - Maximum number of items plus prefixes to return in a single page of responses. As duplicate prefixes are omitted, fewer total results may be returned than requested. The service will use this parameter or 1,000 items, whichever is smaller.

pageToken - A previously-returned page token representing part of the larger set of results to view.

prefix - Filter results to objects whose names begin with this prefix.

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

  • "full" : Include all properties.
  • "noAcl" : Omit the owner, acl property.

startOffset - Filter results to objects whose names are lexicographically equal to or after startOffset. If endOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).

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

versions - If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.

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

Completes with a Objects.

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<Objects> list(
  core.String bucket, {
  core.String? delimiter,
  core.String? endOffset,
  core.bool? includeTrailingDelimiter,
  core.int? maxResults,
  core.String? pageToken,
  core.String? prefix,
  core.String? projection,
  core.String? startOffset,
  core.String? userProject,
  core.bool? versions,
  core.String? $fields,
}) async {
  final _queryParams = <core.String, core.List<core.String>>{
    if (delimiter != null) 'delimiter': [delimiter],
    if (endOffset != null) 'endOffset': [endOffset],
    if (includeTrailingDelimiter != null)
      'includeTrailingDelimiter': ['${includeTrailingDelimiter}'],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (prefix != null) 'prefix': [prefix],
    if (projection != null) 'projection': [projection],
    if (startOffset != null) 'startOffset': [startOffset],
    if (userProject != null) 'userProject': [userProject],
    if (versions != null) 'versions': ['${versions}'],
    if ($fields != null) 'fields': [$fields],
  };

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

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