/* 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 { BouncedEmailDto, BouncedEmailDtoFromJSON, BouncedEmailDtoToJSON, BouncedRecipientDto, BouncedRecipientDtoFromJSON, BouncedRecipientDtoToJSON, PageBouncedEmail, PageBouncedEmailFromJSON, PageBouncedEmailToJSON, PageBouncedRecipients, PageBouncedRecipientsFromJSON, PageBouncedRecipientsToJSON, } from '../models'; export interface GetBouncedEmailRequest { id: string; } export interface GetBouncedEmailsRequest { page?: number; size?: number; sort?: GetBouncedEmailsSortEnum; since?: Date; before?: Date; } export interface GetBouncedRecipientRequest { id: string; } export interface GetBouncedRecipientsRequest { page?: number; size?: number; sort?: GetBouncedRecipientsSortEnum; since?: Date; before?: Date; } /** * BounceControllerApi - interface * * @export * @interface BounceControllerApiInterface */ export interface BounceControllerApiInterface { /** * Bounced emails are email you have sent that were rejected by a recipient * @summary Get a bounced email. * @param {string} id ID of the bounced email to fetch * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BounceControllerApiInterface */ getBouncedEmailRaw(requestParameters: GetBouncedEmailRequest): Promise>; /** * Bounced emails are email you have sent that were rejected by a recipient * Get a bounced email. */ getBouncedEmail(requestParameters: GetBouncedEmailRequest): Promise; /** * Bounced emails are email you have sent that were rejected by a recipient * @summary Get paginated list of bounced emails. * @param {number} [page] Optional page index * @param {number} [size] Optional page size * @param {'ASC' | 'DESC'} [sort] Optional createdAt sort direction ASC or DESC * @param {Date} [since] Filter by created at after the given timestamp * @param {Date} [before] Filter by created at before the given timestamp * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BounceControllerApiInterface */ getBouncedEmailsRaw(requestParameters: GetBouncedEmailsRequest): Promise>; /** * Bounced emails are email you have sent that were rejected by a recipient * Get paginated list of bounced emails. */ getBouncedEmails(requestParameters: GetBouncedEmailsRequest): Promise; /** * Bounced emails are email you have sent that were rejected by a recipient * @summary Get a bounced email. * @param {string} id ID of the bounced recipient * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BounceControllerApiInterface */ getBouncedRecipientRaw(requestParameters: GetBouncedRecipientRequest): Promise>; /** * Bounced emails are email you have sent that were rejected by a recipient * Get a bounced email. */ getBouncedRecipient(requestParameters: GetBouncedRecipientRequest): Promise; /** * Bounced recipients are email addresses that you have sent emails to that did not accept the sent email. Once a recipient is bounced you cannot send emails to that address. * @summary Get paginated list of bounced recipients. * @param {number} [page] Optional page index * @param {number} [size] Optional page size * @param {'ASC' | 'DESC'} [sort] Optional createdAt sort direction ASC or DESC * @param {Date} [since] Filter by created at after the given timestamp * @param {Date} [before] Filter by created at before the given timestamp * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BounceControllerApiInterface */ getBouncedRecipientsRaw(requestParameters: GetBouncedRecipientsRequest): Promise>; /** * Bounced recipients are email addresses that you have sent emails to that did not accept the sent email. Once a recipient is bounced you cannot send emails to that address. * Get paginated list of bounced recipients. */ getBouncedRecipients(requestParameters: GetBouncedRecipientsRequest): Promise; } /** * */ export class BounceControllerApi extends runtime.BaseAPI implements BounceControllerApiInterface { /** * Bounced emails are email you have sent that were rejected by a recipient * Get a bounced email. */ async getBouncedEmailRaw(requestParameters: GetBouncedEmailRequest): Promise> { if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getBouncedEmail.'); } 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: `/bounce/emails/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => BouncedEmailDtoFromJSON(jsonValue)); } /** * Bounced emails are email you have sent that were rejected by a recipient * Get a bounced email. */ async getBouncedEmail(requestParameters: GetBouncedEmailRequest): Promise { const response = await this.getBouncedEmailRaw(requestParameters); return await response.value(); } /** * Bounced emails are email you have sent that were rejected by a recipient * Get paginated list of bounced emails. */ async getBouncedEmailsRaw(requestParameters: GetBouncedEmailsRequest): Promise> { const queryParameters: runtime.HTTPQuery = {}; 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: `/bounce/emails`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => PageBouncedEmailFromJSON(jsonValue)); } /** * Bounced emails are email you have sent that were rejected by a recipient * Get paginated list of bounced emails. */ async getBouncedEmails(requestParameters: GetBouncedEmailsRequest): Promise { const response = await this.getBouncedEmailsRaw(requestParameters); return await response.value(); } /** * Bounced emails are email you have sent that were rejected by a recipient * Get a bounced email. */ async getBouncedRecipientRaw(requestParameters: GetBouncedRecipientRequest): Promise> { if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getBouncedRecipient.'); } 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: `/bounce/recipients/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => BouncedRecipientDtoFromJSON(jsonValue)); } /** * Bounced emails are email you have sent that were rejected by a recipient * Get a bounced email. */ async getBouncedRecipient(requestParameters: GetBouncedRecipientRequest): Promise { const response = await this.getBouncedRecipientRaw(requestParameters); return await response.value(); } /** * Bounced recipients are email addresses that you have sent emails to that did not accept the sent email. Once a recipient is bounced you cannot send emails to that address. * Get paginated list of bounced recipients. */ async getBouncedRecipientsRaw(requestParameters: GetBouncedRecipientsRequest): Promise> { const queryParameters: runtime.HTTPQuery = {}; 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: `/bounce/recipients`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => PageBouncedRecipientsFromJSON(jsonValue)); } /** * Bounced recipients are email addresses that you have sent emails to that did not accept the sent email. Once a recipient is bounced you cannot send emails to that address. * Get paginated list of bounced recipients. */ async getBouncedRecipients(requestParameters: GetBouncedRecipientsRequest): Promise { const response = await this.getBouncedRecipientsRaw(requestParameters); return await response.value(); } } /** * @export * @enum {string} */ export enum GetBouncedEmailsSortEnum { ASC = 'ASC', DESC = 'DESC' } /** * @export * @enum {string} */ export enum GetBouncedRecipientsSortEnum { ASC = 'ASC', DESC = 'DESC' }