UNPKG

@0xtld/tair-node

Version:

A Node.js package for Tair functionality with configuration, core, and helper modules.

103 lines 2.74 kB
import { AxiosInstance } from "axios"; interface IMailRestAccount { address: string; password: string; } declare enum EMailRestGateway { MAIL_TM = "https://api.mail.tm", MAIL_GW = "https://api.mail.gw" } interface IMailRestConfig { gateway: EMailRestGateway; account: IMailRestAccount; maximumRetries: number; } interface IMailRestArgsGetOtp { receiptEmail: string; extractOtp: (message: IMailRestMessage) => Promise<string>; configs: { retry: number; isGetDetail?: boolean; isDelete?: boolean; }; } interface IMailRestMessage { "@id": string; "@type": string; "@context": string; id: string; accountId: string; msgid: string; from: { name: string; address: string; }; to: { name: string; address: string; }[]; subject: string; intro: string; seen: boolean; isDeleted: boolean; hasAttachments: boolean; size: number; downloadUrl: string; createdAt: string; updatedAt: string; text: string; html: [string]; } interface IMailRestDomain { id: string; domain: string; isActive: boolean; createdAt: string; updatedAt: string; } /** * @description MailRest class */ declare class MailRest { /** * @description jwt token of the account */ token: string | null; axios: AxiosInstance; configs: IMailRestConfig; domains: IMailRestDomain[]; constructor(configs: IMailRestConfig); setAccount(account: IMailRestAccount): void; setAccountAndLogin(account: IMailRestAccount): Promise<void>; getDomains(): Promise<IMailRestDomain[]>; /** * @description Create an account * @param account IMailRestAccount * @param configs { createAndSet?: boolean } * @returns Promise<IMailRestAccount> */ createAccount(account: IMailRestAccount, configs?: { createAndSet?: boolean; }): Promise<IMailRestAccount>; beforeRequest(): Promise<void>; login(): Promise<void>; /** * * @returns Promise<IMailRestMessage[]> */ messages(): Promise<IMailRestMessage[]>; deleteMessage(id: string): Promise<import("axios").AxiosResponse<any, any>>; getMessage(id: string): Promise<IMailRestMessage>; /** * @description Truncate all messages */ truncateAllMessages(): Promise<void>; /** * @description Get OTP from email * @param args IMailRestArgsGetOtp * @returns Promise<string | null> * */ getOTP(args: IMailRestArgsGetOtp): Promise<string | null>; } export { MailRest, IMailRestConfig, IMailRestMessage, EMailRestGateway, IMailRestAccount, IMailRestArgsGetOtp, }; //# sourceMappingURL=mail.d.ts.map