UNPKG

onesecmail

Version:

Create and receive email in only 1 second.

53 lines (52 loc) 2.13 kB
/// <reference types="node" resolution-mode="require"/> import { TypedEmitter } from "tiny-typed-emitter"; import OneSecMailAPI from "./OneSecMailAPI.js"; import type { ShortMessage, Attachment, Message, Options } from "./types.js"; interface OneSecMailboxEvents { newMessage: (message: OneSecMailShortMessage) => void; error: (error: Error) => void; } export default function OneSecMail(emailAddress?: string): Promise<OneSecMailbox>; export default function OneSecMail(options: Partial<Options>): Promise<OneSecMailbox>; export default function OneSecMail(emailAddress: string, options?: Partial<Options>): Promise<OneSecMailbox>; declare class OneSecMailbox extends TypedEmitter<OneSecMailboxEvents> { #private; readonly emailAddress: string; constructor(emailAddress: string, api: OneSecMailAPI); getMessages(options?: Partial<Options>): Promise<OneSecMailShortMessage[]>; clearMessages(options?: Partial<Options>): Promise<void>; startPolling(intervalTime?: number): boolean; stopPolling(): boolean; } declare class OneSecMailShortMessage { #private; readonly id: number; readonly from: string; readonly subject: string; readonly date: string; constructor(emailAddress: string, message: ShortMessage, api: OneSecMailAPI); fetchFullMessage(options?: Partial<Options>): Promise<OneSecMailMessage>; serialize(): ShortMessage; } declare class OneSecMailMessage { readonly id: number; readonly from: string; readonly subject: string; readonly date: string; readonly attachments: OneSecMailAttachment[]; readonly body: string; readonly textBody: string; readonly htmlBody: string; constructor(emailAddress: string, message: Message, api: OneSecMailAPI); serialize(): Message; } declare class OneSecMailAttachment { #private; readonly filename: string; readonly contentType: string; readonly size: number; constructor(emailAddress: string, messageId: number, attachment: Attachment, api: OneSecMailAPI); download(options?: Partial<Options>): Promise<Buffer>; serialize(): Attachment; } export {};