list method
- String? corpora,
- String? corpus,
- String? driveId,
- bool? includeItemsFromAllDrives,
- String? includeLabels,
- String? includePermissionsForView,
- bool? includeTeamDriveItems,
- int? maxResults,
- String? orderBy,
- String? pageToken,
- String? projection,
- String? q,
- String? spaces,
- bool? supportsAllDrives,
- bool? supportsTeamDrives,
- String? teamDriveId,
- String? $fields,
Lists the user's files.
This method accepts the q
parameter, which is a search query combining
one or more search terms. For more information, see the [Search for files
& folders](/drive/api/guides/search-files) guide. Note: This method
returns all files by default, including trashed files. If you don't want
trashed files to appear in the list, use the trashed=false
query
parameter to remove trashed files from the results.
Request parameters:
corpora
- Bodies of items (files/documents) to which the query applies.
Supported bodies are default
, domain
, drive
and allDrives
. Prefer
default
or drive
to allDrives
for efficiency.
corpus
- Deprecated: The body of items (files/documents) to which the
query applies. Use corpora
instead.
Possible string values are:
- "DEFAULT" : The items that the user has accessed.
- "DOMAIN" : Items shared to the user's domain.
driveId
- ID of the shared drive to search.
includeItemsFromAllDrives
- Whether both My Drive and shared drive items
should be included in results.
includeLabels
- A comma-separated list of IDs of labels to include in
the labelInfo
part of the response.
includePermissionsForView
- Specifies which additional view's
permissions to include in the response. Only published
is supported.
includeTeamDriveItems
- Deprecated: Use includeItemsFromAllDrives
instead.
maxResults
- The maximum number of files to return per page. Partial or
empty result pages are possible even before the end of the files list has
been reached.
orderBy
- A comma-separated list of sort keys. Valid keys are
createdDate
, folder
, lastViewedByMeDate
, modifiedByMeDate
,
modifiedDate
, quotaBytesUsed
, recency
, sharedWithMeDate
,
starred
, title
, and title_natural
. 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 files.
projection
- Deprecated: This parameter has no function.
Possible string values are:
- "BASIC" : Deprecated.
- "FULL" : Deprecated.
q
- Query string for searching files.
spaces
- A comma-separated list of spaces to query. Supported values are
drive
, and appDataFolder
.
supportsAllDrives
- Whether the requesting application supports both My
Drives and shared drives.
supportsTeamDrives
- Deprecated: Use supportsAllDrives
instead.
teamDriveId
- Deprecated: Use driveId
instead.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a FileList.
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<FileList> list({
core.String? corpora,
core.String? corpus,
core.String? driveId,
core.bool? includeItemsFromAllDrives,
core.String? includeLabels,
core.String? includePermissionsForView,
core.bool? includeTeamDriveItems,
core.int? maxResults,
core.String? orderBy,
core.String? pageToken,
core.String? projection,
core.String? q,
core.String? spaces,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.String? teamDriveId,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (corpora != null) 'corpora': [corpora],
if (corpus != null) 'corpus': [corpus],
if (driveId != null) 'driveId': [driveId],
if (includeItemsFromAllDrives != null)
'includeItemsFromAllDrives': ['${includeItemsFromAllDrives}'],
if (includeLabels != null) 'includeLabels': [includeLabels],
if (includePermissionsForView != null)
'includePermissionsForView': [includePermissionsForView],
if (includeTeamDriveItems != null)
'includeTeamDriveItems': ['${includeTeamDriveItems}'],
if (maxResults != null) 'maxResults': ['${maxResults}'],
if (orderBy != null) 'orderBy': [orderBy],
if (pageToken != null) 'pageToken': [pageToken],
if (projection != null) 'projection': [projection],
if (q != null) 'q': [q],
if (spaces != null) 'spaces': [spaces],
if (supportsAllDrives != null)
'supportsAllDrives': ['${supportsAllDrives}'],
if (supportsTeamDrives != null)
'supportsTeamDrives': ['${supportsTeamDrives}'],
if (teamDriveId != null) 'teamDriveId': [teamDriveId],
if ($fields != null) 'fields': [$fields],
};
const url_ = 'files';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return FileList.fromJson(response_ as core.Map<core.String, core.dynamic>);
}