list method
- String bucket, {
- String? delimiter,
- String? endOffset,
- bool? includeFoldersAsPrefixes,
- bool? includeTrailingDelimiter,
- String? matchGlob,
- int? maxResults,
- String? pageToken,
- String? prefix,
- String? projection,
- bool? softDeleted,
- String? startOffset,
- String? userProject,
- bool? versions,
- 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).
includeFoldersAsPrefixes
- Only applicable if delimiter is set to '/'.
If true, will also include folders and managed folders (besides objects)
in the returned prefixes.
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.
softDeleted
- If true, only soft-deleted object versions will be listed.
The default is false. For more information, see Soft Delete.
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? includeFoldersAsPrefixes,
core.bool? includeTrailingDelimiter,
core.String? matchGlob,
core.int? maxResults,
core.String? pageToken,
core.String? prefix,
core.String? projection,
core.bool? softDeleted,
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 (includeFoldersAsPrefixes != null)
'includeFoldersAsPrefixes': ['${includeFoldersAsPrefixes}'],
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 (softDeleted != null) 'softDeleted': ['${softDeleted}'],
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>);
}