list method

Future<ChildList> list(
  1. String folderId, {
  2. int? maxResults,
  3. String? orderBy,
  4. String? pageToken,
  5. String? q,
  6. String? $fields,
})

Lists a folder's children.

Request parameters:

folderId - The ID of the folder.

maxResults - Maximum number of children to return.

orderBy - A comma-separated list of sort keys. Valid keys are createdDate, folder, lastViewedByMeDate, modifiedByMeDate, modifiedDate, quotaBytesUsed, recency, sharedWithMeDate, starred, and title. Each key sorts ascending by default, but may be reversed with the desc modifier. Example usage: ?orderBy=folder,modifiedDate desc,title. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.

pageToken - Page token for children.

q - Query string for searching children.

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

Completes with a ChildList.

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<ChildList> list(
  core.String folderId, {
  core.int? maxResults,
  core.String? orderBy,
  core.String? pageToken,
  core.String? q,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (orderBy != null) 'orderBy': [orderBy],
    if (pageToken != null) 'pageToken': [pageToken],
    if (q != null) 'q': [q],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'files/' + commons.escapeVariable('$folderId') + '/children';

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