/** * Gmail module — search, read, send, reply, forward, labels, drafts. * * All functions take an OAuth2Client as first argument. * Use `getAuth('gmail', 'account@email.com')` from the auth module. */ import type { OAuth2Client } from 'google-auth-library'; import type { GmailMessage, GmailThread, GmailDraft, ListResult, WriteResult, SearchOptions, SendOptions, ReplyOptions, ForwardOptions, BatchLabelOptions } from './types.js'; export type { GmailMessage, GmailThread, GmailDraft, ListResult, WriteResult, SearchOptions, SendOptions, ReplyOptions, ForwardOptions, BatchLabelOptions, }; export { getMessageRaw, getThreadMbox } from './raw.js'; export { sanitizeEmailHtml } from './formats.js'; export { markdownToHtml } from './markdown.js'; /** * Get the authenticated user's email address. */ export declare function getProfile(auth: OAuth2Client): Promise; /** * Search messages using Gmail query syntax. * * @example * ```ts * const results = await search(auth, { query: 'from:client is:unread' }); * ``` */ export declare function search(auth: OAuth2Client, opts: SearchOptions): Promise>; /** * Get a single message by ID. */ export declare function getMessage(auth: OAuth2Client, messageId: string): Promise; /** * Get a thread (conversation) by ID. */ export declare function getThread(auth: OAuth2Client, threadId: string): Promise; /** * Send an email. * * ⚠️ DESTRUCTIVE — requires safety confirmation. */ export declare function send(auth: OAuth2Client, opts: SendOptions): Promise; /** * Reply to a thread. * * ⚠️ DESTRUCTIVE — requires safety confirmation. */ export declare function reply(auth: OAuth2Client, opts: ReplyOptions): Promise; /** * Forward a message to new recipients. * * Fetches the original message, quotes its body, and re-attaches attachments. * By default creates a **draft** (WRITE, no safety gate). Use `sendNow: true` * to send immediately (⚠️ DESTRUCTIVE — requires safety confirmation). * * Supports keeping in thread, filtering attachments by include/exclude * lists, and markdown/html bodies. */ export declare function forward(auth: OAuth2Client, opts: ForwardOptions): Promise; /** * Batch modify labels on multiple messages. * * This is a WRITE operation (reversible), no safety gate. */ export declare function batchModifyLabels(auth: OAuth2Client, opts: BatchLabelOptions): Promise; /** * List all labels for the account. */ export declare function listLabels(auth: OAuth2Client): Promise>; /** * Create a draft. * * WRITE operation (reversible), no safety gate. * * @param opts.threadId - Optional thread ID to place the draft in an existing thread * @param opts.extraHeaders - Optional extra MIME headers (e.g. In-Reply-To, References) */ export declare function createDraft(auth: OAuth2Client, opts: SendOptions & { threadId?: string; extraHeaders?: Record; }): Promise; /** * Send an existing draft. * * ⚠️ DESTRUCTIVE — requires safety confirmation. */ export declare function sendDraft(auth: OAuth2Client, draftId: string): Promise; /** * List drafts. */ export declare function listDrafts(auth: OAuth2Client, maxResults?: number, pageToken?: string): Promise>; /** * Download an attachment's content as a Buffer. */ export declare function getAttachmentContent(auth: OAuth2Client, messageId: string, attachmentId: string): Promise; //# sourceMappingURL=index.d.ts.map