/** * Gmail Integration for WORKWAY * * Weniger, aber besser: Extends BaseAPIClient for shared HTTP logic. * * @example * ```typescript * import { Gmail } from '@workwayco/integrations/gmail'; * * const gmail = new Gmail({ accessToken: tokens.gmail.access_token }); * * // List recent emails * const emails = await gmail.listEmails({ maxResults: 10 }); * * // Get a specific email * const email = await gmail.getEmail({ id: 'abc123' }); * * // Send an email * const sent = await gmail.sendEmail({ * to: ['recipient@example.com'], * subject: 'Hello from WORKWAY', * body: 'This is a test email' * }); * ``` */ import { ActionResult } from '@workwayco/sdk'; import { BaseAPIClient } from '../core/index.js'; /** * Gmail API email message format */ export interface GmailMessage { id: string; threadId: string; labelIds: string[]; snippet: string; payload: { headers: Array<{ name: string; value: string; }>; mimeType: string; body?: { data?: string; size: number; }; parts?: Array<{ mimeType: string; body?: { data?: string; size: number; }; }>; }; internalDate: string; } /** * Gmail integration configuration */ export interface GmailConfig { /** OAuth access token */ accessToken: string; /** Optional: Override API endpoint (for testing) */ apiUrl?: string; /** Request timeout in milliseconds (default: 30000) */ timeout?: number; } /** * Options for listing emails */ export interface ListEmailsOptions { /** Maximum number of emails to return (default: 20, max: 100) */ maxResults?: number; /** Filter query (Gmail search syntax) */ query?: string; /** Label to filter by */ labelId?: string; /** Page token for pagination */ pageToken?: string; /** Include spam and trash (default: false) */ includeSpamTrash?: boolean; } /** * Options for getting a single email */ export interface GetEmailOptions { /** Email ID */ id: string; /** Format: 'full', 'metadata', 'minimal', 'raw' */ format?: 'full' | 'metadata' | 'minimal' | 'raw'; } /** * Options for sending an email */ export interface SendEmailOptions { /** Recipients */ to: string[]; /** CC recipients */ cc?: string[]; /** BCC recipients */ bcc?: string[]; /** Email subject */ subject: string; /** Plain text body */ body: string; /** HTML body (optional) */ htmlBody?: string; /** Thread ID to reply to */ threadId?: string; } /** * Options for creating a draft */ export interface CreateDraftOptions { /** Recipients */ to?: string[]; /** CC recipients */ cc?: string[]; /** BCC recipients */ bcc?: string[]; /** Email subject */ subject: string; /** Plain text body */ body: string; /** HTML body (optional) */ htmlBody?: string; /** Thread ID to reply to */ threadId?: string; } /** * Draft message response */ export interface GmailDraft { id: string; message: { id: string; threadId: string; }; } /** * Gmail Integration * * Weniger, aber besser: Extends BaseAPIClient for shared HTTP logic. */ export declare class Gmail extends BaseAPIClient { constructor(config: GmailConfig); /** * List emails from the user's inbox * * @returns ActionResult with list of emails */ listEmails(options?: ListEmailsOptions): Promise>; /** * Get a single email by ID * * @returns ActionResult with email data and StandardMessage format */ getEmail(options: GetEmailOptions): Promise>; /** * Send an email * * @returns ActionResult with sent message info */ sendEmail(options: SendEmailOptions): Promise>; /** * Search emails with query * * @returns ActionResult with matching emails */ searchEmails(query: string, maxResults?: number): Promise>; /** * Create a draft email * * Zuhandenheit: User reviews and sends when ready. * Perfect for meeting follow-ups that need personal touches. * * @returns ActionResult with draft info */ createDraft(options: CreateDraftOptions): Promise>; /** * Create a follow-up email draft from meeting data * * Zuhandenheit: Developer thinks "draft follow-up email" * not "construct MIME message, encode base64, POST to drafts API" * * @returns ActionResult with draft info */ createMeetingFollowup(options: { meetingTitle: string; attendees?: string[]; summary: string; actionItems: Array<{ task: string; assignee?: string; }>; notionUrl?: string; customMessage?: string; }): Promise>; /** * Get capabilities for Gmail actions */ private getCapabilities; /** * Convert Gmail message to StandardMessage format */ private toStandardMessage; /** * Base64 URL-safe encode (for email content) */ private base64UrlEncode; /** * Base64 URL-safe decode (for email content) */ private base64UrlDecode; } //# sourceMappingURL=index.d.ts.map