list method

Future<Objects> list(
  1. String bucket, {
  2. String? delimiter,
  3. String? endOffset,
  4. bool? includeTrailingDelimiter,
  5. String? matchGlob,
  6. int? maxResults,
  7. String? pageToken,
  8. String? prefix,
  9. String? projection,
  10. String? startOffset,
  11. String? userProject,
  12. bool? versions,
  13. 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.

matchGlob - Filter results to objects and prefixes that match this glob pattern.

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.String? matchGlob,
  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 (matchGlob != null) 'matchGlob': [matchGlob],
    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>);
}