mailslurp-client
Version:
Official client for MailSlurp Email and SMS API. Create email addresses and phone numbers in Javascript without a mail server. Send and receive real emails in applications or tests.
1,695 lines (1,451 loc) • 141 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* MailSlurp API
* MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. 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://docs.mailslurp.com/) - [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 {
CountDto,
CountDtoFromJSON,
CountDtoToJSON,
CreateInboxDto,
CreateInboxDtoFromJSON,
CreateInboxDtoToJSON,
CreateInboxRulesetOptions,
CreateInboxRulesetOptionsFromJSON,
CreateInboxRulesetOptionsToJSON,
Email,
EmailFromJSON,
EmailToJSON,
EmailAvailableResult,
EmailAvailableResultFromJSON,
EmailAvailableResultToJSON,
EmailPreview,
EmailPreviewFromJSON,
EmailPreviewToJSON,
FlushExpiredInboxesResult,
FlushExpiredInboxesResultFromJSON,
FlushExpiredInboxesResultToJSON,
ImapAccessDetails,
ImapAccessDetailsFromJSON,
ImapAccessDetailsToJSON,
ImapSmtpAccessDetails,
ImapSmtpAccessDetailsFromJSON,
ImapSmtpAccessDetailsToJSON,
ImapSmtpAccessServers,
ImapSmtpAccessServersFromJSON,
ImapSmtpAccessServersToJSON,
InboxByEmailAddressResult,
InboxByEmailAddressResultFromJSON,
InboxByEmailAddressResultToJSON,
InboxByNameResult,
InboxByNameResultFromJSON,
InboxByNameResultToJSON,
InboxDto,
InboxDtoFromJSON,
InboxDtoToJSON,
InboxExistsDto,
InboxExistsDtoFromJSON,
InboxExistsDtoToJSON,
InboxIdsResult,
InboxIdsResultFromJSON,
InboxIdsResultToJSON,
InboxRulesetDto,
InboxRulesetDtoFromJSON,
InboxRulesetDtoToJSON,
PageDeliveryStatus,
PageDeliveryStatusFromJSON,
PageDeliveryStatusToJSON,
PageEmailPreview,
PageEmailPreviewFromJSON,
PageEmailPreviewToJSON,
PageInboxProjection,
PageInboxProjectionFromJSON,
PageInboxProjectionToJSON,
PageInboxRulesetDto,
PageInboxRulesetDtoFromJSON,
PageInboxRulesetDtoToJSON,
PageInboxTags,
PageInboxTagsFromJSON,
PageInboxTagsToJSON,
PageOrganizationInboxProjection,
PageOrganizationInboxProjectionFromJSON,
PageOrganizationInboxProjectionToJSON,
PagePlusAddressProjection,
PagePlusAddressProjectionFromJSON,
PagePlusAddressProjectionToJSON,
PageScheduledJobs,
PageScheduledJobsFromJSON,
PageScheduledJobsToJSON,
PageSentEmailProjection,
PageSentEmailProjectionFromJSON,
PageSentEmailProjectionToJSON,
PageTrackingPixelProjection,
PageTrackingPixelProjectionFromJSON,
PageTrackingPixelProjectionToJSON,
PlusAddressDto,
PlusAddressDtoFromJSON,
PlusAddressDtoToJSON,
ScheduledJobDto,
ScheduledJobDtoFromJSON,
ScheduledJobDtoToJSON,
SearchInboxesOptions,
SearchInboxesOptionsFromJSON,
SearchInboxesOptionsToJSON,
SendEmailOptions,
SendEmailOptionsFromJSON,
SendEmailOptionsToJSON,
SendSMTPEnvelopeOptions,
SendSMTPEnvelopeOptionsFromJSON,
SendSMTPEnvelopeOptionsToJSON,
SentEmailDto,
SentEmailDtoFromJSON,
SentEmailDtoToJSON,
SetInboxFavouritedOptions,
SetInboxFavouritedOptionsFromJSON,
SetInboxFavouritedOptionsToJSON,
SmtpAccessDetails,
SmtpAccessDetailsFromJSON,
SmtpAccessDetailsToJSON,
UpdateImapAccessOptions,
UpdateImapAccessOptionsFromJSON,
UpdateImapAccessOptionsToJSON,
UpdateInboxOptions,
UpdateInboxOptionsFromJSON,
UpdateInboxOptionsToJSON,
UpdateSmtpAccessOptions,
UpdateSmtpAccessOptionsFromJSON,
UpdateSmtpAccessOptionsToJSON,
} from '../models';
export interface CancelScheduledJobRequest {
jobId: string;
}
export interface CreateInboxRequest {
emailAddress?: string;
tags?: Array<string>;
name?: string;
description?: string;
useDomainPool?: boolean;
favourite?: boolean;
expiresAt?: Date;
expiresIn?: number;
allowTeamAccess?: boolean;
inboxType?: CreateInboxInboxTypeEnum;
virtualInbox?: boolean;
useShortAddress?: boolean;
domainId?: string;
domainName?: string;
prefix?: string;
}
export interface CreateInboxRulesetRequest {
inboxId: string;
createInboxRulesetOptions: CreateInboxRulesetOptions;
}
export interface CreateInboxWithOptionsRequest {
createInboxDto: CreateInboxDto;
}
export interface DeleteAllInboxEmailsRequest {
inboxId: string;
}
export interface DeleteAllInboxesByDescriptionRequest {
description: string;
}
export interface DeleteAllInboxesByNameRequest {
name: string;
}
export interface DeleteAllInboxesByTagRequest {
tag: string;
}
export interface DeleteInboxRequest {
inboxId: string;
}
export interface DoesInboxExistRequest {
emailAddress: string;
allowCatchAll?: boolean;
}
export interface FlushExpiredRequest {
before?: Date;
}
export interface GetAllInboxesRequest {
page?: number;
size?: number;
sort?: GetAllInboxesSortEnum;
favourite?: boolean;
search?: string;
tag?: string;
teamAccess?: boolean;
since?: Date;
before?: Date;
inboxType?: GetAllInboxesInboxTypeEnum;
inboxFunction?: GetAllInboxesInboxFunctionEnum;
domainId?: string;
}
export interface GetAllInboxesOffsetPaginatedRequest {
page?: number;
size?: number;
sort?: GetAllInboxesOffsetPaginatedSortEnum;
favourite?: boolean;
search?: string;
tag?: string;
teamAccess?: boolean;
since?: Date;
before?: Date;
inboxType?: GetAllInboxesOffsetPaginatedInboxTypeEnum;
inboxFunction?: GetAllInboxesOffsetPaginatedInboxFunctionEnum;
domainId?: string;
}
export interface GetAllPlusAddressesRequest {
page?: number;
size?: number;
sort?: GetAllPlusAddressesSortEnum;
inboxId?: string;
}
export interface GetAllScheduledJobsRequest {
page?: number;
size?: number;
sort?: GetAllScheduledJobsSortEnum;
since?: Date;
before?: Date;
inboxId?: string;
}
export interface GetDeliveryStatusesByInboxIdRequest {
inboxId: string;
page?: number;
size?: number;
sort?: GetDeliveryStatusesByInboxIdSortEnum;
since?: Date;
before?: Date;
}
export interface GetEmailsRequest {
inboxId: string;
size?: number;
limit?: number;
sort?: GetEmailsSortEnum;
retryTimeout?: number;
delayTimeout?: number;
minCount?: number;
unreadOnly?: boolean;
before?: Date;
since?: Date;
}
export interface GetImapAccessRequest {
inboxId?: string;
}
export interface GetImapSmtpAccessRequest {
inboxId?: string;
}
export interface GetImapSmtpAccessEnvRequest {
inboxId?: string;
}
export interface GetInboxRequest {
inboxId: string;
}
export interface GetInboxByEmailAddressRequest {
emailAddress: string;
}
export interface GetInboxByNameRequest {
name: string;
}
export interface GetInboxEmailCountRequest {
inboxId: string;
}
export interface GetInboxEmailsPaginatedRequest {
inboxId: string;
page?: number;
size?: number;
sort?: GetInboxEmailsPaginatedSortEnum;
since?: Date;
before?: Date;
syncConnectors?: boolean;
}
export interface GetInboxPlusAddressRequest {
plusAddressId: string;
inboxId: string;
}
export interface GetInboxPlusAddressByIdRequest {
plusAddressId: string;
inboxId?: string;
}
export interface GetInboxPlusAddressEmailsRequest {
plusAddress: string;
inboxId: string;
page?: number;
size?: number;
sort?: GetInboxPlusAddressEmailsSortEnum;
since?: Date;
before?: Date;
}
export interface GetInboxPlusAddressEmailsForPlusAddressIdRequest {
plusAddressId: string;
inboxId: string;
page?: number;
size?: number;
sort?: GetInboxPlusAddressEmailsForPlusAddressIdSortEnum;
since?: Date;
before?: Date;
}
export interface GetInboxPlusAddressesRequest {
inboxId: string;
page?: number;
size?: number;
sort?: GetInboxPlusAddressesSortEnum;
}
export interface GetInboxSentCountRequest {
inboxId: string;
}
export interface GetInboxSentEmailsRequest {
inboxId: string;
page?: number;
size?: number;
sort?: GetInboxSentEmailsSortEnum;
searchFilter?: string;
since?: Date;
before?: Date;
}
export interface GetInboxTagsRequest {
page?: number;
size?: number;
sort?: GetInboxTagsSortEnum;
searchFilter?: string;
}
export interface GetInboxTagsPaginatedRequest {
page?: number;
size?: number;
sort?: GetInboxTagsPaginatedSortEnum;
searchFilter?: string;
}
export interface GetInboxesRequest {
size?: number;
sort?: GetInboxesSortEnum;
since?: Date;
excludeCatchAllInboxes?: boolean;
before?: Date;
include?: Array<string>;
}
export interface GetInboxesByTagRequest {
tag: string;
page?: number;
size?: number;
sort?: GetInboxesByTagSortEnum;
searchFilter?: string;
}
export interface GetLatestEmailInInboxRequest {
inboxId: string;
timeoutMillis: number;
}
export interface GetOrganizationInboxesRequest {
page?: number;
size?: number;
sort?: GetOrganizationInboxesSortEnum;
searchFilter?: string;
since?: Date;
before?: Date;
}
export interface GetOutboxesRequest {
page?: number;
size?: number;
sort?: GetOutboxesSortEnum;
}
export interface GetScheduledJobRequest {
jobId: string;
}
export interface GetScheduledJobsByInboxIdRequest {
inboxId: string;
page?: number;
size?: number;
sort?: GetScheduledJobsByInboxIdSortEnum;
since?: Date;
before?: Date;
}
export interface GetSmtpAccessRequest {
inboxId?: string;
}
export interface IsEmailAddressAvailableRequest {
emailAddress: string;
}
export interface ListInboxRulesetsRequest {
inboxId: string;
page?: number;
size?: number;
sort?: ListInboxRulesetsSortEnum;
searchFilter?: string;
since?: Date;
before?: Date;
}
export interface ListInboxTrackingPixelsRequest {
inboxId: string;
page?: number;
size?: number;
sort?: ListInboxTrackingPixelsSortEnum;
searchFilter?: string;
since?: Date;
before?: Date;
}
export interface SearchInboxesRequest {
searchInboxesOptions: SearchInboxesOptions;
}
export interface SendEmailRequest {
inboxId: string;
sendEmailOptions: SendEmailOptions;
}
export interface SendEmailAndConfirmRequest {
inboxId: string;
sendEmailOptions: SendEmailOptions;
}
export interface SendEmailWithQueueRequest {
inboxId: string;
validateBeforeEnqueue: boolean;
sendEmailOptions: SendEmailOptions;
}
export interface SendSmtpEnvelopeRequest {
inboxId: string;
sendSMTPEnvelopeOptions: SendSMTPEnvelopeOptions;
}
export interface SendTestEmailRequest {
inboxId: string;
}
export interface SendWithScheduleRequest {
inboxId: string;
sendEmailOptions: SendEmailOptions;
sendAtTimestamp?: Date;
sendAtNowPlusSeconds?: number;
validateBeforeEnqueue?: boolean;
}
export interface SetInboxFavouritedRequest {
inboxId: string;
setInboxFavouritedOptions: SetInboxFavouritedOptions;
}
export interface UpdateImapAccessRequest {
updateImapAccessOptions: UpdateImapAccessOptions;
inboxId?: string;
}
export interface UpdateInboxRequest {
inboxId: string;
updateInboxOptions: UpdateInboxOptions;
}
export interface UpdateSmtpAccessRequest {
updateSmtpAccessOptions: UpdateSmtpAccessOptions;
inboxId?: string;
}
/**
*
*/
export class InboxControllerApi extends runtime.BaseAPI {
/**
* Get a scheduled email job and cancel it. Will fail if status of job is already cancelled, failed, or complete.
* Cancel a scheduled email job
*/
async cancelScheduledJobRaw(
requestParameters: CancelScheduledJobRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<ScheduledJobDto>> {
if (
requestParameters.jobId === null ||
requestParameters.jobId === undefined
) {
throw new runtime.RequiredError(
'jobId',
'Required parameter requestParameters.jobId was null or undefined when calling cancelScheduledJob.'
);
}
const queryParameters: any = {};
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: `/inboxes/scheduled-jobs/{jobId}`.replace(
`{${'jobId'}}`,
encodeURIComponent(String(requestParameters.jobId))
),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
ScheduledJobDtoFromJSON(jsonValue)
);
}
/**
* Get a scheduled email job and cancel it. Will fail if status of job is already cancelled, failed, or complete.
* Cancel a scheduled email job
*/
async cancelScheduledJob(
requestParameters: CancelScheduledJobRequest,
initOverrides?: RequestInit
): Promise<ScheduledJobDto> {
const response = await this.cancelScheduledJobRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Create a new inbox and with a randomized email address to send and receive from. Pass emailAddress parameter if you wish to use a specific email address. Creating an inbox is required before sending or receiving emails. If writing tests it is recommended that you create a new inbox during each test method so that it is unique and empty.
* Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.
*/
async createInboxRaw(
requestParameters: CreateInboxRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<InboxDto>> {
const queryParameters: any = {};
if (requestParameters.emailAddress !== undefined) {
queryParameters['emailAddress'] = requestParameters.emailAddress;
}
if (requestParameters.tags) {
queryParameters['tags'] = requestParameters.tags;
}
if (requestParameters.name !== undefined) {
queryParameters['name'] = requestParameters.name;
}
if (requestParameters.description !== undefined) {
queryParameters['description'] = requestParameters.description;
}
if (requestParameters.useDomainPool !== undefined) {
queryParameters['useDomainPool'] = requestParameters.useDomainPool;
}
if (requestParameters.favourite !== undefined) {
queryParameters['favourite'] = requestParameters.favourite;
}
if (requestParameters.expiresAt !== undefined) {
queryParameters['expiresAt'] = (
requestParameters.expiresAt as any
).toISOString();
}
if (requestParameters.expiresIn !== undefined) {
queryParameters['expiresIn'] = requestParameters.expiresIn;
}
if (requestParameters.allowTeamAccess !== undefined) {
queryParameters['allowTeamAccess'] = requestParameters.allowTeamAccess;
}
if (requestParameters.inboxType !== undefined) {
queryParameters['inboxType'] = requestParameters.inboxType;
}
if (requestParameters.virtualInbox !== undefined) {
queryParameters['virtualInbox'] = requestParameters.virtualInbox;
}
if (requestParameters.useShortAddress !== undefined) {
queryParameters['useShortAddress'] = requestParameters.useShortAddress;
}
if (requestParameters.domainId !== undefined) {
queryParameters['domainId'] = requestParameters.domainId;
}
if (requestParameters.domainName !== undefined) {
queryParameters['domainName'] = requestParameters.domainName;
}
if (requestParameters.prefix !== undefined) {
queryParameters['prefix'] = requestParameters.prefix;
}
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: `/inboxes`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
InboxDtoFromJSON(jsonValue)
);
}
/**
* Create a new inbox and with a randomized email address to send and receive from. Pass emailAddress parameter if you wish to use a specific email address. Creating an inbox is required before sending or receiving emails. If writing tests it is recommended that you create a new inbox during each test method so that it is unique and empty.
* Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.
*/
async createInbox(
requestParameters: CreateInboxRequest,
initOverrides?: RequestInit
): Promise<InboxDto> {
const response = await this.createInboxRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving
* Create an inbox ruleset
*/
async createInboxRulesetRaw(
requestParameters: CreateInboxRulesetRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<InboxRulesetDto>> {
if (
requestParameters.inboxId === null ||
requestParameters.inboxId === undefined
) {
throw new runtime.RequiredError(
'inboxId',
'Required parameter requestParameters.inboxId was null or undefined when calling createInboxRuleset.'
);
}
if (
requestParameters.createInboxRulesetOptions === null ||
requestParameters.createInboxRulesetOptions === undefined
) {
throw new runtime.RequiredError(
'createInboxRulesetOptions',
'Required parameter requestParameters.createInboxRulesetOptions was null or undefined when calling createInboxRuleset.'
);
}
const queryParameters: any = {};
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: `/inboxes/{inboxId}/rulesets`.replace(
`{${'inboxId'}}`,
encodeURIComponent(String(requestParameters.inboxId))
),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CreateInboxRulesetOptionsToJSON(
requestParameters.createInboxRulesetOptions
),
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
InboxRulesetDtoFromJSON(jsonValue)
);
}
/**
* Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving
* Create an inbox ruleset
*/
async createInboxRuleset(
requestParameters: CreateInboxRulesetRequest,
initOverrides?: RequestInit
): Promise<InboxRulesetDto> {
const response = await this.createInboxRulesetRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Create an inbox with default options. Uses MailSlurp domain pool address and is private.
*/
async createInboxWithDefaultsRaw(
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<InboxDto>> {
const queryParameters: any = {};
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: `/inboxes/withDefaults`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
InboxDtoFromJSON(jsonValue)
);
}
/**
* Create an inbox with default options. Uses MailSlurp domain pool address and is private.
*/
async createInboxWithDefaults(
initOverrides?: RequestInit
): Promise<InboxDto> {
const response = await this.createInboxWithDefaultsRaw(initOverrides);
return await response.value();
}
/**
* Additional endpoint that allows inbox creation with request body options. Can be more flexible that other methods for some clients.
* Create an inbox with options. Extended options for inbox creation.
*/
async createInboxWithOptionsRaw(
requestParameters: CreateInboxWithOptionsRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<InboxDto>> {
if (
requestParameters.createInboxDto === null ||
requestParameters.createInboxDto === undefined
) {
throw new runtime.RequiredError(
'createInboxDto',
'Required parameter requestParameters.createInboxDto was null or undefined when calling createInboxWithOptions.'
);
}
const queryParameters: any = {};
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: `/inboxes/withOptions`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CreateInboxDtoToJSON(requestParameters.createInboxDto),
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
InboxDtoFromJSON(jsonValue)
);
}
/**
* Additional endpoint that allows inbox creation with request body options. Can be more flexible that other methods for some clients.
* Create an inbox with options. Extended options for inbox creation.
*/
async createInboxWithOptions(
requestParameters: CreateInboxWithOptionsRequest,
initOverrides?: RequestInit
): Promise<InboxDto> {
const response = await this.createInboxWithOptionsRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Deletes all emails in an inbox. Be careful as emails cannot be recovered
* Delete all emails in a given inboxes.
*/
async deleteAllInboxEmailsRaw(
requestParameters: DeleteAllInboxEmailsRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<void>> {
if (
requestParameters.inboxId === null ||
requestParameters.inboxId === undefined
) {
throw new runtime.RequiredError(
'inboxId',
'Required parameter requestParameters.inboxId was null or undefined when calling deleteAllInboxEmails.'
);
}
const queryParameters: any = {};
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: `/inboxes/{inboxId}/deleteAllInboxEmails`.replace(
`{${'inboxId'}}`,
encodeURIComponent(String(requestParameters.inboxId))
),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.VoidApiResponse(response);
}
/**
* Deletes all emails in an inbox. Be careful as emails cannot be recovered
* Delete all emails in a given inboxes.
*/
async deleteAllInboxEmails(
requestParameters: DeleteAllInboxEmailsRequest,
initOverrides?: RequestInit
): Promise<void> {
await this.deleteAllInboxEmailsRaw(requestParameters, initOverrides);
}
/**
* Permanently delete all inboxes and associated email addresses. This will also delete all emails within the inboxes. Be careful as inboxes cannot be recovered once deleted. Note: deleting inboxes will not impact your usage limits. Monthly inbox creation limits are based on how many inboxes were created in the last 30 days, not how many inboxes you currently have.
* Delete all inboxes
*/
async deleteAllInboxesRaw(
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<void>> {
const queryParameters: any = {};
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: `/inboxes`,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.VoidApiResponse(response);
}
/**
* Permanently delete all inboxes and associated email addresses. This will also delete all emails within the inboxes. Be careful as inboxes cannot be recovered once deleted. Note: deleting inboxes will not impact your usage limits. Monthly inbox creation limits are based on how many inboxes were created in the last 30 days, not how many inboxes you currently have.
* Delete all inboxes
*/
async deleteAllInboxes(initOverrides?: RequestInit): Promise<void> {
await this.deleteAllInboxesRaw(initOverrides);
}
/**
* Permanently delete all inboxes by description
* Delete inboxes by description
*/
async deleteAllInboxesByDescriptionRaw(
requestParameters: DeleteAllInboxesByDescriptionRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<void>> {
if (
requestParameters.description === null ||
requestParameters.description === undefined
) {
throw new runtime.RequiredError(
'description',
'Required parameter requestParameters.description was null or undefined when calling deleteAllInboxesByDescription.'
);
}
const queryParameters: any = {};
if (requestParameters.description !== undefined) {
queryParameters['description'] = requestParameters.description;
}
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: `/inboxes/by-description`,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.VoidApiResponse(response);
}
/**
* Permanently delete all inboxes by description
* Delete inboxes by description
*/
async deleteAllInboxesByDescription(
requestParameters: DeleteAllInboxesByDescriptionRequest,
initOverrides?: RequestInit
): Promise<void> {
await this.deleteAllInboxesByDescriptionRaw(
requestParameters,
initOverrides
);
}
/**
* Permanently delete all inboxes by name
* Delete inboxes by name
*/
async deleteAllInboxesByNameRaw(
requestParameters: DeleteAllInboxesByNameRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<void>> {
if (
requestParameters.name === null ||
requestParameters.name === undefined
) {
throw new runtime.RequiredError(
'name',
'Required parameter requestParameters.name was null or undefined when calling deleteAllInboxesByName.'
);
}
const queryParameters: any = {};
if (requestParameters.name !== undefined) {
queryParameters['name'] = requestParameters.name;
}
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: `/inboxes/by-name`,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.VoidApiResponse(response);
}
/**
* Permanently delete all inboxes by name
* Delete inboxes by name
*/
async deleteAllInboxesByName(
requestParameters: DeleteAllInboxesByNameRequest,
initOverrides?: RequestInit
): Promise<void> {
await this.deleteAllInboxesByNameRaw(requestParameters, initOverrides);
}
/**
* Permanently delete all inboxes by tag
* Delete inboxes by tag
*/
async deleteAllInboxesByTagRaw(
requestParameters: DeleteAllInboxesByTagRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<void>> {
if (requestParameters.tag === null || requestParameters.tag === undefined) {
throw new runtime.RequiredError(
'tag',
'Required parameter requestParameters.tag was null or undefined when calling deleteAllInboxesByTag.'
);
}
const queryParameters: any = {};
if (requestParameters.tag !== undefined) {
queryParameters['tag'] = requestParameters.tag;
}
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: `/inboxes/by-tag`,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.VoidApiResponse(response);
}
/**
* Permanently delete all inboxes by tag
* Delete inboxes by tag
*/
async deleteAllInboxesByTag(
requestParameters: DeleteAllInboxesByTagRequest,
initOverrides?: RequestInit
): Promise<void> {
await this.deleteAllInboxesByTagRaw(requestParameters, initOverrides);
}
/**
* Permanently delete an inbox and associated email address as well as all emails within the given inbox. This action cannot be undone. Note: deleting an inbox will not affect your account usage. Monthly inbox usage is based on how many inboxes you create within 30 days, not how many exist at time of request.
* Delete inbox
*/
async deleteInboxRaw(
requestParameters: DeleteInboxRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<void>> {
if (
requestParameters.inboxId === null ||
requestParameters.inboxId === undefined
) {
throw new runtime.RequiredError(
'inboxId',
'Required parameter requestParameters.inboxId was null or undefined when calling deleteInbox.'
);
}
const queryParameters: any = {};
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: `/inboxes/{inboxId}`.replace(
`{${'inboxId'}}`,
encodeURIComponent(String(requestParameters.inboxId))
),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.VoidApiResponse(response);
}
/**
* Permanently delete an inbox and associated email address as well as all emails within the given inbox. This action cannot be undone. Note: deleting an inbox will not affect your account usage. Monthly inbox usage is based on how many inboxes you create within 30 days, not how many exist at time of request.
* Delete inbox
*/
async deleteInbox(
requestParameters: DeleteInboxRequest,
initOverrides?: RequestInit
): Promise<void> {
await this.deleteInboxRaw(requestParameters, initOverrides);
}
/**
* Check if inboxes exist by email address. Useful if you are sending emails to mailslurp addresses
* Does inbox exist
*/
async doesInboxExistRaw(
requestParameters: DoesInboxExistRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<InboxExistsDto>> {
if (
requestParameters.emailAddress === null ||
requestParameters.emailAddress === undefined
) {
throw new runtime.RequiredError(
'emailAddress',
'Required parameter requestParameters.emailAddress was null or undefined when calling doesInboxExist.'
);
}
const queryParameters: any = {};
if (requestParameters.emailAddress !== undefined) {
queryParameters['emailAddress'] = requestParameters.emailAddress;
}
if (requestParameters.allowCatchAll !== undefined) {
queryParameters['allowCatchAll'] = requestParameters.allowCatchAll;
}
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: `/inboxes/exists`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
InboxExistsDtoFromJSON(jsonValue)
);
}
/**
* Check if inboxes exist by email address. Useful if you are sending emails to mailslurp addresses
* Does inbox exist
*/
async doesInboxExist(
requestParameters: DoesInboxExistRequest,
initOverrides?: RequestInit
): Promise<InboxExistsDto> {
const response = await this.doesInboxExistRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Check if an inbox has automations.
* Does inbox have automations
*/
async doesInboxHaveAutomationsRaw(
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<void>> {
const queryParameters: any = {};
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: `/inboxes/automations`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.VoidApiResponse(response);
}
/**
* Check if an inbox has automations.
* Does inbox have automations
*/
async doesInboxHaveAutomations(initOverrides?: RequestInit): Promise<void> {
await this.doesInboxHaveAutomationsRaw(initOverrides);
}
/**
* Remove any expired inboxes for your account (instead of waiting for scheduled removal on server)
* Remove expired inboxes
*/
async flushExpiredRaw(
requestParameters: FlushExpiredRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<FlushExpiredInboxesResult>> {
const queryParameters: any = {};
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: `/inboxes/expired`,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
FlushExpiredInboxesResultFromJSON(jsonValue)
);
}
/**
* Remove any expired inboxes for your account (instead of waiting for scheduled removal on server)
* Remove expired inboxes
*/
async flushExpired(
requestParameters: FlushExpiredRequest,
initOverrides?: RequestInit
): Promise<FlushExpiredInboxesResult> {
const response = await this.flushExpiredRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* List inboxes in paginated form. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time). You Can also filter by whether an inbox is favorited or use email address pattern. This method is the recommended way to query inboxes. The alternative `getInboxes` method returns a full list of inboxes but is limited to 100 results.
* List All Inboxes Paginated
*/
async getAllInboxesRaw(
requestParameters: GetAllInboxesRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<PageInboxProjection>> {
const queryParameters: any = {};
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.favourite !== undefined) {
queryParameters['favourite'] = requestParameters.favourite;
}
if (requestParameters.search !== undefined) {
queryParameters['search'] = requestParameters.search;
}
if (requestParameters.tag !== undefined) {
queryParameters['tag'] = requestParameters.tag;
}
if (requestParameters.teamAccess !== undefined) {
queryParameters['teamAccess'] = requestParameters.teamAccess;
}
if (requestParameters.since !== undefined) {
queryParameters['since'] = (requestParameters.since as any).toISOString();
}
if (requestParameters.before !== undefined) {
queryParameters['before'] = (
requestParameters.before as any
).toISOString();
}
if (requestParameters.inboxType !== undefined) {
queryParameters['inboxType'] = requestParameters.inboxType;
}
if (requestParameters.inboxFunction !== undefined) {
queryParameters['inboxFunction'] = requestParameters.inboxFunction;
}
if (requestParameters.domainId !== undefined) {
queryParameters['domainId'] = requestParameters.domainId;
}
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: `/inboxes/paginated`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
PageInboxProjectionFromJSON(jsonValue)
);
}
/**
* List inboxes in paginated form. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time). You Can also filter by whether an inbox is favorited or use email address pattern. This method is the recommended way to query inboxes. The alternative `getInboxes` method returns a full list of inboxes but is limited to 100 results.
* List All Inboxes Paginated
*/
async getAllInboxes(
requestParameters: GetAllInboxesRequest,
initOverrides?: RequestInit
): Promise<PageInboxProjection> {
const response = await this.getAllInboxesRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* List inboxes in paginated form. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time). You Can also filter by whether an inbox is favorited or use email address pattern. This method is the recommended way to query inboxes. The alternative `getInboxes` method returns a full list of inboxes but is limited to 100 results.
* List All Inboxes Offset Paginated
*/
async getAllInboxesOffsetPaginatedRaw(
requestParameters: GetAllInboxesOffsetPaginatedRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<PageInboxProjection>> {
const queryParameters: any = {};
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.favourite !== undefined) {
queryParameters['favourite'] = requestParameters.favourite;
}
if (requestParameters.search !== undefined) {
queryParameters['search'] = requestParameters.search;
}
if (requestParameters.tag !== undefined) {
queryParameters['tag'] = requestParameters.tag;
}
if (requestParameters.teamAccess !== undefined) {
queryParameters['teamAccess'] = requestParameters.teamAccess;
}
if (requestParameters.since !== undefined) {
queryParameters['since'] = (requestParameters.since as any).toISOString();
}
if (requestParameters.before !== undefined) {
queryParameters['before'] = (
requestParameters.before as any
).toISOString();
}
if (requestParameters.inboxType !== undefined) {
queryParameters['inboxType'] = requestParameters.inboxType;
}
if (requestParameters.inboxFunction !== undefined) {
queryParameters['inboxFunction'] = requestParameters.inboxFunction;
}
if (requestParameters.domainId !== undefined) {
queryParameters['domainId'] = requestParameters.domainId;
}
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: `/inboxes/offset-paginated`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
PageInboxProjectionFromJSON(jsonValue)
);
}
/**
* List inboxes in paginated form. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time). You Can also filter by whether an inbox is favorited or use email address pattern. This method is the recommended way to query inboxes. The alternative `getInboxes` method returns a full list of inboxes but is limited to 100 results.
* List All Inboxes Offset Paginated
*/
async getAllInboxesOffsetPaginated(
requestParameters: GetAllInboxesOffsetPaginatedRequest,
initOverrides?: RequestInit
): Promise<PageInboxProjection> {
const response = await this.getAllInboxesOffsetPaginatedRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Returns paginated list of all plus alias addresses found for in account based on received emails that used the inbox address with a +xyz alias.
* Get all sub address plus address aliases for an inbox
*/
async getAllPlusAddressesRaw(
requestParameters: GetAllPlusAddressesRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<PagePlusAddressProjection>> {
const queryParameters: any = {};
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.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: `/inboxes/plus-addresses`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
PagePlusAddressProjectionFromJSON(jsonValue)
);
}
/**
* Returns paginated list of all plus alias addresses found for in account based on received emails that used the inbox address with a +xyz alias.
* Get all sub address plus address aliases for an inbox
*/
async getAllPlusAddresses(
requestParameters: GetAllPlusAddressesRequest,
initOverrides?: RequestInit
): Promise<PagePlusAddressProjection> {
const response = await this.getAllPlusAddressesRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Schedule sending of emails using scheduled jobs. These can be inbox or account level.
* Get all scheduled email sending jobs for account
*/
async getAllScheduledJobsRaw(
requestParameters: GetAllScheduledJobsRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<PageScheduledJobs>> {
const queryParameters: any = {};
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.since !== undefined) {
queryParameters['since'] = (requestParameters.since as any).toISOString();
}
if (requestParameters.before !== undefined) {
queryParameters['before'] = (
requestParameters.before as any
).toISOString();
}
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: `/inboxes/scheduled-jobs`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
PageScheduledJobsFromJSON(jsonValue)
);
}
/**
* Schedule sending of emails using scheduled jobs. These can be inbox or account level.
* Get all scheduled email sending jobs for account
*/
async getAllScheduledJobs(
requestParameters: GetAllScheduledJobsRequest,
initOverrides?: RequestInit
): Promise<PageScheduledJobs> {
const response = await this.getAllScheduledJobsRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Get all email delivery statuses for an inbox
*/
async getDeliveryStatusesByInboxIdRaw(
requestParameters: GetDeliveryStatusesByInboxIdRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<PageDeliveryStatus>> {
if (
requestParameters.inboxId === null ||
requestParameters.inboxId === undefined
) {
throw new runtime.RequiredError(
'inboxId',
'Required parameter requestParameters.inboxId was null or undefined when calling getDeliveryStatusesByInboxId.'
);
}
const queryParameters: any = {};
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.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: `/inboxes/{inboxId}/delivery-status`.replace(
`{${'inboxId'}}`,
encodeURIComponent(String(requestParameters.inboxId))
),
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
PageDeliveryStatusFromJSON(jsonValue)
);
}
/**
* Get all email delivery statuses for an inbox
*/
async getDeliveryStatusesByInboxId(
requestParameters: GetDeliveryStatusesByInboxIdRequest,
initOverrides?: RequestInit
): Promise<PageDeliveryStatus> {
const response = await this.getDeliveryStatusesByInboxIdRaw(
requestParameters,
initOverrides