e2e-mailbox
Version:
E2E test your email notification system using GuerrillaMail API.
61 lines (60 loc) • 2.47 kB
TypeScript
import { EmailResponse, MailboxProvider } from '../types';
import MailboxService from './mailboxService';
declare class DeveloperMailService extends MailboxService {
API_URL: string;
PROVIDER: MailboxProvider;
private token;
private mailboxName;
/**
* Send request to DeveloperMail API.
* @param data
* @param method
* @param endpoint
* @returns AxiosResponse on success, undefined on failure.
*/
private sendRequest;
/**
* Convert Mime-Type response from DeveloperMail to EmailResponse
* @param message
* @param mailId
* @returns generated EmailResponse
*/
private static convertMimeToEmailResponse;
/**
* Initialize a session and set the client with an email address. If the session already exists,
* then it will return the email address details of the existing session. If a new session needs to be created, then it
* will first check for the SUBSCR cookie to create a session for a subscribed address, otherwise it will create new email
* address randomly.
* @returns email address
*/
createEmailAddress(): Promise<string>;
/**
* Get the current list of emails from the email inbox.
* @returns Array of emails
*/
fetchEmailList(): Promise<EmailResponse[]>;
/**
* Forget the current email address. This will not stop the session, the existing session will be maintained.
* A subsequent call to get_email_address will fetch a new email address or the client can call set_email_user
* to set a new address. Typically, a user would want to set a new address manually after clicking the
* ‘forget me’ button.
* @returns True on success, false on failure
*/
forgetEmailAddress(): Promise<boolean | undefined>;
/**
* Delete a specific email by ID.
* @param emailId
* @returns true on success, false on failure
*/
deleteEmailById(emailId: string): Promise<boolean>;
/**
* Get the contents of an email. All HTML in the body of the email is filtered.
* Eg, Javascript, applets, iframes, etc is removed. Subject and email excerpt are escaped using HTML Entities.
* Only emails owned by the current session id can be fetched.
* @param emailId
* @returns
*/
fetchEmailById(emailId: string): Promise<EmailResponse>;
sendSelfMail(subject: string, body: string): Promise<boolean>;
}
export default DeveloperMailService;