import type { HttpClient, RequestOptions } from "../http.js"; import type { DriveFile, MailMessage, MailSummary, Person, SaveToDriveParams, SearchDriveParams, SearchMailParams } from "../types.js"; /** * A user's own Google, through this API rather than through Google. * * The distinction is the point. Google's tokens live encrypted on the server * and never reach a client, so an API key that leaks is an API key - not a * mailbox. Nothing here takes a Google credential, and nothing here ever will. * * Every method answers 409 when there is no connected account, or when Google * has stopped renewing one. Neither is a server fault and neither is fixed by * retrying: the user has to connect or reconnect at * persistmemory.com/dashboard/connect, and the error message says so. */ export declare class Google { #private; constructor(http: HttpClient); /** Files by name, newest first. Omit the query for recently changed ones. */ searchDrive(params?: SearchDriveParams, options?: RequestOptions): Promise<{ data: DriveFile[]; }>; getDriveFile(fileId: string, options?: RequestOptions): Promise; /** * The bytes of a Drive file. * * A Google Doc, Sheet or Slide holds no bytes of its own and is exported on * the way - a document as PDF, a spreadsheet as CSV - so `filename` comes * back describing what it BECAME. Writing it under the id instead produces a * file nothing will open. */ downloadDriveFile(fileId: string, options?: RequestOptions): Promise<{ bytes: Uint8Array; contentType: string; filename?: string; }>; /** * Writes a file into the user's Drive. * * Needs one of the Drive write permissions on their connection. A read-only * grant is refused by Google, and the error names the missing permission * rather than reporting a failed upload - one is fixed with a checkbox and * the other sends somebody looking for a bug. */ saveToDrive(params: SaveToDriveParams, options?: RequestOptions): Promise; /** * Recent messages - senders, subjects and a one-line preview, never bodies. * * `query` is Gmail's own syntax passed through as written: `from:priya`, * `has:attachment`, `newer_than:7d`. It selects within the connected mailbox * and cannot reach another one. */ searchMail(params?: SearchMailParams, options?: RequestOptions): Promise<{ data: MailSummary[]; }>; /** One message, with its body and the names of what is attached. */ readMail(messageId: string, options?: RequestOptions): Promise; /** * The bytes of one attachment. * * Separate from `readMail` so listing a mailbox never drags attachments * across the network: a message with a 40 MB deck should not cost 40 MB to * summarise. */ downloadAttachment(messageId: string, attachmentId: string, options?: RequestOptions): Promise<{ bytes: Uint8Array; contentType: string; }>; /** Sends as the connected account. Needs the send permission. */ sendMail(params: { to: string; subject: string; body: string; replyToMessageId?: string; }, options?: RequestOptions): Promise<{ id: string; }>; /** People in the user's contacts. Omit the query to list them. */ contacts(params?: { query?: string; limit?: number; }, options?: RequestOptions): Promise<{ data: Person[]; }>; }