import { IAddress, IForwardOptions, IOwned } from "./models/Address"; import { IAttachment } from "./models/Attachment"; import { FolderTypes, IFolderResponse, IHeadersResponse, IInboxOptions, IInboxResponse, ILabelsResponse, IMessage, IReadResponse, ISearchResponse, ISendMessageOptions } from "./models/Message"; import { ISignOutResult, IUser, IUserStats } from "./models/User"; export interface ICountResponse { _id: string; n: number; } /** * Querystring Param Format Description * startDate date (UTC) Required - Limit results to inboxes that received messages after this date. * endDate date (UTC) Required - Limit results to inboxes that received messages before this date. * limit integer Optional - Limit results to this many, default 20, max 1000. * skip integer Optional - Skip this many, default 0. */ export interface IQueryOptions { startDate: Date; endDate: Date; limit?: number; skip?: number; } export declare class Client { apiKey?: string; private axios; constructor(apiKey?: string); /** * Get an array of private inbox address objects for the account. * @return {Promise} address list */ getPrivateAddresses(): Promise; /** * Get a single address object. * Returns an object if owned by the user or not owned. * Returns 401 if owned by other user. * @param {string} email email * @return {Promise} Address */ getAddress(email: string): Promise; /** * Check if an address is private (AKA owned). * @param {string} email email * @return {Promise} owned */ checkAddressOwnership(email: string): Promise; /** * Reserve ownership of a private email address. * No POST body is required. * Returns 200 if successfully reserves the address. * Returns 401 if owned by other user. * Returns 400 if it is already owned by the user. * @param {string} email email * @return {Promise} address */ reserveAddress(email: string): Promise; /** * Release ownership of a private address. * Returns 200 if successfully releases the address. * Returns 401 if owned by other user. * Returns 400 if it is not owned. * @param {string} email email * @return {Promise} void */ releaseAddress(email: string): Promise; /** * For a privately owned address email, set it to forward to another email. * @param {string} email email * @return {Promise} void */ forwardAddress(email: string, options: IForwardOptions): Promise; /** * This is how to check the mail. Get a list of messages for the :email address. * The objects are abbreviated to provide basic metadata. * @param {string} email email * @return {Promise} message list */ getMessages(email: string): Promise; /** * Get a list of messages that have been saved and made private for the user. * @return {Promise} message list */ getSavedMessages(): Promise; /** * Get an individual message. * @param {string} email email address * @param {string} messageId the Mailsac Message._id * @return {Promise} message */ getMessage(email: string, messageId: string): Promise; /** * This is how to check the mail across all of an account's private email addresses. * @param {IInboxOptions} options IInboxOptions * @return {Promise} response */ getPrivateMessages(options?: IInboxOptions): Promise; /** * Search for messages in private address. query matches the to, from, and subject. * @param {string} query query * @return {Promise} response */ searchPrivateMessages(query: string): Promise; /** * Toggle starred status so it will not be automatically removed. * There is no PUT body. * It returns only the message metadata. * @param {string} email email * @param {string} messageId messageId * @return {Promise} message */ saveMessage(email: string, messageId: string): Promise; /** * Set labels on a message. * Any existing labels will be replaced with the new array of string labels. * Maximum 3 labels per message. * @param {string} email email * @param {string} messageId messageId * @param {string[]} labels labels list * @return {Promise} response */ setMessageLabels(email: string, messageId: string, labels: string[]): Promise; /** * Move the message to a different mail folder. * No PUT body is needed. * No other folders can be added. To organize mail, use labels. * @param {string} email email * @param {string} messageId messageId * @param {FolderTypes} folder folder * @return {Promise} response */ changeMessageFolder(email: string, messageId: string, folder: FolderTypes): Promise; /** * Change the read state of a message. No PUT body is needed. * Pass read as true to mark the message as read, and false to mark it as unread. The default is false - unread. * @param {string} email email * @param {string} messageId messageId * @param {boolean} read read * @return {Promise} response */ setMessageRead(email: string, messageId: string, read?: boolean): Promise; /** * Permanently removes a message. There is no history or trash bin. * @param {string} email email * @param {string} messageId messageId * @return {Promise} void */ deleteMessage(email: string, messageId: string): Promise; /** * Get the SMTP headers from an email message. * Use the querystring param ?download=1 to trigger file download in browser. * @param {string} email email * @param {string} messageId messageId * @param {[type]} download=false download * @return {Promise} void */ getMessageHeaders(email: string, messageId: string, download?: boolean): Promise; /** * Get safe HTML from an email message. Scripts, images and links are stripped out. * Use the querystring param ?download=1 to trigger file download in browser. * @param {string} email email * @param {string} messageId messageId * @param {[type]} download=false download * @return {Promise} response */ getSanitizedMessage(email: string, messageId: string, download?: boolean): Promise; /** * Get a message's HTML content. * Attached images are inlined and nothing has been stripped. * Use the querystring param ?download=1 to trigger file download in browser. * @param {string} email email * @param {string} messageId messageId * @param {[type]} download=false download * @return {Promise} response */ getHTMLMessage(email: string, messageId: string, download?: boolean): Promise; /** * Get a message's text content. * Use the querystring param ?download=1 to trigger file download in browser. * @param {string} email email * @param {string} messageId messageId * @param {[type]} download=false download * @return {Promise} response */ getMessageText(email: string, messageId: string, download?: boolean): Promise; /** * The entire original SMTP message transport message. * Use the querystring param ?download=1 to trigger file download in browser. * @param {string} email email * @param {string} messageId messageId * @param {[type]} download=false download * @return {Promise} response */ getRawMessage(email: string, messageId: string, download?: boolean): Promise; /** * Send transactional text-only email messages. * Outgoing message credits must be purchased first. * One credit will be used per recipient (as opposed to per email). * Either text or html is required to send a message. * When passing a raw SMTP package it should be a full SMTP message. * All required fields below must be included in the raw package * @param {ISendMessageOptions} options options * @return {Promise} response */ sendMessage(options: ISendMessageOptions): Promise; /** * Get Current User * @return {Promise} user */ getCurrentUser(): Promise; /** * Get information about non-owned addresses with starred * messages and total starred messages, and list of owned addresses. * @return {Promise} stats */ getCurrentUserStats(): Promise; /** * Destroy the logged in user's session. * No POST body. * For cookie auth which works on the website only. * @return {Promise} result */ signOut(): Promise; /** * List the metadata for all attachments on a message. * @param {string} email email * @param {string} messageId messageId * @return {Promise} attachments list */ getAttachments(email: string, messageId: string): Promise; /** * Download an attachment on a message. * The Content-Type will be set to the contentType field from the attachment metadata. * @param {string} email email * @param {string} messageId messageId * @param {string} attachmentId attachmentId * @return {Promise} void */ downloadAttachment(email: string, messageId: string, attachmentId: string): Promise; /** * Search for attachments that were received during the requested time period. * Limited to non-private inboxes. * @param {IQueryOptions} options options * Field Description * id MD5 hash of the attachment file * n count of messages with this attachment * @return {Promise} common attachments list */ getCommonAttachments(options: IQueryOptions): Promise; /** * Count the number of email messages that have attachments with this MD5 sum. * Limited to non-private inboxes. * @param {string} md5 md5 * @return {Promise} number */ countMD5Attachments(md5: string): Promise; /** * List the email messages that have attachments with the requested MD5 sum. * Limited to non-private inboxes. * @param {string} md5 MD5 * @return {Promise} messages */ getMessagesWitchAttachment(md5: string): Promise; /** * Download an attachment with the MD5 sum requested. * Warning: attachments may contain viruses! * @param {string} md5 MD5 * @return {Promise} void */ downloadCommonAttachment(md5: string): Promise; /** * Search for the top non-private addresses that have been receiving mail. * @param {IQueryOptions} options options * @return {Promise} response */ getTopAddresses(options: IQueryOptions): Promise; /** * Get an array of domains and IP addresses that have been * blacklisted for violating the terms of service and/or degrading the service experience for other customers. * @return {Promise} blacklisted */ getBlacklistedDomainsAndIps(): Promise; /** * Check if a domain or IP is on the blacklist. * Returns 404 if not blacklisted. * Returns 200 if blacklisted. * @param {string} domainOrIP domainOrIP * @return {Promise} blacklisted */ checkBlacklist(domainOrIP: string): Promise; private request(url, method?, config?); }