import ContactEventsBaseAPI from "./api/ContactEvents"; import ContactExportsBaseAPI from "./api/ContactExports"; import ContactFieldsBaseAPI from "./api/ContactFields"; import ContactImportsBaseAPI from "./api/ContactImports"; import ContactListsBaseAPI from "./api/ContactLists"; import ContactsBaseAPI from "./api/Contacts"; import EmailLogsBaseAPI from "./api/EmailLogs"; import GeneralAPI from "./api/General"; import InboundAPI from "./api/Inbound"; import SendingDomainsBaseAPI from "./api/SendingDomains"; import StatsBaseAPI from "./api/Stats"; import SuppressionsBaseAPI from "./api/Suppressions"; import OrganizationsBaseAPI from "./api/Organizations"; import TemplatesBaseAPI from "./api/Templates"; import TestingAPI from "./api/Testing"; import WebhooksBaseAPI from "./api/Webhooks"; import { Mail, SendResponse, MailtrapClientConfig, BatchSendResponse, BatchSendRequest } from "../types/mailtrap"; /** * Mailtrap client class. Initializes instance with available methods. */ export default class MailtrapClient { private axios; private testInboxId?; private accountId?; private organizationId?; private bulk; private sandbox; /** * Initalizes axios instance with Mailtrap params. */ constructor({ token, testInboxId, accountId, organizationId, bulk, sandbox, userAgent, }: MailtrapClientConfig); /** * Validates that account ID is present, throws MailtrapError if missing. */ private validateAccountIdPresence; /** * Validates that organization ID is present, throws MailtrapError if missing. */ private validateOrganizationIdPresence; /** * Validates that test inbox ID is present, throws MailtrapError if missing. */ private validateTestInboxIdPresence; /** * Getter for Testing API. Warns if some of the required keys are missing. */ get testing(): TestingAPI; /** * Getter for General API. */ get general(): GeneralAPI; /** * Getter for Inbound API. Scoped to the token's account, so no accountId is required. */ get inbound(): InboundAPI; /** * Getter for Contacts API. */ get contacts(): ContactsBaseAPI; /** * Getter for Contact Events API. */ get contactEvents(): ContactEventsBaseAPI; /** * Getter for Contact Exports API. */ get contactExports(): ContactExportsBaseAPI; /** * Getter for Contact Lists API. */ get contactLists(): ContactListsBaseAPI; /** * Getter for Contact Fields API. */ get contactFields(): ContactFieldsBaseAPI; /** * Getter for Contact Imports API. */ get contactImports(): ContactImportsBaseAPI; /** * Getter for Templates API. */ get templates(): TemplatesBaseAPI; /** * Getter for Suppressions API. */ get suppressions(): SuppressionsBaseAPI; /** * Getter for Stats API. */ get stats(): StatsBaseAPI; /** * Getter for Sending Domains API. */ get sendingDomains(): SendingDomainsBaseAPI; /** * Getter for Email Logs API. */ get emailLogs(): EmailLogsBaseAPI; /** * Getter for Webhooks API. */ get webhooks(): WebhooksBaseAPI; /** * Getter for Organizations API. Requires `organizationId` in config. */ get organizations(): OrganizationsBaseAPI; /** * Returns configured host. Checks if `bulk` and `sandbox` modes are activated simultaneously, * then reject with Mailtrap Error. * Otherwise returns appropriate host url. */ private determineHost; /** * Sends mail with given `mail` params. If there is error, rejects with `MailtrapError`. */ send(mail: Mail): Promise; /** * Sends a batch of emails with the given array of mail objects. * If there is an error, rejects with MailtrapError. */ batchSend(request: BatchSendRequest): Promise; } //# sourceMappingURL=MailtrapClient.d.ts.map