/*! * Copyright Adaptavist 2025 (c) All rights reserved */ import { HeadersOption } from '@managed-api/commons-core'; import { CommonError, ErrorStrategyOption } from '../errorStrategy'; import { FileFields, ListFiles, ResumableUpload } from '../definitions/File'; import { Operation } from '../definitions/Operation'; import { GeneratedIds } from '../definitions/GeneratedIds'; import { ListLabels, ModifiedLabels } from '../definitions/Label'; import { Channel } from '../definitions/Channel'; export interface CopyFileRequest extends HeadersOption, ErrorStrategyOption { /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * The ID of the file. */ fileId: string; /** * 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. */ ignoreDefaultVisibility?: boolean; /** * 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. */ keepRevisionForever?: boolean; /** * A language hint for OCR processing during image import (ISO 639-1 code). */ ocrLanguage?: string; /** * Whether the requesting application supports both My Drives and shared drives. */ supportsAllDrives?: boolean; /** * Specifies which additional view's permissions to include in the response. Only 'published' is supported. */ includePermissionsForView?: 'published'; /** * A comma-separated list of IDs of labels to include in the labelInfo part of the response. */ includeLabels?: string; body?: { /** * The ID of the parent folder containing the file. * A file can only have one parent folder; specifying multiple parents isn't supported. */ parents?: string[]; /** * A collection of arbitrary key-value pairs which are visible to all apps. */ properties?: Record; /** * A collection of arbitrary key-value pairs which are private to the requesting app. */ appProperties?: Record; /** * Restrictions for accessing the content of the file. */ contentRestrictions?: { /** * 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. */ readOnly?: boolean; /** * Reason for why the content of the file is restricted. This is only mutable on requests that also set readOnly=true. */ reason?: string; /** * 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. */ ownerRestricted?: boolean; }[]; /** * Whether the options to copy, print, or download this file, should be disabled for readers and commenters. */ copyRequiresWriterPermission?: boolean; /** * Additional information about the content of the file. */ contentHints?: { /** * Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements. */ indexableText?: string; /** * A thumbnail for the file. This will only be used if Google Drive cannot generate a standard thumbnail. */ thumbnail?: { /** * The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5). * A base64-encoded string. */ image?: string; /** * The MIME type of the thumbnail. */ mimeType?: string; }; }; /** * The ID of the file. */ id?: string; /** * Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives. */ writersCanShare?: boolean; /** * The name of the file. This is not necessarily unique within a folder. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the name is constant. */ name?: string; /** * 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 resource. */ mimeType?: string; /** * A short description of the file. */ description?: string; /** * Whether the user has starred the file. */ starred?: boolean; /** * The time at which the file was created (RFC 3339 date-time). */ createdTime?: string; /** * The last time the file was modified by anyone (RFC 3339 date-time). */ modifiedTime?: string; /** * The last time the file was viewed by the user (RFC 3339 date-time). */ viewedByMeTime?: string; /** * 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. */ originalFilename?: string; /** * Whether this file has inherited permissions disabled. Inherited permissions are enabled by default. */ inheritedPermissionsDisabled?: boolean; /** * Download restrictions applied on the file. */ downloadRestrictions?: { /** * The download restriction of the file applied directly by the owner or organizer. This does not take into account shared drive settings or DLP rules. */ itemDownloadRestriction: { /** * Whether download and copy is restricted for readers. */ restrictedForReaders?: boolean; /** * Whether download and copy is restricted for writers. If true, download is also restricted for readers. */ restrictedForWriters?: boolean; }; }; }; } export interface CopyFileResponseOK extends FileFields { } export interface CopyFileResponseError extends CommonError { } export interface GetFilesRequest extends HeadersOption, ErrorStrategyOption { /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * Bodies of items (files/documents) to which the query applies. Supported bodies are 'user', 'domain', 'drive', and '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. */ corpora?: string; /** * ID of the shared drive to search. */ driveId?: string; /** * Whether both My Drive and shared drive items should be included in results. */ includeItemsFromAllDrives?: boolean; /** * A comma-separated list of sort keys. Valid keys are: * - createdTime: When the file was created. * - 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. */ orderBy?: string; /** * 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. */ pageSize?: number; /** * 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. */ pageToken?: string; /** * A query for filtering the file results. See the "Search for files & folders" guide for supported syntax. */ q?: string; /** * A comma-separated list of spaces to query within the corpora. Supported values are 'drive' and 'appDataFolder'. */ spaces?: string; /** * Whether the requesting application supports both My Drives and shared drives. */ supportsAllDrives?: boolean; /** * Specifies which additional view's permissions to include in the response. Only 'published' is supported. */ includePermissionsForView?: 'published'; /** * A comma-separated list of IDs of labels to include in the labelInfo part of the response. */ includeLabels?: string; } export interface GetFilesResponseOK extends ListFiles { } export interface GetFilesResponseError extends CommonError { } export interface DeleteFileRequest extends HeadersOption, ErrorStrategyOption { /** * The ID of the file. */ fileId: string; /** * Whether the requesting application supports both My Drives and shared drives. */ supportsAllDrives?: boolean; } export type DeleteFileResponseOK = undefined; export interface DeleteFileResponseError extends CommonError { } export interface DownloadFileRequest extends HeadersOption, ErrorStrategyOption { /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * The ID of the file to download. */ fileId: string; /** * The MIME type the file should be downloaded as. This field can only be set when downloading Google Workspace documents. * [See files.export MIME types for Google Workspace documents for the list of supported MIME types](https://developers.google.com/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. */ mimeType?: string; /** * 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. */ revisionId?: string; } export interface DownloadFileResponseOK extends Operation { } export interface DownloadFileResponseError extends CommonError { } export interface EmptyTrashRequest extends HeadersOption, ErrorStrategyOption { /** * If set, empties the trash of the provided shared drive. */ driveId?: string; } export type EmptyTrashResponseOK = undefined; export interface EmptyTrashResponseError extends CommonError { } export interface ExportFileRequest extends HeadersOption, ErrorStrategyOption { /** * The ID of the file. */ fileId: string; /** * The MIME type of the format requested for this export. */ mimeType: string; } export type ExportFileResponseOK = ArrayBuffer | string; export interface ExportFileResponseError extends CommonError { } export interface GenerateIdsRequest extends HeadersOption, ErrorStrategyOption { /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * The number of IDs to return. */ count?: number; /** * The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'. (Default: 'drive') */ space?: string; /** * 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') */ type?: string; } export interface GenerateIdsResponseOK extends GeneratedIds { } export interface GenerateIdsResponseError extends CommonError { } export interface GetFileRequest extends HeadersOption, ErrorStrategyOption { /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * The ID of the file. */ fileId: string; /** * 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. */ acknowledgeAbuse?: boolean; /** * Whether the requesting application supports both My Drives and shared drives. */ supportsAllDrives?: boolean; /** * Specifies which additional view's permissions to include in the response. Only 'published' is supported. */ includePermissionsForView?: 'published'; /** * A comma-separated list of IDs of labels to include in the labelInfo part of the response. */ includeLabels?: string; /** * If set to 'media', the response includes the file contents in the response body. */ alt?: 'media' | 'json'; } export type GetFileResponseOK = FileFields & ArrayBuffer & string; export interface GetFileResponseError extends CommonError { } export interface GetLabelsRequest extends HeadersOption, ErrorStrategyOption { /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * The ID of the file. */ fileId: string; /** * The maximum number of labels to return per page. When not set, defaults to 100. */ maxResults?: number; /** * 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. */ pageToken?: string; } export interface GetLabelsResponseOK extends ListLabels { } export interface GetLabelsResponseError extends CommonError { } export interface EditLabelsRequest extends HeadersOption, ErrorStrategyOption { /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * The ID of the file to which the labels belong. */ fileId: string; /** * The request body containing label modifications. */ body: { /** * The list of label modifications to apply. */ labelModifications: { /** * The ID of the label to modify. */ labelId: string; /** * The fields to update. For each field, specify the field ID and the new values. */ fieldModifications?: { /** * The ID of the field to modify. */ fieldId: string; /** * Array of strings in RFC 3339 full-date format (YYYY-MM-DD) to set as values for a date field. */ setDateValues?: string[]; /** * Array of strings to set as values for a text field. */ setTextValues?: string[]; /** * Array of strings to set as values for a selection field. */ setSelectionValues?: string[]; /** * Array of integers to set as values for an integer field. */ setIntegerValues?: number[]; /** * Array of email addresses to set as values for a user field. */ setUserValues?: string[]; /** * Whether to unset all values for this field. */ unsetValues?: boolean; }[]; /** * Whether to remove the label from the file. */ removeLabel?: boolean; }[]; }; } export interface EditLabelsResponseOK extends ModifiedLabels { } export interface EditLabelsResponseError extends CommonError { } export interface CreateFileRequest extends HeadersOption, ErrorStrategyOption { /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * 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. */ ignoreDefaultVisibility?: boolean; /** * 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. */ keepRevisionForever?: boolean; /** * A language hint for OCR processing during image import (ISO 639-1 code). */ ocrLanguage?: string; /** * Whether the requesting application supports both My Drives and shared drives. */ supportsAllDrives?: boolean; /** * Whether to use the uploaded content as indexable text. */ useContentAsIndexableText?: boolean; /** * The type of upload request to the /upload URI. If you are uploading data with an /upload URI, this field is required. If you are creating a metadata-only file, this field isn't required. * Acceptable values are: * - media: [Simple upload.](https://developers.google.com/workspace/drive/api/guides/manage-uploads#simple) Upload the media only, without any metadata. * - multipart: [Multipart upload.](https://developers.google.com/workspace/drive/api/guides/manage-uploads#multipart) Upload both the media and its metadata, in a single request. * - resumable: [Resumable upload.](https://developers.google.com/workspace/drive/api/guides/manage-uploads#resumable) Upload the file in a resumable fashion, using a series of at least two requests where the first request includes the metadata. * Upload a file by making a POST request to the location URL using fetch. */ uploadType?: 'media' | 'multipart' | 'resumable'; /** * The metadata for the file. */ body?: { /** * The content of the file. Required when uploadType is provided. * When uploadType is specified, this content will be uploaded to Google Drive. */ content?: string | ArrayBuffer; /** * The ID of the parent folder containing the file. * A file can only have one parent folder; specifying multiple parents isn't supported. */ parents?: string[]; /** * A collection of arbitrary key-value pairs which are visible to all apps. */ properties?: Record; /** * A collection of arbitrary key-value pairs which are private to the requesting app. */ appProperties?: Record; /** * Whether users with only writer permission can modify the file's permissions. */ writersCanShare?: boolean; /** * Restrictions for accessing the content of the file. */ contentRestrictions?: { /** * 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. */ readOnly?: boolean; /** * Reason for why the content of the file is restricted. This is only mutable on requests that also set readOnly=true. */ reason?: string; /** * 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. */ ownerRestricted?: boolean; }[]; /** * Whether the options to copy, print, or download this file, should be disabled for readers and commenters. */ copyRequiresWriterPermission?: boolean; /** * Additional information about the content of the file. */ contentHints?: { /** * Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements. */ indexableText?: string; /** * A thumbnail for the file. This will only be used if Google Drive cannot generate a standard thumbnail. */ thumbnail?: { /** * The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5). * A base64-encoded string. */ image?: string; /** * The MIME type of the thumbnail. */ mimeType?: string; }; }; /** * The ID of the file. */ id?: string; /** * The name of the file. This is not necessarily unique within a folder. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the name is constant. */ name?: string; /** * 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 resource. */ mimeType?: string; /** * A short description of the file. */ description?: string; /** * Whether the user has starred the file. */ starred?: boolean; /** * The time at which the file was created (RFC 3339 date-time). */ createdTime?: string; /** * The last time the file was modified by anyone (RFC 3339 date-time). */ modifiedTime?: string; /** * The last time the file was viewed by the user (RFC 3339 date-time). */ viewedByMeTime?: string; /** * Whether this file has inherited permissions disabled. Inherited permissions are enabled by default. */ inheritedPermissionsDisabled?: boolean; /** * Download restrictions applied on the file. */ downloadRestrictions?: { /** * The download restriction of the file applied directly by the owner or organizer. This does not take into account shared drive settings or DLP rules. */ itemDownloadRestriction: { /** * Whether download and copy is restricted for readers. */ restrictedForReaders?: boolean; /** * Whether download and copy is restricted for writers. If true, download is also restricted for readers. */ restrictedForWriters?: boolean; }; }; /** * 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 resource. * If an unsupported color is specified, the closest color in the palette is used instead. */ folderColorRgb?: string; /** * Shortcut file details. Only populated for shortcut files, which have the mimeType field set to application/vnd.google-apps.shortcut. * */ shortcutDetails?: { /** * The ID of the file that this shortcut points to. */ targetId: string; }; }; /** * Specifies which additional view's permissions to include in the response. Only 'published' is supported. */ includePermissionsForView?: 'published'; /** * A comma-separated list of IDs of labels to include in the labelInfo part of the response. */ includeLabels?: string; } export type CreateFileResponseOK = FileFields & ResumableUpload; export interface CreateFileResponseError extends CommonError { } export interface UpdateFileRequest extends HeadersOption, ErrorStrategyOption { /** * The ID of the file. */ fileId: string; /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * A comma-separated list of parent IDs to add. */ addParents?: string; /** * A comma-separated list of parent IDs to remove. */ removeParents?: string; /** * 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. */ keepRevisionForever?: boolean; /** * A language hint for OCR processing during image import (ISO 639-1 code). */ ocrLanguage?: string; /** * Whether the requesting application supports both My Drives and shared drives. */ supportsAllDrives?: boolean; /** * Whether to use the uploaded content as indexable text. */ useContentAsIndexableText?: boolean; /** * The type of upload request to the /upload URI. If you are uploading data with an /upload URI, this field is required. If you are creating a metadata-only file, this field isn't required. * Acceptable values are: * - media: [Simple upload.](https://developers.google.com/workspace/drive/api/guides/manage-uploads#simple) Upload the media only, without any metadata. * - multipart: [Multipart upload.](https://developers.google.com/workspace/drive/api/guides/manage-uploads#multipart) Upload both the media and its metadata, in a single request. * - resumable: [Resumable upload.](https://developers.google.com/workspace/drive/api/guides/manage-uploads#resumable) Upload the file in a resumable fashion, using a series of at least two requests where the first request includes the metadata. * Upload a file by making a POST request to the location URL using fetch. */ uploadType?: 'media' | 'multipart' | 'resumable'; /** * Specifies which additional view's permissions to include in the response. Only published is supported. */ includePermissionsForView?: 'published'; /** * A comma-separated list of IDs of labels to include in the labelInfo part of the response. */ includeLabels?: string; /** * The metadata for the file. */ body?: { /** * The content of the file. Required when uploadType is provided. * When uploadType is specified, this content will be uploaded to Google Drive. */ content?: string | ArrayBuffer; /** * A collection of arbitrary key-value pairs which are visible to all apps. */ properties?: Record; /** * A collection of arbitrary key-value pairs which are private to the requesting app. */ appProperties?: Record; /** * Whether users with only writer permission can modify the file's permissions. */ writersCanShare?: boolean; /** * Restrictions for accessing the content of the file. */ contentRestrictions?: { /** * 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. */ readOnly?: boolean; /** * Reason for why the content of the file is restricted. This is only mutable on requests that also set readOnly=true. */ reason?: string; /** * 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. */ ownerRestricted?: boolean; }[]; /** * Whether the options to copy, print, or download this file, should be disabled for readers and commenters. */ copyRequiresWriterPermission?: boolean; /** * Additional information about the content of the file. */ contentHints?: { /** * Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements. */ indexableText?: string; /** * A thumbnail for the file. This will only be used if Google Drive cannot generate a standard thumbnail. */ thumbnail?: { /** * The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5). * A base64-encoded string. */ image?: string; /** * The MIME type of the thumbnail. */ mimeType?: string; }; }; /** * Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash. */ trashed?: boolean; /** * The name of the file. This is not necessarily unique within a folder. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the name is constant. */ name?: string; /** * 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 resource. */ mimeType?: string; /** * A short description of the file. */ description?: string; /** * Whether the user has starred the file. */ starred?: boolean; /** * The last time the file was modified by anyone (RFC 3339 date-time). */ modifiedTime?: string; /** * The last time the file was viewed by the user (RFC 3339 date-time). */ viewedByMeTime?: string; /** * Whether this file has inherited permissions disabled. Inherited permissions are enabled by default. */ inheritedPermissionsDisabled?: boolean; /** * Download restrictions applied on the file. */ downloadRestrictions?: { /** * The download restriction of the file applied directly by the owner or organizer. This does not take into account shared drive settings or DLP rules. */ itemDownloadRestriction: { /** * Whether download and copy is restricted for readers. */ restrictedForReaders?: boolean; /** * Whether download and copy is restricted for writers. If true, download is also restricted for readers. */ restrictedForWriters?: boolean; }; }; /** * 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 resource. * If an unsupported color is specified, the closest color in the palette is used instead. */ folderColorRgb?: string; }; } export type UpdateFileResponseOK = FileFields & ResumableUpload; export interface UpdateFileResponseError extends CommonError { } export interface WatchFileRequest extends HeadersOption, ErrorStrategyOption { /** * The ID of the file to watch. */ fileId: string; /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * Whether the requesting application supports both My Drives and shared drives. */ supportsAllDrives?: boolean; /** * Specifies which additional view's permissions to include in the response. Only 'published' is supported. */ includePermissionsForView?: 'published'; /** * A comma-separated list of IDs of labels to include in the labelInfo part of the response. */ includeLabels?: string; body: { /** * A UUID or similar unique string that identifies this channel. */ id?: string; /** * An arbitrary string delivered to the target address with each notification delivered over this channel. Optional. */ token?: string; /** * The type of delivery mechanism used for this channel. Valid values are "web_hook" or "webhook". */ type: 'web_hook' | 'webhook'; /** * The address where notifications are delivered for this channel. */ address?: string; /** * Additional parameters controlling delivery channel behavior. Optional. */ params?: Record; /** * A Boolean value to indicate whether payload is wanted. Optional. */ payload?: boolean; }; } export interface WatchFileResponseOK extends Channel { } export interface WatchFileResponseError extends CommonError { } //# sourceMappingURL=file.d.ts.map