// Generated by notion tool-core codegen-script-types --connections. Do not edit. import type { ConnectionActionInvoker } from "./connection-actions.js" /** * Script input for the "Append Google Sheet rows" effect (`googleDriveOauth.appendSheetRows`), * derived from its Tool Core definition's call_function input projection. * * Append rows to a Google Sheet via OAuth. */ export type AppendSheetRowsScriptInput = { /** * The Google Sheet file ID. */ fileId: string /** * Sheet (tab) title to append to, e.g. 'Sheet1'. */ sheet: string /** * 2D array of new rows to append (rows × columns). Each inner array is one row. */ values: Array> /** * USER_ENTERED (default) parses formulas, dates, and numbers as if a user typed them. RAW stores each value exactly as provided. */ valueInputOption?: "RAW" | "USER_ENTERED" } /** * Canonical Tool Core output for the "Append Google Sheet rows" effect (`googleDriveOauth.appendSheetRows`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type AppendSheetRowsScriptOutput = { updatedRange?: string updatedRows?: number } /** * Script input for the "Batch update Google Doc" effect (`googleDriveOauth.batchUpdateDocument`), * derived from its Tool Core definition's call_function input projection. * * Apply low-level Google Docs batchUpdate requests to a document via OAuth. */ export type BatchUpdateDocumentScriptInput = { /** * The Google Doc file ID. */ fileId: string /** * A list of updates to apply to the document. Each request should be a valid documents.batchUpdate Request object, using the schema documented in: https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request Requests will be applied in the order they are specified. If any request is not valid, no requests will be applied. */ requests: Array> /** * Require the document revision returned by readDocument. */ writeControl?: { requiredRevisionId: string } } /** * Canonical Tool Core output for the "Batch update Google Doc" effect (`googleDriveOauth.batchUpdateDocument`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type BatchUpdateDocumentScriptOutput = { replies: Array> documentId: string writeControl?: { requiredRevisionId?: string } } /** * Script input for the "Batch update Google Slides presentation" effect (`googleDriveOauth.batchUpdatePresentation`), * derived from its Tool Core definition's call_function input projection. * * Apply low-level Google Slides batchUpdate requests to a presentation via OAuth. */ export type BatchUpdatePresentationScriptInput = { /** * The Google Slides presentation file ID. */ fileId: string /** * A list of updates to apply to the presentation. Each request should be a valid presentations.batchUpdate Request object, using the schema documented in: https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request Requests will be applied in the order they are specified. If any request is not valid, no requests will be applied. */ requests: Array> /** * Require the presentation revision returned by readPresentation. */ writeControl?: { requiredRevisionId: string } } /** * Canonical Tool Core output for the "Batch update Google Slides presentation" effect (`googleDriveOauth.batchUpdatePresentation`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type BatchUpdatePresentationScriptOutput = { replies: Array> presentationId: string writeControl?: { requiredRevisionId?: string } } /** * Script input for the "Batch update Google Sheet" effect (`googleDriveOauth.batchUpdateSpreadsheet`), * derived from its Tool Core definition's call_function input projection. * * Apply low-level Google Sheets batchUpdate requests to a spreadsheet via OAuth. */ export type BatchUpdateSpreadsheetScriptInput = { /** * The Google Sheet file ID. */ fileId: string /** * A list of updates to apply to the spreadsheet. Each request should be a valid spreadsheets.batchUpdate Request object, using the schema documented in: https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/request Requests will be applied in the order they are specified. If any request is not valid, no requests will be applied. */ requests: Array> /** * Whether to include the updated spreadsheet resource in the response. */ includeSpreadsheetInResponse?: boolean /** * A1 ranges to include when includeSpreadsheetInResponse is true. */ responseRanges?: Array /** * Whether the updated spreadsheet response should include grid data. */ responseIncludeGridData?: boolean } /** * Canonical Tool Core output for the "Batch update Google Sheet" effect (`googleDriveOauth.batchUpdateSpreadsheet`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type BatchUpdateSpreadsheetScriptOutput = { replies: Array> spreadsheetId: string updatedSpreadsheet?: Record } /** * Script input for the "Copy Google Drive file" effect (`googleDriveOauth.copyFile`), * derived from its Tool Core definition's call_function input projection. * * Copy a Google Drive file via OAuth. */ export type CopyFileScriptInput = { /** * The ID of the file to copy. */ fileId: string /** * Optional name for the copy. Defaults to 'Copy of '. */ name?: string /** * Optional folder or shared drive ID to place the copy in. */ destinationParentId?: string } /** * Canonical Tool Core output for the "Copy Google Drive file" effect (`googleDriveOauth.copyFile`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type CopyFileScriptOutput = { id: string name: string mimeType: string webViewLink?: string } /** * Script input for the "Create Google Doc" effect (`googleDriveOauth.createDocument`), * derived from its Tool Core definition's call_function input projection. * * Create a new Google Doc with content via OAuth. */ export type CreateDocumentScriptInput = { /** * The name for the new document. */ name: string /** * HTML content for the document. Supports headings, paragraphs, lists, tables, bold, italic, links, etc. Google converts the HTML into native Doc formatting. */ content: string /** * Optional folder or shared drive ID to create the document in. */ parentId?: string /** * Optional description for the document. */ description?: string } /** * Canonical Tool Core output for the "Create Google Doc" effect (`googleDriveOauth.createDocument`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type CreateDocumentScriptOutput = { id: string name: string mimeType: string webViewLink?: string } /** * Script input for the "Create Google Drive folder" effect (`googleDriveOauth.createFolder`), * derived from its Tool Core definition's call_function input projection. * * Create a new folder in Google Drive via OAuth. */ export type CreateFolderScriptInput = { /** * The name for the new folder. */ name: string /** * Optional folder or shared drive ID to create the folder in. */ parentId?: string /** * Optional description for the folder. */ description?: string } /** * Canonical Tool Core output for the "Create Google Drive folder" effect (`googleDriveOauth.createFolder`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type CreateFolderScriptOutput = { id: string name: string webViewLink?: string } /** * Script input for the "Create Google Slides presentation" effect (`googleDriveOauth.createPresentation`), * derived from its Tool Core definition's call_function input projection. * * Create a new Google Slides presentation via OAuth. */ export type CreatePresentationScriptInput = { /** * The name for the new presentation. */ name: string /** * Optional title-slide title. Defaults to the name when omitted. */ title?: string /** * Optional title-slide subtitle. */ subtitle?: string /** * Optional folder or shared drive ID to create the presentation in. */ parentId?: string /** * Optional description for the presentation. */ description?: string } /** * Canonical Tool Core output for the "Create Google Slides presentation" effect (`googleDriveOauth.createPresentation`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type CreatePresentationScriptOutput = { id: string name: string mimeType: string webViewLink?: string } /** * Script input for the "Create Google Sheet" effect (`googleDriveOauth.createSpreadsheet`), * derived from its Tool Core definition's call_function input projection. * * Create a new Google Sheet with data via OAuth. */ export type CreateSpreadsheetScriptInput = { /** * The name for the new spreadsheet. */ name: string /** * CSV-formatted data: rows separated by newlines, columns by commas. Example: "Name,Age\nAlice,30\nBob,25" */ content: string /** * Optional folder or shared drive ID to create the spreadsheet in. */ parentId?: string /** * Optional description for the spreadsheet. */ description?: string } /** * Canonical Tool Core output for the "Create Google Sheet" effect (`googleDriveOauth.createSpreadsheet`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type CreateSpreadsheetScriptOutput = { id: string name: string mimeType: string webViewLink?: string } /** * Script input for the "Download Google Drive file" effect (`googleDriveOauth.downloadFile`), * derived from its Tool Core definition's call_function input projection. * * Download a Google Drive file into the current thread. */ export type DownloadFileScriptInput = { /** * The Google Drive file ID to download. */ fileId: string /** * Optional Google Drive export MIME type for a native Google Workspace file, such as application/pdf. */ exportMimeType?: string } /** * Canonical Tool Core output for the "Download Google Drive file" effect (`googleDriveOauth.downloadFile`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type DownloadFileScriptOutput = { id: string name: string mimeType: string sourceMimeType: string modifiedTime?: string } /** * Script input for the "List Google Drive changes" effect (`googleDriveOauth.listChanges`), * derived from its Tool Core definition's call_function input projection. * * List Google Drive files modified since the trigger's previous poll. */ export type ListChangesScriptInput = { /** * ISO 8601 timestamp from the trigger's `changeToken` variable. */ pageToken: string /** * Override the auto-applied scope to query a specific shared drive. */ driveId?: string /** * Override the auto-applied scope to filter to a folder's direct children. */ folderId?: string } /** * Canonical Tool Core output for the "List Google Drive changes" effect (`googleDriveOauth.listChanges`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ListChangesScriptOutput = { changes: Array<{ fileId: string removed: boolean changeType?: string time?: string file?: { id: string name: string mimeType: string webViewLink?: string modifiedTime?: string createdTime?: string } }> truncated?: boolean nextModifiedAfter?: string } /** * Script input for the "List Google Drive files" effect (`googleDriveOauth.listFiles`), * derived from its Tool Core definition's call_function input projection. * * List Google Drive files via OAuth. */ export type ListFilesScriptInput = { /** * Google Drive folder ID to list files from. */ folderId?: string /** * Shared drive ID to list files from. */ driveId?: string /** * Optional MIME type filters (e.g. 'application/vnd.google-apps.document', 'application/vnd.google-apps.folder'). */ mimeTypes?: Array /** * Optional file or folder name prefix. This searches names only, not file content. */ nameContains?: string /** * Optional most-recent-first sort order; it ranks results but does not filter to a time range. Use 'recency desc' for generic recent files, 'modifiedByMeTime desc' for files the connected user recently updated, and 'viewedByMeTime desc' for files they recently viewed. */ orderBy?: | "modifiedTime desc" | "modifiedByMeTime desc" | "viewedByMeTime desc" | "recency desc" /** * Maximum number of files to return (default: 50, max: 100). */ pageSize?: number /** * Token from a previous response to fetch the next page of results. */ pageToken?: string } /** * Canonical Tool Core output for the "List Google Drive files" effect (`googleDriveOauth.listFiles`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ListFilesScriptOutput = { files: Array<{ id: string name: string mimeType: string webViewLink?: string modifiedTime?: string createdTime?: string modifiedByMeTime?: string viewedByMeTime?: string sharedWithMeTime?: string }> /** * Pass this opaque token as pageToken for the next page. */ nextPageToken?: string /** * True when an unscoped listing may have omitted shared-drive results. */ incompleteSearch?: boolean } /** * Script input for the "Move or rename Google Drive file" effect (`googleDriveOauth.moveFile`), * derived from its Tool Core definition's call_function input projection. * * Move and/or rename a Google Drive file via OAuth. */ export type MoveFileScriptInput = { /** * The ID of the file to move or rename. */ fileId: string /** * New name for the file. Omit to keep the current name. */ name?: string /** * Folder or shared drive ID to move the file into. Omit to keep the file in its current location. */ destinationParentId?: string } /** * Canonical Tool Core output for the "Move or rename Google Drive file" effect (`googleDriveOauth.moveFile`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type MoveFileScriptOutput = { id: string name: string mimeType: string webViewLink?: string } /** * Script input for the "Read Google Doc structure" effect (`googleDriveOauth.readDocument`), * derived from its Tool Core definition's call_function input projection. * * Read a Google Doc's outline and optionally a section body via OAuth. */ export type ReadDocumentScriptInput = { /** * The Google Doc file ID. */ fileId: string /** * Optional tab ID from the overview. With no indices, returns the whole tab if it fits. */ tabId?: string /** * Optional inclusive character index. Must be provided with tabId and endIndex. */ startIndex?: number /** * Optional exclusive character index. Must be provided with tabId and startIndex. */ endIndex?: number } /** * Canonical Tool Core output for the "Read Google Doc structure" effect (`googleDriveOauth.readDocument`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ReadDocumentScriptOutput = | { id: string title: string type: "overview" webViewLink?: string revisionId?: string tabs: Array<{ tabId: string title: string index?: number nestingLevel?: number parentTabId?: string startIndex: number endIndex: number characterCount: number headings: Array<{ heading: string level: number order: number startIndex: number contentStartIndex: number endIndex: number preview?: string }> }> } | { id: string title: string type: "content" webViewLink?: string revisionId?: string tabId: string range: { startIndex: number endIndex: number } documentTab: Record } /** * Script input for the "Read Google Drive file" effect (`googleDriveOauth.readFile`), * derived from its Tool Core definition's call_function input projection. * * Read a Google Drive file's content or metadata via OAuth. */ export type ReadFileScriptInput = { /** * The Google Drive file ID to read. */ fileId: string /** * When true, returns only file metadata without downloading content. Useful for checking file info without the cost of a full read. */ metadataOnly?: boolean } /** * Canonical Tool Core output for the "Read Google Drive file" effect (`googleDriveOauth.readFile`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ReadFileScriptOutput = { id: string name: string mimeType: string content?: string webViewLink?: string modifiedTime?: string } /** * Script input for the "Read Google Slides structure" effect (`googleDriveOauth.readPresentation`), * derived from its Tool Core definition's call_function input projection. * * Read a Google Slides presentation's structure via OAuth. */ export type ReadPresentationScriptInput = { /** * The Google Slides file ID to read. */ fileId: string /** * Optional. One to 20 slide, layout, or master page object IDs from the overview. Returns raw Page details. Omit to get the page map. */ pageIds?: Array } /** * Canonical Tool Core output for the "Read Google Slides structure" effect (`googleDriveOauth.readPresentation`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ReadPresentationScriptOutput = | { id: string title: string type: "overview" webViewLink?: string revisionId?: string slides: Array<{ pageId: string index: number title?: string textPreview?: string layoutId?: string masterId?: string }> layouts: Array<{ pageId: string name?: string displayName?: string masterId?: string }> masters: Array<{ pageId: string }> } | { id: string title: string type: "pages" webViewLink?: string revisionId?: string pages: Array> } /** * Script input for the "Read Google Sheet structure" effect (`googleDriveOauth.readSpreadsheet`), * derived from its Tool Core definition's call_function input projection. * * Read a Google Sheet's structure and optionally one sheet's values via OAuth. */ export type ReadSpreadsheetScriptInput = { /** * The Google Sheet file ID to read. */ fileId: string /** * Optional explicit A1 range, including the tab name, such as "Sales!A1:H200". Omit for metadata only. Reads are limited to 10,000 requested cells and oversized requests fail with a narrower example. */ range?: string } /** * Canonical Tool Core output for the "Read Google Sheet structure" effect (`googleDriveOauth.readSpreadsheet`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type ReadSpreadsheetScriptOutput = { id: string title: string webViewLink?: string sheets: Array<{ sheetId: number title: string index: number rowCount?: number columnCount?: number }> sheetValues?: { requestedRange: string returnedRange: string majorDimension: string values: Array> } } /** * Script input for the "Search Google Drive files" effect (`googleDriveOauth.searchFiles`), * derived from its Tool Core definition's call_function input projection. * * Search Google Drive files via OAuth. */ export type SearchFilesScriptInput = { /** * Plain-text search query for finding files by name or content. Do NOT put Drive query syntax here (e.g. mimeType=, modifiedTime>, name contains) — use the dedicated parameters instead. */ query: string /** * Optional folder ID to scope the search within. */ folderId?: string /** * Optional shared drive ID to scope the search within. */ driveId?: string /** * Optional MIME type filters (e.g. 'application/vnd.google-apps.document', 'application/vnd.google-apps.folder'). */ mimeTypes?: Array /** * Optional ISO date string to filter files modified after this date (e.g. '2024-01-01T00:00:00Z'). */ modifiedAfter?: string /** * Optional ISO date string to filter files created after this date. Use for finding new files. */ createdAfter?: string /** * Maximum number of results per page (default: 20, max: 100). */ pageSize?: number /** * Continuation cursor. Pass a prior result's `nextPageToken` to fetch the next page. */ pageToken?: string } /** * Canonical Tool Core output for the "Search Google Drive files" effect (`googleDriveOauth.searchFiles`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type SearchFilesScriptOutput = { files: Array<{ id: string name: string mimeType: string webViewLink?: string modifiedTime?: string createdTime?: string modifiedByMeTime?: string viewedByMeTime?: string sharedWithMeTime?: string }> /** * Pass this opaque token as pageToken for the next page. */ nextPageToken?: string /** * True when an unscoped search may have omitted shared-drive results. */ incompleteSearch?: boolean } /** * Script input for the "Trash Google Drive file" effect (`googleDriveOauth.trashFile`), * derived from its Tool Core definition's call_function input projection. * * Move a Google Drive file to trash via OAuth. */ export type TrashFileScriptInput = { /** * The ID of the file to trash. */ fileId: string } /** * Canonical Tool Core output for the "Trash Google Drive file" effect (`googleDriveOauth.trashFile`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type TrashFileScriptOutput = { id: string name: string trashed: boolean } /** * Script input for the "Upload Google Drive file" effect (`googleDriveOauth.uploadFile`), * derived from its Tool Core definition's call_function input projection. * * Create a new Google Drive file from a thread file. */ export type UploadFileScriptInput = { /** * Authenticated thread file URI returned by computer.downloadFile, or session-file:// for a file attached to the Agent Service session. */ fileUri: string /** * Source filename including extension, used to infer its media type. */ sourceFileName: string /** * Optional name for the newly created Drive file. Defaults to sourceFileName. */ name?: string /** * Optional destination folder or shared drive ID. */ parentId?: string /** * Optional Drive file description. */ description?: string /** * Optionally convert a compatible file to a native Google Workspace format. */ convertTo?: "document" | "spreadsheet" | "presentation" } /** * Canonical Tool Core output for the "Upload Google Drive file" effect (`googleDriveOauth.uploadFile`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type UploadFileScriptOutput = { id: string name: string mimeType: string webViewLink?: string } /** * Script input for the "Write Google Sheet range" effect (`googleDriveOauth.writeSheetRange`), * derived from its Tool Core definition's call_function input projection. * * Write values to a range in a Google Sheet via OAuth. */ export type WriteSheetRangeScriptInput = { /** * The Google Sheet file ID. */ fileId: string /** * A1-notation range to write to, e.g. 'Sheet1!A1:C10'. Include the sheet name to avoid ambiguity. */ range: string /** * 2D array of cell values (rows × columns). All cells are written as strings; Google parses formulas and numbers when valueInputOption is USER_ENTERED (default). */ values: Array> /** * USER_ENTERED (default) parses formulas, dates, and numbers as if a user typed them. RAW stores each value exactly as provided. */ valueInputOption?: "RAW" | "USER_ENTERED" } /** * Canonical Tool Core output for the "Write Google Sheet range" effect (`googleDriveOauth.writeSheetRange`). * This is the definition's output schema; the effect's script surface may * re-encode it before returning. */ export type WriteSheetRangeScriptOutput = { updatedRange?: string updatedCells?: number } export class GoogleDriveOauthConnectionClient { constructor(private readonly invoke: ConnectionActionInvoker) {} appendSheetRows( args: AppendSheetRowsScriptInput, ): Promise { return this.invoke("appendSheetRows", args) } batchUpdateDocument( args: BatchUpdateDocumentScriptInput, ): Promise { return this.invoke( "batchUpdateDocument", args, ) } batchUpdatePresentation( args: BatchUpdatePresentationScriptInput, ): Promise { return this.invoke( "batchUpdatePresentation", args, ) } batchUpdateSpreadsheet( args: BatchUpdateSpreadsheetScriptInput, ): Promise { return this.invoke( "batchUpdateSpreadsheet", args, ) } copyFile(args: CopyFileScriptInput): Promise { return this.invoke("copyFile", args) } createDocument( args: CreateDocumentScriptInput, ): Promise { return this.invoke("createDocument", args) } createFolder( args: CreateFolderScriptInput, ): Promise { return this.invoke("createFolder", args) } createPresentation( args: CreatePresentationScriptInput, ): Promise { return this.invoke( "createPresentation", args, ) } createSpreadsheet( args: CreateSpreadsheetScriptInput, ): Promise { return this.invoke("createSpreadsheet", args) } downloadFile( args: DownloadFileScriptInput, ): Promise { return this.invoke("downloadFile", args) } listChanges(args: ListChangesScriptInput): Promise { return this.invoke("listChanges", args) } listFiles(args: ListFilesScriptInput): Promise { return this.invoke("listFiles", args) } moveFile(args: MoveFileScriptInput): Promise { return this.invoke("moveFile", args) } readDocument( args: ReadDocumentScriptInput, ): Promise { return this.invoke("readDocument", args) } readFile(args: ReadFileScriptInput): Promise { return this.invoke("readFile", args) } readPresentation( args: ReadPresentationScriptInput, ): Promise { return this.invoke("readPresentation", args) } readSpreadsheet( args: ReadSpreadsheetScriptInput, ): Promise { return this.invoke("readSpreadsheet", args) } searchFiles(args: SearchFilesScriptInput): Promise { return this.invoke("searchFiles", args) } trashFile(args: TrashFileScriptInput): Promise { return this.invoke("trashFile", args) } uploadFile(args: UploadFileScriptInput): Promise { return this.invoke("uploadFile", args) } writeSheetRange( args: WriteSheetRangeScriptInput, ): Promise { return this.invoke("writeSheetRange", args) } }