list method
- String? corpora,
- String? corpus,
- String? driveId,
- bool? includeItemsFromAllDrives,
- String? includeLabels,
- String? includePermissionsForView,
- bool? includeTeamDriveItems,
- String? orderBy,
- int? pageSize,
- String? pageToken,
- String? q,
- String? spaces,
- bool? supportsAllDrives,
- bool? supportsTeamDrives,
- String? teamDriveId,
- String? $fields,
Lists the user's files.
For more information, see [Search for files and
folders](/workspace/drive/api/guides/search-files). This method accepts
the q parameter, which is a search query combining one or more search
terms. 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 - Specifies a collection of items (files or documents) to which
the query applies. Supported items include: * user * domain * drive
allDrivesPreferuserordrivetoallDrivesfor efficiency. By default, corpora is set touser. However, this can change depending on the filter set through theqparameter. For more information, see File organization.
corpus - Deprecated: The source of files to list. Use corpora instead.
Possible string values are:
- "domain" : Files shared to the user's domain.
- "user" : Files owned by or shared to the user.
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.
orderBy - A comma-separated list of sort keys. Valid keys are: *
createdTime: When the file was created. Avoid using this key for queries
on large item collections as it might result in timeouts or other issues.
For time-related sorting on large item collections, use modifiedTime
instead. * folder: The folder ID. This field is sorted using
alphabetical ordering. * modifiedByMeTime: The last time the file was
modified by the user. * modifiedTime: The last time the file was
modified by anyone. * name: The name of the file. This field is sorted
using alphabetical ordering, so 1, 12, 2, 22. * name_natural: The name
of the file. This field is sorted using natural sort ordering, so 1, 2,
12, 22. * quotaBytesUsed: The number of storage quota bytes used by the
file. * recency: The most recent timestamp from the file's date-time
fields. * sharedWithMeTime: When the file was shared with the user, if
applicable. * starred: Whether the user has starred the file. *
viewedByMeTime: The last time the file was viewed by the user. Each key
sorts ascending by default, but can be reversed with the desc modifier.
Example usage: ?orderBy=folder,modifiedTime desc,name.
pageSize - 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.
Value must be between "1" and "1000".
pageToken - The token for continuing a previous list request on the next
page. This should be set to the value of nextPageToken from the previous
response.
q - A query for filtering the file results. For supported syntax, see
[Search for files and
folders](/workspace/drive/api/guides/search-files).
spaces - A comma-separated list of spaces to query within the corpora.
Supported values are drive and appDataFolder. For more information,
see
File organization.
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.String? orderBy,
core.int? pageSize,
core.String? pageToken,
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>>{
'corpora': ?corpora == null ? null : [corpora],
'corpus': ?corpus == null ? null : [corpus],
'driveId': ?driveId == null ? null : [driveId],
'includeItemsFromAllDrives': ?includeItemsFromAllDrives == null
? null
: ['${includeItemsFromAllDrives}'],
'includeLabels': ?includeLabels == null ? null : [includeLabels],
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'includeTeamDriveItems': ?includeTeamDriveItems == null
? null
: ['${includeTeamDriveItems}'],
'orderBy': ?orderBy == null ? null : [orderBy],
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'q': ?q == null ? null : [q],
'spaces': ?spaces == null ? null : [spaces],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'teamDriveId': ?teamDriveId == null ? null : [teamDriveId],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'files';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return FileList.fromJson(response_ as core.Map<core.String, core.dynamic>);
}