blob: 311aca45413288679525ee7d3dd45657914cf98b [file] [edit]
// Copyright 2015 Google LLC
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
// This is a generated file (see the discoveryapis_generator project).
// ignore_for_file: camel_case_types
// ignore_for_file: comment_references
// ignore_for_file: deprecated_member_use_from_same_package
// ignore_for_file: doc_directive_unknown
// ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: prefer_interpolation_to_compose_strings
// ignore_for_file: unintended_html_in_doc_comment
// ignore_for_file: unnecessary_brace_in_string_interps
// ignore_for_file: unnecessary_lambdas
// ignore_for_file: unnecessary_string_interpolations
/// Google Drive API - v3
///
/// The Google Drive API allows clients to access resources from Google Drive.
///
/// For more information, see <https://developers.google.com/workspace/drive/>
///
/// Create an instance of [DriveApi] to access these resources:
///
/// - [AboutResource]
/// - [AccessproposalsResource]
/// - [ApprovalsResource]
/// - [AppsResource]
/// - [ChangesResource]
/// - [ChannelsResource]
/// - [CommentsResource]
/// - [DrivesResource]
/// - [FilesResource]
/// - [OperationsResource]
/// - [PermissionsResource]
/// - [RepliesResource]
/// - [RevisionsResource]
/// - [TeamdrivesResource]
library;
import 'dart:async' as async;
import 'dart:convert' as convert;
import 'dart:core' as core;
import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons;
import 'package:http/http.dart' as http;
import '../shared.dart';
import '../src/user_agent.dart';
export 'package:_discoveryapis_commons/_discoveryapis_commons.dart'
show
ApiRequestError,
ByteRange,
DetailedApiRequestError,
DownloadOptions,
Media,
PartialDownloadOptions,
ResumableUploadOptions,
UploadOptions;
/// The Google Drive API allows clients to access resources from Google Drive.
class DriveApi {
/// See, edit, create, and delete all of your Google Drive files
static const driveScope = 'https://www.googleapis.com/auth/drive';
/// See, create, and delete its own configuration data in your Google Drive
static const driveAppdataScope =
'https://www.googleapis.com/auth/drive.appdata';
/// View your Google Drive apps
static const driveAppsReadonlyScope =
'https://www.googleapis.com/auth/drive.apps.readonly';
/// See, edit, create, and delete only the specific Google Drive files you use
/// with this app
static const driveFileScope = 'https://www.googleapis.com/auth/drive.file';
/// See and download your Google Drive files that were created or edited by
/// Google Meet.
static const driveMeetReadonlyScope =
'https://www.googleapis.com/auth/drive.meet.readonly';
/// View and manage metadata of files in your Google Drive
static const driveMetadataScope =
'https://www.googleapis.com/auth/drive.metadata';
/// See information about your Google Drive files
static const driveMetadataReadonlyScope =
'https://www.googleapis.com/auth/drive.metadata.readonly';
/// View the photos, videos and albums in your Google Photos
static const drivePhotosReadonlyScope =
'https://www.googleapis.com/auth/drive.photos.readonly';
/// See and download all your Google Drive files
static const driveReadonlyScope =
'https://www.googleapis.com/auth/drive.readonly';
/// Modify your Google Apps Script scripts' behavior
static const driveScriptsScope =
'https://www.googleapis.com/auth/drive.scripts';
final commons.ApiRequester _requester;
AboutResource get about => AboutResource(_requester);
AccessproposalsResource get accessproposals =>
AccessproposalsResource(_requester);
ApprovalsResource get approvals => ApprovalsResource(_requester);
AppsResource get apps => AppsResource(_requester);
ChangesResource get changes => ChangesResource(_requester);
ChannelsResource get channels => ChannelsResource(_requester);
CommentsResource get comments => CommentsResource(_requester);
DrivesResource get drives => DrivesResource(_requester);
FilesResource get files => FilesResource(_requester);
OperationsResource get operations => OperationsResource(_requester);
PermissionsResource get permissions => PermissionsResource(_requester);
RepliesResource get replies => RepliesResource(_requester);
RevisionsResource get revisions => RevisionsResource(_requester);
TeamdrivesResource get teamdrives => TeamdrivesResource(_requester);
DriveApi(
http.Client client, {
core.String rootUrl = 'https://www.googleapis.com/',
core.String servicePath = 'drive/v3/',
}) : _requester = commons.ApiRequester(
client,
rootUrl,
servicePath,
requestHeaders,
);
}
class AboutResource {
final commons.ApiRequester _requester;
AboutResource(commons.ApiRequester client) : _requester = client;
/// Gets information about the user, the user's Drive, and system
/// capabilities.
///
/// For more information, see
/// [Return user info](https://developers.google.com/workspace/drive/api/guides/user-info).
/// Required: The `fields` parameter must be set. To return the exact fields
/// you need, see
/// [Return specific fields](https://developers.google.com/workspace/drive/api/guides/fields-parameter).
///
/// Request parameters:
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [About].
///
/// 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.
async.Future<About> get({core.String? $fields}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'about';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return About.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class AccessproposalsResource {
final commons.ApiRequester _requester;
AccessproposalsResource(commons.ApiRequester client) : _requester = client;
/// Retrieves an access proposal by ID.
///
/// For more information, see
/// [Manage pending access proposals](https://developers.google.com/workspace/drive/api/guides/pending-access).
///
/// Request parameters:
///
/// [fileId] - Required. The ID of the item the request is on.
///
/// [proposalId] - Required. The ID of the access proposal to resolve.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [AccessProposal].
///
/// 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.
async.Future<AccessProposal> get(
core.String fileId,
core.String proposalId, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/accessproposals/' +
commons.escapeVariable('$proposalId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return AccessProposal.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// List the access proposals on a file.
///
/// For more information, see
/// [Manage pending access proposals](https://developers.google.com/workspace/drive/api/guides/pending-access).
/// Note: Only approvers are able to list access proposals on a file. If the
/// user isn't an approver, a 403 error is returned.
///
/// Request parameters:
///
/// [fileId] - Required. The ID of the item the request is on.
///
/// [pageSize] - Optional. The number of results per page.
///
/// [pageToken] - Optional. The continuation token on the list of access
/// requests.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [ListAccessProposalsResponse].
///
/// 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.
async.Future<ListAccessProposalsResponse> list(
core.String fileId, {
core.int? pageSize,
core.String? pageToken,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' + commons.escapeVariable('$fileId') + '/accessproposals';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListAccessProposalsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Approves or denies an access proposal.
///
/// For more information, see
/// [Manage pending access proposals](https://developers.google.com/workspace/drive/api/guides/pending-access).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - Required. The ID of the item the request is on.
///
/// [proposalId] - Required. The ID of the access proposal to resolve.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> resolve(
ResolveAccessProposalRequest request,
core.String fileId,
core.String proposalId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/accessproposals/' +
commons.escapeVariable('$proposalId') +
':resolve';
await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
downloadOptions: null,
);
}
}
class ApprovalsResource {
final commons.ApiRequester _requester;
ApprovalsResource(commons.ApiRequester client) : _requester = client;
/// Gets an Approval by ID.
///
/// Request parameters:
///
/// [fileId] - Required. The ID of the file the Approval is on.
///
/// [approvalId] - Required. The ID of the Approval.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Approval].
///
/// 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.
async.Future<Approval> get(
core.String fileId,
core.String approvalId, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/approvals/' +
commons.escapeVariable('$approvalId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Approval.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Lists the Approvals on a file.
///
/// Request parameters:
///
/// [fileId] - Required. The ID of the file the Approval is on.
///
/// [pageSize] - The maximum number of Approvals to return. When not set, at
/// most 100 Approvals will be returned.
///
/// [pageToken] - The token for continuing a previous list request on the next
/// page. This should be set to the value of nextPageToken from a previous
/// response.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [ApprovalList].
///
/// 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.
async.Future<ApprovalList> list(
core.String fileId, {
core.int? pageSize,
core.String? pageToken,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/approvals';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ApprovalList.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
}
class AppsResource {
final commons.ApiRequester _requester;
AppsResource(commons.ApiRequester client) : _requester = client;
/// Gets a specific app.
///
/// For more information, see
/// [Return user info](https://developers.google.com/workspace/drive/api/guides/user-info).
///
/// Request parameters:
///
/// [appId] - The ID of the app.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [App].
///
/// 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.
async.Future<App> get(core.String appId, {core.String? $fields}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'apps/' + commons.escapeVariable('$appId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return App.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Lists a user's installed apps.
///
/// For more information, see
/// [Return user info](https://developers.google.com/workspace/drive/api/guides/user-info).
///
/// Request parameters:
///
/// [appFilterExtensions] - A comma-separated list of file extensions to limit
/// returned results. All results within the given app query scope which can
/// open any of the given file extensions are included in the response. If
/// `appFilterMimeTypes` are provided as well, the result is a union of the
/// two resulting app lists.
///
/// [appFilterMimeTypes] - A comma-separated list of file extensions to limit
/// returned results. All results within the given app query scope which can
/// open any of the given MIME types will be included in the response. If
/// `appFilterExtensions` are provided as well, the result is a union of the
/// two resulting app lists.
///
/// [languageCode] - A language or locale code, as defined by BCP 47, with
/// some extensions from Unicode's LDML format
/// (http://www.unicode.org/reports/tr35/).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [AppList].
///
/// 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.
async.Future<AppList> list({
core.String? appFilterExtensions,
core.String? appFilterMimeTypes,
core.String? languageCode,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'appFilterExtensions': ?appFilterExtensions == null
? null
: [appFilterExtensions],
'appFilterMimeTypes': ?appFilterMimeTypes == null
? null
: [appFilterMimeTypes],
'languageCode': ?languageCode == null ? null : [languageCode],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'apps';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return AppList.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class ChangesResource {
final commons.ApiRequester _requester;
ChangesResource(commons.ApiRequester client) : _requester = client;
/// Gets the starting pageToken for listing future changes.
///
/// For more information, see
/// [Retrieve changes](https://developers.google.com/workspace/drive/api/guides/manage-changes).
///
/// Request parameters:
///
/// [driveId] - The ID of the shared drive for which the starting pageToken
/// for listing future changes from that shared drive will be returned.
///
/// [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 [StartPageToken].
///
/// 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.
async.Future<StartPageToken> getStartPageToken({
core.String? driveId,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.String? teamDriveId,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'driveId': ?driveId == null ? null : [driveId],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'teamDriveId': ?teamDriveId == null ? null : [teamDriveId],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'changes/startPageToken';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return StartPageToken.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Lists the changes for a user or shared drive.
///
/// For more information, see
/// [Retrieve changes](https://developers.google.com/workspace/drive/api/guides/manage-changes).
///
/// Request parameters:
///
/// [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 or to the response from the getStartPageToken method.
///
/// [driveId] - The shared drive from which changes will be returned. If
/// specified the change IDs will be reflective of the shared drive; use the
/// combined drive ID and change ID as an identifier.
///
/// [includeCorpusRemovals] - Whether changes should include the file resource
/// if the file is still accessible by the user at the time of the request,
/// even when a file was removed from the list of changes and there will be no
/// further change entries for this file.
///
/// [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.
///
/// [includeRemoved] - Whether to include changes indicating that items have
/// been removed from the list of changes, for example by deletion or loss of
/// access.
///
/// [includeTeamDriveItems] - Deprecated: Use `includeItemsFromAllDrives`
/// instead.
///
/// [pageSize] - The maximum number of changes to return per page.
/// Value must be between "1" and "1000".
///
/// [restrictToMyDrive] - Whether to restrict the results to changes inside
/// the My Drive hierarchy. This omits changes to files such as those in the
/// Application Data folder or shared files which have not been added to My
/// Drive.
///
/// [spaces] - A comma-separated list of spaces to query within the corpora.
/// 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 [ChangeList].
///
/// 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.
async.Future<ChangeList> list(
core.String pageToken, {
core.String? driveId,
core.bool? includeCorpusRemovals,
core.bool? includeItemsFromAllDrives,
core.String? includeLabels,
core.String? includePermissionsForView,
core.bool? includeRemoved,
core.bool? includeTeamDriveItems,
core.int? pageSize,
core.bool? restrictToMyDrive,
core.String? spaces,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.String? teamDriveId,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'pageToken': [pageToken],
'driveId': ?driveId == null ? null : [driveId],
'includeCorpusRemovals': ?includeCorpusRemovals == null
? null
: ['${includeCorpusRemovals}'],
'includeItemsFromAllDrives': ?includeItemsFromAllDrives == null
? null
: ['${includeItemsFromAllDrives}'],
'includeLabels': ?includeLabels == null ? null : [includeLabels],
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'includeRemoved': ?includeRemoved == null ? null : ['${includeRemoved}'],
'includeTeamDriveItems': ?includeTeamDriveItems == null
? null
: ['${includeTeamDriveItems}'],
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'restrictToMyDrive': ?restrictToMyDrive == null
? null
: ['${restrictToMyDrive}'],
'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_ = 'changes';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ChangeList.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Subscribes to changes for a user.
///
/// For more information, see
/// [Notifications for resource changes](https://developers.google.com/workspace/drive/api/guides/push).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [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 or to the response from the getStartPageToken method.
///
/// [driveId] - The shared drive from which changes will be returned. If
/// specified the change IDs will be reflective of the shared drive; use the
/// combined drive ID and change ID as an identifier.
///
/// [includeCorpusRemovals] - Whether changes should include the file resource
/// if the file is still accessible by the user at the time of the request,
/// even when a file was removed from the list of changes and there will be no
/// further change entries for this file.
///
/// [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.
///
/// [includeRemoved] - Whether to include changes indicating that items have
/// been removed from the list of changes, for example by deletion or loss of
/// access.
///
/// [includeTeamDriveItems] - Deprecated: Use `includeItemsFromAllDrives`
/// instead.
///
/// [pageSize] - The maximum number of changes to return per page.
/// Value must be between "1" and "1000".
///
/// [restrictToMyDrive] - Whether to restrict the results to changes inside
/// the My Drive hierarchy. This omits changes to files such as those in the
/// Application Data folder or shared files which have not been added to My
/// Drive.
///
/// [spaces] - A comma-separated list of spaces to query within the corpora.
/// 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 [Channel].
///
/// 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.
async.Future<Channel> watch(
Channel request,
core.String pageToken, {
core.String? driveId,
core.bool? includeCorpusRemovals,
core.bool? includeItemsFromAllDrives,
core.String? includeLabels,
core.String? includePermissionsForView,
core.bool? includeRemoved,
core.bool? includeTeamDriveItems,
core.int? pageSize,
core.bool? restrictToMyDrive,
core.String? spaces,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.String? teamDriveId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'pageToken': [pageToken],
'driveId': ?driveId == null ? null : [driveId],
'includeCorpusRemovals': ?includeCorpusRemovals == null
? null
: ['${includeCorpusRemovals}'],
'includeItemsFromAllDrives': ?includeItemsFromAllDrives == null
? null
: ['${includeItemsFromAllDrives}'],
'includeLabels': ?includeLabels == null ? null : [includeLabels],
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'includeRemoved': ?includeRemoved == null ? null : ['${includeRemoved}'],
'includeTeamDriveItems': ?includeTeamDriveItems == null
? null
: ['${includeTeamDriveItems}'],
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'restrictToMyDrive': ?restrictToMyDrive == null
? null
: ['${restrictToMyDrive}'],
'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_ = 'changes/watch';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Channel.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class ChannelsResource {
final commons.ApiRequester _requester;
ChannelsResource(commons.ApiRequester client) : _requester = client;
/// Stops watching resources through this channel.
///
/// For more information, see
/// [Notifications for resource changes](https://developers.google.com/workspace/drive/api/guides/push).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> stop(Channel request, {core.String? $fields}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'channels/stop';
await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
downloadOptions: null,
);
}
}
class CommentsResource {
final commons.ApiRequester _requester;
CommentsResource(commons.ApiRequester client) : _requester = client;
/// Creates a comment on a file.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
/// Required: The `fields` parameter must be set. To return the exact fields
/// you need, see
/// [Return specific fields](https://developers.google.com/workspace/drive/api/guides/fields-parameter).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Comment].
///
/// 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.
async.Future<Comment> create(
Comment request,
core.String fileId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/comments';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Comment.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Deletes a comment.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [commentId] - The ID of the comment.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> delete(
core.String fileId,
core.String commentId, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/comments/' +
commons.escapeVariable('$commentId');
await _requester.request(
url_,
'DELETE',
queryParams: queryParams_,
downloadOptions: null,
);
}
/// Gets a comment by ID.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
/// Required: The `fields` parameter must be set. To return the exact fields
/// you need, see
/// [Return specific fields](https://developers.google.com/workspace/drive/api/guides/fields-parameter).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [commentId] - The ID of the comment.
///
/// [includeDeleted] - Whether to return deleted comments. Deleted comments
/// will not include their original content.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Comment].
///
/// 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.
async.Future<Comment> get(
core.String fileId,
core.String commentId, {
core.bool? includeDeleted,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'includeDeleted': ?includeDeleted == null ? null : ['${includeDeleted}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/comments/' +
commons.escapeVariable('$commentId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Comment.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Lists a file's comments.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
/// Required: The `fields` parameter must be set. To return the exact fields
/// you need, see
/// [Return specific fields](https://developers.google.com/workspace/drive/api/guides/fields-parameter).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [includeDeleted] - Whether to include deleted comments. Deleted comments
/// will not include their original content.
///
/// [pageSize] - The maximum number of comments to return per page.
/// Value must be between "1" and "100".
///
/// [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.
///
/// [startModifiedTime] - The minimum value of 'modifiedTime' for the result
/// comments (RFC 3339 date-time).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [CommentList].
///
/// 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.
async.Future<CommentList> list(
core.String fileId, {
core.bool? includeDeleted,
core.int? pageSize,
core.String? pageToken,
core.String? startModifiedTime,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'includeDeleted': ?includeDeleted == null ? null : ['${includeDeleted}'],
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'startModifiedTime': ?startModifiedTime == null
? null
: [startModifiedTime],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/comments';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return CommentList.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Updates a comment with patch semantics.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
/// Required: The `fields` parameter must be set. To return the exact fields
/// you need, see
/// [Return specific fields](https://developers.google.com/workspace/drive/api/guides/fields-parameter).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [commentId] - The ID of the comment.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Comment].
///
/// 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.
async.Future<Comment> update(
Comment request,
core.String fileId,
core.String commentId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/comments/' +
commons.escapeVariable('$commentId');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return Comment.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class DrivesResource {
final commons.ApiRequester _requester;
DrivesResource(commons.ApiRequester client) : _requester = client;
/// Creates a shared drive.
///
/// For more information, see
/// [Manage shared drives](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [requestId] - Required. An ID, such as a random UUID, which uniquely
/// identifies this user's request for idempotent creation of a shared drive.
/// A repeated request by the same user and with the same request ID will
/// avoid creating duplicates by attempting to create the same shared drive.
/// If the shared drive already exists a 409 error will be returned.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Drive].
///
/// 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.
async.Future<Drive> create(
Drive request,
core.String requestId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'requestId': [requestId],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'drives';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Drive.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Permanently deletes a shared drive for which the user is an `organizer`.
///
/// The shared drive cannot contain any untrashed items. For more information,
/// see
/// [Manage shared drives](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives).
///
/// Request parameters:
///
/// [driveId] - The ID of the shared drive.
///
/// [allowItemDeletion] - Whether any items inside the shared drive should
/// also be deleted. This option is only supported when `useDomainAdminAccess`
/// is also set to `true`.
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator; if
/// set to true, then the requester will be granted access if they are an
/// administrator of the domain to which the shared drive belongs.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> delete(
core.String driveId, {
core.bool? allowItemDeletion,
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'allowItemDeletion': ?allowItemDeletion == null
? null
: ['${allowItemDeletion}'],
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'drives/' + commons.escapeVariable('$driveId');
await _requester.request(
url_,
'DELETE',
queryParams: queryParams_,
downloadOptions: null,
);
}
/// Gets a shared drive's metadata by ID.
///
/// For more information, see
/// [Manage shared drives](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives).
///
/// Request parameters:
///
/// [driveId] - The ID of the shared drive.
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator; if
/// set to true, then the requester will be granted access if they are an
/// administrator of the domain to which the shared drive belongs.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Drive].
///
/// 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.
async.Future<Drive> get(
core.String driveId, {
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'drives/' + commons.escapeVariable('$driveId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Drive.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Hides a shared drive from the default view.
///
/// For more information, see
/// [Manage shared drives](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives).
///
/// Request parameters:
///
/// [driveId] - The ID of the shared drive.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Drive].
///
/// 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.
async.Future<Drive> hide(core.String driveId, {core.String? $fields}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'drives/' + commons.escapeVariable('$driveId') + '/hide';
final response_ = await _requester.request(
url_,
'POST',
queryParams: queryParams_,
);
return Drive.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Lists the user's shared drives.
///
/// This method accepts the `q` parameter, which is a search query combining
/// one or more search terms. For more information, see the
/// [Search for shared drives](https://developers.google.com/workspace/drive/api/guides/search-shareddrives)
/// guide.
///
/// Request parameters:
///
/// [pageSize] - Maximum number of shared drives to return per page.
/// Value must be between "1" and "100".
///
/// [pageToken] - Page token for shared drives.
///
/// [q] - Query string for searching shared drives.
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator; if
/// set to true, then all shared drives of the domain in which the requester
/// is an administrator are returned.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [DriveList].
///
/// 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.
async.Future<DriveList> list({
core.int? pageSize,
core.String? pageToken,
core.String? q,
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'q': ?q == null ? null : [q],
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'drives';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return DriveList.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Restores a shared drive to the default view.
///
/// For more information, see
/// [Manage shared drives](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives).
///
/// Request parameters:
///
/// [driveId] - The ID of the shared drive.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Drive].
///
/// 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.
async.Future<Drive> unhide(
core.String driveId, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'drives/' + commons.escapeVariable('$driveId') + '/unhide';
final response_ = await _requester.request(
url_,
'POST',
queryParams: queryParams_,
);
return Drive.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Updates the metadata for a shared drive.
///
/// For more information, see
/// [Manage shared drives](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [driveId] - The ID of the shared drive.
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator; if
/// set to true, then the requester will be granted access if they are an
/// administrator of the domain to which the shared drive belongs.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Drive].
///
/// 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.
async.Future<Drive> update(
Drive request,
core.String driveId, {
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'drives/' + commons.escapeVariable('$driveId');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return Drive.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class FilesResource {
final commons.ApiRequester _requester;
FilesResource(commons.ApiRequester client) : _requester = client;
/// Creates a copy of a file and applies any requested updates with patch
/// semantics.
///
/// For more information, see
/// [Create and manage files](https://developers.google.com/workspace/drive/api/guides/create-file).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [enforceSingleParent] - Deprecated: Copying files into multiple folders is
/// no longer supported. Use shortcuts instead.
///
/// [ignoreDefaultVisibility] - Whether to ignore the domain's default
/// visibility settings for the created file. Domain administrators can choose
/// to make all uploaded files visible to the domain by default; this
/// parameter bypasses that behavior for the request. Permissions are still
/// inherited from parent folders.
///
/// [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.
///
/// [keepRevisionForever] - Whether to set the `keepForever` field in the new
/// head revision. This is only applicable to files with binary content in
/// Google Drive. Only 200 revisions for the file can be kept forever. If the
/// limit is reached, try deleting pinned revisions.
///
/// [ocrLanguage] - A language hint for OCR processing during image import
/// (ISO 639-1 code).
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [File].
///
/// 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.
async.Future<File> copy(
File request,
core.String fileId, {
core.bool? enforceSingleParent,
core.bool? ignoreDefaultVisibility,
core.String? includeLabels,
core.String? includePermissionsForView,
core.bool? keepRevisionForever,
core.String? ocrLanguage,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'enforceSingleParent': ?enforceSingleParent == null
? null
: ['${enforceSingleParent}'],
'ignoreDefaultVisibility': ?ignoreDefaultVisibility == null
? null
: ['${ignoreDefaultVisibility}'],
'includeLabels': ?includeLabels == null ? null : [includeLabels],
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'keepRevisionForever': ?keepRevisionForever == null
? null
: ['${keepRevisionForever}'],
'ocrLanguage': ?ocrLanguage == null ? null : [ocrLanguage],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/copy';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return File.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Creates a file.
///
/// For more information, see
/// [Create and manage files](https://developers.google.com/workspace/drive/api/guides/create-file).
/// This method supports an * / upload* URI and accepts uploaded media with
/// the following characteristics: - *Maximum file size:* 5,120 GB - *Accepted
/// Media MIME types:* `* / * ` (Specify a valid MIME type, rather than the
/// literal `* / * ` value. The literal `* / * ` is only used to indicate that
/// any valid MIME type can be uploaded. For more information, see
/// [Google Workspace and Google Drive supported MIME types](https://developers.google.com/workspace/drive/api/guides/mime-types).)
/// For more information on uploading files, see
/// [Upload file data](https://developers.google.com/workspace/drive/api/guides/manage-uploads).
/// Apps creating shortcuts with the `create` method must specify the MIME
/// type `application/vnd.google-apps.shortcut`. Apps should specify a file
/// extension in the `name` property when inserting files with the API. For
/// example, an operation to insert a JPEG file should specify something like
/// `"name": "cat.jpg"` in the metadata. Subsequent `GET` requests include the
/// read-only `fileExtension` property populated with the extension originally
/// specified in the `name` property. When a Google Drive user requests to
/// download a file, or when the file is downloaded through the sync client,
/// Drive builds a full filename (with extension) based on the name. In cases
/// where the extension is missing, Drive attempts to determine the extension
/// based on the file's MIME type.
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [enforceSingleParent] - Deprecated: Creating files in multiple folders is
/// no longer supported.
///
/// [ignoreDefaultVisibility] - Whether to ignore the domain's default
/// visibility settings for the created file. Domain administrators can choose
/// to make all uploaded files visible to the domain by default; this
/// parameter bypasses that behavior for the request. Permissions are still
/// inherited from parent folders.
///
/// [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.
///
/// [keepRevisionForever] - Whether to set the `keepForever` field in the new
/// head revision. This is only applicable to files with binary content in
/// Google Drive. Only 200 revisions for the file can be kept forever. If the
/// limit is reached, try deleting pinned revisions.
///
/// [ocrLanguage] - A language hint for OCR processing during image import
/// (ISO 639-1 code).
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [useContentAsIndexableText] - Whether to use the uploaded content as
/// indexable text.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// [uploadMedia] - The media to upload.
///
/// [uploadOptions] - Options for the media upload. Streaming Media without
/// the length being known ahead of time is only supported via resumable
/// uploads.
///
/// Completes with a [File].
///
/// 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.
async.Future<File> create(
File request, {
core.bool? enforceSingleParent,
core.bool? ignoreDefaultVisibility,
core.String? includeLabels,
core.String? includePermissionsForView,
core.bool? keepRevisionForever,
core.String? ocrLanguage,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.bool? useContentAsIndexableText,
core.String? $fields,
commons.UploadOptions uploadOptions = commons.UploadOptions.defaultOptions,
commons.Media? uploadMedia,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'enforceSingleParent': ?enforceSingleParent == null
? null
: ['${enforceSingleParent}'],
'ignoreDefaultVisibility': ?ignoreDefaultVisibility == null
? null
: ['${ignoreDefaultVisibility}'],
'includeLabels': ?includeLabels == null ? null : [includeLabels],
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'keepRevisionForever': ?keepRevisionForever == null
? null
: ['${keepRevisionForever}'],
'ocrLanguage': ?ocrLanguage == null ? null : [ocrLanguage],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'useContentAsIndexableText': ?useContentAsIndexableText == null
? null
: ['${useContentAsIndexableText}'],
'fields': ?$fields == null ? null : [$fields],
};
core.String url_;
if (uploadMedia == null) {
url_ = 'files';
} else if (uploadOptions is commons.ResumableUploadOptions) {
url_ = '/resumable/upload/drive/v3/files';
} else {
url_ = '/upload/drive/v3/files';
}
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
uploadMedia: uploadMedia,
uploadOptions: uploadOptions,
);
return File.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Permanently deletes a file owned by the user without moving it to the
/// trash.
///
/// For more information, see
/// [Trash or delete files and folders](https://developers.google.com/workspace/drive/api/guides/delete).
/// If the file belongs to a shared drive, the user must be an `organizer` on
/// the parent folder. If the target is a folder, all descendants owned by the
/// user are also deleted.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [enforceSingleParent] - Deprecated: If an item isn't in a shared drive and
/// its last parent is deleted but the item itself isn't, the item will be
/// placed under its owner's root.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> delete(
core.String fileId, {
core.bool? enforceSingleParent,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'enforceSingleParent': ?enforceSingleParent == null
? null
: ['${enforceSingleParent}'],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId');
await _requester.request(
url_,
'DELETE',
queryParams: queryParams_,
downloadOptions: null,
);
}
/// Downloads the content of a file.
///
/// For more information, see
/// [Download and export files](https://developers.google.com/workspace/drive/api/guides/manage-downloads).
/// Operations are valid for 24 hours from the time of creation.
///
/// Request parameters:
///
/// [fileId] - Required. The ID of the file to download.
///
/// [mimeType] - Optional. The MIME type the file should be downloaded as.
/// This field can only be set when downloading Google Workspace documents.
/// For a list of supported MIME types, see \[Export MIME types for Google
/// Workspace documents\](/workspace/drive/api/guides/ref-export-formats). If
/// not set, a Google Workspace document is downloaded with a default MIME
/// type. The default MIME type might change in the future.
///
/// [revisionId] - Optional. The revision ID of the file to download. This
/// field can only be set when downloading blob files, Google Docs, and Google
/// Sheets. Returns `INVALID_ARGUMENT` if downloading a specific revision on
/// the file is unsupported.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Operation].
///
/// 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.
async.Future<Operation> download(
core.String fileId, {
core.String? mimeType,
core.String? revisionId,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'mimeType': ?mimeType == null ? null : [mimeType],
'revisionId': ?revisionId == null ? null : [revisionId],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/download';
final response_ = await _requester.request(
url_,
'POST',
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Permanently deletes all of the user's trashed files.
///
/// For more information, see
/// [Trash or delete files and folders](https://developers.google.com/workspace/drive/api/guides/delete).
///
/// Request parameters:
///
/// [driveId] - If set, empties the trash of the provided shared drive.
///
/// [enforceSingleParent] - Deprecated: If an item isn't in a shared drive and
/// its last parent is deleted but the item itself isn't, the item will be
/// placed under its owner's root.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> emptyTrash({
core.String? driveId,
core.bool? enforceSingleParent,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'driveId': ?driveId == null ? null : [driveId],
'enforceSingleParent': ?enforceSingleParent == null
? null
: ['${enforceSingleParent}'],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'files/trash';
await _requester.request(
url_,
'DELETE',
queryParams: queryParams_,
downloadOptions: null,
);
}
/// Exports a Google Workspace document to the requested MIME type and returns
/// exported byte content.
///
/// For more information, see
/// [Download and export files](https://developers.google.com/workspace/drive/api/guides/manage-downloads).
/// Note that the exported content is limited to 10 MB.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [mimeType] - Required. The MIME type of the format requested for this
/// export. For a list of supported MIME types, see \[Export MIME types for
/// Google Workspace
/// documents\](/workspace/drive/api/guides/ref-export-formats).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// [downloadOptions] - Options for downloading. A download can be either a
/// Metadata (default) or Media download. Partial Media downloads are possible
/// as well.
///
/// 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.
async.Future<commons.Media?> export(
core.String fileId,
core.String mimeType, {
core.String? $fields,
commons.DownloadOptions downloadOptions = commons.DownloadOptions.metadata,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'mimeType': [mimeType],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/export';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
downloadOptions: downloadOptions,
);
if (downloadOptions.isMetadataDownload) {
return null;
} else {
return response_ as commons.Media;
}
}
/// Generates a CSE token which can be used to create or update CSE files.
///
/// Request parameters:
///
/// [fileId] - The ID of the file for which the JWT should be generated. If
/// not provided, an id will be generated.
///
/// [parent] - The ID of the expected parent of the file. Used when generating
/// a JWT for a new CSE file. If specified, the parent will be fetched, and if
/// the parent is a shared drive item, the shared drive's policy will be used
/// to determine the KACLS that should be used. It is invalid to specify both
/// file_id and parent in a single request.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [GenerateCseTokenResponse].
///
/// 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.
async.Future<GenerateCseTokenResponse> generateCseToken({
core.String? fileId,
core.String? parent,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fileId': ?fileId == null ? null : [fileId],
'parent': ?parent == null ? null : [parent],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'files/generateCseToken';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return GenerateCseTokenResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Generates a set of file IDs which can be provided in create or copy
/// requests.
///
/// For more information, see
/// [Create and manage files](https://developers.google.com/workspace/drive/api/guides/create-file).
///
/// Request parameters:
///
/// [count] - The number of IDs to return.
/// Value must be between "1" and "1000".
///
/// [space] - The space in which the IDs can be used to create files.
/// Supported values are `drive` and `appDataFolder`. (Default: `drive`.) For
/// more information, see
/// [File organization](https://developers.google.com/workspace/drive/api/guides/about-files#file-organization).
///
/// [type] - The type of items which the IDs can be used for. Supported values
/// are `files` and `shortcuts`. Note that `shortcuts` are only supported in
/// the `drive` `space`. (Default: `files`.) For more information, see
/// [File organization](https://developers.google.com/workspace/drive/api/guides/about-files#file-organization).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [GeneratedIds].
///
/// 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.
async.Future<GeneratedIds> generateIds({
core.int? count,
core.String? space,
core.String? type,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'count': ?count == null ? null : ['${count}'],
'space': ?space == null ? null : [space],
'type': ?type == null ? null : [type],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'files/generateIds';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return GeneratedIds.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Gets a file's metadata or content by ID.
///
/// For more information, see
/// [Search for files and folders](https://developers.google.com/workspace/drive/api/guides/search-files).
/// If you provide the URL parameter `alt=media`, then the response includes
/// the file contents in the response body. Downloading content with
/// `alt=media` only works if the file is stored in Drive. To download Google
/// Docs, Sheets, and Slides use
/// \[`files.export`\](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/export)
/// instead. For more information, see
/// [Download and export files](https://developers.google.com/workspace/drive/api/guides/manage-downloads).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [acknowledgeAbuse] - Whether the user is acknowledging the risk of
/// downloading known malware or other abusive files. This is only applicable
/// when the `alt` parameter is set to `media` and the user is the owner of
/// the file or an organizer of the shared drive in which the file resides.
///
/// [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.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// [downloadOptions] - Options for downloading. A download can be either a
/// Metadata (default) or Media download. Partial Media downloads are possible
/// as well.
///
/// Completes with a
///
/// - [File] for Metadata downloads (see [downloadOptions]).
///
/// - [commons.Media] for Media downloads (see [downloadOptions]).
///
/// 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.
async.Future<core.Object> get(
core.String fileId, {
core.bool? acknowledgeAbuse,
core.String? includeLabels,
core.String? includePermissionsForView,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.String? $fields,
commons.DownloadOptions downloadOptions = commons.DownloadOptions.metadata,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'acknowledgeAbuse': ?acknowledgeAbuse == null
? null
: ['${acknowledgeAbuse}'],
'includeLabels': ?includeLabels == null ? null : [includeLabels],
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
downloadOptions: downloadOptions,
);
if (downloadOptions.isMetadataDownload) {
return File.fromJson(response_ as core.Map<core.String, core.dynamic>);
} else {
return response_ as commons.Media;
}
}
/// Lists the user's files.
///
/// For more information, see
/// [Search for files and folders](https://developers.google.com/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`
/// * `allDrives` Prefer `user` or `drive` to `allDrives` for efficiency. By
/// default, corpora is set to `user`. However, this can change depending on
/// the filter set through the `q` parameter. For more information, see
/// [File organization](https://developers.google.com/workspace/drive/api/guides/about-files#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](https://developers.google.com/workspace/drive/api/guides/about-files#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.
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>);
}
/// Lists the labels on a file.
///
/// For more information, see
/// [List labels on a file](https://developers.google.com/workspace/drive/api/guides/list-labels).
///
/// Request parameters:
///
/// [fileId] - The ID for the file.
///
/// [maxResults] - The maximum number of labels to return per page. When not
/// set, defaults to 100.
/// Value must be between "1" and "100".
///
/// [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.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [LabelList].
///
/// 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.
async.Future<LabelList> listLabels(
core.String fileId, {
core.int? maxResults,
core.String? pageToken,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'maxResults': ?maxResults == null ? null : ['${maxResults}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/listLabels';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return LabelList.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Modifies the set of labels applied to a file.
///
/// For more information, see
/// [Set a label field on a file](https://developers.google.com/workspace/drive/api/guides/set-label).
/// Returns a list of the labels that were added or modified.
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file to which the labels belong.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [ModifyLabelsResponse].
///
/// 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.
async.Future<ModifyLabelsResponse> modifyLabels(
ModifyLabelsRequest request,
core.String fileId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/modifyLabels';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return ModifyLabelsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Updates a file's metadata, content, or both.
///
/// When calling this method, only populate fields in the request that you
/// want to modify. When updating fields, some fields might be changed
/// automatically, such as `modifiedDate`. This method supports patch
/// semantics. This method supports an * / upload* URI and accepts uploaded
/// media with the following characteristics: - *Maximum file size:* 5,120 GB
/// - *Accepted Media MIME types:* `* / * ` (Specify a valid MIME type, rather
/// than the literal `* / * ` value. The literal `* / * ` is only used to
/// indicate that any valid MIME type can be uploaded. For more information,
/// see
/// [Google Workspace and Google Drive supported MIME types](https://developers.google.com/workspace/drive/api/guides/mime-types).)
/// For more information on uploading files, see
/// [Upload file data](https://developers.google.com/workspace/drive/api/guides/manage-uploads).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [addParents] - A comma-separated list of parent IDs to add.
///
/// [enforceSingleParent] - Deprecated: Adding files to multiple folders is no
/// longer supported. Use shortcuts instead.
///
/// [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.
///
/// [keepRevisionForever] - Whether to set the `keepForever` field in the new
/// head revision. This is only applicable to files with binary content in
/// Google Drive. Only 200 revisions for the file can be kept forever. If the
/// limit is reached, try deleting pinned revisions.
///
/// [ocrLanguage] - A language hint for OCR processing during image import
/// (ISO 639-1 code).
///
/// [removeParents] - A comma-separated list of parent IDs to remove.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [useContentAsIndexableText] - Whether to use the uploaded content as
/// indexable text.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// [uploadMedia] - The media to upload.
///
/// [uploadOptions] - Options for the media upload. Streaming Media without
/// the length being known ahead of time is only supported via resumable
/// uploads.
///
/// Completes with a [File].
///
/// 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.
async.Future<File> update(
File request,
core.String fileId, {
core.String? addParents,
core.bool? enforceSingleParent,
core.String? includeLabels,
core.String? includePermissionsForView,
core.bool? keepRevisionForever,
core.String? ocrLanguage,
core.String? removeParents,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.bool? useContentAsIndexableText,
core.String? $fields,
commons.UploadOptions uploadOptions = commons.UploadOptions.defaultOptions,
commons.Media? uploadMedia,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'addParents': ?addParents == null ? null : [addParents],
'enforceSingleParent': ?enforceSingleParent == null
? null
: ['${enforceSingleParent}'],
'includeLabels': ?includeLabels == null ? null : [includeLabels],
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'keepRevisionForever': ?keepRevisionForever == null
? null
: ['${keepRevisionForever}'],
'ocrLanguage': ?ocrLanguage == null ? null : [ocrLanguage],
'removeParents': ?removeParents == null ? null : [removeParents],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'useContentAsIndexableText': ?useContentAsIndexableText == null
? null
: ['${useContentAsIndexableText}'],
'fields': ?$fields == null ? null : [$fields],
};
core.String url_;
if (uploadMedia == null) {
url_ = 'files/' + commons.escapeVariable('$fileId');
} else if (uploadOptions is commons.ResumableUploadOptions) {
url_ =
'/resumable/upload/drive/v3/files/' +
commons.escapeVariable('$fileId');
} else {
url_ = '/upload/drive/v3/files/' + commons.escapeVariable('$fileId');
}
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
uploadMedia: uploadMedia,
uploadOptions: uploadOptions,
);
return File.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Subscribes to changes to a file.
///
/// For more information, see
/// [Notifications for resource changes](https://developers.google.com/workspace/drive/api/guides/push).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [acknowledgeAbuse] - Whether the user is acknowledging the risk of
/// downloading known malware or other abusive files. This is only applicable
/// when the `alt` parameter is set to `media` and the user is the owner of
/// the file or an organizer of the shared drive in which the file resides.
///
/// [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.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Channel].
///
/// 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.
async.Future<Channel> watch(
Channel request,
core.String fileId, {
core.bool? acknowledgeAbuse,
core.String? includeLabels,
core.String? includePermissionsForView,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'acknowledgeAbuse': ?acknowledgeAbuse == null
? null
: ['${acknowledgeAbuse}'],
'includeLabels': ?includeLabels == null ? null : [includeLabels],
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/watch';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Channel.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class OperationsResource {
final commons.ApiRequester _requester;
OperationsResource(commons.ApiRequester client) : _requester = client;
/// Gets the latest state of a long-running operation.
///
/// Clients can use this method to poll the operation result at intervals as
/// recommended by the API service.
///
/// Request parameters:
///
/// [name] - The name of the operation resource.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Operation].
///
/// 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.
async.Future<Operation> get(core.String name, {core.String? $fields}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'operations/' + commons.escapeVariable('$name');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class PermissionsResource {
final commons.ApiRequester _requester;
PermissionsResource(commons.ApiRequester client) : _requester = client;
/// Creates a permission for a file or shared drive.
///
/// For more information, see
/// [Share files, folders, and drives](https://developers.google.com/workspace/drive/api/guides/manage-sharing).
/// **Warning:** Concurrent permissions operations on the same file aren't
/// supported; only the last update is applied.
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file or shared drive.
///
/// [emailMessage] - A plain text custom message to include in the
/// notification email.
///
/// [enforceExpansiveAccess] - Deprecated: All requests use the expansive
/// access rules.
///
/// [enforceSingleParent] - Deprecated: See `moveToNewOwnersRoot` for details.
///
/// [moveToNewOwnersRoot] - This parameter only takes effect if the item isn't
/// in a shared drive and the request is attempting to transfer the ownership
/// of the item. If set to `true`, the item is moved to the new owner's My
/// Drive root folder and all prior parents removed. If set to `false`,
/// parents aren't changed.
///
/// [sendNotificationEmail] - Whether to send a notification email when
/// sharing to users or groups. This defaults to `true` for users and groups,
/// and is not allowed for other requests. It must not be disabled for
/// ownership transfers.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [transferOwnership] - Whether to transfer ownership to the specified user
/// and downgrade the current owner to a writer. This parameter is required as
/// an acknowledgement of the side effect. For more information, see
/// [Transfer file ownership](https://developers.google.com/workspace/drive/api/guides/transfer-file).
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator. If
/// set to `true`, and if the following additional conditions are met, the
/// requester is granted access: 1. The file ID parameter refers to a shared
/// drive. 2. The requester is an administrator of the domain to which the
/// shared drive belongs. For more information, see
/// [Manage shared drives as domain administrators](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives#manage-administrators).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Permission].
///
/// 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.
async.Future<Permission> create(
Permission request,
core.String fileId, {
core.String? emailMessage,
core.bool? enforceExpansiveAccess,
core.bool? enforceSingleParent,
core.bool? moveToNewOwnersRoot,
core.bool? sendNotificationEmail,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.bool? transferOwnership,
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'emailMessage': ?emailMessage == null ? null : [emailMessage],
'enforceExpansiveAccess': ?enforceExpansiveAccess == null
? null
: ['${enforceExpansiveAccess}'],
'enforceSingleParent': ?enforceSingleParent == null
? null
: ['${enforceSingleParent}'],
'moveToNewOwnersRoot': ?moveToNewOwnersRoot == null
? null
: ['${moveToNewOwnersRoot}'],
'sendNotificationEmail': ?sendNotificationEmail == null
? null
: ['${sendNotificationEmail}'],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'transferOwnership': ?transferOwnership == null
? null
: ['${transferOwnership}'],
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/permissions';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Permission.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Deletes a permission.
///
/// For more information, see
/// [Share files, folders, and drives](https://developers.google.com/workspace/drive/api/guides/manage-sharing).
/// **Warning:** Concurrent permissions operations on the same file aren't
/// supported; only the last update is applied.
///
/// Request parameters:
///
/// [fileId] - The ID of the file or shared drive.
///
/// [permissionId] - The ID of the permission.
///
/// [enforceExpansiveAccess] - Deprecated: All requests use the expansive
/// access rules.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator. If
/// set to `true`, and if the following additional conditions are met, the
/// requester is granted access: 1. The file ID parameter refers to a shared
/// drive. 2. The requester is an administrator of the domain to which the
/// shared drive belongs. For more information, see
/// [Manage shared drives as domain administrators](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives#manage-administrators).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> delete(
core.String fileId,
core.String permissionId, {
core.bool? enforceExpansiveAccess,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'enforceExpansiveAccess': ?enforceExpansiveAccess == null
? null
: ['${enforceExpansiveAccess}'],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/permissions/' +
commons.escapeVariable('$permissionId');
await _requester.request(
url_,
'DELETE',
queryParams: queryParams_,
downloadOptions: null,
);
}
/// Gets a permission by ID.
///
/// For more information, see
/// [Share files, folders, and drives](https://developers.google.com/workspace/drive/api/guides/manage-sharing).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [permissionId] - The ID of the permission.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator. If
/// set to `true`, and if the following additional conditions are met, the
/// requester is granted access: 1. The file ID parameter refers to a shared
/// drive. 2. The requester is an administrator of the domain to which the
/// shared drive belongs. For more information, see
/// [Manage shared drives as domain administrators](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives#manage-administrators).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Permission].
///
/// 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.
async.Future<Permission> get(
core.String fileId,
core.String permissionId, {
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/permissions/' +
commons.escapeVariable('$permissionId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Permission.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Lists a file's or shared drive's permissions.
///
/// For more information, see
/// [Share files, folders, and drives](https://developers.google.com/workspace/drive/api/guides/manage-sharing).
///
/// Request parameters:
///
/// [fileId] - The ID of the file or shared drive.
///
/// [includePermissionsForView] - Specifies which additional view's
/// permissions to include in the response. Only `published` is supported.
///
/// [pageSize] - The maximum number of permissions to return per page. When
/// not set for files in a shared drive, at most 100 results will be returned.
/// When not set for files that are not in a shared drive, the entire list
/// will be returned.
/// Value must be between "1" and "100".
///
/// [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.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator. If
/// set to `true`, and if the following additional conditions are met, the
/// requester is granted access: 1. The file ID parameter refers to a shared
/// drive. 2. The requester is an administrator of the domain to which the
/// shared drive belongs. For more information, see
/// [Manage shared drives as domain administrators](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives#manage-administrators).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [PermissionList].
///
/// 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.
async.Future<PermissionList> list(
core.String fileId, {
core.String? includePermissionsForView,
core.int? pageSize,
core.String? pageToken,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'includePermissionsForView': ?includePermissionsForView == null
? null
: [includePermissionsForView],
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/permissions';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return PermissionList.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Updates a permission with patch semantics.
///
/// For more information, see
/// [Share files, folders, and drives](https://developers.google.com/workspace/drive/api/guides/manage-sharing).
/// **Warning:** Concurrent permissions operations on the same file aren't
/// supported; only the last update is applied.
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file or shared drive.
///
/// [permissionId] - The ID of the permission.
///
/// [enforceExpansiveAccess] - Deprecated: All requests use the expansive
/// access rules.
///
/// [removeExpiration] - Whether to remove the expiration date.
///
/// [supportsAllDrives] - Whether the requesting application supports both My
/// Drives and shared drives.
///
/// [supportsTeamDrives] - Deprecated: Use `supportsAllDrives` instead.
///
/// [transferOwnership] - Whether to transfer ownership to the specified user
/// and downgrade the current owner to a writer. This parameter is required as
/// an acknowledgement of the side effect. For more information, see
/// [Transfer file ownership](https://developers.google.com//workspace/drive/api/guides/transfer-file).
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator. If
/// set to `true`, and if the following additional conditions are met, the
/// requester is granted access: 1. The file ID parameter refers to a shared
/// drive. 2. The requester is an administrator of the domain to which the
/// shared drive belongs. For more information, see
/// [Manage shared drives as domain administrators](https://developers.google.com/workspace/drive/api/guides/manage-shareddrives#manage-administrators).
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Permission].
///
/// 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.
async.Future<Permission> update(
Permission request,
core.String fileId,
core.String permissionId, {
core.bool? enforceExpansiveAccess,
core.bool? removeExpiration,
core.bool? supportsAllDrives,
core.bool? supportsTeamDrives,
core.bool? transferOwnership,
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'enforceExpansiveAccess': ?enforceExpansiveAccess == null
? null
: ['${enforceExpansiveAccess}'],
'removeExpiration': ?removeExpiration == null
? null
: ['${removeExpiration}'],
'supportsAllDrives': ?supportsAllDrives == null
? null
: ['${supportsAllDrives}'],
'supportsTeamDrives': ?supportsTeamDrives == null
? null
: ['${supportsTeamDrives}'],
'transferOwnership': ?transferOwnership == null
? null
: ['${transferOwnership}'],
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/permissions/' +
commons.escapeVariable('$permissionId');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return Permission.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
}
class RepliesResource {
final commons.ApiRequester _requester;
RepliesResource(commons.ApiRequester client) : _requester = client;
/// Creates a reply to a comment.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [commentId] - The ID of the comment.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Reply].
///
/// 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.
async.Future<Reply> create(
Reply request,
core.String fileId,
core.String commentId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/comments/' +
commons.escapeVariable('$commentId') +
'/replies';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Reply.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Deletes a reply.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [commentId] - The ID of the comment.
///
/// [replyId] - The ID of the reply.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> delete(
core.String fileId,
core.String commentId,
core.String replyId, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/comments/' +
commons.escapeVariable('$commentId') +
'/replies/' +
commons.escapeVariable('$replyId');
await _requester.request(
url_,
'DELETE',
queryParams: queryParams_,
downloadOptions: null,
);
}
/// Gets a reply by ID.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [commentId] - The ID of the comment.
///
/// [replyId] - The ID of the reply.
///
/// [includeDeleted] - Whether to return deleted replies. Deleted replies
/// don't include their original content.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Reply].
///
/// 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.
async.Future<Reply> get(
core.String fileId,
core.String commentId,
core.String replyId, {
core.bool? includeDeleted,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'includeDeleted': ?includeDeleted == null ? null : ['${includeDeleted}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/comments/' +
commons.escapeVariable('$commentId') +
'/replies/' +
commons.escapeVariable('$replyId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Reply.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Lists a comment's replies.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [commentId] - The ID of the comment.
///
/// [includeDeleted] - Whether to include deleted replies. Deleted replies
/// don't include their original content.
///
/// [pageSize] - The maximum number of replies to return per page.
/// Value must be between "1" and "100".
///
/// [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.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [ReplyList].
///
/// 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.
async.Future<ReplyList> list(
core.String fileId,
core.String commentId, {
core.bool? includeDeleted,
core.int? pageSize,
core.String? pageToken,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'includeDeleted': ?includeDeleted == null ? null : ['${includeDeleted}'],
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/comments/' +
commons.escapeVariable('$commentId') +
'/replies';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ReplyList.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Updates a reply with patch semantics.
///
/// For more information, see
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/guides/manage-comments).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [commentId] - The ID of the comment.
///
/// [replyId] - The ID of the reply.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Reply].
///
/// 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.
async.Future<Reply> update(
Reply request,
core.String fileId,
core.String commentId,
core.String replyId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/comments/' +
commons.escapeVariable('$commentId') +
'/replies/' +
commons.escapeVariable('$replyId');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return Reply.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class RevisionsResource {
final commons.ApiRequester _requester;
RevisionsResource(commons.ApiRequester client) : _requester = client;
/// Permanently deletes a file version.
///
/// You can only delete revisions for files with binary content in Google
/// Drive, like images or videos. Revisions for other files, like Google Docs
/// or Sheets, and the last remaining file version can't be deleted. For more
/// information, see
/// [Manage file revisions](https://developers.google.com/drive/api/guides/manage-revisions).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [revisionId] - The ID of the revision.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> delete(
core.String fileId,
core.String revisionId, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/revisions/' +
commons.escapeVariable('$revisionId');
await _requester.request(
url_,
'DELETE',
queryParams: queryParams_,
downloadOptions: null,
);
}
/// Gets a revision's metadata or content by ID.
///
/// For more information, see
/// [Manage file revisions](https://developers.google.com/workspace/drive/api/guides/manage-revisions).
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [revisionId] - The ID of the revision.
///
/// [acknowledgeAbuse] - Whether the user is acknowledging the risk of
/// downloading known malware or other abusive files. This is only applicable
/// when the `alt` parameter is set to `media` and the user is the owner of
/// the file or an organizer of the shared drive in which the file resides.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// [downloadOptions] - Options for downloading. A download can be either a
/// Metadata (default) or Media download. Partial Media downloads are possible
/// as well.
///
/// Completes with a
///
/// - [Revision] for Metadata downloads (see [downloadOptions]).
///
/// - [commons.Media] for Media downloads (see [downloadOptions]).
///
/// 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.
async.Future<core.Object> get(
core.String fileId,
core.String revisionId, {
core.bool? acknowledgeAbuse,
core.String? $fields,
commons.DownloadOptions downloadOptions = commons.DownloadOptions.metadata,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'acknowledgeAbuse': ?acknowledgeAbuse == null
? null
: ['${acknowledgeAbuse}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/revisions/' +
commons.escapeVariable('$revisionId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
downloadOptions: downloadOptions,
);
if (downloadOptions.isMetadataDownload) {
return Revision.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
} else {
return response_ as commons.Media;
}
}
/// Lists a file's revisions.
///
/// For more information, see
/// [Manage file revisions](https://developers.google.com/workspace/drive/api/guides/manage-revisions).
/// **Important:** The list of revisions returned by this method might be
/// incomplete for files with a large revision history, including frequently
/// edited Google Docs, Sheets, and Slides. Older revisions might be omitted
/// from the response, meaning the first revision returned may not be the
/// oldest existing revision. The revision history visible in the Workspace
/// editor user interface might be more complete than the list returned by the
/// API.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [pageSize] - The maximum number of revisions to return per page.
/// 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.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [RevisionList].
///
/// 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.
async.Future<RevisionList> list(
core.String fileId, {
core.int? pageSize,
core.String? pageToken,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'files/' + commons.escapeVariable('$fileId') + '/revisions';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return RevisionList.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Updates a revision with patch semantics.
///
/// For more information, see
/// [Manage file revisions](https://developers.google.com/workspace/drive/api/guides/manage-revisions).
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [fileId] - The ID of the file.
///
/// [revisionId] - The ID of the revision.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [Revision].
///
/// 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.
async.Future<Revision> update(
Revision request,
core.String fileId,
core.String revisionId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'files/' +
commons.escapeVariable('$fileId') +
'/revisions/' +
commons.escapeVariable('$revisionId');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return Revision.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class TeamdrivesResource {
final commons.ApiRequester _requester;
TeamdrivesResource(commons.ApiRequester client) : _requester = client;
/// Deprecated: Use `drives.create` instead.
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [requestId] - Required. An ID, such as a random UUID, which uniquely
/// identifies this user's request for idempotent creation of a Team Drive. A
/// repeated request by the same user and with the same request ID will avoid
/// creating duplicates by attempting to create the same Team Drive. If the
/// Team Drive already exists a 409 error will be returned.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [TeamDrive].
///
/// 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.
async.Future<TeamDrive> create(
TeamDrive request,
core.String requestId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'requestId': [requestId],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'teamdrives';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return TeamDrive.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Deprecated: Use `drives.delete` instead.
///
/// Request parameters:
///
/// [teamDriveId] - The ID of the Team Drive
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// 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.
async.Future<void> delete(
core.String teamDriveId, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'teamdrives/' + commons.escapeVariable('$teamDriveId');
await _requester.request(
url_,
'DELETE',
queryParams: queryParams_,
downloadOptions: null,
);
}
/// Deprecated: Use `drives.get` instead.
///
/// Request parameters:
///
/// [teamDriveId] - The ID of the Team Drive
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator; if
/// set to true, then the requester will be granted access if they are an
/// administrator of the domain to which the Team Drive belongs.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [TeamDrive].
///
/// 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.
async.Future<TeamDrive> get(
core.String teamDriveId, {
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'teamdrives/' + commons.escapeVariable('$teamDriveId');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return TeamDrive.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
/// Deprecated: Use `drives.list` instead.
///
/// Request parameters:
///
/// [pageSize] - Maximum number of Team Drives to return.
/// Value must be between "1" and "100".
///
/// [pageToken] - Page token for Team Drives.
///
/// [q] - Query string for searching Team Drives.
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator; if
/// set to true, then all Team Drives of the domain in which the requester is
/// an administrator are returned.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [TeamDriveList].
///
/// 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.
async.Future<TeamDriveList> list({
core.int? pageSize,
core.String? pageToken,
core.String? q,
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'q': ?q == null ? null : [q],
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
const url_ = 'teamdrives';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return TeamDriveList.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}
/// Deprecated: Use `drives.update` instead.
///
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [teamDriveId] - The ID of the Team Drive
///
/// [useDomainAdminAccess] - Issue the request as a domain administrator; if
/// set to true, then the requester will be granted access if they are an
/// administrator of the domain to which the Team Drive belongs.
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [TeamDrive].
///
/// 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.
async.Future<TeamDrive> update(
TeamDrive request,
core.String teamDriveId, {
core.bool? useDomainAdminAccess,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'useDomainAdminAccess': ?useDomainAdminAccess == null
? null
: ['${useDomainAdminAccess}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'teamdrives/' + commons.escapeVariable('$teamDriveId');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return TeamDrive.fromJson(response_ as core.Map<core.String, core.dynamic>);
}
}
class AboutDriveThemes {
/// A link to this theme's background image.
core.String? backgroundImageLink;
/// The color of this theme as an RGB hex string.
core.String? colorRgb;
/// The ID of the theme.
core.String? id;
AboutDriveThemes({this.backgroundImageLink, this.colorRgb, this.id});
AboutDriveThemes.fromJson(core.Map json_)
: this(
backgroundImageLink: json_['backgroundImageLink'] as core.String?,
colorRgb: json_['colorRgb'] as core.String?,
id: json_['id'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final backgroundImageLink = this.backgroundImageLink;
final colorRgb = this.colorRgb;
final id = this.id;
return {
'backgroundImageLink': ?backgroundImageLink,
'colorRgb': ?colorRgb,
'id': ?id,
};
}
}
/// The user's storage quota limits and usage.
///
/// For users that are part of an organization with pooled storage, information
/// about the limit and usage across all services is for the organization,
/// rather than the individual user. All fields are measured in bytes.
class AboutStorageQuota {
/// The usage limit, if applicable.
///
/// This will not be present if the user has unlimited storage. For users that
/// are part of an organization with pooled storage, this is the limit for the
/// organization, rather than the individual user.
core.String? limit;
/// The total usage across all services.
///
/// For users that are part of an organization with pooled storage, this is
/// the usage across all services for the organization, rather than the
/// individual user.
core.String? usage;
/// The usage by all files in Google Drive.
core.String? usageInDrive;
/// The usage by trashed files in Google Drive.
core.String? usageInDriveTrash;
AboutStorageQuota({
this.limit,
this.usage,
this.usageInDrive,
this.usageInDriveTrash,
});
AboutStorageQuota.fromJson(core.Map json_)
: this(
limit: json_['limit'] as core.String?,
usage: json_['usage'] as core.String?,
usageInDrive: json_['usageInDrive'] as core.String?,
usageInDriveTrash: json_['usageInDriveTrash'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final limit = this.limit;
final usage = this.usage;
final usageInDrive = this.usageInDrive;
final usageInDriveTrash = this.usageInDriveTrash;
return {
'limit': ?limit,
'usage': ?usage,
'usageInDrive': ?usageInDrive,
'usageInDriveTrash': ?usageInDriveTrash,
};
}
}
class AboutTeamDriveThemes {
/// Deprecated: Use `driveThemes/backgroundImageLink` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? backgroundImageLink;
/// Deprecated: Use `driveThemes/colorRgb` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? colorRgb;
/// Deprecated: Use `driveThemes/id` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? id;
AboutTeamDriveThemes({this.backgroundImageLink, this.colorRgb, this.id});
AboutTeamDriveThemes.fromJson(core.Map json_)
: this(
backgroundImageLink: json_['backgroundImageLink'] as core.String?,
colorRgb: json_['colorRgb'] as core.String?,
id: json_['id'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final backgroundImageLink = this.backgroundImageLink;
final colorRgb = this.colorRgb;
final id = this.id;
return {
'backgroundImageLink': ?backgroundImageLink,
'colorRgb': ?colorRgb,
'id': ?id,
};
}
}
/// Information about the user, the user's Drive, and system capabilities.
class About {
/// Whether the user has installed the requesting app.
core.bool? appInstalled;
/// Whether the user can create shared drives.
core.bool? canCreateDrives;
/// Deprecated: Use `canCreateDrives` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canCreateTeamDrives;
/// A list of themes that are supported for shared drives.
core.List<AboutDriveThemes>? driveThemes;
/// A map of source MIME type to possible targets for all supported exports.
core.Map<core.String, core.List<core.String>>? exportFormats;
/// The currently supported folder colors as RGB hex strings.
core.List<core.String>? folderColorPalette;
/// A map of source MIME type to possible targets for all supported imports.
core.Map<core.String, core.List<core.String>>? importFormats;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#about"`.
core.String? kind;
/// A map of maximum import sizes by MIME type, in bytes.
core.Map<core.String, core.String>? maxImportSizes;
/// The maximum upload size in bytes.
core.String? maxUploadSize;
/// The user's storage quota limits and usage.
///
/// For users that are part of an organization with pooled storage,
/// information about the limit and usage across all services is for the
/// organization, rather than the individual user. All fields are measured in
/// bytes.
AboutStorageQuota? storageQuota;
/// Deprecated: Use `driveThemes` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.List<AboutTeamDriveThemes>? teamDriveThemes;
/// The authenticated user.
User? user;
About({
this.appInstalled,
this.canCreateDrives,
this.canCreateTeamDrives,
this.driveThemes,
this.exportFormats,
this.folderColorPalette,
this.importFormats,
this.kind,
this.maxImportSizes,
this.maxUploadSize,
this.storageQuota,
this.teamDriveThemes,
this.user,
});
About.fromJson(core.Map json_)
: this(
appInstalled: json_['appInstalled'] as core.bool?,
canCreateDrives: json_['canCreateDrives'] as core.bool?,
canCreateTeamDrives: json_['canCreateTeamDrives'] as core.bool?,
driveThemes: (json_['driveThemes'] as core.List?)
?.map(
(value) => AboutDriveThemes.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
exportFormats:
(json_['exportFormats'] as core.Map<core.String, core.dynamic>?)
?.map(
(key, value) => core.MapEntry(
key,
(value as core.List)
.map((value) => value as core.String)
.toList(),
),
),
folderColorPalette: (json_['folderColorPalette'] as core.List?)
?.map((value) => value as core.String)
.toList(),
importFormats:
(json_['importFormats'] as core.Map<core.String, core.dynamic>?)
?.map(
(key, value) => core.MapEntry(
key,
(value as core.List)
.map((value) => value as core.String)
.toList(),
),
),
kind: json_['kind'] as core.String?,
maxImportSizes:
(json_['maxImportSizes'] as core.Map<core.String, core.dynamic>?)
?.map((key, value) => core.MapEntry(key, value as core.String)),
maxUploadSize: json_['maxUploadSize'] as core.String?,
storageQuota: json_.containsKey('storageQuota')
? AboutStorageQuota.fromJson(
json_['storageQuota'] as core.Map<core.String, core.dynamic>,
)
: null,
teamDriveThemes: (json_['teamDriveThemes'] as core.List?)
?.map(
(value) => AboutTeamDriveThemes.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
user: json_.containsKey('user')
? User.fromJson(
json_['user'] as core.Map<core.String, core.dynamic>,
)
: null,
);
core.Map<core.String, core.dynamic> toJson() {
final appInstalled = this.appInstalled;
final canCreateDrives = this.canCreateDrives;
final canCreateTeamDrives = this.canCreateTeamDrives;
final driveThemes = this.driveThemes;
final exportFormats = this.exportFormats;
final folderColorPalette = this.folderColorPalette;
final importFormats = this.importFormats;
final kind = this.kind;
final maxImportSizes = this.maxImportSizes;
final maxUploadSize = this.maxUploadSize;
final storageQuota = this.storageQuota;
final teamDriveThemes = this.teamDriveThemes;
final user = this.user;
return {
'appInstalled': ?appInstalled,
'canCreateDrives': ?canCreateDrives,
'canCreateTeamDrives': ?canCreateTeamDrives,
'driveThemes': ?driveThemes,
'exportFormats': ?exportFormats,
'folderColorPalette': ?folderColorPalette,
'importFormats': ?importFormats,
'kind': ?kind,
'maxImportSizes': ?maxImportSizes,
'maxUploadSize': ?maxUploadSize,
'storageQuota': ?storageQuota,
'teamDriveThemes': ?teamDriveThemes,
'user': ?user,
};
}
}
/// Manage outstanding access proposals on a file.
class AccessProposal {
/// The creation time.
core.String? createTime;
/// The file ID that the proposal for access is on.
core.String? fileId;
/// The ID of the access proposal.
core.String? proposalId;
/// The email address of the user that will receive permissions, if accepted.
core.String? recipientEmailAddress;
/// The message that the requester added to the proposal.
core.String? requestMessage;
/// The email address of the requesting user.
core.String? requesterEmailAddress;
/// A wrapper for the role and view of an access proposal.
///
/// For more information, see
/// [Roles and permissions](https://developers.google.com/workspace/drive/api/guides/ref-roles).
core.List<AccessProposalRoleAndView>? rolesAndViews;
AccessProposal({
this.createTime,
this.fileId,
this.proposalId,
this.recipientEmailAddress,
this.requestMessage,
this.requesterEmailAddress,
this.rolesAndViews,
});
AccessProposal.fromJson(core.Map json_)
: this(
createTime: json_['createTime'] as core.String?,
fileId: json_['fileId'] as core.String?,
proposalId: json_['proposalId'] as core.String?,
recipientEmailAddress: json_['recipientEmailAddress'] as core.String?,
requestMessage: json_['requestMessage'] as core.String?,
requesterEmailAddress: json_['requesterEmailAddress'] as core.String?,
rolesAndViews: (json_['rolesAndViews'] as core.List?)
?.map(
(value) => AccessProposalRoleAndView.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
);
core.Map<core.String, core.dynamic> toJson() {
final createTime = this.createTime;
final fileId = this.fileId;
final proposalId = this.proposalId;
final recipientEmailAddress = this.recipientEmailAddress;
final requestMessage = this.requestMessage;
final requesterEmailAddress = this.requesterEmailAddress;
final rolesAndViews = this.rolesAndViews;
return {
'createTime': ?createTime,
'fileId': ?fileId,
'proposalId': ?proposalId,
'recipientEmailAddress': ?recipientEmailAddress,
'requestMessage': ?requestMessage,
'requesterEmailAddress': ?requesterEmailAddress,
'rolesAndViews': ?rolesAndViews,
};
}
}
/// A wrapper for the role and view of an access proposal.
///
/// For more information, see
/// [Roles and permissions](https://developers.google.com/workspace/drive/api/guides/ref-roles).
class AccessProposalRoleAndView {
/// The role that was proposed by the requester.
///
/// The supported values are: * `writer` * `commenter` * `reader`
core.String? role;
/// Indicates the view for this access proposal.
///
/// Only populated for proposals that belong to a view. Only `published` is
/// supported.
core.String? view;
AccessProposalRoleAndView({this.role, this.view});
AccessProposalRoleAndView.fromJson(core.Map json_)
: this(
role: json_['role'] as core.String?,
view: json_['view'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final role = this.role;
final view = this.view;
return {'role': ?role, 'view': ?view};
}
}
/// The `apps` resource provides a list of apps that a user has installed, with
/// information about each app's supported MIME types, file extensions, and
/// other details.
///
/// Some resource methods (such as `apps.get`) require an `appId`. Use the
/// `apps.list` method to retrieve the ID for an installed application.
class App {
/// Whether the app is authorized to access data on the user's Drive.
core.bool? authorized;
/// The template URL to create a file with this app in a given folder.
///
/// The template contains the {folderId} to be replaced by the folder ID house
/// the new file.
core.String? createInFolderTemplate;
/// The URL to create a file with this app.
core.String? createUrl;
/// Whether the app has Drive-wide scope.
///
/// An app with Drive-wide scope can access all files in the user's Drive.
core.bool? hasDriveWideScope;
/// The various icons for the app.
core.List<AppIcons>? icons;
/// The ID of the app.
core.String? id;
/// Whether the app is installed.
core.bool? installed;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string "drive#app".
///
/// Output only.
core.String? kind;
/// A long description of the app.
core.String? longDescription;
/// The name of the app.
core.String? name;
/// The type of object this app creates such as a Chart.
///
/// If empty, the app name should be used instead.
core.String? objectType;
/// The template URL for opening files with this app.
///
/// The template contains {ids} or {exportIds} to be replaced by the actual
/// file IDs. For more information, see Open Files for the full documentation.
core.String? openUrlTemplate;
/// The list of primary file extensions.
core.List<core.String>? primaryFileExtensions;
/// The list of primary MIME types.
core.List<core.String>? primaryMimeTypes;
/// The ID of the product listing for this app.
core.String? productId;
/// A link to the product listing for this app.
core.String? productUrl;
/// The list of secondary file extensions.
core.List<core.String>? secondaryFileExtensions;
/// The list of secondary MIME types.
core.List<core.String>? secondaryMimeTypes;
/// A short description of the app.
core.String? shortDescription;
/// Whether this app supports creating objects.
core.bool? supportsCreate;
/// Whether this app supports importing from Google Docs.
core.bool? supportsImport;
/// Whether this app supports opening more than one file.
core.bool? supportsMultiOpen;
/// Whether this app supports creating files when offline.
core.bool? supportsOfflineCreate;
/// Whether the app is selected as the default handler for the types it
/// supports.
core.bool? useByDefault;
App({
this.authorized,
this.createInFolderTemplate,
this.createUrl,
this.hasDriveWideScope,
this.icons,
this.id,
this.installed,
this.kind,
this.longDescription,
this.name,
this.objectType,
this.openUrlTemplate,
this.primaryFileExtensions,
this.primaryMimeTypes,
this.productId,
this.productUrl,
this.secondaryFileExtensions,
this.secondaryMimeTypes,
this.shortDescription,
this.supportsCreate,
this.supportsImport,
this.supportsMultiOpen,
this.supportsOfflineCreate,
this.useByDefault,
});
App.fromJson(core.Map json_)
: this(
authorized: json_['authorized'] as core.bool?,
createInFolderTemplate: json_['createInFolderTemplate'] as core.String?,
createUrl: json_['createUrl'] as core.String?,
hasDriveWideScope: json_['hasDriveWideScope'] as core.bool?,
icons: (json_['icons'] as core.List?)
?.map(
(value) => AppIcons.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
id: json_['id'] as core.String?,
installed: json_['installed'] as core.bool?,
kind: json_['kind'] as core.String?,
longDescription: json_['longDescription'] as core.String?,
name: json_['name'] as core.String?,
objectType: json_['objectType'] as core.String?,
openUrlTemplate: json_['openUrlTemplate'] as core.String?,
primaryFileExtensions: (json_['primaryFileExtensions'] as core.List?)
?.map((value) => value as core.String)
.toList(),
primaryMimeTypes: (json_['primaryMimeTypes'] as core.List?)
?.map((value) => value as core.String)
.toList(),
productId: json_['productId'] as core.String?,
productUrl: json_['productUrl'] as core.String?,
secondaryFileExtensions:
(json_['secondaryFileExtensions'] as core.List?)
?.map((value) => value as core.String)
.toList(),
secondaryMimeTypes: (json_['secondaryMimeTypes'] as core.List?)
?.map((value) => value as core.String)
.toList(),
shortDescription: json_['shortDescription'] as core.String?,
supportsCreate: json_['supportsCreate'] as core.bool?,
supportsImport: json_['supportsImport'] as core.bool?,
supportsMultiOpen: json_['supportsMultiOpen'] as core.bool?,
supportsOfflineCreate: json_['supportsOfflineCreate'] as core.bool?,
useByDefault: json_['useByDefault'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final authorized = this.authorized;
final createInFolderTemplate = this.createInFolderTemplate;
final createUrl = this.createUrl;
final hasDriveWideScope = this.hasDriveWideScope;
final icons = this.icons;
final id = this.id;
final installed = this.installed;
final kind = this.kind;
final longDescription = this.longDescription;
final name = this.name;
final objectType = this.objectType;
final openUrlTemplate = this.openUrlTemplate;
final primaryFileExtensions = this.primaryFileExtensions;
final primaryMimeTypes = this.primaryMimeTypes;
final productId = this.productId;
final productUrl = this.productUrl;
final secondaryFileExtensions = this.secondaryFileExtensions;
final secondaryMimeTypes = this.secondaryMimeTypes;
final shortDescription = this.shortDescription;
final supportsCreate = this.supportsCreate;
final supportsImport = this.supportsImport;
final supportsMultiOpen = this.supportsMultiOpen;
final supportsOfflineCreate = this.supportsOfflineCreate;
final useByDefault = this.useByDefault;
return {
'authorized': ?authorized,
'createInFolderTemplate': ?createInFolderTemplate,
'createUrl': ?createUrl,
'hasDriveWideScope': ?hasDriveWideScope,
'icons': ?icons,
'id': ?id,
'installed': ?installed,
'kind': ?kind,
'longDescription': ?longDescription,
'name': ?name,
'objectType': ?objectType,
'openUrlTemplate': ?openUrlTemplate,
'primaryFileExtensions': ?primaryFileExtensions,
'primaryMimeTypes': ?primaryMimeTypes,
'productId': ?productId,
'productUrl': ?productUrl,
'secondaryFileExtensions': ?secondaryFileExtensions,
'secondaryMimeTypes': ?secondaryMimeTypes,
'shortDescription': ?shortDescription,
'supportsCreate': ?supportsCreate,
'supportsImport': ?supportsImport,
'supportsMultiOpen': ?supportsMultiOpen,
'supportsOfflineCreate': ?supportsOfflineCreate,
'useByDefault': ?useByDefault,
};
}
}
class AppIcons {
/// Category of the icon.
///
/// Allowed values are: * `application` - The icon for the application. *
/// `document` - The icon for a file associated with the app. *
/// `documentShared` - The icon for a shared file associated with the app.
core.String? category;
/// URL for the icon.
core.String? iconUrl;
/// Size of the icon.
///
/// Represented as the maximum of the width and height.
core.int? size;
AppIcons({this.category, this.iconUrl, this.size});
AppIcons.fromJson(core.Map json_)
: this(
category: json_['category'] as core.String?,
iconUrl: json_['iconUrl'] as core.String?,
size: json_['size'] as core.int?,
);
core.Map<core.String, core.dynamic> toJson() {
final category = this.category;
final iconUrl = this.iconUrl;
final size = this.size;
return {'category': ?category, 'iconUrl': ?iconUrl, 'size': ?size};
}
}
/// A list of third-party applications which the user has installed or given
/// access to Google Drive.
class AppList {
/// The list of app IDs that the user has specified to use by default.
///
/// The list is in reverse-priority order (lowest to highest).
core.List<core.String>? defaultAppIds;
/// The list of apps.
core.List<App>? items;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string "drive#appList".
///
/// Output only.
core.String? kind;
/// A link back to this list.
core.String? selfLink;
AppList({this.defaultAppIds, this.items, this.kind, this.selfLink});
AppList.fromJson(core.Map json_)
: this(
defaultAppIds: (json_['defaultAppIds'] as core.List?)
?.map((value) => value as core.String)
.toList(),
items: (json_['items'] as core.List?)
?.map(
(value) =>
App.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
kind: json_['kind'] as core.String?,
selfLink: json_['selfLink'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final defaultAppIds = this.defaultAppIds;
final items = this.items;
final kind = this.kind;
final selfLink = this.selfLink;
return {
'defaultAppIds': ?defaultAppIds,
'items': ?items,
'kind': ?kind,
'selfLink': ?selfLink,
};
}
}
/// Metadata for an approval.
///
/// An approval is a review/approve process for a Drive item.
class Approval {
/// The Approval ID.
core.String? approvalId;
/// The time the approval was completed.
///
/// Output only.
core.String? completeTime;
/// The time the approval was created.
///
/// Output only.
core.String? createTime;
/// The time that the approval is due.
core.String? dueTime;
/// The user that requested the Approval.
User? initiator;
/// This is always drive#approval.
core.String? kind;
/// The most recent time the approval was modified.
///
/// Output only.
core.String? modifyTime;
/// The responses made on the Approval by reviewers.
core.List<ReviewerResponse>? reviewerResponses;
/// The status of the approval at the time this resource was requested.
///
/// Output only.
/// Possible string values are:
/// - "STATUS_UNSPECIFIED" : Approval status has not been set or was set to an
/// invalid value.
/// - "IN_PROGRESS" : The approval process has started and not finished.
/// - "APPROVED" : The approval process is finished and the target was
/// approved.
/// - "CANCELLED" : The approval process was cancelled before it finished.
/// - "DECLINED" : The approval process is finished and the target was
/// declined.
core.String? status;
/// Target file id of the approval.
core.String? targetFileId;
Approval({
this.approvalId,
this.completeTime,
this.createTime,
this.dueTime,
this.initiator,
this.kind,
this.modifyTime,
this.reviewerResponses,
this.status,
this.targetFileId,
});
Approval.fromJson(core.Map json_)
: this(
approvalId: json_['approvalId'] as core.String?,
completeTime: json_['completeTime'] as core.String?,
createTime: json_['createTime'] as core.String?,
dueTime: json_['dueTime'] as core.String?,
initiator: json_.containsKey('initiator')
? User.fromJson(
json_['initiator'] as core.Map<core.String, core.dynamic>,
)
: null,
kind: json_['kind'] as core.String?,
modifyTime: json_['modifyTime'] as core.String?,
reviewerResponses: (json_['reviewerResponses'] as core.List?)
?.map(
(value) => ReviewerResponse.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
status: json_['status'] as core.String?,
targetFileId: json_['targetFileId'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final approvalId = this.approvalId;
final completeTime = this.completeTime;
final createTime = this.createTime;
final dueTime = this.dueTime;
final initiator = this.initiator;
final kind = this.kind;
final modifyTime = this.modifyTime;
final reviewerResponses = this.reviewerResponses;
final status = this.status;
final targetFileId = this.targetFileId;
return {
'approvalId': ?approvalId,
'completeTime': ?completeTime,
'createTime': ?createTime,
'dueTime': ?dueTime,
'initiator': ?initiator,
'kind': ?kind,
'modifyTime': ?modifyTime,
'reviewerResponses': ?reviewerResponses,
'status': ?status,
'targetFileId': ?targetFileId,
};
}
}
/// The response of an Approvals list request.
class ApprovalList {
/// The list of Approvals.
///
/// If nextPageToken is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<Approval>? items;
/// This is always drive#approvalList
core.String? kind;
/// The page token for the next page of Approvals.
///
/// This will be absent if the end of the Approvals list has been reached. If
/// the token is rejected for any reason, it should be discarded, and
/// pagination should be restarted from the first page of results.
core.String? nextPageToken;
ApprovalList({this.items, this.kind, this.nextPageToken});
ApprovalList.fromJson(core.Map json_)
: this(
items: (json_['items'] as core.List?)
?.map(
(value) => Approval.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
kind: json_['kind'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final items = this.items;
final kind = this.kind;
final nextPageToken = this.nextPageToken;
return {'items': ?items, 'kind': ?kind, 'nextPageToken': ?nextPageToken};
}
}
/// A change to a file or shared drive.
class Change {
/// The type of the change.
///
/// Possible values are `file` and `drive`.
core.String? changeType;
/// The updated state of the shared drive.
///
/// Present if the changeType is drive, the user is still a member of the
/// shared drive, and the shared drive has not been deleted.
Drive? drive;
/// The ID of the shared drive associated with this change.
core.String? driveId;
/// The updated state of the file.
///
/// Present if the type is file and the file has not been removed from this
/// list of changes.
File? file;
/// The ID of the file which has changed.
core.String? fileId;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#change"`.
core.String? kind;
/// Whether the file or shared drive has been removed from this list of
/// changes, for example by deletion or loss of access.
core.bool? removed;
/// Deprecated: Use `drive` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
TeamDrive? teamDrive;
/// Deprecated: Use `driveId` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? teamDriveId;
/// The time of this change (RFC 3339 date-time).
core.DateTime? time;
/// Deprecated: Use `changeType` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? type;
Change({
this.changeType,
this.drive,
this.driveId,
this.file,
this.fileId,
this.kind,
this.removed,
this.teamDrive,
this.teamDriveId,
this.time,
this.type,
});
Change.fromJson(core.Map json_)
: this(
changeType: json_['changeType'] as core.String?,
drive: json_.containsKey('drive')
? Drive.fromJson(
json_['drive'] as core.Map<core.String, core.dynamic>,
)
: null,
driveId: json_['driveId'] as core.String?,
file: json_.containsKey('file')
? File.fromJson(
json_['file'] as core.Map<core.String, core.dynamic>,
)
: null,
fileId: json_['fileId'] as core.String?,
kind: json_['kind'] as core.String?,
removed: json_['removed'] as core.bool?,
teamDrive: json_.containsKey('teamDrive')
? TeamDrive.fromJson(
json_['teamDrive'] as core.Map<core.String, core.dynamic>,
)
: null,
teamDriveId: json_['teamDriveId'] as core.String?,
time: json_.containsKey('time')
? core.DateTime.parse(json_['time'] as core.String)
: null,
type: json_['type'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final changeType = this.changeType;
final drive = this.drive;
final driveId = this.driveId;
final file = this.file;
final fileId = this.fileId;
final kind = this.kind;
final removed = this.removed;
final teamDrive = this.teamDrive;
final teamDriveId = this.teamDriveId;
final time = this.time;
final type = this.type;
return {
'changeType': ?changeType,
'drive': ?drive,
'driveId': ?driveId,
'file': ?file,
'fileId': ?fileId,
'kind': ?kind,
'removed': ?removed,
'teamDrive': ?teamDrive,
'teamDriveId': ?teamDriveId,
'time': ?time?.toUtc().toIso8601String(),
'type': ?type,
};
}
}
/// A list of changes for a user.
class ChangeList {
/// The list of changes.
///
/// If nextPageToken is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<Change>? changes;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#changeList"`.
core.String? kind;
/// The starting page token for future changes.
///
/// This will be present only if the end of the current changes list has been
/// reached. The page token doesn't expire.
core.String? newStartPageToken;
/// The page token for the next page of changes.
///
/// This will be absent if the end of the changes list has been reached. The
/// page token doesn't expire.
core.String? nextPageToken;
ChangeList({
this.changes,
this.kind,
this.newStartPageToken,
this.nextPageToken,
});
ChangeList.fromJson(core.Map json_)
: this(
changes: (json_['changes'] as core.List?)
?.map(
(value) =>
Change.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
kind: json_['kind'] as core.String?,
newStartPageToken: json_['newStartPageToken'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final changes = this.changes;
final kind = this.kind;
final newStartPageToken = this.newStartPageToken;
final nextPageToken = this.nextPageToken;
return {
'changes': ?changes,
'kind': ?kind,
'newStartPageToken': ?newStartPageToken,
'nextPageToken': ?nextPageToken,
};
}
}
/// A notification channel used to watch for resource changes.
typedef Channel = $Channel01;
/// Details about the client-side encryption applied to the file.
class ClientEncryptionDetails {
/// The metadata used for client-side operations.
DecryptionMetadata? decryptionMetadata;
/// The encryption state of the file.
///
/// The values expected here are: - encrypted - unencrypted
core.String? encryptionState;
ClientEncryptionDetails({this.decryptionMetadata, this.encryptionState});
ClientEncryptionDetails.fromJson(core.Map json_)
: this(
decryptionMetadata: json_.containsKey('decryptionMetadata')
? DecryptionMetadata.fromJson(
json_['decryptionMetadata']
as core.Map<core.String, core.dynamic>,
)
: null,
encryptionState: json_['encryptionState'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final decryptionMetadata = this.decryptionMetadata;
final encryptionState = this.encryptionState;
return {
'decryptionMetadata': ?decryptionMetadata,
'encryptionState': ?encryptionState,
};
}
}
/// The file content to which the comment refers, typically within the anchor
/// region.
///
/// For a text file, for example, this would be the text at the location of the
/// comment.
class CommentQuotedFileContent {
/// The MIME type of the quoted content.
core.String? mimeType;
/// The quoted content itself.
///
/// This is interpreted as plain text if set through the API.
core.String? value;
CommentQuotedFileContent({this.mimeType, this.value});
CommentQuotedFileContent.fromJson(core.Map json_)
: this(
mimeType: json_['mimeType'] as core.String?,
value: json_['value'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final mimeType = this.mimeType;
final value = this.value;
return {'mimeType': ?mimeType, 'value': ?value};
}
}
/// A comment on a file.
///
/// Some resource methods (such as `comments.update`) require a `commentId`. Use
/// the `comments.list` method to retrieve the ID for a comment in a file.
class Comment {
/// A region of the document represented as a JSON string.
///
/// For details on defining anchor properties, refer to
/// [Manage comments and replies](https://developers.google.com/workspace/drive/api/v3/manage-comments).
core.String? anchor;
/// The email address of the user assigned to this comment.
///
/// If no user is assigned, the field is unset.
///
/// Output only.
core.String? assigneeEmailAddress;
/// The author of the comment.
///
/// The author's email address and permission ID will not be populated.
///
/// Output only.
User? author;
/// The plain text content of the comment.
///
/// This field is used for setting the content, while `htmlContent` should be
/// displayed.
core.String? content;
/// The time at which the comment was created (RFC 3339 date-time).
core.DateTime? createdTime;
/// Whether the comment has been deleted.
///
/// A deleted comment has no content.
///
/// Output only.
core.bool? deleted;
/// The content of the comment with HTML formatting.
///
/// Output only.
core.String? htmlContent;
/// The ID of the comment.
///
/// Output only.
core.String? id;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#comment"`.
///
/// Output only.
core.String? kind;
/// A list of email addresses for users mentioned in this comment.
///
/// If no users are mentioned, the list is empty.
///
/// Output only.
core.List<core.String>? mentionedEmailAddresses;
/// The last time the comment or any of its replies was modified (RFC 3339
/// date-time).
core.DateTime? modifiedTime;
/// The file content to which the comment refers, typically within the anchor
/// region.
///
/// For a text file, for example, this would be the text at the location of
/// the comment.
CommentQuotedFileContent? quotedFileContent;
/// The full list of replies to the comment in chronological order.
///
/// Output only.
core.List<Reply>? replies;
/// Whether the comment has been resolved by one of its replies.
///
/// Output only.
core.bool? resolved;
Comment({
this.anchor,
this.assigneeEmailAddress,
this.author,
this.content,
this.createdTime,
this.deleted,
this.htmlContent,
this.id,
this.kind,
this.mentionedEmailAddresses,
this.modifiedTime,
this.quotedFileContent,
this.replies,
this.resolved,
});
Comment.fromJson(core.Map json_)
: this(
anchor: json_['anchor'] as core.String?,
assigneeEmailAddress: json_['assigneeEmailAddress'] as core.String?,
author: json_.containsKey('author')
? User.fromJson(
json_['author'] as core.Map<core.String, core.dynamic>,
)
: null,
content: json_['content'] as core.String?,
createdTime: json_.containsKey('createdTime')
? core.DateTime.parse(json_['createdTime'] as core.String)
: null,
deleted: json_['deleted'] as core.bool?,
htmlContent: json_['htmlContent'] as core.String?,
id: json_['id'] as core.String?,
kind: json_['kind'] as core.String?,
mentionedEmailAddresses:
(json_['mentionedEmailAddresses'] as core.List?)
?.map((value) => value as core.String)
.toList(),
modifiedTime: json_.containsKey('modifiedTime')
? core.DateTime.parse(json_['modifiedTime'] as core.String)
: null,
quotedFileContent: json_.containsKey('quotedFileContent')
? CommentQuotedFileContent.fromJson(
json_['quotedFileContent']
as core.Map<core.String, core.dynamic>,
)
: null,
replies: (json_['replies'] as core.List?)
?.map(
(value) =>
Reply.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
resolved: json_['resolved'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final anchor = this.anchor;
final assigneeEmailAddress = this.assigneeEmailAddress;
final author = this.author;
final content = this.content;
final createdTime = this.createdTime;
final deleted = this.deleted;
final htmlContent = this.htmlContent;
final id = this.id;
final kind = this.kind;
final mentionedEmailAddresses = this.mentionedEmailAddresses;
final modifiedTime = this.modifiedTime;
final quotedFileContent = this.quotedFileContent;
final replies = this.replies;
final resolved = this.resolved;
return {
'anchor': ?anchor,
'assigneeEmailAddress': ?assigneeEmailAddress,
'author': ?author,
'content': ?content,
'createdTime': ?createdTime?.toUtc().toIso8601String(),
'deleted': ?deleted,
'htmlContent': ?htmlContent,
'id': ?id,
'kind': ?kind,
'mentionedEmailAddresses': ?mentionedEmailAddresses,
'modifiedTime': ?modifiedTime?.toUtc().toIso8601String(),
'quotedFileContent': ?quotedFileContent,
'replies': ?replies,
'resolved': ?resolved,
};
}
}
/// A list of comments on a file.
class CommentList {
/// The list of comments.
///
/// If nextPageToken is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<Comment>? comments;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#commentList"`.
core.String? kind;
/// The page token for the next page of comments.
///
/// This will be absent if the end of the comments list has been reached. If
/// the token is rejected for any reason, it should be discarded, and
/// pagination should be restarted from the first page of results. The page
/// token is typically valid for several hours. However, if new items are
/// added or removed, your expected results might differ.
core.String? nextPageToken;
CommentList({this.comments, this.kind, this.nextPageToken});
CommentList.fromJson(core.Map json_)
: this(
comments: (json_['comments'] as core.List?)
?.map(
(value) => Comment.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
kind: json_['kind'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final comments = this.comments;
final kind = this.kind;
final nextPageToken = this.nextPageToken;
return {
'comments': ?comments,
'kind': ?kind,
'nextPageToken': ?nextPageToken,
};
}
}
/// A restriction for accessing the content of the file.
class ContentRestriction {
/// Whether the content restriction can only be modified or removed by a user
/// who owns the file.
///
/// For files in shared drives, any user with `organizer` capabilities can
/// modify or remove this content restriction.
core.bool? ownerRestricted;
/// Whether the content of the file is read-only.
///
/// If a file is read-only, a new revision of the file may not be added,
/// comments may not be added or modified, and the title of the file may not
/// be modified.
core.bool? readOnly;
/// Reason for why the content of the file is restricted.
///
/// This is only mutable on requests that also set `readOnly=true`.
core.String? reason;
/// The user who set the content restriction.
///
/// Only populated if `readOnly=true`.
///
/// Output only.
User? restrictingUser;
/// The time at which the content restriction was set (formatted RFC 3339
/// timestamp).
///
/// Only populated if readOnly is true.
core.DateTime? restrictionTime;
/// Whether the content restriction was applied by the system, for example due
/// to an esignature.
///
/// Users cannot modify or remove system restricted content restrictions.
///
/// Output only.
core.bool? systemRestricted;
/// The type of the content restriction.
///
/// Currently the only possible value is `globalContentRestriction`.
///
/// Output only.
core.String? type;
ContentRestriction({
this.ownerRestricted,
this.readOnly,
this.reason,
this.restrictingUser,
this.restrictionTime,
this.systemRestricted,
this.type,
});
ContentRestriction.fromJson(core.Map json_)
: this(
ownerRestricted: json_['ownerRestricted'] as core.bool?,
readOnly: json_['readOnly'] as core.bool?,
reason: json_['reason'] as core.String?,
restrictingUser: json_.containsKey('restrictingUser')
? User.fromJson(
json_['restrictingUser'] as core.Map<core.String, core.dynamic>,
)
: null,
restrictionTime: json_.containsKey('restrictionTime')
? core.DateTime.parse(json_['restrictionTime'] as core.String)
: null,
systemRestricted: json_['systemRestricted'] as core.bool?,
type: json_['type'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final ownerRestricted = this.ownerRestricted;
final readOnly = this.readOnly;
final reason = this.reason;
final restrictingUser = this.restrictingUser;
final restrictionTime = this.restrictionTime;
final systemRestricted = this.systemRestricted;
final type = this.type;
return {
'ownerRestricted': ?ownerRestricted,
'readOnly': ?readOnly,
'reason': ?reason,
'restrictingUser': ?restrictingUser,
'restrictionTime': ?restrictionTime?.toUtc().toIso8601String(),
'systemRestricted': ?systemRestricted,
'type': ?type,
};
}
}
/// Representation of the CSE DecryptionMetadata.
typedef DecryptionMetadata = $DecryptionMetadata;
/// A restriction for copy and download of the file.
class DownloadRestriction {
/// Whether download and copy is restricted for readers.
core.bool? restrictedForReaders;
/// Whether download and copy is restricted for writers.
///
/// If `true`, download is also restricted for readers.
core.bool? restrictedForWriters;
DownloadRestriction({this.restrictedForReaders, this.restrictedForWriters});
DownloadRestriction.fromJson(core.Map json_)
: this(
restrictedForReaders: json_['restrictedForReaders'] as core.bool?,
restrictedForWriters: json_['restrictedForWriters'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final restrictedForReaders = this.restrictedForReaders;
final restrictedForWriters = this.restrictedForWriters;
return {
'restrictedForReaders': ?restrictedForReaders,
'restrictedForWriters': ?restrictedForWriters,
};
}
}
/// Download restrictions applied to the file.
class DownloadRestrictionsMetadata {
/// The effective download restriction applied to this file.
///
/// This considers all restriction settings and DLP rules.
///
/// Output only.
DownloadRestriction? effectiveDownloadRestrictionWithContext;
/// The download restriction of the file applied directly by the owner or
/// organizer.
///
/// This doesn't take into account shared drive settings or DLP rules.
DownloadRestriction? itemDownloadRestriction;
DownloadRestrictionsMetadata({
this.effectiveDownloadRestrictionWithContext,
this.itemDownloadRestriction,
});
DownloadRestrictionsMetadata.fromJson(core.Map json_)
: this(
effectiveDownloadRestrictionWithContext:
json_.containsKey('effectiveDownloadRestrictionWithContext')
? DownloadRestriction.fromJson(
json_['effectiveDownloadRestrictionWithContext']
as core.Map<core.String, core.dynamic>,
)
: null,
itemDownloadRestriction: json_.containsKey('itemDownloadRestriction')
? DownloadRestriction.fromJson(
json_['itemDownloadRestriction']
as core.Map<core.String, core.dynamic>,
)
: null,
);
core.Map<core.String, core.dynamic> toJson() {
final effectiveDownloadRestrictionWithContext =
this.effectiveDownloadRestrictionWithContext;
final itemDownloadRestriction = this.itemDownloadRestriction;
return {
'effectiveDownloadRestrictionWithContext':
?effectiveDownloadRestrictionWithContext,
'itemDownloadRestriction': ?itemDownloadRestriction,
};
}
}
/// An image file and cropping parameters from which a background image for this
/// shared drive is set.
///
/// This is a write only field; it can only be set on `drive.drives.update`
/// requests that don't set `themeId`. When specified, all fields of the
/// `backgroundImageFile` must be set.
class DriveBackgroundImageFile {
/// The ID of an image file in Google Drive to use for the background image.
core.String? id;
/// The width of the cropped image in the closed range of 0 to 1.
///
/// This value represents the width of the cropped image divided by the width
/// of the entire image. The height is computed by applying a width to height
/// aspect ratio of 80 to 9. The resulting image must be at least 1280 pixels
/// wide and 144 pixels high.
core.double? width;
/// The X coordinate of the upper left corner of the cropping area in the
/// background image.
///
/// This is a value in the closed range of 0 to 1. This value represents the
/// horizontal distance from the left side of the entire image to the left
/// side of the cropping area divided by the width of the entire image.
core.double? xCoordinate;
/// The Y coordinate of the upper left corner of the cropping area in the
/// background image.
///
/// This is a value in the closed range of 0 to 1. This value represents the
/// vertical distance from the top side of the entire image to the top side of
/// the cropping area divided by the height of the entire image.
core.double? yCoordinate;
DriveBackgroundImageFile({
this.id,
this.width,
this.xCoordinate,
this.yCoordinate,
});
DriveBackgroundImageFile.fromJson(core.Map json_)
: this(
id: json_['id'] as core.String?,
width: (json_['width'] as core.num?)?.toDouble(),
xCoordinate: (json_['xCoordinate'] as core.num?)?.toDouble(),
yCoordinate: (json_['yCoordinate'] as core.num?)?.toDouble(),
);
core.Map<core.String, core.dynamic> toJson() {
final id = this.id;
final width = this.width;
final xCoordinate = this.xCoordinate;
final yCoordinate = this.yCoordinate;
return {
'id': ?id,
'width': ?width,
'xCoordinate': ?xCoordinate,
'yCoordinate': ?yCoordinate,
};
}
}
/// Capabilities the current user has on this shared drive.
///
/// Output only.
class DriveCapabilities {
/// Whether the current user can add children to folders in this shared drive.
///
/// Output only.
core.bool? canAddChildren;
/// Whether the current user can change the `copyRequiresWriterPermission`
/// restriction of this shared drive.
///
/// Output only.
core.bool? canChangeCopyRequiresWriterPermissionRestriction;
/// Whether the current user can change the `domainUsersOnly` restriction of
/// this shared drive.
///
/// Output only.
core.bool? canChangeDomainUsersOnlyRestriction;
/// Whether the current user can change organizer-applied download
/// restrictions of this shared drive.
///
/// Output only.
core.bool? canChangeDownloadRestriction;
/// Whether the current user can change the background of this shared drive.
///
/// Output only.
core.bool? canChangeDriveBackground;
/// Whether the current user can change the `driveMembersOnly` restriction of
/// this shared drive.
///
/// Output only.
core.bool? canChangeDriveMembersOnlyRestriction;
/// Whether the current user can change the
/// `sharingFoldersRequiresOrganizerPermission` restriction of this shared
/// drive.
///
/// Output only.
core.bool? canChangeSharingFoldersRequiresOrganizerPermissionRestriction;
/// Whether the current user can comment on files in this shared drive.
///
/// Output only.
core.bool? canComment;
/// Whether the current user can copy files in this shared drive.
///
/// Output only.
core.bool? canCopy;
/// Whether the current user can delete children from folders in this shared
/// drive.
///
/// Output only.
core.bool? canDeleteChildren;
/// Whether the current user can delete this shared drive.
///
/// Attempting to delete the shared drive may still fail if there are
/// untrashed items inside the shared drive.
///
/// Output only.
core.bool? canDeleteDrive;
/// Whether the current user can download files in this shared drive.
///
/// Output only.
core.bool? canDownload;
/// Whether the current user can edit files in this shared drive
///
/// Output only.
core.bool? canEdit;
/// Whether the current user can list the children of folders in this shared
/// drive.
///
/// Output only.
core.bool? canListChildren;
/// Whether the current user can add members to this shared drive or remove
/// them or change their role.
///
/// Output only.
core.bool? canManageMembers;
/// Whether the current user can read the revisions resource of files in this
/// shared drive.
///
/// Output only.
core.bool? canReadRevisions;
/// Whether the current user can rename files or folders in this shared drive.
///
/// Output only.
core.bool? canRename;
/// Whether the current user can rename this shared drive.
///
/// Output only.
core.bool? canRenameDrive;
/// Whether the current user can reset the shared drive restrictions to
/// defaults.
///
/// Output only.
core.bool? canResetDriveRestrictions;
/// Whether the current user can share files or folders in this shared drive.
///
/// Output only.
core.bool? canShare;
/// Whether the current user can trash children from folders in this shared
/// drive.
///
/// Output only.
core.bool? canTrashChildren;
DriveCapabilities({
this.canAddChildren,
this.canChangeCopyRequiresWriterPermissionRestriction,
this.canChangeDomainUsersOnlyRestriction,
this.canChangeDownloadRestriction,
this.canChangeDriveBackground,
this.canChangeDriveMembersOnlyRestriction,
this.canChangeSharingFoldersRequiresOrganizerPermissionRestriction,
this.canComment,
this.canCopy,
this.canDeleteChildren,
this.canDeleteDrive,
this.canDownload,
this.canEdit,
this.canListChildren,
this.canManageMembers,
this.canReadRevisions,
this.canRename,
this.canRenameDrive,
this.canResetDriveRestrictions,
this.canShare,
this.canTrashChildren,
});
DriveCapabilities.fromJson(core.Map json_)
: this(
canAddChildren: json_['canAddChildren'] as core.bool?,
canChangeCopyRequiresWriterPermissionRestriction:
json_['canChangeCopyRequiresWriterPermissionRestriction']
as core.bool?,
canChangeDomainUsersOnlyRestriction:
json_['canChangeDomainUsersOnlyRestriction'] as core.bool?,
canChangeDownloadRestriction:
json_['canChangeDownloadRestriction'] as core.bool?,
canChangeDriveBackground:
json_['canChangeDriveBackground'] as core.bool?,
canChangeDriveMembersOnlyRestriction:
json_['canChangeDriveMembersOnlyRestriction'] as core.bool?,
canChangeSharingFoldersRequiresOrganizerPermissionRestriction:
json_['canChangeSharingFoldersRequiresOrganizerPermissionRestriction']
as core.bool?,
canComment: json_['canComment'] as core.bool?,
canCopy: json_['canCopy'] as core.bool?,
canDeleteChildren: json_['canDeleteChildren'] as core.bool?,
canDeleteDrive: json_['canDeleteDrive'] as core.bool?,
canDownload: json_['canDownload'] as core.bool?,
canEdit: json_['canEdit'] as core.bool?,
canListChildren: json_['canListChildren'] as core.bool?,
canManageMembers: json_['canManageMembers'] as core.bool?,
canReadRevisions: json_['canReadRevisions'] as core.bool?,
canRename: json_['canRename'] as core.bool?,
canRenameDrive: json_['canRenameDrive'] as core.bool?,
canResetDriveRestrictions:
json_['canResetDriveRestrictions'] as core.bool?,
canShare: json_['canShare'] as core.bool?,
canTrashChildren: json_['canTrashChildren'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final canAddChildren = this.canAddChildren;
final canChangeCopyRequiresWriterPermissionRestriction =
this.canChangeCopyRequiresWriterPermissionRestriction;
final canChangeDomainUsersOnlyRestriction =
this.canChangeDomainUsersOnlyRestriction;
final canChangeDownloadRestriction = this.canChangeDownloadRestriction;
final canChangeDriveBackground = this.canChangeDriveBackground;
final canChangeDriveMembersOnlyRestriction =
this.canChangeDriveMembersOnlyRestriction;
final canChangeSharingFoldersRequiresOrganizerPermissionRestriction =
this.canChangeSharingFoldersRequiresOrganizerPermissionRestriction;
final canComment = this.canComment;
final canCopy = this.canCopy;
final canDeleteChildren = this.canDeleteChildren;
final canDeleteDrive = this.canDeleteDrive;
final canDownload = this.canDownload;
final canEdit = this.canEdit;
final canListChildren = this.canListChildren;
final canManageMembers = this.canManageMembers;
final canReadRevisions = this.canReadRevisions;
final canRename = this.canRename;
final canRenameDrive = this.canRenameDrive;
final canResetDriveRestrictions = this.canResetDriveRestrictions;
final canShare = this.canShare;
final canTrashChildren = this.canTrashChildren;
return {
'canAddChildren': ?canAddChildren,
'canChangeCopyRequiresWriterPermissionRestriction':
?canChangeCopyRequiresWriterPermissionRestriction,
'canChangeDomainUsersOnlyRestriction':
?canChangeDomainUsersOnlyRestriction,
'canChangeDownloadRestriction': ?canChangeDownloadRestriction,
'canChangeDriveBackground': ?canChangeDriveBackground,
'canChangeDriveMembersOnlyRestriction':
?canChangeDriveMembersOnlyRestriction,
'canChangeSharingFoldersRequiresOrganizerPermissionRestriction':
?canChangeSharingFoldersRequiresOrganizerPermissionRestriction,
'canComment': ?canComment,
'canCopy': ?canCopy,
'canDeleteChildren': ?canDeleteChildren,
'canDeleteDrive': ?canDeleteDrive,
'canDownload': ?canDownload,
'canEdit': ?canEdit,
'canListChildren': ?canListChildren,
'canManageMembers': ?canManageMembers,
'canReadRevisions': ?canReadRevisions,
'canRename': ?canRename,
'canRenameDrive': ?canRenameDrive,
'canResetDriveRestrictions': ?canResetDriveRestrictions,
'canShare': ?canShare,
'canTrashChildren': ?canTrashChildren,
};
}
}
/// A set of restrictions that apply to this shared drive or items inside this
/// shared drive.
///
/// Note that restrictions can't be set when creating a shared drive. To add a
/// restriction, first create a shared drive and then use `drives.update` to add
/// restrictions.
class DriveRestrictions {
/// Whether administrative privileges on this shared drive are required to
/// modify restrictions.
core.bool? adminManagedRestrictions;
/// Whether the options to copy, print, or download files inside this shared
/// drive, should be disabled for readers and commenters.
///
/// When this restriction is set to `true`, it will override the similarly
/// named field to `true` for any file inside this shared drive.
core.bool? copyRequiresWriterPermission;
/// Whether access to this shared drive and items inside this shared drive is
/// restricted to users of the domain to which this shared drive belongs.
///
/// This restriction may be overridden by other sharing policies controlled
/// outside of this shared drive.
core.bool? domainUsersOnly;
/// Download restrictions applied by shared drive managers.
DownloadRestriction? downloadRestriction;
/// Whether access to items inside this shared drive is restricted to its
/// members.
core.bool? driveMembersOnly;
/// If true, only users with the organizer role can share folders.
///
/// If false, users with either the organizer role or the file organizer role
/// can share folders.
core.bool? sharingFoldersRequiresOrganizerPermission;
DriveRestrictions({
this.adminManagedRestrictions,
this.copyRequiresWriterPermission,
this.domainUsersOnly,
this.downloadRestriction,
this.driveMembersOnly,
this.sharingFoldersRequiresOrganizerPermission,
});
DriveRestrictions.fromJson(core.Map json_)
: this(
adminManagedRestrictions:
json_['adminManagedRestrictions'] as core.bool?,
copyRequiresWriterPermission:
json_['copyRequiresWriterPermission'] as core.bool?,
domainUsersOnly: json_['domainUsersOnly'] as core.bool?,
downloadRestriction: json_.containsKey('downloadRestriction')
? DownloadRestriction.fromJson(
json_['downloadRestriction']
as core.Map<core.String, core.dynamic>,
)
: null,
driveMembersOnly: json_['driveMembersOnly'] as core.bool?,
sharingFoldersRequiresOrganizerPermission:
json_['sharingFoldersRequiresOrganizerPermission'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final adminManagedRestrictions = this.adminManagedRestrictions;
final copyRequiresWriterPermission = this.copyRequiresWriterPermission;
final domainUsersOnly = this.domainUsersOnly;
final downloadRestriction = this.downloadRestriction;
final driveMembersOnly = this.driveMembersOnly;
final sharingFoldersRequiresOrganizerPermission =
this.sharingFoldersRequiresOrganizerPermission;
return {
'adminManagedRestrictions': ?adminManagedRestrictions,
'copyRequiresWriterPermission': ?copyRequiresWriterPermission,
'domainUsersOnly': ?domainUsersOnly,
'downloadRestriction': ?downloadRestriction,
'driveMembersOnly': ?driveMembersOnly,
'sharingFoldersRequiresOrganizerPermission':
?sharingFoldersRequiresOrganizerPermission,
};
}
}
/// Representation of a shared drive.
///
/// Some resource methods (such as `drives.update`) require a `driveId`. Use the
/// `drives.list` method to retrieve the ID for a shared drive.
class Drive {
/// An image file and cropping parameters from which a background image for
/// this shared drive is set.
///
/// This is a write only field; it can only be set on `drive.drives.update`
/// requests that don't set `themeId`. When specified, all fields of the
/// `backgroundImageFile` must be set.
DriveBackgroundImageFile? backgroundImageFile;
/// A short-lived link to this shared drive's background image.
///
/// Output only.
core.String? backgroundImageLink;
/// Capabilities the current user has on this shared drive.
///
/// Output only.
DriveCapabilities? capabilities;
/// The color of this shared drive as an RGB hex string.
///
/// It can only be set on a `drive.drives.update` request that does not set
/// `themeId`.
core.String? colorRgb;
/// The time at which the shared drive was created (RFC 3339 date-time).
core.DateTime? createdTime;
/// Whether the shared drive is hidden from default view.
core.bool? hidden;
/// The ID of this shared drive which is also the ID of the top level folder
/// of this shared drive.
///
/// Output only.
core.String? id;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#drive"`.
///
/// Output only.
core.String? kind;
/// The name of this shared drive.
core.String? name;
/// The organizational unit of this shared drive.
///
/// This field is only populated on `drives.list` responses when the
/// `useDomainAdminAccess` parameter is set to `true`.
///
/// Output only.
core.String? orgUnitId;
/// A set of restrictions that apply to this shared drive or items inside this
/// shared drive.
///
/// Note that restrictions can't be set when creating a shared drive. To add a
/// restriction, first create a shared drive and then use `drives.update` to
/// add restrictions.
DriveRestrictions? restrictions;
/// The ID of the theme from which the background image and color will be set.
///
/// The set of possible `driveThemes` can be retrieved from a
/// `drive.about.get` response. When not specified on a `drive.drives.create`
/// request, a random theme is chosen from which the background image and
/// color are set. This is a write-only field; it can only be set on requests
/// that don't set `colorRgb` or `backgroundImageFile`.
core.String? themeId;
Drive({
this.backgroundImageFile,
this.backgroundImageLink,
this.capabilities,
this.colorRgb,
this.createdTime,
this.hidden,
this.id,
this.kind,
this.name,
this.orgUnitId,
this.restrictions,
this.themeId,
});
Drive.fromJson(core.Map json_)
: this(
backgroundImageFile: json_.containsKey('backgroundImageFile')
? DriveBackgroundImageFile.fromJson(
json_['backgroundImageFile']
as core.Map<core.String, core.dynamic>,
)
: null,
backgroundImageLink: json_['backgroundImageLink'] as core.String?,
capabilities: json_.containsKey('capabilities')
? DriveCapabilities.fromJson(
json_['capabilities'] as core.Map<core.String, core.dynamic>,
)
: null,
colorRgb: json_['colorRgb'] as core.String?,
createdTime: json_.containsKey('createdTime')
? core.DateTime.parse(json_['createdTime'] as core.String)
: null,
hidden: json_['hidden'] as core.bool?,
id: json_['id'] as core.String?,
kind: json_['kind'] as core.String?,
name: json_['name'] as core.String?,
orgUnitId: json_['orgUnitId'] as core.String?,
restrictions: json_.containsKey('restrictions')
? DriveRestrictions.fromJson(
json_['restrictions'] as core.Map<core.String, core.dynamic>,
)
: null,
themeId: json_['themeId'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final backgroundImageFile = this.backgroundImageFile;
final backgroundImageLink = this.backgroundImageLink;
final capabilities = this.capabilities;
final colorRgb = this.colorRgb;
final createdTime = this.createdTime;
final hidden = this.hidden;
final id = this.id;
final kind = this.kind;
final name = this.name;
final orgUnitId = this.orgUnitId;
final restrictions = this.restrictions;
final themeId = this.themeId;
return {
'backgroundImageFile': ?backgroundImageFile,
'backgroundImageLink': ?backgroundImageLink,
'capabilities': ?capabilities,
'colorRgb': ?colorRgb,
'createdTime': ?createdTime?.toUtc().toIso8601String(),
'hidden': ?hidden,
'id': ?id,
'kind': ?kind,
'name': ?name,
'orgUnitId': ?orgUnitId,
'restrictions': ?restrictions,
'themeId': ?themeId,
};
}
}
/// A list of shared drives.
class DriveList {
/// The list of shared drives.
///
/// If nextPageToken is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<Drive>? drives;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#driveList"`.
core.String? kind;
/// The page token for the next page of shared drives.
///
/// This will be absent if the end of the list has been reached. If the token
/// is rejected for any reason, it should be discarded, and pagination should
/// be restarted from the first page of results. The page token is typically
/// valid for several hours. However, if new items are added or removed, your
/// expected results might differ.
core.String? nextPageToken;
DriveList({this.drives, this.kind, this.nextPageToken});
DriveList.fromJson(core.Map json_)
: this(
drives: (json_['drives'] as core.List?)
?.map(
(value) =>
Drive.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
kind: json_['kind'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final drives = this.drives;
final kind = this.kind;
final nextPageToken = this.nextPageToken;
return {'drives': ?drives, 'kind': ?kind, 'nextPageToken': ?nextPageToken};
}
}
/// Capabilities the current user has on this file.
///
/// Each capability corresponds to a fine-grained action that a user may take.
/// For more information, see
/// [Understand file capabilities](https://developers.google.com/workspace/drive/api/guides/manage-sharing#capabilities).
///
/// Output only.
class FileCapabilities {
/// Whether the current user is the pending owner of the file.
///
/// Not populated for shared drive files.
///
/// Output only.
core.bool? canAcceptOwnership;
/// Whether the current user can add children to this folder.
///
/// This is always `false` when the item isn't a folder.
///
/// Output only.
core.bool? canAddChildren;
/// Whether the current user can add a folder from another drive (different
/// shared drive or My Drive) to this folder.
///
/// This is `false` when the item isn't a folder. Only populated for items in
/// shared drives.
///
/// Output only.
core.bool? canAddFolderFromAnotherDrive;
/// Whether the current user can add a parent for the item without removing an
/// existing parent in the same request.
///
/// Not populated for shared drive files.
///
/// Output only.
core.bool? canAddMyDriveParent;
/// Whether the current user can change the `copyRequiresWriterPermission`
/// restriction of this file.
///
/// Output only.
core.bool? canChangeCopyRequiresWriterPermission;
/// Whether the current user can change the owner or organizer-applied
/// download restrictions of the file.
///
/// Output only.
core.bool? canChangeItemDownloadRestriction;
/// Whether the current user can change the `securityUpdateEnabled` field on
/// link share metadata.
///
/// Output only.
core.bool? canChangeSecurityUpdateEnabled;
/// Deprecated: Output only.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canChangeViewersCanCopyContent;
/// Whether the current user can comment on this file.
///
/// Output only.
core.bool? canComment;
/// Whether the current user can copy this file.
///
/// For an item in a shared drive, whether the current user can copy
/// non-folder descendants of this item, or this item if it's not a folder.
///
/// Output only.
core.bool? canCopy;
/// Whether the current user can delete this file.
///
/// Output only.
core.bool? canDelete;
/// Whether the current user can delete children of this folder.
///
/// This is `false` when the item isn't a folder. Only populated for items in
/// shared drives.
///
/// Output only.
core.bool? canDeleteChildren;
/// Whether a user can disable inherited permissions.
core.bool? canDisableInheritedPermissions;
/// Whether the current user can download this file.
///
/// Output only.
core.bool? canDownload;
/// Whether the current user can edit this file.
///
/// Other factors may limit the type of changes a user can make to a file. For
/// example, see `canChangeCopyRequiresWriterPermission` or
/// `canModifyContent`.
///
/// Output only.
core.bool? canEdit;
/// Whether a user can re-enable inherited permissions.
core.bool? canEnableInheritedPermissions;
/// Whether the current user can list the children of this folder.
///
/// This is always `false` when the item isn't a folder.
///
/// Output only.
core.bool? canListChildren;
/// Whether the current user can modify the content of this file.
///
/// Output only.
core.bool? canModifyContent;
/// Deprecated: Output only.
///
/// Use one of `canModifyEditorContentRestriction`,
/// `canModifyOwnerContentRestriction`, or `canRemoveContentRestriction`.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canModifyContentRestriction;
/// Whether the current user can add or modify content restrictions on the
/// file which are editor restricted.
///
/// Output only.
core.bool? canModifyEditorContentRestriction;
/// Whether the current user can modify the labels on the file.
///
/// Output only.
core.bool? canModifyLabels;
/// Whether the current user can add or modify content restrictions which are
/// owner restricted.
///
/// Output only.
core.bool? canModifyOwnerContentRestriction;
/// Whether the current user can move children of this folder outside of the
/// shared drive.
///
/// This is `false` when the item isn't a folder. Only populated for items in
/// shared drives.
///
/// Output only.
core.bool? canMoveChildrenOutOfDrive;
/// Deprecated: Output only.
///
/// Use `canMoveChildrenOutOfDrive` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canMoveChildrenOutOfTeamDrive;
/// Whether the current user can move children of this folder within this
/// drive.
///
/// This is `false` when the item isn't a folder. Note that a request to move
/// the child may still fail depending on the current user's access to the
/// child and to the destination folder.
///
/// Output only.
core.bool? canMoveChildrenWithinDrive;
/// Deprecated: Output only.
///
/// Use `canMoveChildrenWithinDrive` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canMoveChildrenWithinTeamDrive;
/// Deprecated: Output only.
///
/// Use `canMoveItemOutOfDrive` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canMoveItemIntoTeamDrive;
/// Whether the current user can move this item outside of this drive by
/// changing its parent.
///
/// Note that a request to change the parent of the item may still fail
/// depending on the new parent that's being added.
///
/// Output only.
core.bool? canMoveItemOutOfDrive;
/// Deprecated: Output only.
///
/// Use `canMoveItemOutOfDrive` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canMoveItemOutOfTeamDrive;
/// Whether the current user can move this item within this drive.
///
/// Note that a request to change the parent of the item may still fail
/// depending on the new parent that's being added and the parent that is
/// being removed.
///
/// Output only.
core.bool? canMoveItemWithinDrive;
/// Deprecated: Output only.
///
/// Use `canMoveItemWithinDrive` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canMoveItemWithinTeamDrive;
/// Deprecated: Output only.
///
/// Use `canMoveItemWithinDrive` or `canMoveItemOutOfDrive` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canMoveTeamDriveItem;
/// Whether the current user can read the shared drive to which this file
/// belongs.
///
/// Only populated for items in shared drives.
///
/// Output only.
core.bool? canReadDrive;
/// Whether the current user can read the labels on the file.
///
/// Output only.
core.bool? canReadLabels;
/// Whether the current user can read the revisions resource of this file.
///
/// For a shared drive item, whether revisions of non-folder descendants of
/// this item, or this item if it's not a folder, can be read.
///
/// Output only.
core.bool? canReadRevisions;
/// Deprecated: Output only.
///
/// Use `canReadDrive` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canReadTeamDrive;
/// Whether the current user can remove children from this folder.
///
/// This is always `false` when the item isn't a folder. For a folder in a
/// shared drive, use `canDeleteChildren` or `canTrashChildren` instead.
///
/// Output only.
core.bool? canRemoveChildren;
/// Whether there's a content restriction on the file that can be removed by
/// the current user.
///
/// Output only.
core.bool? canRemoveContentRestriction;
/// Whether the current user can remove a parent from the item without adding
/// another parent in the same request.
///
/// Not populated for shared drive files.
///
/// Output only.
core.bool? canRemoveMyDriveParent;
/// Whether the current user can rename this file.
///
/// Output only.
core.bool? canRename;
/// Whether the current user can modify the sharing settings for this file.
///
/// Output only.
core.bool? canShare;
/// Whether the current user can move this file to trash.
///
/// Output only.
core.bool? canTrash;
/// Whether the current user can trash children of this folder.
///
/// This is `false` when the item isn't a folder. Only populated for items in
/// shared drives.
///
/// Output only.
core.bool? canTrashChildren;
/// Whether the current user can restore this file from trash.
///
/// Output only.
core.bool? canUntrash;
FileCapabilities({
this.canAcceptOwnership,
this.canAddChildren,
this.canAddFolderFromAnotherDrive,
this.canAddMyDriveParent,
this.canChangeCopyRequiresWriterPermission,
this.canChangeItemDownloadRestriction,
this.canChangeSecurityUpdateEnabled,
this.canChangeViewersCanCopyContent,
this.canComment,
this.canCopy,
this.canDelete,
this.canDeleteChildren,
this.canDisableInheritedPermissions,
this.canDownload,
this.canEdit,
this.canEnableInheritedPermissions,
this.canListChildren,
this.canModifyContent,
this.canModifyContentRestriction,
this.canModifyEditorContentRestriction,
this.canModifyLabels,
this.canModifyOwnerContentRestriction,
this.canMoveChildrenOutOfDrive,
this.canMoveChildrenOutOfTeamDrive,
this.canMoveChildrenWithinDrive,
this.canMoveChildrenWithinTeamDrive,
this.canMoveItemIntoTeamDrive,
this.canMoveItemOutOfDrive,
this.canMoveItemOutOfTeamDrive,
this.canMoveItemWithinDrive,
this.canMoveItemWithinTeamDrive,
this.canMoveTeamDriveItem,
this.canReadDrive,
this.canReadLabels,
this.canReadRevisions,
this.canReadTeamDrive,
this.canRemoveChildren,
this.canRemoveContentRestriction,
this.canRemoveMyDriveParent,
this.canRename,
this.canShare,
this.canTrash,
this.canTrashChildren,
this.canUntrash,
});
FileCapabilities.fromJson(core.Map json_)
: this(
canAcceptOwnership: json_['canAcceptOwnership'] as core.bool?,
canAddChildren: json_['canAddChildren'] as core.bool?,
canAddFolderFromAnotherDrive:
json_['canAddFolderFromAnotherDrive'] as core.bool?,
canAddMyDriveParent: json_['canAddMyDriveParent'] as core.bool?,
canChangeCopyRequiresWriterPermission:
json_['canChangeCopyRequiresWriterPermission'] as core.bool?,
canChangeItemDownloadRestriction:
json_['canChangeItemDownloadRestriction'] as core.bool?,
canChangeSecurityUpdateEnabled:
json_['canChangeSecurityUpdateEnabled'] as core.bool?,
canChangeViewersCanCopyContent:
json_['canChangeViewersCanCopyContent'] as core.bool?,
canComment: json_['canComment'] as core.bool?,
canCopy: json_['canCopy'] as core.bool?,
canDelete: json_['canDelete'] as core.bool?,
canDeleteChildren: json_['canDeleteChildren'] as core.bool?,
canDisableInheritedPermissions:
json_['canDisableInheritedPermissions'] as core.bool?,
canDownload: json_['canDownload'] as core.bool?,
canEdit: json_['canEdit'] as core.bool?,
canEnableInheritedPermissions:
json_['canEnableInheritedPermissions'] as core.bool?,
canListChildren: json_['canListChildren'] as core.bool?,
canModifyContent: json_['canModifyContent'] as core.bool?,
canModifyContentRestriction:
json_['canModifyContentRestriction'] as core.bool?,
canModifyEditorContentRestriction:
json_['canModifyEditorContentRestriction'] as core.bool?,
canModifyLabels: json_['canModifyLabels'] as core.bool?,
canModifyOwnerContentRestriction:
json_['canModifyOwnerContentRestriction'] as core.bool?,
canMoveChildrenOutOfDrive:
json_['canMoveChildrenOutOfDrive'] as core.bool?,
canMoveChildrenOutOfTeamDrive:
json_['canMoveChildrenOutOfTeamDrive'] as core.bool?,
canMoveChildrenWithinDrive:
json_['canMoveChildrenWithinDrive'] as core.bool?,
canMoveChildrenWithinTeamDrive:
json_['canMoveChildrenWithinTeamDrive'] as core.bool?,
canMoveItemIntoTeamDrive:
json_['canMoveItemIntoTeamDrive'] as core.bool?,
canMoveItemOutOfDrive: json_['canMoveItemOutOfDrive'] as core.bool?,
canMoveItemOutOfTeamDrive:
json_['canMoveItemOutOfTeamDrive'] as core.bool?,
canMoveItemWithinDrive: json_['canMoveItemWithinDrive'] as core.bool?,
canMoveItemWithinTeamDrive:
json_['canMoveItemWithinTeamDrive'] as core.bool?,
canMoveTeamDriveItem: json_['canMoveTeamDriveItem'] as core.bool?,
canReadDrive: json_['canReadDrive'] as core.bool?,
canReadLabels: json_['canReadLabels'] as core.bool?,
canReadRevisions: json_['canReadRevisions'] as core.bool?,
canReadTeamDrive: json_['canReadTeamDrive'] as core.bool?,
canRemoveChildren: json_['canRemoveChildren'] as core.bool?,
canRemoveContentRestriction:
json_['canRemoveContentRestriction'] as core.bool?,
canRemoveMyDriveParent: json_['canRemoveMyDriveParent'] as core.bool?,
canRename: json_['canRename'] as core.bool?,
canShare: json_['canShare'] as core.bool?,
canTrash: json_['canTrash'] as core.bool?,
canTrashChildren: json_['canTrashChildren'] as core.bool?,
canUntrash: json_['canUntrash'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final canAcceptOwnership = this.canAcceptOwnership;
final canAddChildren = this.canAddChildren;
final canAddFolderFromAnotherDrive = this.canAddFolderFromAnotherDrive;
final canAddMyDriveParent = this.canAddMyDriveParent;
final canChangeCopyRequiresWriterPermission =
this.canChangeCopyRequiresWriterPermission;
final canChangeItemDownloadRestriction =
this.canChangeItemDownloadRestriction;
final canChangeSecurityUpdateEnabled = this.canChangeSecurityUpdateEnabled;
final canChangeViewersCanCopyContent = this.canChangeViewersCanCopyContent;
final canComment = this.canComment;
final canCopy = this.canCopy;
final canDelete = this.canDelete;
final canDeleteChildren = this.canDeleteChildren;
final canDisableInheritedPermissions = this.canDisableInheritedPermissions;
final canDownload = this.canDownload;
final canEdit = this.canEdit;
final canEnableInheritedPermissions = this.canEnableInheritedPermissions;
final canListChildren = this.canListChildren;
final canModifyContent = this.canModifyContent;
final canModifyContentRestriction = this.canModifyContentRestriction;
final canModifyEditorContentRestriction =
this.canModifyEditorContentRestriction;
final canModifyLabels = this.canModifyLabels;
final canModifyOwnerContentRestriction =
this.canModifyOwnerContentRestriction;
final canMoveChildrenOutOfDrive = this.canMoveChildrenOutOfDrive;
final canMoveChildrenOutOfTeamDrive = this.canMoveChildrenOutOfTeamDrive;
final canMoveChildrenWithinDrive = this.canMoveChildrenWithinDrive;
final canMoveChildrenWithinTeamDrive = this.canMoveChildrenWithinTeamDrive;
final canMoveItemIntoTeamDrive = this.canMoveItemIntoTeamDrive;
final canMoveItemOutOfDrive = this.canMoveItemOutOfDrive;
final canMoveItemOutOfTeamDrive = this.canMoveItemOutOfTeamDrive;
final canMoveItemWithinDrive = this.canMoveItemWithinDrive;
final canMoveItemWithinTeamDrive = this.canMoveItemWithinTeamDrive;
final canMoveTeamDriveItem = this.canMoveTeamDriveItem;
final canReadDrive = this.canReadDrive;
final canReadLabels = this.canReadLabels;
final canReadRevisions = this.canReadRevisions;
final canReadTeamDrive = this.canReadTeamDrive;
final canRemoveChildren = this.canRemoveChildren;
final canRemoveContentRestriction = this.canRemoveContentRestriction;
final canRemoveMyDriveParent = this.canRemoveMyDriveParent;
final canRename = this.canRename;
final canShare = this.canShare;
final canTrash = this.canTrash;
final canTrashChildren = this.canTrashChildren;
final canUntrash = this.canUntrash;
return {
'canAcceptOwnership': ?canAcceptOwnership,
'canAddChildren': ?canAddChildren,
'canAddFolderFromAnotherDrive': ?canAddFolderFromAnotherDrive,
'canAddMyDriveParent': ?canAddMyDriveParent,
'canChangeCopyRequiresWriterPermission':
?canChangeCopyRequiresWriterPermission,
'canChangeItemDownloadRestriction': ?canChangeItemDownloadRestriction,
'canChangeSecurityUpdateEnabled': ?canChangeSecurityUpdateEnabled,
'canChangeViewersCanCopyContent': ?canChangeViewersCanCopyContent,
'canComment': ?canComment,
'canCopy': ?canCopy,
'canDelete': ?canDelete,
'canDeleteChildren': ?canDeleteChildren,
'canDisableInheritedPermissions': ?canDisableInheritedPermissions,
'canDownload': ?canDownload,
'canEdit': ?canEdit,
'canEnableInheritedPermissions': ?canEnableInheritedPermissions,
'canListChildren': ?canListChildren,
'canModifyContent': ?canModifyContent,
'canModifyContentRestriction': ?canModifyContentRestriction,
'canModifyEditorContentRestriction': ?canModifyEditorContentRestriction,
'canModifyLabels': ?canModifyLabels,
'canModifyOwnerContentRestriction': ?canModifyOwnerContentRestriction,
'canMoveChildrenOutOfDrive': ?canMoveChildrenOutOfDrive,
'canMoveChildrenOutOfTeamDrive': ?canMoveChildrenOutOfTeamDrive,
'canMoveChildrenWithinDrive': ?canMoveChildrenWithinDrive,
'canMoveChildrenWithinTeamDrive': ?canMoveChildrenWithinTeamDrive,
'canMoveItemIntoTeamDrive': ?canMoveItemIntoTeamDrive,
'canMoveItemOutOfDrive': ?canMoveItemOutOfDrive,
'canMoveItemOutOfTeamDrive': ?canMoveItemOutOfTeamDrive,
'canMoveItemWithinDrive': ?canMoveItemWithinDrive,
'canMoveItemWithinTeamDrive': ?canMoveItemWithinTeamDrive,
'canMoveTeamDriveItem': ?canMoveTeamDriveItem,
'canReadDrive': ?canReadDrive,
'canReadLabels': ?canReadLabels,
'canReadRevisions': ?canReadRevisions,
'canReadTeamDrive': ?canReadTeamDrive,
'canRemoveChildren': ?canRemoveChildren,
'canRemoveContentRestriction': ?canRemoveContentRestriction,
'canRemoveMyDriveParent': ?canRemoveMyDriveParent,
'canRename': ?canRename,
'canShare': ?canShare,
'canTrash': ?canTrash,
'canTrashChildren': ?canTrashChildren,
'canUntrash': ?canUntrash,
};
}
}
/// A thumbnail for the file.
///
/// This will only be used if Google Drive cannot generate a standard thumbnail.
class FileContentHintsThumbnail {
/// The thumbnail data encoded with URL-safe Base64
/// ([RFC 4648 section 5](https://datatracker.ietf.org/doc/html/rfc4648#section-5)).
core.String? image;
core.List<core.int> get imageAsBytes => convert.base64.decode(image!);
set imageAsBytes(core.List<core.int> bytes_) {
image = convert.base64
.encode(bytes_)
.replaceAll('/', '_')
.replaceAll('+', '-');
}
/// The MIME type of the thumbnail.
core.String? mimeType;
FileContentHintsThumbnail({this.image, this.mimeType});
FileContentHintsThumbnail.fromJson(core.Map json_)
: this(
image: json_['image'] as core.String?,
mimeType: json_['mimeType'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final image = this.image;
final mimeType = this.mimeType;
return {'image': ?image, 'mimeType': ?mimeType};
}
}
/// Additional information about the content of the file.
///
/// These fields are never populated in responses.
class FileContentHints {
/// Text to be indexed for the file to improve fullText queries.
///
/// This is limited to 128 KB in length and may contain HTML elements.
core.String? indexableText;
/// A thumbnail for the file.
///
/// This will only be used if Google Drive cannot generate a standard
/// thumbnail.
FileContentHintsThumbnail? thumbnail;
FileContentHints({this.indexableText, this.thumbnail});
FileContentHints.fromJson(core.Map json_)
: this(
indexableText: json_['indexableText'] as core.String?,
thumbnail: json_.containsKey('thumbnail')
? FileContentHintsThumbnail.fromJson(
json_['thumbnail'] as core.Map<core.String, core.dynamic>,
)
: null,
);
core.Map<core.String, core.dynamic> toJson() {
final indexableText = this.indexableText;
final thumbnail = this.thumbnail;
return {'indexableText': ?indexableText, 'thumbnail': ?thumbnail};
}
}
/// Geographic location information stored in the image.
///
/// Output only.
class FileImageMediaMetadataLocation {
/// The altitude stored in the image.
///
/// Output only.
core.double? altitude;
/// The latitude stored in the image.
///
/// Output only.
core.double? latitude;
/// The longitude stored in the image.
///
/// Output only.
core.double? longitude;
FileImageMediaMetadataLocation({
this.altitude,
this.latitude,
this.longitude,
});
FileImageMediaMetadataLocation.fromJson(core.Map json_)
: this(
altitude: (json_['altitude'] as core.num?)?.toDouble(),
latitude: (json_['latitude'] as core.num?)?.toDouble(),
longitude: (json_['longitude'] as core.num?)?.toDouble(),
);
core.Map<core.String, core.dynamic> toJson() {
final altitude = this.altitude;
final latitude = this.latitude;
final longitude = this.longitude;
return {
'altitude': ?altitude,
'latitude': ?latitude,
'longitude': ?longitude,
};
}
}
/// Additional metadata about image media, if available.
///
/// Output only.
class FileImageMediaMetadata {
/// The aperture used to create the photo (f-number).
///
/// Output only.
core.double? aperture;
/// The make of the camera used to create the photo.
///
/// Output only.
core.String? cameraMake;
/// The model of the camera used to create the photo.
///
/// Output only.
core.String? cameraModel;
/// The color space of the photo.
///
/// Output only.
core.String? colorSpace;
/// The exposure bias of the photo (APEX value).
///
/// Output only.
core.double? exposureBias;
/// The exposure mode used to create the photo.
///
/// Output only.
core.String? exposureMode;
/// The length of the exposure, in seconds.
///
/// Output only.
core.double? exposureTime;
/// Whether a flash was used to create the photo.
///
/// Output only.
core.bool? flashUsed;
/// The focal length used to create the photo, in millimeters.
///
/// Output only.
core.double? focalLength;
/// The height of the image in pixels.
///
/// Output only.
core.int? height;
/// The ISO speed used to create the photo.
///
/// Output only.
core.int? isoSpeed;
/// The lens used to create the photo.
///
/// Output only.
core.String? lens;
/// Geographic location information stored in the image.
///
/// Output only.
FileImageMediaMetadataLocation? location;
/// The smallest f-number of the lens at the focal length used to create the
/// photo (APEX value).
///
/// Output only.
core.double? maxApertureValue;
/// The metering mode used to create the photo.
///
/// Output only.
core.String? meteringMode;
/// The number of clockwise 90 degree rotations applied from the image's
/// original orientation.
///
/// Output only.
core.int? rotation;
/// The type of sensor used to create the photo.
///
/// Output only.
core.String? sensor;
/// The distance to the subject of the photo, in meters.
///
/// Output only.
core.int? subjectDistance;
/// The date and time the photo was taken (EXIF DateTime).
///
/// Output only.
core.String? time;
/// The white balance mode used to create the photo.
///
/// Output only.
core.String? whiteBalance;
/// The width of the image in pixels.
///
/// Output only.
core.int? width;
FileImageMediaMetadata({
this.aperture,
this.cameraMake,
this.cameraModel,
this.colorSpace,
this.exposureBias,
this.exposureMode,
this.exposureTime,
this.flashUsed,
this.focalLength,
this.height,
this.isoSpeed,
this.lens,
this.location,
this.maxApertureValue,
this.meteringMode,
this.rotation,
this.sensor,
this.subjectDistance,
this.time,
this.whiteBalance,
this.width,
});
FileImageMediaMetadata.fromJson(core.Map json_)
: this(
aperture: (json_['aperture'] as core.num?)?.toDouble(),
cameraMake: json_['cameraMake'] as core.String?,
cameraModel: json_['cameraModel'] as core.String?,
colorSpace: json_['colorSpace'] as core.String?,
exposureBias: (json_['exposureBias'] as core.num?)?.toDouble(),
exposureMode: json_['exposureMode'] as core.String?,
exposureTime: (json_['exposureTime'] as core.num?)?.toDouble(),
flashUsed: json_['flashUsed'] as core.bool?,
focalLength: (json_['focalLength'] as core.num?)?.toDouble(),
height: json_['height'] as core.int?,
isoSpeed: json_['isoSpeed'] as core.int?,
lens: json_['lens'] as core.String?,
location: json_.containsKey('location')
? FileImageMediaMetadataLocation.fromJson(
json_['location'] as core.Map<core.String, core.dynamic>,
)
: null,
maxApertureValue: (json_['maxApertureValue'] as core.num?)?.toDouble(),
meteringMode: json_['meteringMode'] as core.String?,
rotation: json_['rotation'] as core.int?,
sensor: json_['sensor'] as core.String?,
subjectDistance: json_['subjectDistance'] as core.int?,
time: json_['time'] as core.String?,
whiteBalance: json_['whiteBalance'] as core.String?,
width: json_['width'] as core.int?,
);
core.Map<core.String, core.dynamic> toJson() {
final aperture = this.aperture;
final cameraMake = this.cameraMake;
final cameraModel = this.cameraModel;
final colorSpace = this.colorSpace;
final exposureBias = this.exposureBias;
final exposureMode = this.exposureMode;
final exposureTime = this.exposureTime;
final flashUsed = this.flashUsed;
final focalLength = this.focalLength;
final height = this.height;
final isoSpeed = this.isoSpeed;
final lens = this.lens;
final location = this.location;
final maxApertureValue = this.maxApertureValue;
final meteringMode = this.meteringMode;
final rotation = this.rotation;
final sensor = this.sensor;
final subjectDistance = this.subjectDistance;
final time = this.time;
final whiteBalance = this.whiteBalance;
final width = this.width;
return {
'aperture': ?aperture,
'cameraMake': ?cameraMake,
'cameraModel': ?cameraModel,
'colorSpace': ?colorSpace,
'exposureBias': ?exposureBias,
'exposureMode': ?exposureMode,
'exposureTime': ?exposureTime,
'flashUsed': ?flashUsed,
'focalLength': ?focalLength,
'height': ?height,
'isoSpeed': ?isoSpeed,
'lens': ?lens,
'location': ?location,
'maxApertureValue': ?maxApertureValue,
'meteringMode': ?meteringMode,
'rotation': ?rotation,
'sensor': ?sensor,
'subjectDistance': ?subjectDistance,
'time': ?time,
'whiteBalance': ?whiteBalance,
'width': ?width,
};
}
}
/// An overview of the labels on the file.
///
/// Output only.
class FileLabelInfo {
/// The set of labels on the file as requested by the label IDs in the
/// `includeLabels` parameter.
///
/// By default, no labels are returned.
///
/// Output only.
core.List<Label>? labels;
FileLabelInfo({this.labels});
FileLabelInfo.fromJson(core.Map json_)
: this(
labels: (json_['labels'] as core.List?)
?.map(
(value) =>
Label.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
);
core.Map<core.String, core.dynamic> toJson() {
final labels = this.labels;
return {'labels': ?labels};
}
}
/// Contains details about the link URLs that clients are using to refer to this
/// item.
class FileLinkShareMetadata {
/// Whether the file is eligible for security update.
///
/// Output only.
core.bool? securityUpdateEligible;
/// Whether the security update is enabled for this file.
///
/// Output only.
core.bool? securityUpdateEnabled;
FileLinkShareMetadata({
this.securityUpdateEligible,
this.securityUpdateEnabled,
});
FileLinkShareMetadata.fromJson(core.Map json_)
: this(
securityUpdateEligible: json_['securityUpdateEligible'] as core.bool?,
securityUpdateEnabled: json_['securityUpdateEnabled'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final securityUpdateEligible = this.securityUpdateEligible;
final securityUpdateEnabled = this.securityUpdateEnabled;
return {
'securityUpdateEligible': ?securityUpdateEligible,
'securityUpdateEnabled': ?securityUpdateEnabled,
};
}
}
/// Shortcut file details.
///
/// Only populated for shortcut files, which have the mimeType field set to
/// `application/vnd.google-apps.shortcut`. Can only be set on `files.create`
/// requests.
class FileShortcutDetails {
/// The ID of the file that this shortcut points to.
///
/// Can only be set on `files.create` requests.
core.String? targetId;
/// The MIME type of the file that this shortcut points to.
///
/// The value of this field is a snapshot of the target's MIME type, captured
/// when the shortcut is created.
///
/// Output only.
core.String? targetMimeType;
/// The `resourceKey` for the target file.
///
/// Output only.
core.String? targetResourceKey;
FileShortcutDetails({
this.targetId,
this.targetMimeType,
this.targetResourceKey,
});
FileShortcutDetails.fromJson(core.Map json_)
: this(
targetId: json_['targetId'] as core.String?,
targetMimeType: json_['targetMimeType'] as core.String?,
targetResourceKey: json_['targetResourceKey'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final targetId = this.targetId;
final targetMimeType = this.targetMimeType;
final targetResourceKey = this.targetResourceKey;
return {
'targetId': ?targetId,
'targetMimeType': ?targetMimeType,
'targetResourceKey': ?targetResourceKey,
};
}
}
/// Additional metadata about video media.
///
/// This may not be available immediately upon upload.
///
/// Output only.
class FileVideoMediaMetadata {
/// The duration of the video in milliseconds.
///
/// Output only.
core.String? durationMillis;
/// The height of the video in pixels.
///
/// Output only.
core.int? height;
/// The width of the video in pixels.
///
/// Output only.
core.int? width;
FileVideoMediaMetadata({this.durationMillis, this.height, this.width});
FileVideoMediaMetadata.fromJson(core.Map json_)
: this(
durationMillis: json_['durationMillis'] as core.String?,
height: json_['height'] as core.int?,
width: json_['width'] as core.int?,
);
core.Map<core.String, core.dynamic> toJson() {
final durationMillis = this.durationMillis;
final height = this.height;
final width = this.width;
return {
'durationMillis': ?durationMillis,
'height': ?height,
'width': ?width,
};
}
}
/// The metadata for a file.
///
/// Some resource methods (such as `files.update`) require a `fileId`. Use the
/// `files.list` method to retrieve the ID for a file.
class File {
/// A collection of arbitrary key-value pairs which are private to the
/// requesting app.
/// Entries with null values are cleared in update and copy requests.
///
/// These properties can only be retrieved using an authenticated request. An
/// authenticated request uses an access token obtained with a OAuth 2 client
/// ID. You cannot use an API key to retrieve private properties.
core.Map<core.String, core.String?>? appProperties;
/// Capabilities the current user has on this file.
///
/// Each capability corresponds to a fine-grained action that a user may take.
/// For more information, see
/// [Understand file capabilities](https://developers.google.com/workspace/drive/api/guides/manage-sharing#capabilities).
///
/// Output only.
FileCapabilities? capabilities;
/// Client Side Encryption related details.
///
/// Contains details about the encryption state of the file and details
/// regarding the encryption mechanism that clients need to use when
/// decrypting the contents of this item. This will only be present on files
/// and not on folders or shortcuts.
ClientEncryptionDetails? clientEncryptionDetails;
/// Additional information about the content of the file.
///
/// These fields are never populated in responses.
FileContentHints? contentHints;
/// Restrictions for accessing the content of the file.
///
/// Only populated if such a restriction exists.
core.List<ContentRestriction>? contentRestrictions;
/// Whether the options to copy, print, or download this file should be
/// disabled for readers and commenters.
core.bool? copyRequiresWriterPermission;
/// The time at which the file was created (RFC 3339 date-time).
core.DateTime? createdTime;
/// A short description of the file.
core.String? description;
/// Download restrictions applied on the file.
DownloadRestrictionsMetadata? downloadRestrictions;
/// ID of the shared drive the file resides in.
///
/// Only populated for items in shared drives.
///
/// Output only.
core.String? driveId;
/// Whether the file has been explicitly trashed, as opposed to recursively
/// trashed from a parent folder.
///
/// Output only.
core.bool? explicitlyTrashed;
/// Links for exporting Docs Editors files to specific formats.
///
/// Output only.
core.Map<core.String, core.String>? exportLinks;
/// The final component of `fullFileExtension`.
///
/// This is only available for files with binary content in Google Drive.
///
/// Output only.
core.String? fileExtension;
/// The color for a folder or a shortcut to a folder as an RGB hex string.
///
/// The supported colors are published in the `folderColorPalette` field of
/// the \[`about`\](/workspace/drive/api/reference/rest/v3/about) resource. If
/// an unsupported color is specified, the closest color in the palette is
/// used instead.
core.String? folderColorRgb;
/// The full file extension extracted from the `name` field.
///
/// May contain multiple concatenated extensions, such as "tar.gz". This is
/// only available for files with binary content in Google Drive. This is
/// automatically updated when the `name` field changes, however it's not
/// cleared if the new name doesn't contain a valid extension.
///
/// Output only.
core.String? fullFileExtension;
/// Whether there are permissions directly on this file.
///
/// This field is only populated for items in shared drives.
///
/// Output only.
core.bool? hasAugmentedPermissions;
/// Whether this file has a thumbnail.
///
/// This doesn't indicate whether the requesting app has access to the
/// thumbnail. To check access, look for the presence of the thumbnailLink
/// field.
///
/// Output only.
core.bool? hasThumbnail;
/// The ID of the file's head revision.
///
/// This is currently only available for files with binary content in Google
/// Drive.
///
/// Output only.
core.String? headRevisionId;
/// A static, unauthenticated link to the file's icon.
///
/// Output only.
core.String? iconLink;
/// The ID of the file.
core.String? id;
/// Additional metadata about image media, if available.
///
/// Output only.
FileImageMediaMetadata? imageMediaMetadata;
/// Whether this file has inherited permissions disabled.
///
/// Inherited permissions are enabled by default.
core.bool? inheritedPermissionsDisabled;
/// Whether the file was created or opened by the requesting app.
///
/// Output only.
core.bool? isAppAuthorized;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#file"`.
///
/// Output only.
core.String? kind;
/// An overview of the labels on the file.
///
/// Output only.
FileLabelInfo? labelInfo;
/// The last user to modify the file.
///
/// This field is only populated when the last modification was performed by a
/// signed-in user.
///
/// Output only.
User? lastModifyingUser;
/// Contains details about the link URLs that clients are using to refer to
/// this item.
FileLinkShareMetadata? linkShareMetadata;
/// The MD5 checksum for the content of the file.
///
/// This is only applicable to files with binary content in Google Drive.
///
/// Output only.
core.String? md5Checksum;
/// The MIME type of the file.
///
/// Google Drive attempts to automatically detect an appropriate value from
/// uploaded content, if no value is provided. The value cannot be changed
/// unless a new revision is uploaded. If a file is created with a Google Doc
/// MIME type, the uploaded content is imported, if possible. The supported
/// import formats are published in the
/// \[`about`\](/workspace/drive/api/reference/rest/v3/about) resource.
core.String? mimeType;
/// Whether the file has been modified by this user.
///
/// Output only.
core.bool? modifiedByMe;
/// The last time the file was modified by the user (RFC 3339 date-time).
core.DateTime? modifiedByMeTime;
/// he last time the file was modified by anyone (RFC 3339 date-time).
///
/// Note that setting modifiedTime will also update modifiedByMeTime for the
/// user.
core.DateTime? modifiedTime;
/// The name of the file.
///
/// This isn't necessarily unique within a folder. Note that for immutable
/// items such as the top-level folders of shared drives, the My Drive root
/// folder, and the Application Data folder, the name is constant.
core.String? name;
/// The original filename of the uploaded content if available, or else the
/// original value of the `name` field.
///
/// This is only available for files with binary content in Google Drive.
core.String? originalFilename;
/// Whether the user owns the file.
///
/// Not populated for items in shared drives.
///
/// Output only.
core.bool? ownedByMe;
/// The owner of this file.
///
/// Only certain legacy files may have more than one owner. This field isn't
/// populated for items in shared drives.
///
/// Output only.
core.List<User>? owners;
/// The ID of the parent folder containing the file.
///
/// A file can only have one parent folder; specifying multiple parents isn't
/// supported. If not specified as part of a create request, the file is
/// placed directly in the user's My Drive folder. If not specified as part of
/// a copy request, the file inherits any discoverable parent of the source
/// file. Update requests must use the `addParents` and `removeParents`
/// parameters to modify the parents list.
core.List<core.String>? parents;
/// List of permission IDs for users with access to this file.
///
/// Output only.
core.List<core.String>? permissionIds;
/// The full list of permissions for the file.
///
/// This is only available if the requesting user can share the file. Not
/// populated for items in shared drives.
///
/// Output only.
core.List<Permission>? permissions;
/// A collection of arbitrary key-value pairs which are visible to all apps.
/// Entries with null values are cleared in update and copy requests.
core.Map<core.String, core.String?>? properties;
/// The number of storage quota bytes used by the file.
///
/// This includes the head revision as well as previous revisions with
/// `keepForever` enabled.
///
/// Output only.
core.String? quotaBytesUsed;
/// A key needed to access the item via a shared link.
///
/// Output only.
core.String? resourceKey;
/// The SHA1 checksum associated with this file, if available.
///
/// This field is only populated for files with content stored in Google
/// Drive; it's not populated for Docs Editors or shortcut files.
///
/// Output only.
core.String? sha1Checksum;
/// The SHA256 checksum associated with this file, if available.
///
/// This field is only populated for files with content stored in Google
/// Drive; it's not populated for Docs Editors or shortcut files.
///
/// Output only.
core.String? sha256Checksum;
/// Whether the file has been shared.
///
/// Not populated for items in shared drives.
///
/// Output only.
core.bool? shared;
/// The time at which the file was shared with the user, if applicable (RFC
/// 3339 date-time).
core.DateTime? sharedWithMeTime;
/// The user who shared the file with the requesting user, if applicable.
///
/// Output only.
User? sharingUser;
/// Shortcut file details.
///
/// Only populated for shortcut files, which have the mimeType field set to
/// `application/vnd.google-apps.shortcut`. Can only be set on `files.create`
/// requests.
FileShortcutDetails? shortcutDetails;
/// Size in bytes of blobs and Google Workspace editor files.
///
/// Won't be populated for files that have no size, like shortcuts and
/// folders.
///
/// Output only.
core.String? size;
/// The list of spaces which contain the file.
///
/// The currently supported values are `drive`, `appDataFolder`, and `photos`.
///
/// Output only.
core.List<core.String>? spaces;
/// Whether the user has starred the file.
core.bool? starred;
/// Deprecated: Output only.
///
/// Use `driveId` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? teamDriveId;
/// A short-lived link to the file's thumbnail, if available.
///
/// Typically lasts on the order of hours. Not intended for direct usage on
/// web applications due to \[Cross-Origin Resource Sharing
/// (CORS)\](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) policies.
/// Consider using a proxy server. Only populated when the requesting app can
/// access the file's content. If the file isn't shared publicly, the URL
/// returned in `files.thumbnailLink` must be fetched using a credentialed
/// request.
///
/// Output only.
core.String? thumbnailLink;
/// The thumbnail version for use in thumbnail cache invalidation.
///
/// Output only.
core.String? thumbnailVersion;
/// Whether the file has been trashed, either explicitly or from a trashed
/// parent folder.
///
/// Only the owner may trash a file, but other users can still access the file
/// in the owner's trash until it's permanently deleted.
core.bool? trashed;
/// The time that the item was trashed (RFC 3339 date-time).
///
/// Only populated for items in shared drives.
core.DateTime? trashedTime;
/// If the file has been explicitly trashed, the user who trashed it.
///
/// Only populated for items in shared drives.
///
/// Output only.
User? trashingUser;
/// A monotonically increasing version number for the file.
///
/// This reflects every change made to the file on the server, even those not
/// visible to the user.
///
/// Output only.
core.String? version;
/// Additional metadata about video media.
///
/// This may not be available immediately upon upload.
///
/// Output only.
FileVideoMediaMetadata? videoMediaMetadata;
/// Whether the file has been viewed by this user.
///
/// Output only.
core.bool? viewedByMe;
/// The last time the file was viewed by the user (RFC 3339 date-time).
core.DateTime? viewedByMeTime;
/// Deprecated: Use `copyRequiresWriterPermission` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? viewersCanCopyContent;
/// A link for downloading the content of the file in a browser.
///
/// This is only available for files with binary content in Google Drive.
///
/// Output only.
core.String? webContentLink;
/// A link for opening the file in a relevant Google editor or viewer in a
/// browser.
///
/// Output only.
core.String? webViewLink;
/// Whether users with only `writer` permission can modify the file's
/// permissions.
///
/// Not populated for items in shared drives.
core.bool? writersCanShare;
File({
this.appProperties,
this.capabilities,
this.clientEncryptionDetails,
this.contentHints,
this.contentRestrictions,
this.copyRequiresWriterPermission,
this.createdTime,
this.description,
this.downloadRestrictions,
this.driveId,
this.explicitlyTrashed,
this.exportLinks,
this.fileExtension,
this.folderColorRgb,
this.fullFileExtension,
this.hasAugmentedPermissions,
this.hasThumbnail,
this.headRevisionId,
this.iconLink,
this.id,
this.imageMediaMetadata,
this.inheritedPermissionsDisabled,
this.isAppAuthorized,
this.kind,
this.labelInfo,
this.lastModifyingUser,
this.linkShareMetadata,
this.md5Checksum,
this.mimeType,
this.modifiedByMe,
this.modifiedByMeTime,
this.modifiedTime,
this.name,
this.originalFilename,
this.ownedByMe,
this.owners,
this.parents,
this.permissionIds,
this.permissions,
this.properties,
this.quotaBytesUsed,
this.resourceKey,
this.sha1Checksum,
this.sha256Checksum,
this.shared,
this.sharedWithMeTime,
this.sharingUser,
this.shortcutDetails,
this.size,
this.spaces,
this.starred,
this.teamDriveId,
this.thumbnailLink,
this.thumbnailVersion,
this.trashed,
this.trashedTime,
this.trashingUser,
this.version,
this.videoMediaMetadata,
this.viewedByMe,
this.viewedByMeTime,
this.viewersCanCopyContent,
this.webContentLink,
this.webViewLink,
this.writersCanShare,
});
File.fromJson(core.Map json_)
: this(
appProperties:
(json_['appProperties'] as core.Map<core.String, core.dynamic>?)
?.map(
(key, value) => core.MapEntry(key, value as core.String?),
),
capabilities: json_.containsKey('capabilities')
? FileCapabilities.fromJson(
json_['capabilities'] as core.Map<core.String, core.dynamic>,
)
: null,
clientEncryptionDetails: json_.containsKey('clientEncryptionDetails')
? ClientEncryptionDetails.fromJson(
json_['clientEncryptionDetails']
as core.Map<core.String, core.dynamic>,
)
: null,
contentHints: json_.containsKey('contentHints')
? FileContentHints.fromJson(
json_['contentHints'] as core.Map<core.String, core.dynamic>,
)
: null,
contentRestrictions: (json_['contentRestrictions'] as core.List?)
?.map(
(value) => ContentRestriction.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
copyRequiresWriterPermission:
json_['copyRequiresWriterPermission'] as core.bool?,
createdTime: json_.containsKey('createdTime')
? core.DateTime.parse(json_['createdTime'] as core.String)
: null,
description: json_['description'] as core.String?,
downloadRestrictions: json_.containsKey('downloadRestrictions')
? DownloadRestrictionsMetadata.fromJson(
json_['downloadRestrictions']
as core.Map<core.String, core.dynamic>,
)
: null,
driveId: json_['driveId'] as core.String?,
explicitlyTrashed: json_['explicitlyTrashed'] as core.bool?,
exportLinks:
(json_['exportLinks'] as core.Map<core.String, core.dynamic>?)?.map(
(key, value) => core.MapEntry(key, value as core.String),
),
fileExtension: json_['fileExtension'] as core.String?,
folderColorRgb: json_['folderColorRgb'] as core.String?,
fullFileExtension: json_['fullFileExtension'] as core.String?,
hasAugmentedPermissions: json_['hasAugmentedPermissions'] as core.bool?,
hasThumbnail: json_['hasThumbnail'] as core.bool?,
headRevisionId: json_['headRevisionId'] as core.String?,
iconLink: json_['iconLink'] as core.String?,
id: json_['id'] as core.String?,
imageMediaMetadata: json_.containsKey('imageMediaMetadata')
? FileImageMediaMetadata.fromJson(
json_['imageMediaMetadata']
as core.Map<core.String, core.dynamic>,
)
: null,
inheritedPermissionsDisabled:
json_['inheritedPermissionsDisabled'] as core.bool?,
isAppAuthorized: json_['isAppAuthorized'] as core.bool?,
kind: json_['kind'] as core.String?,
labelInfo: json_.containsKey('labelInfo')
? FileLabelInfo.fromJson(
json_['labelInfo'] as core.Map<core.String, core.dynamic>,
)
: null,
lastModifyingUser: json_.containsKey('lastModifyingUser')
? User.fromJson(
json_['lastModifyingUser']
as core.Map<core.String, core.dynamic>,
)
: null,
linkShareMetadata: json_.containsKey('linkShareMetadata')
? FileLinkShareMetadata.fromJson(
json_['linkShareMetadata']
as core.Map<core.String, core.dynamic>,
)
: null,
md5Checksum: json_['md5Checksum'] as core.String?,
mimeType: json_['mimeType'] as core.String?,
modifiedByMe: json_['modifiedByMe'] as core.bool?,
modifiedByMeTime: json_.containsKey('modifiedByMeTime')
? core.DateTime.parse(json_['modifiedByMeTime'] as core.String)
: null,
modifiedTime: json_.containsKey('modifiedTime')
? core.DateTime.parse(json_['modifiedTime'] as core.String)
: null,
name: json_['name'] as core.String?,
originalFilename: json_['originalFilename'] as core.String?,
ownedByMe: json_['ownedByMe'] as core.bool?,
owners: (json_['owners'] as core.List?)
?.map(
(value) =>
User.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
parents: (json_['parents'] as core.List?)
?.map((value) => value as core.String)
.toList(),
permissionIds: (json_['permissionIds'] as core.List?)
?.map((value) => value as core.String)
.toList(),
permissions: (json_['permissions'] as core.List?)
?.map(
(value) => Permission.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
properties:
(json_['properties'] as core.Map<core.String, core.dynamic>?)?.map(
(key, value) => core.MapEntry(key, value as core.String?),
),
quotaBytesUsed: json_['quotaBytesUsed'] as core.String?,
resourceKey: json_['resourceKey'] as core.String?,
sha1Checksum: json_['sha1Checksum'] as core.String?,
sha256Checksum: json_['sha256Checksum'] as core.String?,
shared: json_['shared'] as core.bool?,
sharedWithMeTime: json_.containsKey('sharedWithMeTime')
? core.DateTime.parse(json_['sharedWithMeTime'] as core.String)
: null,
sharingUser: json_.containsKey('sharingUser')
? User.fromJson(
json_['sharingUser'] as core.Map<core.String, core.dynamic>,
)
: null,
shortcutDetails: json_.containsKey('shortcutDetails')
? FileShortcutDetails.fromJson(
json_['shortcutDetails'] as core.Map<core.String, core.dynamic>,
)
: null,
size: json_['size'] as core.String?,
spaces: (json_['spaces'] as core.List?)
?.map((value) => value as core.String)
.toList(),
starred: json_['starred'] as core.bool?,
teamDriveId: json_['teamDriveId'] as core.String?,
thumbnailLink: json_['thumbnailLink'] as core.String?,
thumbnailVersion: json_['thumbnailVersion'] as core.String?,
trashed: json_['trashed'] as core.bool?,
trashedTime: json_.containsKey('trashedTime')
? core.DateTime.parse(json_['trashedTime'] as core.String)
: null,
trashingUser: json_.containsKey('trashingUser')
? User.fromJson(
json_['trashingUser'] as core.Map<core.String, core.dynamic>,
)
: null,
version: json_['version'] as core.String?,
videoMediaMetadata: json_.containsKey('videoMediaMetadata')
? FileVideoMediaMetadata.fromJson(
json_['videoMediaMetadata']
as core.Map<core.String, core.dynamic>,
)
: null,
viewedByMe: json_['viewedByMe'] as core.bool?,
viewedByMeTime: json_.containsKey('viewedByMeTime')
? core.DateTime.parse(json_['viewedByMeTime'] as core.String)
: null,
viewersCanCopyContent: json_['viewersCanCopyContent'] as core.bool?,
webContentLink: json_['webContentLink'] as core.String?,
webViewLink: json_['webViewLink'] as core.String?,
writersCanShare: json_['writersCanShare'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final appProperties = this.appProperties;
final capabilities = this.capabilities;
final clientEncryptionDetails = this.clientEncryptionDetails;
final contentHints = this.contentHints;
final contentRestrictions = this.contentRestrictions;
final copyRequiresWriterPermission = this.copyRequiresWriterPermission;
final createdTime = this.createdTime;
final description = this.description;
final downloadRestrictions = this.downloadRestrictions;
final driveId = this.driveId;
final explicitlyTrashed = this.explicitlyTrashed;
final exportLinks = this.exportLinks;
final fileExtension = this.fileExtension;
final folderColorRgb = this.folderColorRgb;
final fullFileExtension = this.fullFileExtension;
final hasAugmentedPermissions = this.hasAugmentedPermissions;
final hasThumbnail = this.hasThumbnail;
final headRevisionId = this.headRevisionId;
final iconLink = this.iconLink;
final id = this.id;
final imageMediaMetadata = this.imageMediaMetadata;
final inheritedPermissionsDisabled = this.inheritedPermissionsDisabled;
final isAppAuthorized = this.isAppAuthorized;
final kind = this.kind;
final labelInfo = this.labelInfo;
final lastModifyingUser = this.lastModifyingUser;
final linkShareMetadata = this.linkShareMetadata;
final md5Checksum = this.md5Checksum;
final mimeType = this.mimeType;
final modifiedByMe = this.modifiedByMe;
final modifiedByMeTime = this.modifiedByMeTime;
final modifiedTime = this.modifiedTime;
final name = this.name;
final originalFilename = this.originalFilename;
final ownedByMe = this.ownedByMe;
final owners = this.owners;
final parents = this.parents;
final permissionIds = this.permissionIds;
final permissions = this.permissions;
final properties = this.properties;
final quotaBytesUsed = this.quotaBytesUsed;
final resourceKey = this.resourceKey;
final sha1Checksum = this.sha1Checksum;
final sha256Checksum = this.sha256Checksum;
final shared = this.shared;
final sharedWithMeTime = this.sharedWithMeTime;
final sharingUser = this.sharingUser;
final shortcutDetails = this.shortcutDetails;
final size = this.size;
final spaces = this.spaces;
final starred = this.starred;
final teamDriveId = this.teamDriveId;
final thumbnailLink = this.thumbnailLink;
final thumbnailVersion = this.thumbnailVersion;
final trashed = this.trashed;
final trashedTime = this.trashedTime;
final trashingUser = this.trashingUser;
final version = this.version;
final videoMediaMetadata = this.videoMediaMetadata;
final viewedByMe = this.viewedByMe;
final viewedByMeTime = this.viewedByMeTime;
final viewersCanCopyContent = this.viewersCanCopyContent;
final webContentLink = this.webContentLink;
final webViewLink = this.webViewLink;
final writersCanShare = this.writersCanShare;
return {
'appProperties': ?appProperties,
'capabilities': ?capabilities,
'clientEncryptionDetails': ?clientEncryptionDetails,
'contentHints': ?contentHints,
'contentRestrictions': ?contentRestrictions,
'copyRequiresWriterPermission': ?copyRequiresWriterPermission,
'createdTime': ?createdTime?.toUtc().toIso8601String(),
'description': ?description,
'downloadRestrictions': ?downloadRestrictions,
'driveId': ?driveId,
'explicitlyTrashed': ?explicitlyTrashed,
'exportLinks': ?exportLinks,
'fileExtension': ?fileExtension,
'folderColorRgb': ?folderColorRgb,
'fullFileExtension': ?fullFileExtension,
'hasAugmentedPermissions': ?hasAugmentedPermissions,
'hasThumbnail': ?hasThumbnail,
'headRevisionId': ?headRevisionId,
'iconLink': ?iconLink,
'id': ?id,
'imageMediaMetadata': ?imageMediaMetadata,
'inheritedPermissionsDisabled': ?inheritedPermissionsDisabled,
'isAppAuthorized': ?isAppAuthorized,
'kind': ?kind,
'labelInfo': ?labelInfo,
'lastModifyingUser': ?lastModifyingUser,
'linkShareMetadata': ?linkShareMetadata,
'md5Checksum': ?md5Checksum,
'mimeType': ?mimeType,
'modifiedByMe': ?modifiedByMe,
'modifiedByMeTime': ?modifiedByMeTime?.toUtc().toIso8601String(),
'modifiedTime': ?modifiedTime?.toUtc().toIso8601String(),
'name': ?name,
'originalFilename': ?originalFilename,
'ownedByMe': ?ownedByMe,
'owners': ?owners,
'parents': ?parents,
'permissionIds': ?permissionIds,
'permissions': ?permissions,
'properties': ?properties,
'quotaBytesUsed': ?quotaBytesUsed,
'resourceKey': ?resourceKey,
'sha1Checksum': ?sha1Checksum,
'sha256Checksum': ?sha256Checksum,
'shared': ?shared,
'sharedWithMeTime': ?sharedWithMeTime?.toUtc().toIso8601String(),
'sharingUser': ?sharingUser,
'shortcutDetails': ?shortcutDetails,
'size': ?size,
'spaces': ?spaces,
'starred': ?starred,
'teamDriveId': ?teamDriveId,
'thumbnailLink': ?thumbnailLink,
'thumbnailVersion': ?thumbnailVersion,
'trashed': ?trashed,
'trashedTime': ?trashedTime?.toUtc().toIso8601String(),
'trashingUser': ?trashingUser,
'version': ?version,
'videoMediaMetadata': ?videoMediaMetadata,
'viewedByMe': ?viewedByMe,
'viewedByMeTime': ?viewedByMeTime?.toUtc().toIso8601String(),
'viewersCanCopyContent': ?viewersCanCopyContent,
'webContentLink': ?webContentLink,
'webViewLink': ?webViewLink,
'writersCanShare': ?writersCanShare,
};
}
}
/// A list of files.
class FileList {
/// The list of files.
///
/// If `nextPageToken` is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<File>? files;
/// Whether the search process was incomplete.
///
/// If true, then some search results might be missing, since all documents
/// were not searched. This can occur when searching multiple drives with the
/// `allDrives` corpora, but all corpora couldn't be searched. When this
/// happens, it's suggested that clients narrow their query by choosing a
/// different corpus such as `user` or `drive`.
core.bool? incompleteSearch;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#fileList"`.
core.String? kind;
/// The page token for the next page of files.
///
/// This will be absent if the end of the files list has been reached. If the
/// token is rejected for any reason, it should be discarded, and pagination
/// should be restarted from the first page of results. The page token is
/// typically valid for several hours. However, if new items are added or
/// removed, your expected results might differ.
core.String? nextPageToken;
FileList({this.files, this.incompleteSearch, this.kind, this.nextPageToken});
FileList.fromJson(core.Map json_)
: this(
files: (json_['files'] as core.List?)
?.map(
(value) =>
File.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
incompleteSearch: json_['incompleteSearch'] as core.bool?,
kind: json_['kind'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final files = this.files;
final incompleteSearch = this.incompleteSearch;
final kind = this.kind;
final nextPageToken = this.nextPageToken;
return {
'files': ?files,
'incompleteSearch': ?incompleteSearch,
'kind': ?kind,
'nextPageToken': ?nextPageToken,
};
}
}
/// JWT and associated metadata used to generate CSE files.
typedef GenerateCseTokenResponse = $GenerateCseTokenResponse;
/// A list of generated file IDs which can be provided in create requests.
class GeneratedIds {
/// The IDs generated for the requesting user in the specified space.
core.List<core.String>? ids;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#generatedIds"`.
core.String? kind;
/// The type of file that can be created with these IDs.
core.String? space;
GeneratedIds({this.ids, this.kind, this.space});
GeneratedIds.fromJson(core.Map json_)
: this(
ids: (json_['ids'] as core.List?)
?.map((value) => value as core.String)
.toList(),
kind: json_['kind'] as core.String?,
space: json_['space'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final ids = this.ids;
final kind = this.kind;
final space = this.space;
return {'ids': ?ids, 'kind': ?kind, 'space': ?space};
}
}
/// Representation of label and label fields.
class Label {
/// A map of the fields on the label, keyed by the field's ID.
core.Map<core.String, LabelField>? fields;
/// The ID of the label.
core.String? id;
/// This is always drive#label
core.String? kind;
/// The revision ID of the label.
core.String? revisionId;
Label({this.fields, this.id, this.kind, this.revisionId});
Label.fromJson(core.Map json_)
: this(
fields: (json_['fields'] as core.Map<core.String, core.dynamic>?)?.map(
(key, value) => core.MapEntry(
key,
LabelField.fromJson(value as core.Map<core.String, core.dynamic>),
),
),
id: json_['id'] as core.String?,
kind: json_['kind'] as core.String?,
revisionId: json_['revisionId'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final fields = this.fields;
final id = this.id;
final kind = this.kind;
final revisionId = this.revisionId;
return {
'fields': ?fields,
'id': ?id,
'kind': ?kind,
'revisionId': ?revisionId,
};
}
}
/// Representation of field, which is a typed key-value pair.
class LabelField {
/// Only present if valueType is dateString.
///
/// RFC 3339 formatted date: YYYY-MM-DD.
core.List<core.DateTime>? dateString;
/// The identifier of this label field.
core.String? id;
/// Only present if `valueType` is `integer`.
core.List<core.String>? integer;
/// This is always drive#labelField.
core.String? kind;
/// Only present if `valueType` is `selection`
core.List<core.String>? selection;
/// Only present if `valueType` is `text`.
core.List<core.String>? text;
/// Only present if `valueType` is `user`.
core.List<User>? user;
/// The field type.
///
/// While new values may be supported in the future, the following are
/// currently allowed: * `dateString` * `integer` * `selection` * `text` *
/// `user`
core.String? valueType;
LabelField({
this.dateString,
this.id,
this.integer,
this.kind,
this.selection,
this.text,
this.user,
this.valueType,
});
LabelField.fromJson(core.Map json_)
: this(
dateString: (json_['dateString'] as core.List?)
?.map((value) => core.DateTime.parse(value as core.String))
.toList(),
id: json_['id'] as core.String?,
integer: (json_['integer'] as core.List?)
?.map((value) => value as core.String)
.toList(),
kind: json_['kind'] as core.String?,
selection: (json_['selection'] as core.List?)
?.map((value) => value as core.String)
.toList(),
text: (json_['text'] as core.List?)
?.map((value) => value as core.String)
.toList(),
user: (json_['user'] as core.List?)
?.map(
(value) =>
User.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
valueType: json_['valueType'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final dateString = this.dateString;
final id = this.id;
final integer = this.integer;
final kind = this.kind;
final selection = this.selection;
final text = this.text;
final user = this.user;
final valueType = this.valueType;
return {
'dateString': ?dateString
?.map(
(value) =>
"${value.year.toString().padLeft(4, '0')}-${value.month.toString().padLeft(2, '0')}-${value.day.toString().padLeft(2, '0')}",
)
.toList(),
'id': ?id,
'integer': ?integer,
'kind': ?kind,
'selection': ?selection,
'text': ?text,
'user': ?user,
'valueType': ?valueType,
};
}
}
/// A modification to a label's field.
class LabelFieldModification {
/// The ID of the field to be modified.
core.String? fieldId;
/// This is always `"drive#labelFieldModification"`.
core.String? kind;
/// Replaces the value of a dateString Field with these new values.
///
/// The string must be in the RFC 3339 full-date format: YYYY-MM-DD.
core.List<core.DateTime>? setDateValues;
/// Replaces the value of an `integer` field with these new values.
core.List<core.String>? setIntegerValues;
/// Replaces a `selection` field with these new values.
core.List<core.String>? setSelectionValues;
/// Sets the value of a `text` field.
core.List<core.String>? setTextValues;
/// Replaces a `user` field with these new values.
///
/// The values must be a valid email addresses.
core.List<core.String>? setUserValues;
/// Unsets the values for this field.
core.bool? unsetValues;
LabelFieldModification({
this.fieldId,
this.kind,
this.setDateValues,
this.setIntegerValues,
this.setSelectionValues,
this.setTextValues,
this.setUserValues,
this.unsetValues,
});
LabelFieldModification.fromJson(core.Map json_)
: this(
fieldId: json_['fieldId'] as core.String?,
kind: json_['kind'] as core.String?,
setDateValues: (json_['setDateValues'] as core.List?)
?.map((value) => core.DateTime.parse(value as core.String))
.toList(),
setIntegerValues: (json_['setIntegerValues'] as core.List?)
?.map((value) => value as core.String)
.toList(),
setSelectionValues: (json_['setSelectionValues'] as core.List?)
?.map((value) => value as core.String)
.toList(),
setTextValues: (json_['setTextValues'] as core.List?)
?.map((value) => value as core.String)
.toList(),
setUserValues: (json_['setUserValues'] as core.List?)
?.map((value) => value as core.String)
.toList(),
unsetValues: json_['unsetValues'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final fieldId = this.fieldId;
final kind = this.kind;
final setDateValues = this.setDateValues;
final setIntegerValues = this.setIntegerValues;
final setSelectionValues = this.setSelectionValues;
final setTextValues = this.setTextValues;
final setUserValues = this.setUserValues;
final unsetValues = this.unsetValues;
return {
'fieldId': ?fieldId,
'kind': ?kind,
'setDateValues': ?setDateValues
?.map(
(value) =>
"${value.year.toString().padLeft(4, '0')}-${value.month.toString().padLeft(2, '0')}-${value.day.toString().padLeft(2, '0')}",
)
.toList(),
'setIntegerValues': ?setIntegerValues,
'setSelectionValues': ?setSelectionValues,
'setTextValues': ?setTextValues,
'setUserValues': ?setUserValues,
'unsetValues': ?unsetValues,
};
}
}
/// A list of labels applied to a file.
class LabelList {
/// This is always `"drive#labelList"`.
core.String? kind;
/// The list of labels.
core.List<Label>? labels;
/// The page token for the next page of labels.
///
/// This field will be absent if the end of the list has been reached. If the
/// token is rejected for any reason, it should be discarded, and pagination
/// should be restarted from the first page of results. The page token is
/// typically valid for several hours. However, if new items are added or
/// removed, your expected results might differ.
core.String? nextPageToken;
LabelList({this.kind, this.labels, this.nextPageToken});
LabelList.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
labels: (json_['labels'] as core.List?)
?.map(
(value) =>
Label.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
nextPageToken: json_['nextPageToken'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final labels = this.labels;
final nextPageToken = this.nextPageToken;
return {'kind': ?kind, 'labels': ?labels, 'nextPageToken': ?nextPageToken};
}
}
/// A modification to a label on a file.
///
/// A `LabelModification` can be used to apply a label to a file, update an
/// existing label on a file, or remove a label from a file.
class LabelModification {
/// The list of modifications to this label's fields.
core.List<LabelFieldModification>? fieldModifications;
/// This is always `"drive#labelModification"`.
core.String? kind;
/// The ID of the label to modify.
core.String? labelId;
/// If true, the label will be removed from the file.
core.bool? removeLabel;
LabelModification({
this.fieldModifications,
this.kind,
this.labelId,
this.removeLabel,
});
LabelModification.fromJson(core.Map json_)
: this(
fieldModifications: (json_['fieldModifications'] as core.List?)
?.map(
(value) => LabelFieldModification.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
kind: json_['kind'] as core.String?,
labelId: json_['labelId'] as core.String?,
removeLabel: json_['removeLabel'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final fieldModifications = this.fieldModifications;
final kind = this.kind;
final labelId = this.labelId;
final removeLabel = this.removeLabel;
return {
'fieldModifications': ?fieldModifications,
'kind': ?kind,
'labelId': ?labelId,
'removeLabel': ?removeLabel,
};
}
}
/// The response to an access proposal list request.
class ListAccessProposalsResponse {
/// The list of access proposals.
///
/// This field is only populated in Drive API v3.
core.List<AccessProposal>? accessProposals;
/// The continuation token for the next page of results.
///
/// This will be absent if the end of the results list has been reached. If
/// the token is rejected for any reason, it should be discarded, and
/// pagination should be restarted from the first page of results.
core.String? nextPageToken;
ListAccessProposalsResponse({this.accessProposals, this.nextPageToken});
ListAccessProposalsResponse.fromJson(core.Map json_)
: this(
accessProposals: (json_['accessProposals'] as core.List?)
?.map(
(value) => AccessProposal.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
nextPageToken: json_['nextPageToken'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final accessProposals = this.accessProposals;
final nextPageToken = this.nextPageToken;
return {
'accessProposals': ?accessProposals,
'nextPageToken': ?nextPageToken,
};
}
}
/// A request to modify the set of labels on a file.
///
/// This request may contain many modifications that will either all succeed or
/// all fail atomically.
class ModifyLabelsRequest {
/// This is always `"drive#modifyLabelsRequest"`.
core.String? kind;
/// The list of modifications to apply to the labels on the file.
core.List<LabelModification>? labelModifications;
ModifyLabelsRequest({this.kind, this.labelModifications});
ModifyLabelsRequest.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
labelModifications: (json_['labelModifications'] as core.List?)
?.map(
(value) => LabelModification.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final labelModifications = this.labelModifications;
return {'kind': ?kind, 'labelModifications': ?labelModifications};
}
}
/// Response to a `ModifyLabels` request.
///
/// This contains only those labels which were added or updated by the request.
class ModifyLabelsResponse {
/// This is always `"drive#modifyLabelsResponse"`.
core.String? kind;
/// The list of labels which were added or updated by the request.
core.List<Label>? modifiedLabels;
ModifyLabelsResponse({this.kind, this.modifiedLabels});
ModifyLabelsResponse.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
modifiedLabels: (json_['modifiedLabels'] as core.List?)
?.map(
(value) =>
Label.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final modifiedLabels = this.modifiedLabels;
return {'kind': ?kind, 'modifiedLabels': ?modifiedLabels};
}
}
/// This resource represents a long-running operation that is the result of a
/// network API call.
class Operation {
/// If the value is `false`, it means the operation is still in progress.
///
/// If `true`, the operation is completed, and either `error` or `response` is
/// available.
core.bool? done;
/// The error result of the operation in case of failure or cancellation.
Status? error;
/// Service-specific metadata associated with the operation.
///
/// It typically contains progress information and common metadata such as
/// create time. Some services might not provide such metadata. Any method
/// that returns a long-running operation should document the metadata type,
/// if any.
///
/// The values for Object must be JSON objects. It can consist of `num`,
/// `String`, `bool` and `null` as well as `Map` and `List` values.
core.Map<core.String, core.Object?>? metadata;
/// The server-assigned name, which is only unique within the same service
/// that originally returns it.
///
/// If you use the default HTTP mapping, the `name` should be a resource name
/// ending with `operations/{unique_id}`.
core.String? name;
/// The normal, successful response of the operation.
///
/// If the original method returns no data on success, such as `Delete`, the
/// response is `google.protobuf.Empty`. If the original method is standard
/// `Get`/`Create`/`Update`, the response should be the resource. For other
/// methods, the response should have the type `XxxResponse`, where `Xxx` is
/// the original method name. For example, if the original method name is
/// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
///
/// The values for Object must be JSON objects. It can consist of `num`,
/// `String`, `bool` and `null` as well as `Map` and `List` values.
core.Map<core.String, core.Object?>? response;
Operation({this.done, this.error, this.metadata, this.name, this.response});
Operation.fromJson(core.Map json_)
: this(
done: json_['done'] as core.bool?,
error: json_.containsKey('error')
? Status.fromJson(
json_['error'] as core.Map<core.String, core.dynamic>,
)
: null,
metadata: json_.containsKey('metadata')
? json_['metadata'] as core.Map<core.String, core.dynamic>
: null,
name: json_['name'] as core.String?,
response: json_.containsKey('response')
? json_['response'] as core.Map<core.String, core.dynamic>
: null,
);
core.Map<core.String, core.dynamic> toJson() {
final done = this.done;
final error = this.error;
final metadata = this.metadata;
final name = this.name;
final response = this.response;
return {
'done': ?done,
'error': ?error,
'metadata': ?metadata,
'name': ?name,
'response': ?response,
};
}
}
class PermissionPermissionDetails {
/// Whether this permission is inherited.
///
/// This field is always populated. This is an output-only field.
///
/// Output only.
core.bool? inherited;
/// The ID of the item from which this permission is inherited.
///
/// This is only populated for items in shared drives.
///
/// Output only.
core.String? inheritedFrom;
/// The permission type for this user.
///
/// Supported values include: * `file` * `member`
///
/// Output only.
core.String? permissionType;
/// The primary role for this user.
///
/// Supported values include: * `owner` * `organizer` * `fileOrganizer` *
/// `writer` * `commenter` * `reader` For more information, see
/// [Roles and permissions](https://developers.google.com/workspace/drive/api/guides/ref-roles).
///
/// Output only.
core.String? role;
PermissionPermissionDetails({
this.inherited,
this.inheritedFrom,
this.permissionType,
this.role,
});
PermissionPermissionDetails.fromJson(core.Map json_)
: this(
inherited: json_['inherited'] as core.bool?,
inheritedFrom: json_['inheritedFrom'] as core.String?,
permissionType: json_['permissionType'] as core.String?,
role: json_['role'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final inherited = this.inherited;
final inheritedFrom = this.inheritedFrom;
final permissionType = this.permissionType;
final role = this.role;
return {
'inherited': ?inherited,
'inheritedFrom': ?inheritedFrom,
'permissionType': ?permissionType,
'role': ?role,
};
}
}
class PermissionTeamDrivePermissionDetails {
/// Deprecated: Output only.
///
/// Use `permissionDetails/inherited` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? inherited;
/// Deprecated: Output only.
///
/// Use `permissionDetails/inheritedFrom` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? inheritedFrom;
/// Deprecated: Output only.
///
/// Use `permissionDetails/role` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? role;
/// Deprecated: Output only.
///
/// Use `permissionDetails/permissionType` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.String? teamDrivePermissionType;
PermissionTeamDrivePermissionDetails({
this.inherited,
this.inheritedFrom,
this.role,
this.teamDrivePermissionType,
});
PermissionTeamDrivePermissionDetails.fromJson(core.Map json_)
: this(
inherited: json_['inherited'] as core.bool?,
inheritedFrom: json_['inheritedFrom'] as core.String?,
role: json_['role'] as core.String?,
teamDrivePermissionType:
json_['teamDrivePermissionType'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final inherited = this.inherited;
final inheritedFrom = this.inheritedFrom;
final role = this.role;
final teamDrivePermissionType = this.teamDrivePermissionType;
return {
'inherited': ?inherited,
'inheritedFrom': ?inheritedFrom,
'role': ?role,
'teamDrivePermissionType': ?teamDrivePermissionType,
};
}
}
/// A permission for a file.
///
/// A permission grants a user, group, domain, or the world access to a file or
/// a folder hierarchy. For more information, see
/// [Share files, folders, and drives](https://developers.google.com/workspace/drive/api/guides/manage-sharing).
/// By default, permission requests only return a subset of fields. Permission
/// `kind`, `ID`, `type`, and `role` are always returned. To retrieve specific
/// fields, see
/// [Return specific fields](https://developers.google.com/workspace/drive/api/guides/fields-parameter).
/// Some resource methods (such as `permissions.update`) require a
/// `permissionId`. Use the `permissions.list` method to retrieve the ID for a
/// file, folder, or shared drive.
class Permission {
/// Whether the permission allows the file to be discovered through search.
///
/// This is only applicable for permissions of type `domain` or `anyone`.
core.bool? allowFileDiscovery;
/// Whether the account associated with this permission has been deleted.
///
/// This field only pertains to permissions of type `user` or `group`.
///
/// Output only.
core.bool? deleted;
/// The "pretty" name of the value of the permission.
///
/// The following is a list of examples for each type of permission: * `user`
/// - User's full name, as defined for their Google Account, such as "Dana A."
/// * `group` - Name of the Google Group, such as "The Company
/// Administrators." * `domain` - String domain name, such as
/// "cymbalgroup.com." * `anyone` - No `displayName` is present.
///
/// Output only.
core.String? displayName;
/// The domain to which this permission refers.
core.String? domain;
/// The email address of the user or group to which this permission refers.
core.String? emailAddress;
/// The time at which this permission will expire (RFC 3339 date-time).
///
/// Expiration times have the following restrictions: - They can only be set
/// on user and group permissions - The time must be in the future - The time
/// cannot be more than a year in the future
core.DateTime? expirationTime;
/// The ID of this permission.
///
/// This is a unique identifier for the grantee, and is published in the
/// [User resource](https://developers.google.com/workspace/drive/api/reference/rest/v3/User)
/// as `permissionId`. IDs should be treated as opaque values.
///
/// Output only.
core.String? id;
/// When `true`, only organizers, owners, and users with permissions added
/// directly on the item can access it.
core.bool? inheritedPermissionsDisabled;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#permission"`.
///
/// Output only.
core.String? kind;
/// Whether the account associated with this permission is a pending owner.
///
/// Only populated for permissions of type `user` for files that aren't in a
/// shared drive.
core.bool? pendingOwner;
/// Details of whether the permissions on this item are inherited or are
/// directly on this item.
///
/// Output only.
core.List<PermissionPermissionDetails>? permissionDetails;
/// A link to the user's profile photo, if available.
///
/// Output only.
core.String? photoLink;
/// The role granted by this permission.
///
/// Supported values include: * `owner` * `organizer` * `fileOrganizer` *
/// `writer` * `commenter` * `reader` For more information, see
/// [Roles and permissions](https://developers.google.com/workspace/drive/api/guides/ref-roles).
core.String? role;
/// Deprecated: Output only.
///
/// Use `permissionDetails` instead.
///
/// Output only.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.List<PermissionTeamDrivePermissionDetails>? teamDrivePermissionDetails;
/// The type of the grantee.
///
/// Supported values include: * `user` * `group` * `domain` * `anyone` When
/// creating a permission, if `type` is `user` or `group`, you must provide an
/// `emailAddress` for the user or group. If `type` is `domain`, you must
/// provide a `domain`. If `type` is `anyone`, no extra information is
/// required.
core.String? type;
/// Indicates the view for this permission.
///
/// Only populated for permissions that belong to a view. The only supported
/// values are `published` and `metadata`: * `published`: The permission's
/// role is `publishedReader`. * `metadata`: The item is only visible to the
/// `metadata` view because the item has limited access and the scope has at
/// least read access to the parent. The `metadata` view is only supported on
/// folders. For more information, see
/// [Views](https://developers.google.com/workspace/drive/api/guides/ref-roles#views).
core.String? view;
Permission({
this.allowFileDiscovery,
this.deleted,
this.displayName,
this.domain,
this.emailAddress,
this.expirationTime,
this.id,
this.inheritedPermissionsDisabled,
this.kind,
this.pendingOwner,
this.permissionDetails,
this.photoLink,
this.role,
this.teamDrivePermissionDetails,
this.type,
this.view,
});
Permission.fromJson(core.Map json_)
: this(
allowFileDiscovery: json_['allowFileDiscovery'] as core.bool?,
deleted: json_['deleted'] as core.bool?,
displayName: json_['displayName'] as core.String?,
domain: json_['domain'] as core.String?,
emailAddress: json_['emailAddress'] as core.String?,
expirationTime: json_.containsKey('expirationTime')
? core.DateTime.parse(json_['expirationTime'] as core.String)
: null,
id: json_['id'] as core.String?,
inheritedPermissionsDisabled:
json_['inheritedPermissionsDisabled'] as core.bool?,
kind: json_['kind'] as core.String?,
pendingOwner: json_['pendingOwner'] as core.bool?,
permissionDetails: (json_['permissionDetails'] as core.List?)
?.map(
(value) => PermissionPermissionDetails.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
photoLink: json_['photoLink'] as core.String?,
role: json_['role'] as core.String?,
teamDrivePermissionDetails:
(json_['teamDrivePermissionDetails'] as core.List?)
?.map(
(value) => PermissionTeamDrivePermissionDetails.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
type: json_['type'] as core.String?,
view: json_['view'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final allowFileDiscovery = this.allowFileDiscovery;
final deleted = this.deleted;
final displayName = this.displayName;
final domain = this.domain;
final emailAddress = this.emailAddress;
final expirationTime = this.expirationTime;
final id = this.id;
final inheritedPermissionsDisabled = this.inheritedPermissionsDisabled;
final kind = this.kind;
final pendingOwner = this.pendingOwner;
final permissionDetails = this.permissionDetails;
final photoLink = this.photoLink;
final role = this.role;
final teamDrivePermissionDetails = this.teamDrivePermissionDetails;
final type = this.type;
final view = this.view;
return {
'allowFileDiscovery': ?allowFileDiscovery,
'deleted': ?deleted,
'displayName': ?displayName,
'domain': ?domain,
'emailAddress': ?emailAddress,
'expirationTime': ?expirationTime?.toUtc().toIso8601String(),
'id': ?id,
'inheritedPermissionsDisabled': ?inheritedPermissionsDisabled,
'kind': ?kind,
'pendingOwner': ?pendingOwner,
'permissionDetails': ?permissionDetails,
'photoLink': ?photoLink,
'role': ?role,
'teamDrivePermissionDetails': ?teamDrivePermissionDetails,
'type': ?type,
'view': ?view,
};
}
}
/// A list of permissions for a file.
class PermissionList {
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#permissionList"`.
core.String? kind;
/// The page token for the next page of permissions.
///
/// This field will be absent if the end of the permissions list has been
/// reached. If the token is rejected for any reason, it should be discarded,
/// and pagination should be restarted from the first page of results. The
/// page token is typically valid for several hours. However, if new items are
/// added or removed, your expected results might differ.
core.String? nextPageToken;
/// The list of permissions.
///
/// If `nextPageToken` is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<Permission>? permissions;
PermissionList({this.kind, this.nextPageToken, this.permissions});
PermissionList.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
permissions: (json_['permissions'] as core.List?)
?.map(
(value) => Permission.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final nextPageToken = this.nextPageToken;
final permissions = this.permissions;
return {
'kind': ?kind,
'nextPageToken': ?nextPageToken,
'permissions': ?permissions,
};
}
}
/// A reply to a comment on a file.
///
/// Some resource methods (such as `replies.update`) require a `replyId`. Use
/// the `replies.list` method to retrieve the ID for a reply.
class Reply {
/// The action the reply performed to the parent comment.
///
/// The supported values are: * `resolve` * `reopen`
core.String? action;
/// The email address of the user assigned to this comment.
///
/// If no user is assigned, the field is unset.
///
/// Output only.
core.String? assigneeEmailAddress;
/// The author of the reply.
///
/// The author's email address and permission ID won't be populated.
///
/// Output only.
User? author;
/// The plain text content of the reply.
///
/// This field is used for setting the content, while `htmlContent` should be
/// displayed. This field is required by the `create` method if no `action`
/// value is specified.
core.String? content;
/// The time at which the reply was created (RFC 3339 date-time).
core.DateTime? createdTime;
/// Whether the reply has been deleted.
///
/// A deleted reply has no content.
///
/// Output only.
core.bool? deleted;
/// The content of the reply with HTML formatting.
///
/// Output only.
core.String? htmlContent;
/// The ID of the reply.
///
/// Output only.
core.String? id;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#reply"`.
///
/// Output only.
core.String? kind;
/// A list of email addresses for users mentioned in this comment.
///
/// If no users are mentioned, the list is empty.
///
/// Output only.
core.List<core.String>? mentionedEmailAddresses;
/// The last time the reply was modified (RFC 3339 date-time).
core.DateTime? modifiedTime;
Reply({
this.action,
this.assigneeEmailAddress,
this.author,
this.content,
this.createdTime,
this.deleted,
this.htmlContent,
this.id,
this.kind,
this.mentionedEmailAddresses,
this.modifiedTime,
});
Reply.fromJson(core.Map json_)
: this(
action: json_['action'] as core.String?,
assigneeEmailAddress: json_['assigneeEmailAddress'] as core.String?,
author: json_.containsKey('author')
? User.fromJson(
json_['author'] as core.Map<core.String, core.dynamic>,
)
: null,
content: json_['content'] as core.String?,
createdTime: json_.containsKey('createdTime')
? core.DateTime.parse(json_['createdTime'] as core.String)
: null,
deleted: json_['deleted'] as core.bool?,
htmlContent: json_['htmlContent'] as core.String?,
id: json_['id'] as core.String?,
kind: json_['kind'] as core.String?,
mentionedEmailAddresses:
(json_['mentionedEmailAddresses'] as core.List?)
?.map((value) => value as core.String)
.toList(),
modifiedTime: json_.containsKey('modifiedTime')
? core.DateTime.parse(json_['modifiedTime'] as core.String)
: null,
);
core.Map<core.String, core.dynamic> toJson() {
final action = this.action;
final assigneeEmailAddress = this.assigneeEmailAddress;
final author = this.author;
final content = this.content;
final createdTime = this.createdTime;
final deleted = this.deleted;
final htmlContent = this.htmlContent;
final id = this.id;
final kind = this.kind;
final mentionedEmailAddresses = this.mentionedEmailAddresses;
final modifiedTime = this.modifiedTime;
return {
'action': ?action,
'assigneeEmailAddress': ?assigneeEmailAddress,
'author': ?author,
'content': ?content,
'createdTime': ?createdTime?.toUtc().toIso8601String(),
'deleted': ?deleted,
'htmlContent': ?htmlContent,
'id': ?id,
'kind': ?kind,
'mentionedEmailAddresses': ?mentionedEmailAddresses,
'modifiedTime': ?modifiedTime?.toUtc().toIso8601String(),
};
}
}
/// A list of replies to a comment on a file.
class ReplyList {
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#replyList"`.
core.String? kind;
/// The page token for the next page of replies.
///
/// This will be absent if the end of the replies list has been reached. If
/// the token is rejected for any reason, it should be discarded, and
/// pagination should be restarted from the first page of results. The page
/// token is typically valid for several hours. However, if new items are
/// added or removed, your expected results might differ.
core.String? nextPageToken;
/// The list of replies.
///
/// If `nextPageToken` is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<Reply>? replies;
ReplyList({this.kind, this.nextPageToken, this.replies});
ReplyList.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
replies: (json_['replies'] as core.List?)
?.map(
(value) =>
Reply.fromJson(value as core.Map<core.String, core.dynamic>),
)
.toList(),
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final nextPageToken = this.nextPageToken;
final replies = this.replies;
return {
'kind': ?kind,
'nextPageToken': ?nextPageToken,
'replies': ?replies,
};
}
}
/// Request message for resolving an AccessProposal on a file.
class ResolveAccessProposalRequest {
/// The action to take on the access proposal.
///
/// Required.
/// Possible string values are:
/// - "ACTION_UNSPECIFIED" : Unspecified action
/// - "ACCEPT" : The user accepts the access proposal. Note: If this action is
/// used, the `role` field must have at least one value.
/// - "DENY" : The user denies the access proposal.
core.String? action;
/// The roles that the approver has allowed, if any.
///
/// For more information, see
/// [Roles and permissions](https://developers.google.com/workspace/drive/api/guides/ref-roles).
/// Note: This field is required for the `ACCEPT` action.
///
/// Optional.
core.List<core.String>? role;
/// Whether to send an email to the requester when the access proposal is
/// denied or accepted.
///
/// Optional.
core.bool? sendNotification;
/// Indicates the view for this access proposal.
///
/// This should only be set when the proposal belongs to a view. Only
/// `published` is supported.
///
/// Optional.
core.String? view;
ResolveAccessProposalRequest({
this.action,
this.role,
this.sendNotification,
this.view,
});
ResolveAccessProposalRequest.fromJson(core.Map json_)
: this(
action: json_['action'] as core.String?,
role: (json_['role'] as core.List?)
?.map((value) => value as core.String)
.toList(),
sendNotification: json_['sendNotification'] as core.bool?,
view: json_['view'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final action = this.action;
final role = this.role;
final sendNotification = this.sendNotification;
final view = this.view;
return {
'action': ?action,
'role': ?role,
'sendNotification': ?sendNotification,
'view': ?view,
};
}
}
/// A response on an Approval made by a specific Reviewer.
class ReviewerResponse {
/// This is always drive#reviewerResponse.
core.String? kind;
/// A Reviewer’s Response for the Approval.
/// Possible string values are:
/// - "RESPONSE_UNSPECIFIED" : Response was set to an unrecognized value.
/// - "NO_RESPONSE" : The reviewer has not yet responded
/// - "APPROVED" : The Reviewer has approved the item.
/// - "DECLINED" : The Reviewer has declined the item.
core.String? response;
/// The user that is responsible for this response.
User? reviewer;
ReviewerResponse({this.kind, this.response, this.reviewer});
ReviewerResponse.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
response: json_['response'] as core.String?,
reviewer: json_.containsKey('reviewer')
? User.fromJson(
json_['reviewer'] as core.Map<core.String, core.dynamic>,
)
: null,
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final response = this.response;
final reviewer = this.reviewer;
return {'kind': ?kind, 'response': ?response, 'reviewer': ?reviewer};
}
}
/// The metadata for a revision to a file.
///
/// Some resource methods (such as `revisions.update`) require a `revisionId`.
/// Use the `revisions.list` method to retrieve the ID for a revision.
class Revision {
/// Links for exporting Docs Editors files to specific formats.
///
/// Output only.
core.Map<core.String, core.String>? exportLinks;
/// The ID of the revision.
///
/// Output only.
core.String? id;
/// Whether to keep this revision forever, even if it is no longer the head
/// revision.
///
/// If not set, the revision will be automatically purged 30 days after newer
/// content is uploaded. This can be set on a maximum of 200 revisions for a
/// file. This field is only applicable to files with binary content in Drive.
core.bool? keepForever;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#revision"`.
///
/// Output only.
core.String? kind;
/// The last user to modify this revision.
///
/// This field is only populated when the last modification was performed by a
/// signed-in user.
///
/// Output only.
User? lastModifyingUser;
/// The MD5 checksum of the revision's content.
///
/// This is only applicable to files with binary content in Drive.
///
/// Output only.
core.String? md5Checksum;
/// The MIME type of the revision.
///
/// Output only.
core.String? mimeType;
/// The last time the revision was modified (RFC 3339 date-time).
core.DateTime? modifiedTime;
/// The original filename used to create this revision.
///
/// This is only applicable to files with binary content in Drive.
///
/// Output only.
core.String? originalFilename;
/// Whether subsequent revisions will be automatically republished.
///
/// This is only applicable to Docs Editors files.
core.bool? publishAuto;
/// Whether this revision is published.
///
/// This is only applicable to Docs Editors files.
core.bool? published;
/// A link to the published revision.
///
/// This is only populated for Docs Editors files.
///
/// Output only.
core.String? publishedLink;
/// Whether this revision is published outside the domain.
///
/// This is only applicable to Docs Editors files.
core.bool? publishedOutsideDomain;
/// The size of the revision's content in bytes.
///
/// This is only applicable to files with binary content in Drive.
///
/// Output only.
core.String? size;
Revision({
this.exportLinks,
this.id,
this.keepForever,
this.kind,
this.lastModifyingUser,
this.md5Checksum,
this.mimeType,
this.modifiedTime,
this.originalFilename,
this.publishAuto,
this.published,
this.publishedLink,
this.publishedOutsideDomain,
this.size,
});
Revision.fromJson(core.Map json_)
: this(
exportLinks:
(json_['exportLinks'] as core.Map<core.String, core.dynamic>?)?.map(
(key, value) => core.MapEntry(key, value as core.String),
),
id: json_['id'] as core.String?,
keepForever: json_['keepForever'] as core.bool?,
kind: json_['kind'] as core.String?,
lastModifyingUser: json_.containsKey('lastModifyingUser')
? User.fromJson(
json_['lastModifyingUser']
as core.Map<core.String, core.dynamic>,
)
: null,
md5Checksum: json_['md5Checksum'] as core.String?,
mimeType: json_['mimeType'] as core.String?,
modifiedTime: json_.containsKey('modifiedTime')
? core.DateTime.parse(json_['modifiedTime'] as core.String)
: null,
originalFilename: json_['originalFilename'] as core.String?,
publishAuto: json_['publishAuto'] as core.bool?,
published: json_['published'] as core.bool?,
publishedLink: json_['publishedLink'] as core.String?,
publishedOutsideDomain: json_['publishedOutsideDomain'] as core.bool?,
size: json_['size'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final exportLinks = this.exportLinks;
final id = this.id;
final keepForever = this.keepForever;
final kind = this.kind;
final lastModifyingUser = this.lastModifyingUser;
final md5Checksum = this.md5Checksum;
final mimeType = this.mimeType;
final modifiedTime = this.modifiedTime;
final originalFilename = this.originalFilename;
final publishAuto = this.publishAuto;
final published = this.published;
final publishedLink = this.publishedLink;
final publishedOutsideDomain = this.publishedOutsideDomain;
final size = this.size;
return {
'exportLinks': ?exportLinks,
'id': ?id,
'keepForever': ?keepForever,
'kind': ?kind,
'lastModifyingUser': ?lastModifyingUser,
'md5Checksum': ?md5Checksum,
'mimeType': ?mimeType,
'modifiedTime': ?modifiedTime?.toUtc().toIso8601String(),
'originalFilename': ?originalFilename,
'publishAuto': ?publishAuto,
'published': ?published,
'publishedLink': ?publishedLink,
'publishedOutsideDomain': ?publishedOutsideDomain,
'size': ?size,
};
}
}
/// A list of revisions of a file.
class RevisionList {
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#revisionList"`.
core.String? kind;
/// The page token for the next page of revisions.
///
/// This will be absent if the end of the revisions list has been reached. If
/// the token is rejected for any reason, it should be discarded, and
/// pagination should be restarted from the first page of results. The page
/// token is typically valid for several hours. However, if new items are
/// added or removed, your expected results might differ.
core.String? nextPageToken;
/// The list of revisions.
///
/// If nextPageToken is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<Revision>? revisions;
RevisionList({this.kind, this.nextPageToken, this.revisions});
RevisionList.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
revisions: (json_['revisions'] as core.List?)
?.map(
(value) => Revision.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final nextPageToken = this.nextPageToken;
final revisions = this.revisions;
return {
'kind': ?kind,
'nextPageToken': ?nextPageToken,
'revisions': ?revisions,
};
}
}
class StartPageToken {
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#startPageToken"`.
core.String? kind;
/// The starting page token for listing future changes.
///
/// The page token doesn't expire.
core.String? startPageToken;
StartPageToken({this.kind, this.startPageToken});
StartPageToken.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
startPageToken: json_['startPageToken'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final startPageToken = this.startPageToken;
return {'kind': ?kind, 'startPageToken': ?startPageToken};
}
}
/// The `Status` type defines a logical error model that is suitable for
/// different programming environments, including REST APIs and RPC APIs.
///
/// It is used by [gRPC](https://github.com/grpc). Each `Status` message
/// contains three pieces of data: error code, error message, and error details.
/// You can find out more about this error model and how to work with it in the
/// [API Design Guide](https://cloud.google.com/apis/design/errors).
typedef Status = $Status00;
/// An image file and cropping parameters from which a background image for this
/// Team Drive is set.
///
/// This is a write only field; it can only be set on `drive.teamdrives.update`
/// requests that don't set `themeId`. When specified, all fields of the
/// `backgroundImageFile` must be set.
class TeamDriveBackgroundImageFile {
/// The ID of an image file in Drive to use for the background image.
core.String? id;
/// The width of the cropped image in the closed range of 0 to 1.
///
/// This value represents the width of the cropped image divided by the width
/// of the entire image. The height is computed by applying a width to height
/// aspect ratio of 80 to 9. The resulting image must be at least 1280 pixels
/// wide and 144 pixels high.
core.double? width;
/// The X coordinate of the upper left corner of the cropping area in the
/// background image.
///
/// This is a value in the closed range of 0 to 1. This value represents the
/// horizontal distance from the left side of the entire image to the left
/// side of the cropping area divided by the width of the entire image.
core.double? xCoordinate;
/// The Y coordinate of the upper left corner of the cropping area in the
/// background image.
///
/// This is a value in the closed range of 0 to 1. This value represents the
/// vertical distance from the top side of the entire image to the top side of
/// the cropping area divided by the height of the entire image.
core.double? yCoordinate;
TeamDriveBackgroundImageFile({
this.id,
this.width,
this.xCoordinate,
this.yCoordinate,
});
TeamDriveBackgroundImageFile.fromJson(core.Map json_)
: this(
id: json_['id'] as core.String?,
width: (json_['width'] as core.num?)?.toDouble(),
xCoordinate: (json_['xCoordinate'] as core.num?)?.toDouble(),
yCoordinate: (json_['yCoordinate'] as core.num?)?.toDouble(),
);
core.Map<core.String, core.dynamic> toJson() {
final id = this.id;
final width = this.width;
final xCoordinate = this.xCoordinate;
final yCoordinate = this.yCoordinate;
return {
'id': ?id,
'width': ?width,
'xCoordinate': ?xCoordinate,
'yCoordinate': ?yCoordinate,
};
}
}
/// Capabilities the current user has on this Team Drive.
class TeamDriveCapabilities {
/// Whether the current user can add children to folders in this Team Drive.
core.bool? canAddChildren;
/// Whether the current user can change the `copyRequiresWriterPermission`
/// restriction of this Team Drive.
core.bool? canChangeCopyRequiresWriterPermissionRestriction;
/// Whether the current user can change the `domainUsersOnly` restriction of
/// this Team Drive.
core.bool? canChangeDomainUsersOnlyRestriction;
/// Whether the current user can change organizer-applied download
/// restrictions of this shared drive.
core.bool? canChangeDownloadRestriction;
/// Whether the current user can change the
/// `sharingFoldersRequiresOrganizerPermission` restriction of this Team
/// Drive.
core.bool? canChangeSharingFoldersRequiresOrganizerPermissionRestriction;
/// Whether the current user can change the background of this Team Drive.
core.bool? canChangeTeamDriveBackground;
/// Whether the current user can change the `teamMembersOnly` restriction of
/// this Team Drive.
core.bool? canChangeTeamMembersOnlyRestriction;
/// Whether the current user can comment on files in this Team Drive.
core.bool? canComment;
/// Whether the current user can copy files in this Team Drive.
core.bool? canCopy;
/// Whether the current user can delete children from folders in this Team
/// Drive.
core.bool? canDeleteChildren;
/// Whether the current user can delete this Team Drive.
///
/// Attempting to delete the Team Drive may still fail if there are untrashed
/// items inside the Team Drive.
core.bool? canDeleteTeamDrive;
/// Whether the current user can download files in this Team Drive.
core.bool? canDownload;
/// Whether the current user can edit files in this Team Drive
core.bool? canEdit;
/// Whether the current user can list the children of folders in this Team
/// Drive.
core.bool? canListChildren;
/// Whether the current user can add members to this Team Drive or remove them
/// or change their role.
core.bool? canManageMembers;
/// Whether the current user can read the revisions resource of files in this
/// Team Drive.
core.bool? canReadRevisions;
/// Deprecated: Use `canDeleteChildren` or `canTrashChildren` instead.
@core.Deprecated(
'Not supported. Member documentation may have more information.',
)
core.bool? canRemoveChildren;
/// Whether the current user can rename files or folders in this Team Drive.
core.bool? canRename;
/// Whether the current user can rename this Team Drive.
core.bool? canRenameTeamDrive;
/// Whether the current user can reset the Team Drive restrictions to
/// defaults.
core.bool? canResetTeamDriveRestrictions;
/// Whether the current user can share files or folders in this Team Drive.
core.bool? canShare;
/// Whether the current user can trash children from folders in this Team
/// Drive.
core.bool? canTrashChildren;
TeamDriveCapabilities({
this.canAddChildren,
this.canChangeCopyRequiresWriterPermissionRestriction,
this.canChangeDomainUsersOnlyRestriction,
this.canChangeDownloadRestriction,
this.canChangeSharingFoldersRequiresOrganizerPermissionRestriction,
this.canChangeTeamDriveBackground,
this.canChangeTeamMembersOnlyRestriction,
this.canComment,
this.canCopy,
this.canDeleteChildren,
this.canDeleteTeamDrive,
this.canDownload,
this.canEdit,
this.canListChildren,
this.canManageMembers,
this.canReadRevisions,
this.canRemoveChildren,
this.canRename,
this.canRenameTeamDrive,
this.canResetTeamDriveRestrictions,
this.canShare,
this.canTrashChildren,
});
TeamDriveCapabilities.fromJson(core.Map json_)
: this(
canAddChildren: json_['canAddChildren'] as core.bool?,
canChangeCopyRequiresWriterPermissionRestriction:
json_['canChangeCopyRequiresWriterPermissionRestriction']
as core.bool?,
canChangeDomainUsersOnlyRestriction:
json_['canChangeDomainUsersOnlyRestriction'] as core.bool?,
canChangeDownloadRestriction:
json_['canChangeDownloadRestriction'] as core.bool?,
canChangeSharingFoldersRequiresOrganizerPermissionRestriction:
json_['canChangeSharingFoldersRequiresOrganizerPermissionRestriction']
as core.bool?,
canChangeTeamDriveBackground:
json_['canChangeTeamDriveBackground'] as core.bool?,
canChangeTeamMembersOnlyRestriction:
json_['canChangeTeamMembersOnlyRestriction'] as core.bool?,
canComment: json_['canComment'] as core.bool?,
canCopy: json_['canCopy'] as core.bool?,
canDeleteChildren: json_['canDeleteChildren'] as core.bool?,
canDeleteTeamDrive: json_['canDeleteTeamDrive'] as core.bool?,
canDownload: json_['canDownload'] as core.bool?,
canEdit: json_['canEdit'] as core.bool?,
canListChildren: json_['canListChildren'] as core.bool?,
canManageMembers: json_['canManageMembers'] as core.bool?,
canReadRevisions: json_['canReadRevisions'] as core.bool?,
canRemoveChildren: json_['canRemoveChildren'] as core.bool?,
canRename: json_['canRename'] as core.bool?,
canRenameTeamDrive: json_['canRenameTeamDrive'] as core.bool?,
canResetTeamDriveRestrictions:
json_['canResetTeamDriveRestrictions'] as core.bool?,
canShare: json_['canShare'] as core.bool?,
canTrashChildren: json_['canTrashChildren'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final canAddChildren = this.canAddChildren;
final canChangeCopyRequiresWriterPermissionRestriction =
this.canChangeCopyRequiresWriterPermissionRestriction;
final canChangeDomainUsersOnlyRestriction =
this.canChangeDomainUsersOnlyRestriction;
final canChangeDownloadRestriction = this.canChangeDownloadRestriction;
final canChangeSharingFoldersRequiresOrganizerPermissionRestriction =
this.canChangeSharingFoldersRequiresOrganizerPermissionRestriction;
final canChangeTeamDriveBackground = this.canChangeTeamDriveBackground;
final canChangeTeamMembersOnlyRestriction =
this.canChangeTeamMembersOnlyRestriction;
final canComment = this.canComment;
final canCopy = this.canCopy;
final canDeleteChildren = this.canDeleteChildren;
final canDeleteTeamDrive = this.canDeleteTeamDrive;
final canDownload = this.canDownload;
final canEdit = this.canEdit;
final canListChildren = this.canListChildren;
final canManageMembers = this.canManageMembers;
final canReadRevisions = this.canReadRevisions;
final canRemoveChildren = this.canRemoveChildren;
final canRename = this.canRename;
final canRenameTeamDrive = this.canRenameTeamDrive;
final canResetTeamDriveRestrictions = this.canResetTeamDriveRestrictions;
final canShare = this.canShare;
final canTrashChildren = this.canTrashChildren;
return {
'canAddChildren': ?canAddChildren,
'canChangeCopyRequiresWriterPermissionRestriction':
?canChangeCopyRequiresWriterPermissionRestriction,
'canChangeDomainUsersOnlyRestriction':
?canChangeDomainUsersOnlyRestriction,
'canChangeDownloadRestriction': ?canChangeDownloadRestriction,
'canChangeSharingFoldersRequiresOrganizerPermissionRestriction':
?canChangeSharingFoldersRequiresOrganizerPermissionRestriction,
'canChangeTeamDriveBackground': ?canChangeTeamDriveBackground,
'canChangeTeamMembersOnlyRestriction':
?canChangeTeamMembersOnlyRestriction,
'canComment': ?canComment,
'canCopy': ?canCopy,
'canDeleteChildren': ?canDeleteChildren,
'canDeleteTeamDrive': ?canDeleteTeamDrive,
'canDownload': ?canDownload,
'canEdit': ?canEdit,
'canListChildren': ?canListChildren,
'canManageMembers': ?canManageMembers,
'canReadRevisions': ?canReadRevisions,
'canRemoveChildren': ?canRemoveChildren,
'canRename': ?canRename,
'canRenameTeamDrive': ?canRenameTeamDrive,
'canResetTeamDriveRestrictions': ?canResetTeamDriveRestrictions,
'canShare': ?canShare,
'canTrashChildren': ?canTrashChildren,
};
}
}
/// A set of restrictions that apply to this Team Drive or items inside this
/// Team Drive.
class TeamDriveRestrictions {
/// Whether administrative privileges on this Team Drive are required to
/// modify restrictions.
core.bool? adminManagedRestrictions;
/// Whether the options to copy, print, or download files inside this Team
/// Drive, should be disabled for readers and commenters.
///
/// When this restriction is set to `true`, it will override the similarly
/// named field to `true` for any file inside this Team Drive.
core.bool? copyRequiresWriterPermission;
/// Whether access to this Team Drive and items inside this Team Drive is
/// restricted to users of the domain to which this Team Drive belongs.
///
/// This restriction may be overridden by other sharing policies controlled
/// outside of this Team Drive.
core.bool? domainUsersOnly;
/// Download restrictions applied by shared drive managers.
DownloadRestriction? downloadRestriction;
/// If true, only users with the organizer role can share folders.
///
/// If false, users with either the organizer role or the file organizer role
/// can share folders.
core.bool? sharingFoldersRequiresOrganizerPermission;
/// Whether access to items inside this Team Drive is restricted to members of
/// this Team Drive.
core.bool? teamMembersOnly;
TeamDriveRestrictions({
this.adminManagedRestrictions,
this.copyRequiresWriterPermission,
this.domainUsersOnly,
this.downloadRestriction,
this.sharingFoldersRequiresOrganizerPermission,
this.teamMembersOnly,
});
TeamDriveRestrictions.fromJson(core.Map json_)
: this(
adminManagedRestrictions:
json_['adminManagedRestrictions'] as core.bool?,
copyRequiresWriterPermission:
json_['copyRequiresWriterPermission'] as core.bool?,
domainUsersOnly: json_['domainUsersOnly'] as core.bool?,
downloadRestriction: json_.containsKey('downloadRestriction')
? DownloadRestriction.fromJson(
json_['downloadRestriction']
as core.Map<core.String, core.dynamic>,
)
: null,
sharingFoldersRequiresOrganizerPermission:
json_['sharingFoldersRequiresOrganizerPermission'] as core.bool?,
teamMembersOnly: json_['teamMembersOnly'] as core.bool?,
);
core.Map<core.String, core.dynamic> toJson() {
final adminManagedRestrictions = this.adminManagedRestrictions;
final copyRequiresWriterPermission = this.copyRequiresWriterPermission;
final domainUsersOnly = this.domainUsersOnly;
final downloadRestriction = this.downloadRestriction;
final sharingFoldersRequiresOrganizerPermission =
this.sharingFoldersRequiresOrganizerPermission;
final teamMembersOnly = this.teamMembersOnly;
return {
'adminManagedRestrictions': ?adminManagedRestrictions,
'copyRequiresWriterPermission': ?copyRequiresWriterPermission,
'domainUsersOnly': ?domainUsersOnly,
'downloadRestriction': ?downloadRestriction,
'sharingFoldersRequiresOrganizerPermission':
?sharingFoldersRequiresOrganizerPermission,
'teamMembersOnly': ?teamMembersOnly,
};
}
}
/// Deprecated: use the drive collection instead.
class TeamDrive {
/// An image file and cropping parameters from which a background image for
/// this Team Drive is set.
///
/// This is a write only field; it can only be set on
/// `drive.teamdrives.update` requests that don't set `themeId`. When
/// specified, all fields of the `backgroundImageFile` must be set.
TeamDriveBackgroundImageFile? backgroundImageFile;
/// A short-lived link to this Team Drive's background image.
core.String? backgroundImageLink;
/// Capabilities the current user has on this Team Drive.
TeamDriveCapabilities? capabilities;
/// The color of this Team Drive as an RGB hex string.
///
/// It can only be set on a `drive.teamdrives.update` request that does not
/// set `themeId`.
core.String? colorRgb;
/// The time at which the Team Drive was created (RFC 3339 date-time).
core.DateTime? createdTime;
/// The ID of this Team Drive which is also the ID of the top level folder of
/// this Team Drive.
core.String? id;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#teamDrive"`.
core.String? kind;
/// The name of this Team Drive.
core.String? name;
/// The organizational unit of this shared drive.
///
/// This field is only populated on `drives.list` responses when the
/// `useDomainAdminAccess` parameter is set to `true`.
core.String? orgUnitId;
/// A set of restrictions that apply to this Team Drive or items inside this
/// Team Drive.
TeamDriveRestrictions? restrictions;
/// The ID of the theme from which the background image and color will be set.
///
/// The set of possible `teamDriveThemes` can be retrieved from a
/// `drive.about.get` response. When not specified on a
/// `drive.teamdrives.create` request, a random theme is chosen from which the
/// background image and color are set. This is a write-only field; it can
/// only be set on requests that don't set `colorRgb` or
/// `backgroundImageFile`.
core.String? themeId;
TeamDrive({
this.backgroundImageFile,
this.backgroundImageLink,
this.capabilities,
this.colorRgb,
this.createdTime,
this.id,
this.kind,
this.name,
this.orgUnitId,
this.restrictions,
this.themeId,
});
TeamDrive.fromJson(core.Map json_)
: this(
backgroundImageFile: json_.containsKey('backgroundImageFile')
? TeamDriveBackgroundImageFile.fromJson(
json_['backgroundImageFile']
as core.Map<core.String, core.dynamic>,
)
: null,
backgroundImageLink: json_['backgroundImageLink'] as core.String?,
capabilities: json_.containsKey('capabilities')
? TeamDriveCapabilities.fromJson(
json_['capabilities'] as core.Map<core.String, core.dynamic>,
)
: null,
colorRgb: json_['colorRgb'] as core.String?,
createdTime: json_.containsKey('createdTime')
? core.DateTime.parse(json_['createdTime'] as core.String)
: null,
id: json_['id'] as core.String?,
kind: json_['kind'] as core.String?,
name: json_['name'] as core.String?,
orgUnitId: json_['orgUnitId'] as core.String?,
restrictions: json_.containsKey('restrictions')
? TeamDriveRestrictions.fromJson(
json_['restrictions'] as core.Map<core.String, core.dynamic>,
)
: null,
themeId: json_['themeId'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final backgroundImageFile = this.backgroundImageFile;
final backgroundImageLink = this.backgroundImageLink;
final capabilities = this.capabilities;
final colorRgb = this.colorRgb;
final createdTime = this.createdTime;
final id = this.id;
final kind = this.kind;
final name = this.name;
final orgUnitId = this.orgUnitId;
final restrictions = this.restrictions;
final themeId = this.themeId;
return {
'backgroundImageFile': ?backgroundImageFile,
'backgroundImageLink': ?backgroundImageLink,
'capabilities': ?capabilities,
'colorRgb': ?colorRgb,
'createdTime': ?createdTime?.toUtc().toIso8601String(),
'id': ?id,
'kind': ?kind,
'name': ?name,
'orgUnitId': ?orgUnitId,
'restrictions': ?restrictions,
'themeId': ?themeId,
};
}
}
/// A list of Team Drives.
class TeamDriveList {
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `"drive#teamDriveList"`.
core.String? kind;
/// The page token for the next page of Team Drives.
///
/// This will be absent if the end of the Team Drives list has been reached.
/// If the token is rejected for any reason, it should be discarded, and
/// pagination should be restarted from the first page of results. The page
/// token is typically valid for several hours. However, if new items are
/// added or removed, your expected results might differ.
core.String? nextPageToken;
/// The list of Team Drives.
///
/// If nextPageToken is populated, then this list may be incomplete and an
/// additional page of results should be fetched.
core.List<TeamDrive>? teamDrives;
TeamDriveList({this.kind, this.nextPageToken, this.teamDrives});
TeamDriveList.fromJson(core.Map json_)
: this(
kind: json_['kind'] as core.String?,
nextPageToken: json_['nextPageToken'] as core.String?,
teamDrives: (json_['teamDrives'] as core.List?)
?.map(
(value) => TeamDrive.fromJson(
value as core.Map<core.String, core.dynamic>,
),
)
.toList(),
);
core.Map<core.String, core.dynamic> toJson() {
final kind = this.kind;
final nextPageToken = this.nextPageToken;
final teamDrives = this.teamDrives;
return {
'kind': ?kind,
'nextPageToken': ?nextPageToken,
'teamDrives': ?teamDrives,
};
}
}
/// Information about a Drive user.
class User {
/// A plain text displayable name for this user.
///
/// Output only.
core.String? displayName;
/// The email address of the user.
///
/// This may not be present in certain contexts if the user has not made their
/// email address visible to the requester.
///
/// Output only.
core.String? emailAddress;
/// Identifies what kind of resource this is.
///
/// Value: the fixed string `drive#user`.
///
/// Output only.
core.String? kind;
/// Whether this user is the requesting user.
///
/// Output only.
core.bool? me;
/// The user's ID as visible in Permission resources.
///
/// Output only.
core.String? permissionId;
/// A link to the user's profile photo, if available.
///
/// Output only.
core.String? photoLink;
User({
this.displayName,
this.emailAddress,
this.kind,
this.me,
this.permissionId,
this.photoLink,
});
User.fromJson(core.Map json_)
: this(
displayName: json_['displayName'] as core.String?,
emailAddress: json_['emailAddress'] as core.String?,
kind: json_['kind'] as core.String?,
me: json_['me'] as core.bool?,
permissionId: json_['permissionId'] as core.String?,
photoLink: json_['photoLink'] as core.String?,
);
core.Map<core.String, core.dynamic> toJson() {
final displayName = this.displayName;
final emailAddress = this.emailAddress;
final kind = this.kind;
final me = this.me;
final permissionId = this.permissionId;
final photoLink = this.photoLink;
return {
'displayName': ?displayName,
'emailAddress': ?emailAddress,
'kind': ?kind,
'me': ?me,
'permissionId': ?permissionId,
'photoLink': ?photoLink,
};
}
}