Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Drive

import { Drive } from "https://googleapis.deno.dev/v1/drive:v3.ts";

The Google Drive API allows clients to access resources from Google Drive.

class Drive {
constructor(client?: CredentialsClient, baseUrl?: string);
async aboutGet(): Promise<About>;
async appsGet(appId: string): Promise<App>;
async appsList(opts?: AppsListOptions): Promise<AppList>;
async changesGetStartPageToken(opts?: ChangesGetStartPageTokenOptions): Promise<StartPageToken>;
async changesList(opts?: ChangesListOptions): Promise<ChangeList>;
async changesWatch(req: Channel, opts?: ChangesWatchOptions): Promise<Channel>;
async channelsStop(req: Channel): Promise<void>;
async commentsCreate(fileId: string, req: Comment): Promise<Comment>;
async commentsDelete(commentId: string, fileId: string): Promise<void>;
async commentsGet(
commentId: string,
fileId: string,
): Promise<Comment>;
async commentsList(fileId: string, opts?: CommentsListOptions): Promise<CommentList>;
async commentsUpdate(
commentId: string,
fileId: string,
req: Comment,
): Promise<Comment>;
async drivesCreate(req: Drive, opts?: DrivesCreateOptions): Promise<Drive>;
async drivesDelete(driveId: string, opts?: DrivesDeleteOptions): Promise<void>;
async drivesGet(driveId: string, opts?: DrivesGetOptions): Promise<Drive>;
async drivesHide(driveId: string): Promise<Drive>;
async drivesList(opts?: DrivesListOptions): Promise<DriveList>;
async drivesUnhide(driveId: string): Promise<Drive>;
async drivesUpdate(
driveId: string,
req: Drive,
): Promise<Drive>;
async filesAccessproposalsList(fileId: string, opts?: FilesAccessproposalsListOptions): Promise<ListAccessProposalsResponse>;
async filesAccessproposalsResolve(
fileId: string,
proposalId: string,
): Promise<void>;
async filesCopy(
fileId: string,
req: File,
): Promise<File>;
async filesCreate(req: File, opts?: FilesCreateOptions): Promise<File>;
async filesDelete(fileId: string, opts?: FilesDeleteOptions): Promise<void>;
async filesDownload(fileId: string, opts?: FilesDownloadOptions): Promise<Operation>;
async filesEmptyTrash(opts?: FilesEmptyTrashOptions): Promise<void>;
async filesExport(fileId: string, opts?: FilesExportOptions): Promise<void>;
async filesGenerateIds(opts?: FilesGenerateIdsOptions): Promise<GeneratedIds>;
async filesGet(fileId: string, opts?: FilesGetOptions): Promise<File>;
async filesList(opts?: FilesListOptions): Promise<FileList>;
async filesListLabels(fileId: string, opts?: FilesListLabelsOptions): Promise<LabelList>;
async filesModifyLabels(fileId: string, req: ModifyLabelsRequest): Promise<ModifyLabelsResponse>;
async filesUpdate(
fileId: string,
req: File,
): Promise<File>;
async filesWatch(
fileId: string,
req: Channel,
): Promise<Channel>;
async operationCancel(name: string): Promise<void>;
async operationDelete(name: string): Promise<void>;
async operationsGet(name: string): Promise<Operation>;
async operationsList(opts?: OperationsListOptions): Promise<ListOperationsResponse>;
async permissionsCreate(
fileId: string,
): Promise<Permission>;
async permissionsDelete(
fileId: string,
permissionId: string,
): Promise<void>;
async permissionsGet(
fileId: string,
permissionId: string,
): Promise<Permission>;
async permissionsList(fileId: string, opts?: PermissionsListOptions): Promise<PermissionList>;
async permissionsUpdate(
fileId: string,
permissionId: string,
): Promise<Permission>;
async repliesCreate(
commentId: string,
fileId: string,
req: Reply,
): Promise<Reply>;
async repliesDelete(
commentId: string,
fileId: string,
replyId: string,
): Promise<void>;
async repliesGet(
commentId: string,
fileId: string,
replyId: string,
): Promise<Reply>;
async repliesList(
commentId: string,
fileId: string,
): Promise<ReplyList>;
async repliesUpdate(
commentId: string,
fileId: string,
replyId: string,
req: Reply,
): Promise<Reply>;
async revisionsDelete(fileId: string, revisionId: string): Promise<void>;
async revisionsGet(
fileId: string,
revisionId: string,
): Promise<Revision>;
async revisionsList(fileId: string, opts?: RevisionsListOptions): Promise<RevisionList>;
async revisionsUpdate(
fileId: string,
revisionId: string,
req: Revision,
): Promise<Revision>;
async teamdrivesCreate(req: TeamDrive, opts?: TeamdrivesCreateOptions): Promise<TeamDrive>;
async teamdrivesDelete(teamDriveId: string): Promise<void>;
async teamdrivesGet(teamDriveId: string, opts?: TeamdrivesGetOptions): Promise<TeamDrive>;
async teamdrivesList(opts?: TeamdrivesListOptions): Promise<TeamDriveList>;
async teamdrivesUpdate(
teamDriveId: string,
req: TeamDrive,
): Promise<TeamDrive>;
}
interface Drive {
backgroundImageFile?: {
id?: string;
width?: number;
xCoordinate?: number;
yCoordinate?: number;
}
;
backgroundImageLink?: string;
capabilities?: {
canAddChildren?: boolean;
canChangeCopyRequiresWriterPermissionRestriction?: boolean;
canChangeDomainUsersOnlyRestriction?: boolean;
canChangeDriveBackground?: boolean;
canChangeDriveMembersOnlyRestriction?: boolean;
canChangeSharingFoldersRequiresOrganizerPermissionRestriction?: boolean;
canComment?: boolean;
canCopy?: boolean;
canDeleteChildren?: boolean;
canDeleteDrive?: boolean;
canDownload?: boolean;
canEdit?: boolean;
canListChildren?: boolean;
canManageMembers?: boolean;
canReadRevisions?: boolean;
canRename?: boolean;
canRenameDrive?: boolean;
canResetDriveRestrictions?: boolean;
canShare?: boolean;
canTrashChildren?: boolean;
}
;
colorRgb?: string;
createdTime?: Date;
hidden?: boolean;
id?: string;
kind?: string;
name?: string;
orgUnitId?: string;
restrictions?: {
adminManagedRestrictions?: boolean;
copyRequiresWriterPermission?: boolean;
domainUsersOnly?: boolean;
driveMembersOnly?: boolean;
sharingFoldersRequiresOrganizerPermission?: boolean;
}
;
themeId?: string;
}

§Constructors

§
new Drive(client?: CredentialsClient, baseUrl?: string)
[src]

§Methods

§
aboutGet(): Promise<About>
[src]

Gets information about the user, the user's Drive, and system capabilities.

§
appsGet(appId: string): Promise<App>
[src]

Gets a specific app.

@param appId

The ID of the app.

§
appsList(opts?: AppsListOptions): Promise<AppList>
[src]

Lists a user's installed apps.

§
changesGetStartPageToken(opts?: ChangesGetStartPageTokenOptions): Promise<StartPageToken>
[src]

Gets the starting pageToken for listing future changes.

§
changesList(opts?: ChangesListOptions): Promise<ChangeList>
[src]

Lists the changes for a user or shared drive.

§
changesWatch(req: Channel, opts?: ChangesWatchOptions): Promise<Channel>
[src]

Subscribes to changes for a user.

§
channelsStop(req: Channel): Promise<void>
[src]

Stops watching resources through this channel.

§
commentsCreate(fileId: string, req: Comment): Promise<Comment>
[src]

Creates a comment on a file.

@param fileId

The ID of the file.

§
commentsDelete(commentId: string, fileId: string): Promise<void>
[src]

Deletes a comment.

@param commentId

The ID of the comment.

@param fileId

The ID of the file.

§
commentsGet(commentId: string, fileId: string, opts?: CommentsGetOptions): Promise<Comment>
[src]

Gets a comment by ID.

@param commentId

The ID of the comment.

@param fileId

The ID of the file.

§
commentsList(fileId: string, opts?: CommentsListOptions): Promise<CommentList>
[src]

Lists a file's comments.

@param fileId

The ID of the file.

§
commentsUpdate(commentId: string, fileId: string, req: Comment): Promise<Comment>
[src]

Updates a comment with patch semantics.

@param commentId

The ID of the comment.

@param fileId

The ID of the file.

§
drivesCreate(req: Drive, opts?: DrivesCreateOptions): Promise<Drive>
[src]

Creates a shared drive.

§
drivesDelete(driveId: string, opts?: DrivesDeleteOptions): Promise<void>
[src]

Permanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items.

@param driveId

The ID of the shared drive.

§
drivesGet(driveId: string, opts?: DrivesGetOptions): Promise<Drive>
[src]

Gets a shared drive's metadata by ID.

@param driveId

The ID of the shared drive.

§
drivesHide(driveId: string): Promise<Drive>
[src]

Hides a shared drive from the default view.

@param driveId

The ID of the shared drive.

§
drivesList(opts?: DrivesListOptions): Promise<DriveList>
[src]

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 guide.

§
drivesUnhide(driveId: string): Promise<Drive>
[src]

Restores a shared drive to the default view.

@param driveId

The ID of the shared drive.

§
drivesUpdate(driveId: string, req: Drive, opts?: DrivesUpdateOptions): Promise<Drive>
[src]

Updates the metadata for a shared drive.

@param driveId

The ID of the shared drive.

§
filesAccessproposalsList(fileId: string, opts?: FilesAccessproposalsListOptions): Promise<ListAccessProposalsResponse>
[src]

List the AccessProposals on a file. Note: Only approvers are able to list AccessProposals on a file. If the user is not an approver, returns a 403.

@param fileId

Required. The id of the item the request is on.

§
filesAccessproposalsResolve(fileId: string, proposalId: string, opts?: FilesAccessproposalsResolveOptions): Promise<void>
[src]

Used to approve or deny an Access Proposal.

@param fileId

Required. The id of the item the request is on.

@param proposalId

Required. The id of the access proposal to resolve.

§
filesCopy(fileId: string, req: File, opts?: FilesCopyOptions): Promise<File>
[src]

Creates a copy of a file and applies any requested updates with patch semantics.

@param fileId

The ID of the file.

§
filesCreate(req: File, opts?: FilesCreateOptions): Promise<File>
[src]

Creates a new 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:**\/* Note: 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 on uploading files, see Upload file data. Apps creating shortcuts with files.create 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 title 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 title. In cases where the extension is missing, Drive attempts to determine the extension based on the file's MIME type.

§
filesDelete(fileId: string, opts?: FilesDeleteOptions): Promise<void>
[src]

Permanently deletes a file owned by the user without moving it to the trash. 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.

@param fileId

The ID of the file.

§
filesDownload(fileId: string, opts?: FilesDownloadOptions): Promise<Operation>
[src]

Downloads content of a file. Operations are valid for 24 hours from the time of creation.

@param fileId

Required. The ID of the file to download.

§
filesEmptyTrash(opts?: FilesEmptyTrashOptions): Promise<void>
[src]

Permanently deletes all of the user's trashed files.

§
filesExport(fileId: string, opts?: FilesExportOptions): Promise<void>
[src]

Exports a Google Workspace document to the requested MIME type and returns exported byte content. Note that the exported content is limited to 10MB.

@param fileId

The ID of the file.

§
filesGenerateIds(opts?: FilesGenerateIdsOptions): Promise<GeneratedIds>
[src]

Generates a set of file IDs which can be provided in create or copy requests.

§
filesGet(fileId: string, opts?: FilesGetOptions): Promise<File>
[src]

Gets a file's metadata or content by ID. 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 instead. For more information, see Download & export files.

@param fileId

The ID of the file.

§
filesList(opts?: FilesListOptions): Promise<FileList>
[src]

Lists the user's files. This method accepts the q parameter, which is a search query combining one or more search terms. For more information, see the Search for files & folders guide. Note: This method returns all files by default, including trashed files. If you don't want trashed files to appear in the list, use the trashed=false query parameter to remove trashed files from the results.

§
filesListLabels(fileId: string, opts?: FilesListLabelsOptions): Promise<LabelList>
[src]

Lists the labels on a file.

@param fileId

The ID for the file.

§
filesModifyLabels(fileId: string, req: ModifyLabelsRequest): Promise<ModifyLabelsResponse>
[src]

Modifies the set of labels applied to a file. Returns a list of the labels that were added or modified.

@param fileId

The ID of the file to which the labels belong.

§
filesUpdate(fileId: string, req: File, opts?: FilesUpdateOptions): Promise<File>
[src]

Updates a file's metadata and/or content. 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:**\/* Note: 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 on uploading files, see Upload file data.

@param fileId

The ID of the file.

§
filesWatch(fileId: string, req: Channel, opts?: FilesWatchOptions): Promise<Channel>
[src]

Subscribes to changes to a file.

@param fileId

The ID of the file.

§
operationCancel(name: string): Promise<void>
[src]

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

@param name

The name of the operation resource to be cancelled.

§
operationDelete(name: string): Promise<void>
[src]

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

@param name

The name of the operation resource to be deleted.

§
operationsGet(name: string): Promise<Operation>
[src]

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.

@param name

The name of the operation resource.

§
operationsList(opts?: OperationsListOptions): Promise<ListOperationsResponse>
[src]

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.

§
permissionsCreate(fileId: string, req: Permission, opts?: PermissionsCreateOptions): Promise<Permission>
[src]

Creates a permission for a file or shared drive. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.

@param fileId

The ID of the file or shared drive.

§
permissionsDelete(fileId: string, permissionId: string, opts?: PermissionsDeleteOptions): Promise<void>
[src]

Deletes a permission. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.

@param fileId

The ID of the file or shared drive.

@param permissionId

The ID of the permission.

§
permissionsGet(fileId: string, permissionId: string, opts?: PermissionsGetOptions): Promise<Permission>
[src]

Gets a permission by ID.

@param fileId

The ID of the file.

@param permissionId

The ID of the permission.

§
permissionsList(fileId: string, opts?: PermissionsListOptions): Promise<PermissionList>
[src]

Lists a file's or shared drive's permissions.

@param fileId

The ID of the file or shared drive.

§
permissionsUpdate(fileId: string, permissionId: string, req: Permission, opts?: PermissionsUpdateOptions): Promise<Permission>
[src]

Updates a permission with patch semantics. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.

@param fileId

The ID of the file or shared drive.

@param permissionId

The ID of the permission.

§
repliesCreate(commentId: string, fileId: string, req: Reply): Promise<Reply>
[src]

Creates a reply to a comment.

@param commentId

The ID of the comment.

@param fileId

The ID of the file.

§
repliesDelete(commentId: string, fileId: string, replyId: string): Promise<void>
[src]

Deletes a reply.

@param commentId

The ID of the comment.

@param fileId

The ID of the file.

@param replyId

The ID of the reply.

§
repliesGet(commentId: string, fileId: string, replyId: string, opts?: RepliesGetOptions): Promise<Reply>
[src]

Gets a reply by ID.

@param commentId

The ID of the comment.

@param fileId

The ID of the file.

@param replyId

The ID of the reply.

§
repliesList(commentId: string, fileId: string, opts?: RepliesListOptions): Promise<ReplyList>
[src]

Lists a comment's replies.

@param commentId

The ID of the comment.

@param fileId

The ID of the file.

§
repliesUpdate(commentId: string, fileId: string, replyId: string, req: Reply): Promise<Reply>
[src]

Updates a reply with patch semantics.

@param commentId

The ID of the comment.

@param fileId

The ID of the file.

@param replyId

The ID of the reply.

§
revisionsDelete(fileId: string, revisionId: string): Promise<void>
[src]

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.

@param fileId

The ID of the file.

@param revisionId

The ID of the revision.

§
revisionsGet(fileId: string, revisionId: string, opts?: RevisionsGetOptions): Promise<Revision>
[src]

Gets a revision's metadata or content by ID.

@param fileId

The ID of the file.

@param revisionId

The ID of the revision.

§
revisionsList(fileId: string, opts?: RevisionsListOptions): Promise<RevisionList>
[src]

Lists a file's revisions.

@param fileId

The ID of the file.

§
revisionsUpdate(fileId: string, revisionId: string, req: Revision): Promise<Revision>
[src]

Updates a revision with patch semantics.

@param fileId

The ID of the file.

@param revisionId

The ID of the revision.

§
teamdrivesCreate(req: TeamDrive, opts?: TeamdrivesCreateOptions): Promise<TeamDrive>
[src]

Deprecated: Use drives.create instead.

§
teamdrivesDelete(teamDriveId: string): Promise<void>
[src]

Deprecated: Use drives.delete instead.

@param teamDriveId

The ID of the Team Drive

§
teamdrivesGet(teamDriveId: string, opts?: TeamdrivesGetOptions): Promise<TeamDrive>
[src]

Deprecated: Use drives.get instead.

@param teamDriveId

The ID of the Team Drive

§
teamdrivesList(opts?: TeamdrivesListOptions): Promise<TeamDriveList>
[src]

Deprecated: Use drives.list instead.

§
teamdrivesUpdate(teamDriveId: string, req: TeamDrive, opts?: TeamdrivesUpdateOptions): Promise<TeamDrive>
[src]

Deprecated: Use drives.update instead.

@param teamDriveId

The ID of the Team Drive

§Properties

§
backgroundImageFile?: {
id?: string;
width?: number;
xCoordinate?: number;
yCoordinate?: number;
}
[src]

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.

§
capabilities?: {
canAddChildren?: boolean;
canChangeCopyRequiresWriterPermissionRestriction?: boolean;
canChangeDomainUsersOnlyRestriction?: boolean;
canChangeDriveBackground?: boolean;
canChangeDriveMembersOnlyRestriction?: boolean;
canChangeSharingFoldersRequiresOrganizerPermissionRestriction?: boolean;
canComment?: boolean;
canCopy?: boolean;
canDeleteChildren?: boolean;
canDeleteDrive?: boolean;
canDownload?: boolean;
canEdit?: boolean;
canListChildren?: boolean;
canManageMembers?: boolean;
canReadRevisions?: boolean;
canRename?: boolean;
canRenameDrive?: boolean;
canResetDriveRestrictions?: boolean;
canShare?: boolean;
canTrashChildren?: boolean;
}
[src]

Output only. Capabilities the current user has on this shared drive.

§
colorRgb?: string
[src]

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.

§
createdTime?: Date
[src]

The time at which the shared drive was created (RFC 3339 date-time).

§
hidden?: boolean
[src]

Whether the shared drive is hidden from default view.

§
id?: string
[src]

Output only. The ID of this shared drive which is also the ID of the top level folder of this shared drive.

§
kind?: string
[src]

Output only. Identifies what kind of resource this is. Value: the fixed string "drive#drive".

§
name?: string
[src]

The name of this shared drive.

§
orgUnitId?: string
[src]

Output only. The organizational unit of this shared drive. This field is only populated on drives.list responses when the useDomainAdminAccess parameter is set to true.

§
restrictions?: {
adminManagedRestrictions?: boolean;
copyRequiresWriterPermission?: boolean;
domainUsersOnly?: boolean;
driveMembersOnly?: boolean;
sharingFoldersRequiresOrganizerPermission?: boolean;
}
[src]

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.

§
themeId?: string
[src]

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.