/* 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 { CreateDomainOptions, CreateDomainOptionsFromJSON, CreateDomainOptionsToJSON, DomainDto, DomainDtoFromJSON, DomainDtoToJSON, DomainPreview, DomainPreviewFromJSON, DomainPreviewToJSON, UpdateDomainOptions, UpdateDomainOptionsFromJSON, UpdateDomainOptionsToJSON, } from '../models'; export interface AddDomainWildcardCatchAllRequest { id: string; } export interface CreateDomainRequest { createDomainOptions: CreateDomainOptions; } export interface DeleteDomainRequest { id: string; } export interface GetDomainRequest { id: string; } export interface UpdateDomainRequest { id: string; updateDomainOptions: UpdateDomainOptions; } /** * DomainControllerApi - interface * * @export * @interface DomainControllerApiInterface */ export interface DomainControllerApiInterface { /** * Add a catch all inbox to a domain so that any emails sent to it that cannot be matched will be sent to the catch all inbox generated * @summary Add catch all wild card inbox to domain * @param {string} id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DomainControllerApiInterface */ addDomainWildcardCatchAllRaw(requestParameters: AddDomainWildcardCatchAllRequest): Promise>; /** * Add a catch all inbox to a domain so that any emails sent to it that cannot be matched will be sent to the catch all inbox generated * Add catch all wild card inbox to domain */ addDomainWildcardCatchAll(requestParameters: AddDomainWildcardCatchAllRequest): Promise; /** * Link a domain that you own with MailSlurp so you can create email addresses using it. Endpoint returns DNS records used for validation. You must add these verification records to your host provider\'s DNS setup to verify the domain. * @summary Create Domain * @param {CreateDomainOptions} createDomainOptions * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DomainControllerApiInterface */ createDomainRaw(requestParameters: CreateDomainRequest): Promise>; /** * Link a domain that you own with MailSlurp so you can create email addresses using it. Endpoint returns DNS records used for validation. You must add these verification records to your host provider\'s DNS setup to verify the domain. * Create Domain */ createDomain(requestParameters: CreateDomainRequest): Promise; /** * Delete a domain. This will disable any existing inboxes that use this domain. * @summary Delete a domain * @param {string} id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DomainControllerApiInterface */ deleteDomainRaw(requestParameters: DeleteDomainRequest): Promise>>; /** * Delete a domain. This will disable any existing inboxes that use this domain. * Delete a domain */ deleteDomain(requestParameters: DeleteDomainRequest): Promise>; /** * Returns domain verification status and tokens for a given domain * @summary Get a domain * @param {string} id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DomainControllerApiInterface */ getDomainRaw(requestParameters: GetDomainRequest): Promise>; /** * Returns domain verification status and tokens for a given domain * Get a domain */ getDomain(requestParameters: GetDomainRequest): Promise; /** * List all custom domains you have created * @summary Get domains * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DomainControllerApiInterface */ getDomainsRaw(): Promise>>; /** * List all custom domains you have created * Get domains */ getDomains(): Promise>; /** * Update values on a domain. Note you cannot change the domain name as it is immutable. Recreate the domain if you need to alter this. * @summary Update a domain * @param {string} id * @param {UpdateDomainOptions} updateDomainOptions * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DomainControllerApiInterface */ updateDomainRaw(requestParameters: UpdateDomainRequest): Promise>; /** * Update values on a domain. Note you cannot change the domain name as it is immutable. Recreate the domain if you need to alter this. * Update a domain */ updateDomain(requestParameters: UpdateDomainRequest): Promise; } /** * */ export class DomainControllerApi extends runtime.BaseAPI implements DomainControllerApiInterface { /** * Add a catch all inbox to a domain so that any emails sent to it that cannot be matched will be sent to the catch all inbox generated * Add catch all wild card inbox to domain */ async addDomainWildcardCatchAllRaw(requestParameters: AddDomainWildcardCatchAllRequest): Promise> { if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling addDomainWildcardCatchAll.'); } 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: `/domains/{id}/wildcard`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => DomainDtoFromJSON(jsonValue)); } /** * Add a catch all inbox to a domain so that any emails sent to it that cannot be matched will be sent to the catch all inbox generated * Add catch all wild card inbox to domain */ async addDomainWildcardCatchAll(requestParameters: AddDomainWildcardCatchAllRequest): Promise { const response = await this.addDomainWildcardCatchAllRaw(requestParameters); return await response.value(); } /** * Link a domain that you own with MailSlurp so you can create email addresses using it. Endpoint returns DNS records used for validation. You must add these verification records to your host provider\'s DNS setup to verify the domain. * Create Domain */ async createDomainRaw(requestParameters: CreateDomainRequest): Promise> { if (requestParameters.createDomainOptions === null || requestParameters.createDomainOptions === undefined) { throw new runtime.RequiredError('createDomainOptions','Required parameter requestParameters.createDomainOptions was null or undefined when calling createDomain.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/domains`, method: 'POST', headers: headerParameters, query: queryParameters, body: CreateDomainOptionsToJSON(requestParameters.createDomainOptions), }); return new runtime.JSONApiResponse(response, (jsonValue) => DomainDtoFromJSON(jsonValue)); } /** * Link a domain that you own with MailSlurp so you can create email addresses using it. Endpoint returns DNS records used for validation. You must add these verification records to your host provider\'s DNS setup to verify the domain. * Create Domain */ async createDomain(requestParameters: CreateDomainRequest): Promise { const response = await this.createDomainRaw(requestParameters); return await response.value(); } /** * Delete a domain. This will disable any existing inboxes that use this domain. * Delete a domain */ async deleteDomainRaw(requestParameters: DeleteDomainRequest): Promise>> { if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteDomain.'); } 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: `/domains/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Delete a domain. This will disable any existing inboxes that use this domain. * Delete a domain */ async deleteDomain(requestParameters: DeleteDomainRequest): Promise> { const response = await this.deleteDomainRaw(requestParameters); return await response.value(); } /** * Returns domain verification status and tokens for a given domain * Get a domain */ async getDomainRaw(requestParameters: GetDomainRequest): Promise> { if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getDomain.'); } 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: `/domains/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => DomainDtoFromJSON(jsonValue)); } /** * Returns domain verification status and tokens for a given domain * Get a domain */ async getDomain(requestParameters: GetDomainRequest): Promise { const response = await this.getDomainRaw(requestParameters); return await response.value(); } /** * List all custom domains you have created * Get domains */ async getDomainsRaw(): Promise>> { const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/domains`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(DomainPreviewFromJSON)); } /** * List all custom domains you have created * Get domains */ async getDomains(): Promise> { const response = await this.getDomainsRaw(); return await response.value(); } /** * Update values on a domain. Note you cannot change the domain name as it is immutable. Recreate the domain if you need to alter this. * Update a domain */ async updateDomainRaw(requestParameters: UpdateDomainRequest): Promise> { if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling updateDomain.'); } if (requestParameters.updateDomainOptions === null || requestParameters.updateDomainOptions === undefined) { throw new runtime.RequiredError('updateDomainOptions','Required parameter requestParameters.updateDomainOptions was null or undefined when calling updateDomain.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // API_KEY authentication } const response = await this.request({ path: `/domains/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PUT', headers: headerParameters, query: queryParameters, body: UpdateDomainOptionsToJSON(requestParameters.updateDomainOptions), }); return new runtime.JSONApiResponse(response, (jsonValue) => DomainDtoFromJSON(jsonValue)); } /** * Update values on a domain. Note you cannot change the domain name as it is immutable. Recreate the domain if you need to alter this. * Update a domain */ async updateDomain(requestParameters: UpdateDomainRequest): Promise { const response = await this.updateDomainRaw(requestParameters); return await response.value(); } }