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,666 lines (1,430 loc) • 96.2 kB
text/typescript
/* 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://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,
EmailPreview,
EmailPreviewFromJSON,
EmailPreviewToJSON,
FlushExpiredInboxesResult,
FlushExpiredInboxesResultFromJSON,
FlushExpiredInboxesResultToJSON,
ImapSmtpAccessDetails,
ImapSmtpAccessDetailsFromJSON,
ImapSmtpAccessDetailsToJSON,
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,
PageOrganizationInboxProjection,
PageOrganizationInboxProjectionFromJSON,
PageOrganizationInboxProjectionToJSON,
PageScheduledJobs,
PageScheduledJobsFromJSON,
PageScheduledJobsToJSON,
PageSentEmailProjection,
PageSentEmailProjectionFromJSON,
PageSentEmailProjectionToJSON,
PageTrackingPixelProjection,
PageTrackingPixelProjectionFromJSON,
PageTrackingPixelProjectionToJSON,
ScheduledJobDto,
ScheduledJobDtoFromJSON,
ScheduledJobDtoToJSON,
SendEmailOptions,
SendEmailOptionsFromJSON,
SendEmailOptionsToJSON,
SendSMTPEnvelopeOptions,
SendSMTPEnvelopeOptionsFromJSON,
SendSMTPEnvelopeOptionsToJSON,
SentEmailDto,
SentEmailDtoFromJSON,
SentEmailDtoToJSON,
SetInboxFavouritedOptions,
SetInboxFavouritedOptionsFromJSON,
SetInboxFavouritedOptionsToJSON,
UpdateInboxOptions,
UpdateInboxOptionsFromJSON,
UpdateInboxOptionsToJSON,
} 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;
}
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 GetAllScheduledJobsRequest {
page?: number;
size?: number;
sort?: GetAllScheduledJobsSortEnum;
since?: Date;
before?: Date;
}
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 GetImapSmtpAccessRequest {
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;
}
export interface GetInboxSentEmailsRequest {
inboxId: string;
page?: number;
size?: number;
sort?: GetInboxSentEmailsSortEnum;
searchFilter?: string;
since?: Date;
before?: Date;
}
export interface GetInboxesRequest {
size?: number;
sort?: GetInboxesSortEnum;
since?: Date;
excludeCatchAllInboxes?: boolean;
before?: Date;
}
export interface GetLatestEmailInInboxRequest {
inboxId: string;
timeoutMillis: number;
}
export interface GetOrganizationInboxesRequest {
page?: number;
size?: number;
sort?: GetOrganizationInboxesSortEnum;
searchFilter?: string;
since?: Date;
before?: Date;
}
export interface GetScheduledJobRequest {
jobId: string;
}
export interface GetScheduledJobsByInboxIdRequest {
inboxId: string;
page?: number;
size?: number;
sort?: GetScheduledJobsByInboxIdSortEnum;
since?: Date;
before?: Date;
}
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 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 UpdateInboxRequest {
inboxId: string;
updateInboxOptions: UpdateInboxOptions;
}
/**
*
*/
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;
}
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();
}
/**
* 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();
}
/**
* 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();
}
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
);
return await response.value();
}
/**
* List emails that an inbox has received. Only emails that are sent to the inbox\'s email address will appear in the inbox. It may take several seconds for any email you send to an inbox\'s email address to appear in the inbox. To make this endpoint wait for a minimum number of emails use the `minCount` parameter. The server will retry the inbox database until the `minCount` is satisfied or the `retryTimeout` is reached
* Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.
*/
async getEmailsRaw(
requestParameters: GetEmailsRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<Array<EmailPreview>>> {
if (
requestParameters.inboxId === null ||
requestParameters.inboxId === undefined
) {
throw new runtime.RequiredError(
'inboxId',
'Required parameter requestParameters.inboxId was null or undefined when calling getEmails.'
);
}
const queryParameters: any = {};
if (requestParameters.size !== undefined) {
queryParameters['size'] = requestParameters.size;
}
if (requestParameters.limit !== undefined) {
queryParameters['limit'] = requestParameters.limit;
}
if (requestParameters.sort !== undefined) {
queryParameters['sort'] = requestParameters.sort;
}
if (requestParameters.retryTimeout !== undefined) {
queryParameters['retryTimeout'] = requestParameters.retryTimeout;
}
if (requestParameters.delayTimeout !== undefined) {
queryParameters['delayTimeout'] = requestParameters.delayTimeout;
}
if (requestParameters.minCount !== undefined) {
queryParameters['minCount'] = requestParameters.minCount;
}
if (requestParameters.unreadOnly !== undefined) {
queryParameters['unreadOnly'] = requestParameters.unreadOnly;
}
if (requestParameters.before !== undefined) {
queryParameters['before'] = (
requestParameters.before as any
).toISOString();
}
if (requestParameters.since !== undefined) {
queryParameters['since'] = (requestParameters.since 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}/emails`.replace(
`{${'inboxId'}}`,
encodeURIComponent(String(requestParameters.inboxId))
),
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
jsonValue.map(EmailPreviewFromJSON)
);
}
/**
* List emails that an inbox has received. Only emails that are sent to the inbox\'s email address will appear in the inbox. It may take several seconds for any email you send to an inbox\'s email address to appear in the inbox. To make this endpoint wait for a minimum number of emails use the `minCount` parameter. The server will retry the inbox database until the `minCount` is satisfied or the `retryTimeout` is reached
* Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.
*/
async getEmails(
requestParameters: GetEmailsRequest,
initOverrides?: RequestInit
): Promise<Array<EmailPreview>> {
const response = await this.getEmailsRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get IMAP and SMTP access usernames and passwords
*/
async getImapSmtpAccessRaw(
requestParameters: GetImapSmtpAccessRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<ImapSmtpAccessDetails>> {
const queryParameters: any = {};
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/imap-smtp-access`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
ImapSmtpAccessDetailsFromJSON(jsonValue)
);
}
/**
* Get IMAP and SMTP access usernames and passwords
*/
async getImapSmtpAccess(
requestParameters: GetImapSmtpAccessRequest,
initOverrides?: RequestInit
): Promise<ImapSmtpAccessDetails> {
const response = await this.getImapSmtpAccessRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Returns an inbox\'s properties, including its email address and ID.
* Get Inbox. Returns properties of an inbox.
*/
async getInboxRaw(
requestParameters: GetInboxRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<InboxDto>> {
if (
requestParameters.inboxId === null ||
requestParameters.inboxId === undefined
) {
throw new runtime.RequiredError(
'inboxId',
'Required parameter requestParameters.inboxId was null or undefined when calling getInbox.'
);
}
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: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
InboxDtoFromJSON(jsonValue)
);
}
/**
* Returns an inbox\'s properties, including its email address and ID.
* Get Inbox. Returns properties of an inbox.
*/
async getInbox(
requestParameters: GetInboxRequest,
initOverrides?: RequestInit
): Promise<InboxDto> {
const response = await this.getInboxRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get a inbox result by email address
* Search for an inbox with the provided email address
*/
async getInboxByEmailAddressRaw(
requestParameters: GetInboxByEmailAddressRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<InboxByEmailAddressResult>> {
if (
requestParameters.emailAddress === null ||
requestParameters.emailAddress === undefined
) {
throw new runtime.RequiredError(
'emailAddress',
'Required parameter requestParameters.emailAddress was null or undefined when calling getInboxByEmailAddress.'
);
}
const queryParameters: any = {};
if (requestParameters.emailAddress !== undefined) {
queryParameters['emailAddress'] = requestParameters.emailAddress;
}
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/byEmailAddress`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
InboxByEmailAddressResultFromJSON(jsonValue)
);
}
/**
* Get a inbox result by email address
* Search for an inbox with the provided email address
*/
async getInboxByEmailAddress(
requestParameters: GetInboxByEmailAddressRequest,
initOverrides?: RequestInit
): Promise<InboxByEmailAddressResult> {
const response = await this.getInboxByEmailAddressRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Get a inbox result by name
* Search for an inbox with the given name
*/
async getInboxByNameRaw(
requestParameters: GetInboxByNameRequest,
initOverrides?: RequestInit
): Promise<runtime.ApiResponse<InboxByNameResult>> {
if (
requestParameters.name === null ||
requestParameters.name === undefined
) {
throw new runtime.RequiredError(
'name',
'Required parameter requestParameters.name was null or undefined when calling getInboxByName.'
);
}
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/byName`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
},
initOverrides
);
return new runtime.JSONApiResponse(response, (jsonValue) =>
InboxByNameResultFromJSON(jsonValue)
);
}
/**
* Get a inbox result by name
* Search for an inbox with the given name
*/
async getInboxByName(
requestParameters: GetInboxByNameRequest,
initOverrides?: RequestInit
): Promise<InboxByNameResult> {
const response = await this.getInboxByNameRaw(
requestParameters,
initOverrides
);
return await response.value();
}
/**
* Get total inbox count
*/
async getInboxCountRaw(
initOverrides?: RequestInit
): Pro