import * as Imap from "imap"; import type { ImapClientOptions } from "../types.js"; import type { EmailLogger } from "../utils/logger.js"; /** * IMAP client wrapper (using node-imap) */ export type ImapClient = Imap; /** * Connect IMAP client and open INBOX * Returns a connected Imap instance with INBOX already opened */ export declare function connectImap(options: ImapClientOptions, log?: EmailLogger): Promise; /** * Search for new emails since last UID * Searches all emails and filters by UID (limited to recent 50) */ export declare function searchNewEmails(client: ImapClient, lastUid: number | null, log?: EmailLogger): Promise<{ uid: number; }[]>; /** * Fetch email by UID * Returns the complete RFC822 message source */ export declare function fetchEmail(client: ImapClient, uid: number): Promise<{ uid: number; source: Buffer; }>; /** * Set up IMAP IDLE listener for new emails * Calls the callback when new emails arrive */ export declare function setupIdleListener(client: ImapClient, onNewEmail: () => void): void; /** * Remove IDLE listener */ export declare function removeIdleListener(client: ImapClient, onNewEmail: () => void): void; /** * Disconnect IMAP client */ export declare function disconnectImap(client: ImapClient, log?: EmailLogger): Promise; /** * Mark email as seen (read) */ export declare function markEmailSeen(client: ImapClient, uid: number, log?: EmailLogger): Promise; /** * Check if client is connected */ export declare function isConnected(client: ImapClient): boolean;