import type { gmail_v1 } from 'googleapis'; import { type AttachmentMeta, type Message, type MessageBody } from '@fluxmail/core'; export declare function decodeBase64Url(data: string): Buffer; export declare function encodeBase64Url(data: Buffer): string; export declare function decodeTextPart(part: gmail_v1.Schema$MessagePart, encoded?: string): string; type BodyField = 'text' | 'html'; export interface ExternalBodyPart { attachmentId: string; part: gmail_v1.Schema$MessagePart; } export type ExternalBodyParts = Partial>; interface WalkedParts { body: MessageBody; attachments: AttachmentMeta[]; externalBodyParts: ExternalBodyParts; } interface ParsedAttachment { meta: AttachmentMeta; content?: Buffer; /** Gmail's opaque ID from the current message response. */ providerAttachmentId?: string; } /** Walk the MIME tree collecting the preferred text/html bodies and attachment metadata. */ export declare function walkParts(payload: gmail_v1.Schema$MessagePart | undefined): WalkedParts; export declare function findAttachment(payload: gmail_v1.Schema$MessagePart | undefined, attachmentId: string): ParsedAttachment | undefined; export interface ParseContext { accountId: string; /** Gmail label id -> display name, for translating labelIds. */ labelNames: Map; includeBody: boolean; /** Set only when the Gmail response includes the MIME payload. */ includeAttachments?: boolean; includeHeaders?: boolean; } export declare function parseGmailMessage(msg: gmail_v1.Schema$Message, ctx: ParseContext): Message; export declare function parseGmailMessageWithParts(msg: gmail_v1.Schema$Message, ctx: ParseContext): { message: Message; externalBodyParts: ExternalBodyParts; }; export {}; //# sourceMappingURL=parse.d.ts.map