list method

Future<Folders> list(
  1. String bucket, {
  2. String? delimiter,
  3. String? endOffset,
  4. int? pageSize,
  5. String? pageToken,
  6. String? prefix,
  7. String? startOffset,
  8. String? $fields,
})

Retrieves a list of folders matching the criteria.

Only applicable to buckets with hierarchical namespace enabled.

Request parameters:

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

delimiter - Returns results in a directory-like mode. The only supported value is '/'. If set, items will only contain folders that either exactly match the prefix, or are one level below the prefix.

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

pageSize - Maximum number of items to return in a single page of responses.

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

prefix - Filter results to folders whose paths begin with this prefix. If set, the value must either be an empty string or end with a '/'.

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

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

Completes with a Folders.

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<Folders> list(
  core.String bucket, {
  core.String? delimiter,
  core.String? endOffset,
  core.int? pageSize,
  core.String? pageToken,
  core.String? prefix,
  core.String? startOffset,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (delimiter != null) 'delimiter': [delimiter],
    if (endOffset != null) 'endOffset': [endOffset],
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (prefix != null) 'prefix': [prefix],
    if (startOffset != null) 'startOffset': [startOffset],
    if ($fields != null) 'fields': [$fields],
  };

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

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return Folders.fromJson(response_ as core.Map<core.String, core.dynamic>);
}