/* tslint:disable */ /* eslint-disable */ /** * MailSlurp API * MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It\'s designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository * * The version of the OpenAPI document: 6.5.2 * Contact: contact@mailslurp.dev * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import { AttachmentMetaData, AttachmentMetaDataFromJSON, AttachmentMetaDataToJSON, ContentMatchOptions, ContentMatchOptionsFromJSON, ContentMatchOptionsToJSON, CountDto, CountDtoFromJSON, CountDtoToJSON, DownloadAttachmentDto, DownloadAttachmentDtoFromJSON, DownloadAttachmentDtoToJSON, Email, EmailFromJSON, EmailToJSON, EmailContentMatchResult, EmailContentMatchResultFromJSON, EmailContentMatchResultToJSON, EmailLinksResult, EmailLinksResultFromJSON, EmailLinksResultToJSON, EmailPreview, EmailPreviewFromJSON, EmailPreviewToJSON, EmailTextLinesResult, EmailTextLinesResultFromJSON, EmailTextLinesResultToJSON, ForwardEmailOptions, ForwardEmailOptionsFromJSON, ForwardEmailOptionsToJSON, GravatarUrl, GravatarUrlFromJSON, GravatarUrlToJSON, PageEmailProjection, PageEmailProjectionFromJSON, PageEmailProjectionToJSON, RawEmailJson, RawEmailJsonFromJSON, RawEmailJsonToJSON, ReplyToEmailOptions, ReplyToEmailOptionsFromJSON, ReplyToEmailOptionsToJSON, SendEmailOptions, SendEmailOptionsFromJSON, SendEmailOptionsToJSON, SentEmailDto, SentEmailDtoFromJSON, SentEmailDtoToJSON, UnreadCount, UnreadCountFromJSON, UnreadCountToJSON, ValidationDto, ValidationDtoFromJSON, ValidationDtoToJSON, } from '../models'; export interface DeleteEmailRequest { emailId: string; } export interface DownloadAttachmentRequest { emailId: string; attachmentId: string; apiKey?: string; } export interface DownloadAttachmentBase64Request { emailId: string; attachmentId: string; } export interface DownloadBodyRequest { emailId: string; } export interface DownloadBodyBytesRequest { emailId: string; } export interface ForwardEmailRequest { emailId: string; forwardEmailOptions: ForwardEmailOptions; } export interface GetAttachmentMetaDataRequest { emailId: string; attachmentId: string; } export interface GetEmailRequest { emailId: string; decode?: boolean; } export interface GetEmailAttachmentsRequest { emailId: string; } export interface GetEmailContentMatchRequest { emailId: string; contentMatchOptions: ContentMatchOptions; } export interface GetEmailHTMLRequest { emailId: string; decode?: boolean; } export interface GetEmailHTMLQueryRequest { emailId: string; htmlSelector: string; } export interface GetEmailLinksRequest { emailId: string; } export interface GetEmailTextLinesRequest { emailId: string; decodeHtmlEntities?: boolean; lineSeparator?: string; } export interface GetEmailsPaginatedRequest { inboxId?: Array; page?: number; size?: number; sort?: GetEmailsPaginatedSortEnum; unreadOnly?: boolean; searchFilter?: string; since?: Date; before?: Date; } export interface GetGravatarUrlForEmailAddressRequest { emailAddress: string; size?: string; } export interface GetLatestEmailRequest { inboxIds?: Array; } export interface GetLatestEmailInInboxRequest { inboxId: string; } export interface GetOrganizationEmailsPaginatedRequest { inboxId?: Array; page?: number; size?: number; sort?: GetOrganizationEmailsPaginatedSortEnum; unreadOnly?: boolean; searchFilter?: string; since?: Date; before?: Date; } export interface GetRawEmailContentsRequest { emailId: string; } export interface GetRawEmailJsonRequest { emailId: string; } export interface MarkAsReadRequest { emailId: string; read?: boolean; } export interface ReplyToEmailRequest { emailId: string; replyToEmailOptions: ReplyToEmailOptions; } export interface SendEmailSourceOptionalRequest { inboxId: string; sendEmailOptions: SendEmailOptions; useDomainPool?: boolean; } export interface ValidateEmailRequest { emailId: string; } /** * EmailControllerApi - interface * * @export * @interface EmailControllerApiInterface */ export interface EmailControllerApiInterface { /** * Deletes all emails in your account. Be careful as emails cannot be recovered * @summary Delete all emails in all inboxes. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ deleteAllEmailsRaw(): Promise>; /** * Deletes all emails in your account. Be careful as emails cannot be recovered * Delete all emails in all inboxes. */ deleteAllEmails(): Promise; /** * Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. * @summary Delete an email * @param {string} emailId ID of email to delete * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ deleteEmailRaw(requestParameters: DeleteEmailRequest): Promise>; /** * Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. * Delete an email */ deleteEmail(requestParameters: DeleteEmailRequest): Promise; /** * Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. * @summary Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. * @param {string} emailId ID of email * @param {string} attachmentId ID of attachment * @param {string} [apiKey] Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ downloadAttachmentRaw(requestParameters: DownloadAttachmentRequest): Promise>; /** * Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. * Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. */ downloadAttachment(requestParameters: DownloadAttachmentRequest): Promise; /** * Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. * @summary Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. * @param {string} emailId ID of email * @param {string} attachmentId ID of attachment * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ downloadAttachmentBase64Raw(requestParameters: DownloadAttachmentBase64Request): Promise>; /** * Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. * Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. */ downloadAttachmentBase64(requestParameters: DownloadAttachmentBase64Request): Promise; /** * Returns the specified email body for a given email as a string * @summary Get email body as string. Returned as `plain/text` with content type header. * @param {string} emailId ID of email * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ downloadBodyRaw(requestParameters: DownloadBodyRequest): Promise>; /** * Returns the specified email body for a given email as a string * Get email body as string. Returned as `plain/text` with content type header. */ downloadBody(requestParameters: DownloadBodyRequest): Promise; /** * Returns the specified email body for a given email as a stream / array of bytes. * @summary Get email body in bytes. Returned as `octet-stream` with content type header. * @param {string} emailId ID of email * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ downloadBodyBytesRaw(requestParameters: DownloadBodyBytesRequest): Promise>; /** * Returns the specified email body for a given email as a stream / array of bytes. * Get email body in bytes. Returned as `octet-stream` with content type header. */ downloadBodyBytes(requestParameters: DownloadBodyBytesRequest): Promise; /** * Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the `from` option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. * @summary Forward email to recipients * @param {string} emailId ID of email * @param {ForwardEmailOptions} forwardEmailOptions * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ forwardEmailRaw(requestParameters: ForwardEmailRequest): Promise>; /** * Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the `from` option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. * Forward email to recipients */ forwardEmail(requestParameters: ForwardEmailRequest): Promise; /** * Returns the metadata such as name and content-type for a given attachment and email. * @summary Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. * @param {string} emailId ID of email * @param {string} attachmentId ID of attachment * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getAttachmentMetaDataRaw(requestParameters: GetAttachmentMetaDataRequest): Promise>; /** * Returns the metadata such as name and content-type for a given attachment and email. * Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. */ getAttachmentMetaData(requestParameters: GetAttachmentMetaDataRequest): Promise; /** * Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints * @summary Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. * @param {string} emailId * @param {boolean} [decode] Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailRaw(requestParameters: GetEmailRequest): Promise>; /** * Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints * Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. */ getEmail(requestParameters: GetEmailRequest): Promise; /** * Returns an array of attachment metadata such as name and content-type for a given email if present. * @summary Get all email attachment metadata. Metadata includes name and size of attachments. * @param {string} emailId ID of email * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailAttachmentsRaw(requestParameters: GetEmailAttachmentsRequest): Promise>>; /** * Returns an array of attachment metadata such as name and content-type for a given email if present. * Get all email attachment metadata. Metadata includes name and size of attachments. */ getEmailAttachments(requestParameters: GetEmailAttachmentsRequest): Promise>; /** * Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `[\'code is: 123456\', \'123456\']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. * @summary Get email content regex pattern match results. Runs regex against email body and returns match groups. * @param {string} emailId ID of email to match against * @param {ContentMatchOptions} contentMatchOptions * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailContentMatchRaw(requestParameters: GetEmailContentMatchRequest): Promise>; /** * Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `[\'code is: 123456\', \'123456\']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. * Get email content regex pattern match results. Runs regex against email body and returns match groups. */ getEmailContentMatch(requestParameters: GetEmailContentMatchRequest): Promise; /** * * @summary Get email count * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailCountRaw(): Promise>; /** * Get email count */ getEmailCount(): Promise; /** * Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx` * @summary Get email content as HTML. For displaying emails in browser context. * @param {string} emailId * @param {boolean} [decode] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailHTMLRaw(requestParameters: GetEmailHTMLRequest): Promise>; /** * Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx` * Get email content as HTML. For displaying emails in browser context. */ getEmailHTML(requestParameters: GetEmailHTMLRequest): Promise; /** * Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors * @summary Parse and return text from an email, stripping HTML and decoding encoded characters * @param {string} emailId ID of email to perform HTML query on * @param {string} htmlSelector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like \'.my-div\' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailHTMLQueryRaw(requestParameters: GetEmailHTMLQueryRequest): Promise>; /** * Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors * Parse and return text from an email, stripping HTML and decoding encoded characters */ getEmailHTMLQuery(requestParameters: GetEmailHTMLQueryRequest): Promise; /** * HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes * @summary Parse and return list of links found in an email (only works for HTML content) * @param {string} emailId ID of email to fetch text for * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailLinksRaw(requestParameters: GetEmailLinksRequest): Promise>; /** * HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes * Parse and return list of links found in an email (only works for HTML content) */ getEmailLinks(requestParameters: GetEmailLinksRequest): Promise; /** * Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. * @summary Parse and return text from an email, stripping HTML and decoding encoded characters * @param {string} emailId ID of email to fetch text for * @param {boolean} [decodeHtmlEntities] Decode HTML entities * @param {string} [lineSeparator] Line separator character * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailTextLinesRaw(requestParameters: GetEmailTextLinesRequest): Promise>; /** * Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. * Parse and return text from an email, stripping HTML and decoding encoded characters */ getEmailTextLines(requestParameters: GetEmailTextLinesRequest): Promise; /** * By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages * @summary Get all emails in all inboxes in paginated form. Email API list all. * @param {Array} [inboxId] Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. * @param {number} [page] Optional page index in email list pagination * @param {number} [size] Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results * @param {'ASC' | 'DESC'} [sort] Optional createdAt sort direction ASC or DESC * @param {boolean} [unreadOnly] Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly * @param {string} [searchFilter] Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body * @param {Date} [since] Optional filter emails received after given date time * @param {Date} [before] Optional filter emails received before given date time * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getEmailsPaginatedRaw(requestParameters: GetEmailsPaginatedRequest): Promise>; /** * By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages * Get all emails in all inboxes in paginated form. Email API list all. */ getEmailsPaginated(requestParameters: GetEmailsPaginatedRequest): Promise; /** * Get gravatar url for email address * @param {string} emailAddress * @param {string} [size] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getGravatarUrlForEmailAddressRaw(requestParameters: GetGravatarUrlForEmailAddressRequest): Promise>; /** * Get gravatar url for email address */ getGravatarUrlForEmailAddress(requestParameters: GetGravatarUrlForEmailAddressRequest): Promise; /** * Get the newest email in all inboxes or in a passed set of inbox IDs * @summary Get latest email in all inboxes. Most recently received. * @param {Array} [inboxIds] Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getLatestEmailRaw(requestParameters: GetLatestEmailRequest): Promise>; /** * Get the newest email in all inboxes or in a passed set of inbox IDs * Get latest email in all inboxes. Most recently received. */ getLatestEmail(requestParameters: GetLatestEmailRequest): Promise; /** * Get the newest email in all inboxes or in a passed set of inbox IDs * @summary Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. * @param {string} inboxId ID of the inbox you want to get the latest email from * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getLatestEmailInInboxRaw(requestParameters: GetLatestEmailInInboxRequest): Promise>; /** * Get the newest email in all inboxes or in a passed set of inbox IDs * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. */ getLatestEmailInInbox(requestParameters: GetLatestEmailInInboxRequest): Promise; /** * By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages * @summary Get all organization emails. List team or shared test email accounts * @param {Array} [inboxId] Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. * @param {number} [page] Optional page index in email list pagination * @param {number} [size] Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results * @param {'ASC' | 'DESC'} [sort] Optional createdAt sort direction ASC or DESC * @param {boolean} [unreadOnly] Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly * @param {string} [searchFilter] Optional search filter search filter for emails. * @param {Date} [since] Optional filter emails received after given date time * @param {Date} [before] Optional filter emails received before given date time * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getOrganizationEmailsPaginatedRaw(requestParameters: GetOrganizationEmailsPaginatedRequest): Promise>; /** * By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages * Get all organization emails. List team or shared test email accounts */ getOrganizationEmailsPaginated(requestParameters: GetOrganizationEmailsPaginatedRequest): Promise; /** * Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint * @summary Get raw email string. Returns unparsed raw SMTP message with headers and body. * @param {string} emailId ID of email * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getRawEmailContentsRaw(requestParameters: GetRawEmailContentsRequest): Promise>; /** * Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint * Get raw email string. Returns unparsed raw SMTP message with headers and body. */ getRawEmailContents(requestParameters: GetRawEmailContentsRequest): Promise; /** * Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response * @summary Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. * @param {string} emailId ID of email * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getRawEmailJsonRaw(requestParameters: GetRawEmailJsonRequest): Promise>; /** * Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response * Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. */ getRawEmailJson(requestParameters: GetRawEmailJsonRequest): Promise; /** * Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response * @summary Get unread email count * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ getUnreadEmailCountRaw(): Promise>; /** * Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response * Get unread email count */ getUnreadEmailCount(): Promise; /** * Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread * @summary Mark an email as read on unread * @param {string} emailId * @param {boolean} [read] What value to assign to email read property. Default true. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ markAsReadRaw(requestParameters: MarkAsReadRequest): Promise>; /** * Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread * Mark an email as read on unread */ markAsRead(requestParameters: MarkAsReadRequest): Promise; /** * Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. * @summary Reply to an email * @param {string} emailId ID of the email that should be replied to * @param {ReplyToEmailOptions} replyToEmailOptions * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ replyToEmailRaw(requestParameters: ReplyToEmailRequest): Promise>; /** * Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. * Reply to an email */ replyToEmail(requestParameters: ReplyToEmailRequest): Promise; /** * Alias for `InboxController.sendEmail` method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. * @summary Send email * @param {string} inboxId ID of the inbox you want to send the email from * @param {SendEmailOptions} sendEmailOptions * @param {boolean} [useDomainPool] Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ sendEmailSourceOptionalRaw(requestParameters: SendEmailSourceOptionalRequest): Promise>; /** * Alias for `InboxController.sendEmail` method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. * Send email */ sendEmailSourceOptional(requestParameters: SendEmailSourceOptionalRequest): Promise; /** * Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. * @summary Validate email HTML contents * @param {string} emailId ID of email * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof EmailControllerApiInterface */ validateEmailRaw(requestParameters: ValidateEmailRequest): Promise>; /** * Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. * Validate email HTML contents */ validateEmail(requestParameters: ValidateEmailRequest): Promise; } /** * */ export class EmailControllerApi extends runtime.BaseAPI implements EmailControllerApiInterface { /** * Deletes all emails in your account. Be careful as emails cannot be recovered * Delete all emails in all inboxes. */ async deleteAllEmailsRaw(): Promise> { const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails`, method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Deletes all emails in your account. Be careful as emails cannot be recovered * Delete all emails in all inboxes. */ async deleteAllEmails(): Promise { await this.deleteAllEmailsRaw(); } /** * Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. * Delete an email */ async deleteEmailRaw(requestParameters: DeleteEmailRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling deleteEmail.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. * Delete an email */ async deleteEmail(requestParameters: DeleteEmailRequest): Promise { await this.deleteEmailRaw(requestParameters); } /** * Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. * Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. */ async downloadAttachmentRaw(requestParameters: DownloadAttachmentRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling downloadAttachment.'); } if (requestParameters.attachmentId === null || requestParameters.attachmentId === undefined) { throw new runtime.RequiredError('attachmentId','Required parameter requestParameters.attachmentId was null or undefined when calling downloadAttachment.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.apiKey !== undefined) { queryParameters['apiKey'] = requestParameters.apiKey; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/attachments/{attachmentId}`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))).replace(`{${"attachmentId"}}`, encodeURIComponent(String(requestParameters.attachmentId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.TextApiResponse(response) as any; } /** * Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. * Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. */ async downloadAttachment(requestParameters: DownloadAttachmentRequest): Promise { const response = await this.downloadAttachmentRaw(requestParameters); return await response.value(); } /** * Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. * Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. */ async downloadAttachmentBase64Raw(requestParameters: DownloadAttachmentBase64Request): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling downloadAttachmentBase64.'); } if (requestParameters.attachmentId === null || requestParameters.attachmentId === undefined) { throw new runtime.RequiredError('attachmentId','Required parameter requestParameters.attachmentId was null or undefined when calling downloadAttachmentBase64.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/attachments/{attachmentId}/base64`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))).replace(`{${"attachmentId"}}`, encodeURIComponent(String(requestParameters.attachmentId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => DownloadAttachmentDtoFromJSON(jsonValue)); } /** * Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. * Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. */ async downloadAttachmentBase64(requestParameters: DownloadAttachmentBase64Request): Promise { const response = await this.downloadAttachmentBase64Raw(requestParameters); return await response.value(); } /** * Returns the specified email body for a given email as a string * Get email body as string. Returned as `plain/text` with content type header. */ async downloadBodyRaw(requestParameters: DownloadBodyRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling downloadBody.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/body`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.TextApiResponse(response) as any; } /** * Returns the specified email body for a given email as a string * Get email body as string. Returned as `plain/text` with content type header. */ async downloadBody(requestParameters: DownloadBodyRequest): Promise { const response = await this.downloadBodyRaw(requestParameters); return await response.value(); } /** * Returns the specified email body for a given email as a stream / array of bytes. * Get email body in bytes. Returned as `octet-stream` with content type header. */ async downloadBodyBytesRaw(requestParameters: DownloadBodyBytesRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling downloadBodyBytes.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/body-bytes`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.TextApiResponse(response) as any; } /** * Returns the specified email body for a given email as a stream / array of bytes. * Get email body in bytes. Returned as `octet-stream` with content type header. */ async downloadBodyBytes(requestParameters: DownloadBodyBytesRequest): Promise { const response = await this.downloadBodyBytesRaw(requestParameters); return await response.value(); } /** * Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the `from` option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. * Forward email to recipients */ async forwardEmailRaw(requestParameters: ForwardEmailRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling forwardEmail.'); } if (requestParameters.forwardEmailOptions === null || requestParameters.forwardEmailOptions === undefined) { throw new runtime.RequiredError('forwardEmailOptions','Required parameter requestParameters.forwardEmailOptions was null or undefined when calling forwardEmail.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/forward`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'POST', headers: headerParameters, query: queryParameters, body: ForwardEmailOptionsToJSON(requestParameters.forwardEmailOptions), }); return new runtime.JSONApiResponse(response, (jsonValue) => SentEmailDtoFromJSON(jsonValue)); } /** * Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the `from` option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. * Forward email to recipients */ async forwardEmail(requestParameters: ForwardEmailRequest): Promise { const response = await this.forwardEmailRaw(requestParameters); return await response.value(); } /** * Returns the metadata such as name and content-type for a given attachment and email. * Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. */ async getAttachmentMetaDataRaw(requestParameters: GetAttachmentMetaDataRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getAttachmentMetaData.'); } if (requestParameters.attachmentId === null || requestParameters.attachmentId === undefined) { throw new runtime.RequiredError('attachmentId','Required parameter requestParameters.attachmentId was null or undefined when calling getAttachmentMetaData.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/attachments/{attachmentId}/metadata`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))).replace(`{${"attachmentId"}}`, encodeURIComponent(String(requestParameters.attachmentId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => AttachmentMetaDataFromJSON(jsonValue)); } /** * Returns the metadata such as name and content-type for a given attachment and email. * Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. */ async getAttachmentMetaData(requestParameters: GetAttachmentMetaDataRequest): Promise { const response = await this.getAttachmentMetaDataRaw(requestParameters); return await response.value(); } /** * Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints * Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. */ async getEmailRaw(requestParameters: GetEmailRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getEmail.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.decode !== undefined) { queryParameters['decode'] = requestParameters.decode; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => EmailFromJSON(jsonValue)); } /** * Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints * Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. */ async getEmail(requestParameters: GetEmailRequest): Promise { const response = await this.getEmailRaw(requestParameters); return await response.value(); } /** * Returns an array of attachment metadata such as name and content-type for a given email if present. * Get all email attachment metadata. Metadata includes name and size of attachments. */ async getEmailAttachmentsRaw(requestParameters: GetEmailAttachmentsRequest): Promise>> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getEmailAttachments.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/attachments`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AttachmentMetaDataFromJSON)); } /** * Returns an array of attachment metadata such as name and content-type for a given email if present. * Get all email attachment metadata. Metadata includes name and size of attachments. */ async getEmailAttachments(requestParameters: GetEmailAttachmentsRequest): Promise> { const response = await this.getEmailAttachmentsRaw(requestParameters); return await response.value(); } /** * Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `[\'code is: 123456\', \'123456\']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. * Get email content regex pattern match results. Runs regex against email body and returns match groups. */ async getEmailContentMatchRaw(requestParameters: GetEmailContentMatchRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getEmailContentMatch.'); } if (requestParameters.contentMatchOptions === null || requestParameters.contentMatchOptions === undefined) { throw new runtime.RequiredError('contentMatchOptions','Required parameter requestParameters.contentMatchOptions was null or undefined when calling getEmailContentMatch.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/contentMatch`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'POST', headers: headerParameters, query: queryParameters, body: ContentMatchOptionsToJSON(requestParameters.contentMatchOptions), }); return new runtime.JSONApiResponse(response, (jsonValue) => EmailContentMatchResultFromJSON(jsonValue)); } /** * Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `[\'code is: 123456\', \'123456\']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. * Get email content regex pattern match results. Runs regex against email body and returns match groups. */ async getEmailContentMatch(requestParameters: GetEmailContentMatchRequest): Promise { const response = await this.getEmailContentMatchRaw(requestParameters); return await response.value(); } /** * Get email count */ async getEmailCountRaw(): Promise> { const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/emails/count`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => CountDtoFromJSON(jsonValue)); } /** * Get email count */ async getEmailCount(): Promise { const response = await this.getEmailCountRaw(); return await response.value(); } /** * Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx` * Get email content as HTML. For displaying emails in browser context. */ async getEmailHTMLRaw(requestParameters: GetEmailHTMLRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getEmailHTML.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.decode !== undefined) { queryParameters['decode'] = requestParameters.decode; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/html`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.TextApiResponse(response) as any; } /** * Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx` * Get email content as HTML. For displaying emails in browser context. */ async getEmailHTML(requestParameters: GetEmailHTMLRequest): Promise { const response = await this.getEmailHTMLRaw(requestParameters); return await response.value(); } /** * Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors * Parse and return text from an email, stripping HTML and decoding encoded characters */ async getEmailHTMLQueryRaw(requestParameters: GetEmailHTMLQueryRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getEmailHTMLQuery.'); } if (requestParameters.htmlSelector === null || requestParameters.htmlSelector === undefined) { throw new runtime.RequiredError('htmlSelector','Required parameter requestParameters.htmlSelector was null or undefined when calling getEmailHTMLQuery.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.htmlSelector !== undefined) { queryParameters['htmlSelector'] = requestParameters.htmlSelector; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/htmlQuery`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => EmailTextLinesResultFromJSON(jsonValue)); } /** * Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors * Parse and return text from an email, stripping HTML and decoding encoded characters */ async getEmailHTMLQuery(requestParameters: GetEmailHTMLQueryRequest): Promise { const response = await this.getEmailHTMLQueryRaw(requestParameters); return await response.value(); } /** * HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes * Parse and return list of links found in an email (only works for HTML content) */ async getEmailLinksRaw(requestParameters: GetEmailLinksRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getEmailLinks.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/links`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => EmailLinksResultFromJSON(jsonValue)); } /** * HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes * Parse and return list of links found in an email (only works for HTML content) */ async getEmailLinks(requestParameters: GetEmailLinksRequest): Promise { const response = await this.getEmailLinksRaw(requestParameters); return await response.value(); } /** * Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. * Parse and return text from an email, stripping HTML and decoding encoded characters */ async getEmailTextLinesRaw(requestParameters: GetEmailTextLinesRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getEmailTextLines.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.decodeHtmlEntities !== undefined) { queryParameters['decodeHtmlEntities'] = requestParameters.decodeHtmlEntities; } if (requestParameters.lineSeparator !== undefined) { queryParameters['lineSeparator'] = requestParameters.lineSeparator; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/textLines`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => EmailTextLinesResultFromJSON(jsonValue)); } /** * Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. * Parse and return text from an email, stripping HTML and decoding encoded characters */ async getEmailTextLines(requestParameters: GetEmailTextLinesRequest): Promise { const response = await this.getEmailTextLinesRaw(requestParameters); return await response.value(); } /** * By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages * Get all emails in all inboxes in paginated form. Email API list all. */ async getEmailsPaginatedRaw(requestParameters: GetEmailsPaginatedRequest): Promise> { const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.inboxId) { queryParameters['inboxId'] = requestParameters.inboxId; } if (requestParameters.page !== undefined) { queryParameters['page'] = requestParameters.page; } if (requestParameters.size !== undefined) { queryParameters['size'] = requestParameters.size; } if (requestParameters.sort !== undefined) { queryParameters['sort'] = requestParameters.sort; } if (requestParameters.unreadOnly !== undefined) { queryParameters['unreadOnly'] = requestParameters.unreadOnly; } if (requestParameters.searchFilter !== undefined) { queryParameters['searchFilter'] = requestParameters.searchFilter; } if (requestParameters.since !== undefined) { queryParameters['since'] = (requestParameters.since as any).toISOString(); } if (requestParameters.before !== undefined) { queryParameters['before'] = (requestParameters.before as any).toISOString(); } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => PageEmailProjectionFromJSON(jsonValue)); } /** * By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages * Get all emails in all inboxes in paginated form. Email API list all. */ async getEmailsPaginated(requestParameters: GetEmailsPaginatedRequest): Promise { const response = await this.getEmailsPaginatedRaw(requestParameters); return await response.value(); } /** * Get gravatar url for email address */ async getGravatarUrlForEmailAddressRaw(requestParameters: GetGravatarUrlForEmailAddressRequest): Promise> { if (requestParameters.emailAddress === null || requestParameters.emailAddress === undefined) { throw new runtime.RequiredError('emailAddress','Required parameter requestParameters.emailAddress was null or undefined when calling getGravatarUrlForEmailAddress.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.emailAddress !== undefined) { queryParameters['emailAddress'] = requestParameters.emailAddress; } if (requestParameters.size !== undefined) { queryParameters['size'] = requestParameters.size; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/gravatarFor`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => GravatarUrlFromJSON(jsonValue)); } /** * Get gravatar url for email address */ async getGravatarUrlForEmailAddress(requestParameters: GetGravatarUrlForEmailAddressRequest): Promise { const response = await this.getGravatarUrlForEmailAddressRaw(requestParameters); return await response.value(); } /** * Get the newest email in all inboxes or in a passed set of inbox IDs * Get latest email in all inboxes. Most recently received. */ async getLatestEmailRaw(requestParameters: GetLatestEmailRequest): Promise> { const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.inboxIds) { queryParameters['inboxIds'] = requestParameters.inboxIds; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/latest`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => EmailFromJSON(jsonValue)); } /** * Get the newest email in all inboxes or in a passed set of inbox IDs * Get latest email in all inboxes. Most recently received. */ async getLatestEmail(requestParameters: GetLatestEmailRequest): Promise { const response = await this.getLatestEmailRaw(requestParameters); return await response.value(); } /** * Get the newest email in all inboxes or in a passed set of inbox IDs * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. */ async getLatestEmailInInboxRaw(requestParameters: GetLatestEmailInInboxRequest): Promise> { if (requestParameters.inboxId === null || requestParameters.inboxId === undefined) { throw new runtime.RequiredError('inboxId','Required parameter requestParameters.inboxId was null or undefined when calling getLatestEmailInInbox.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.inboxId !== undefined) { queryParameters['inboxId'] = requestParameters.inboxId; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/latestIn`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => EmailFromJSON(jsonValue)); } /** * Get the newest email in all inboxes or in a passed set of inbox IDs * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. */ async getLatestEmailInInbox(requestParameters: GetLatestEmailInInboxRequest): Promise { const response = await this.getLatestEmailInInboxRaw(requestParameters); return await response.value(); } /** * By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages * Get all organization emails. List team or shared test email accounts */ async getOrganizationEmailsPaginatedRaw(requestParameters: GetOrganizationEmailsPaginatedRequest): Promise> { const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.inboxId) { queryParameters['inboxId'] = requestParameters.inboxId; } if (requestParameters.page !== undefined) { queryParameters['page'] = requestParameters.page; } if (requestParameters.size !== undefined) { queryParameters['size'] = requestParameters.size; } if (requestParameters.sort !== undefined) { queryParameters['sort'] = requestParameters.sort; } if (requestParameters.unreadOnly !== undefined) { queryParameters['unreadOnly'] = requestParameters.unreadOnly; } if (requestParameters.searchFilter !== undefined) { queryParameters['searchFilter'] = requestParameters.searchFilter; } if (requestParameters.since !== undefined) { queryParameters['since'] = (requestParameters.since as any).toISOString(); } if (requestParameters.before !== undefined) { queryParameters['before'] = (requestParameters.before as any).toISOString(); } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/organization`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => PageEmailProjectionFromJSON(jsonValue)); } /** * By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages * Get all organization emails. List team or shared test email accounts */ async getOrganizationEmailsPaginated(requestParameters: GetOrganizationEmailsPaginatedRequest): Promise { const response = await this.getOrganizationEmailsPaginatedRaw(requestParameters); return await response.value(); } /** * Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint * Get raw email string. Returns unparsed raw SMTP message with headers and body. */ async getRawEmailContentsRaw(requestParameters: GetRawEmailContentsRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getRawEmailContents.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/raw`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.TextApiResponse(response) as any; } /** * Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint * Get raw email string. Returns unparsed raw SMTP message with headers and body. */ async getRawEmailContents(requestParameters: GetRawEmailContentsRequest): Promise { const response = await this.getRawEmailContentsRaw(requestParameters); return await response.value(); } /** * Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response * Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. */ async getRawEmailJsonRaw(requestParameters: GetRawEmailJsonRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling getRawEmailJson.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/raw/json`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => RawEmailJsonFromJSON(jsonValue)); } /** * Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response * Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. */ async getRawEmailJson(requestParameters: GetRawEmailJsonRequest): Promise { const response = await this.getRawEmailJsonRaw(requestParameters); return await response.value(); } /** * Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response * Get unread email count */ async getUnreadEmailCountRaw(): Promise> { const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/unreadCount`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => UnreadCountFromJSON(jsonValue)); } /** * Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response * Get unread email count */ async getUnreadEmailCount(): Promise { const response = await this.getUnreadEmailCountRaw(); return await response.value(); } /** * Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread * Mark an email as read on unread */ async markAsReadRaw(requestParameters: MarkAsReadRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling markAsRead.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.read !== undefined) { queryParameters['read'] = requestParameters.read; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/read`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'PATCH', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => EmailPreviewFromJSON(jsonValue)); } /** * Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread * Mark an email as read on unread */ async markAsRead(requestParameters: MarkAsReadRequest): Promise { const response = await this.markAsReadRaw(requestParameters); return await response.value(); } /** * Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. * Reply to an email */ async replyToEmailRaw(requestParameters: ReplyToEmailRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling replyToEmail.'); } if (requestParameters.replyToEmailOptions === null || requestParameters.replyToEmailOptions === undefined) { throw new runtime.RequiredError('replyToEmailOptions','Required parameter requestParameters.replyToEmailOptions was null or undefined when calling replyToEmail.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'PUT', headers: headerParameters, query: queryParameters, body: ReplyToEmailOptionsToJSON(requestParameters.replyToEmailOptions), }); return new runtime.JSONApiResponse(response, (jsonValue) => SentEmailDtoFromJSON(jsonValue)); } /** * Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. * Reply to an email */ async replyToEmail(requestParameters: ReplyToEmailRequest): Promise { const response = await this.replyToEmailRaw(requestParameters); return await response.value(); } /** * Alias for `InboxController.sendEmail` method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. * Send email */ async sendEmailSourceOptionalRaw(requestParameters: SendEmailSourceOptionalRequest): Promise> { if (requestParameters.inboxId === null || requestParameters.inboxId === undefined) { throw new runtime.RequiredError('inboxId','Required parameter requestParameters.inboxId was null or undefined when calling sendEmailSourceOptional.'); } if (requestParameters.sendEmailOptions === null || requestParameters.sendEmailOptions === undefined) { throw new runtime.RequiredError('sendEmailOptions','Required parameter requestParameters.sendEmailOptions was null or undefined when calling sendEmailSourceOptional.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.useDomainPool !== undefined) { queryParameters['useDomainPool'] = requestParameters.useDomainPool; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails`.replace(`{${"inboxId"}}`, encodeURIComponent(String(requestParameters.inboxId))), method: 'POST', headers: headerParameters, query: queryParameters, body: SendEmailOptionsToJSON(requestParameters.sendEmailOptions), }); return new runtime.VoidApiResponse(response); } /** * Alias for `InboxController.sendEmail` method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. * Send email */ async sendEmailSourceOptional(requestParameters: SendEmailSourceOptionalRequest): Promise { await this.sendEmailSourceOptionalRaw(requestParameters); } /** * Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. * Validate email HTML contents */ async validateEmailRaw(requestParameters: ValidateEmailRequest): Promise> { if (requestParameters.emailId === null || requestParameters.emailId === undefined) { throw new runtime.RequiredError('emailId','Required parameter requestParameters.emailId was null or undefined when calling validateEmail.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/emails/{emailId}/validate`.replace(`{${"emailId"}}`, encodeURIComponent(String(requestParameters.emailId))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => ValidationDtoFromJSON(jsonValue)); } /** * Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. * Validate email HTML contents */ async validateEmail(requestParameters: ValidateEmailRequest): Promise { const response = await this.validateEmailRaw(requestParameters); return await response.value(); } } /** * @export * @enum {string} */ export enum GetEmailsPaginatedSortEnum { ASC = 'ASC', DESC = 'DESC' } /** * @export * @enum {string} */ export enum GetOrganizationEmailsPaginatedSortEnum { ASC = 'ASC', DESC = 'DESC' }