/* 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 { CreatePostmasterConnectionOptions, CreatePostmasterConnectionOptionsFromJSON, CreatePostmasterConnectionOptionsToJSON, CreatePostmasterConnectionResult, CreatePostmasterConnectionResultFromJSON, CreatePostmasterConnectionResultToJSON, ExchangePostmasterCodeOptions, ExchangePostmasterCodeOptionsFromJSON, ExchangePostmasterCodeOptionsToJSON, PostmasterConnectionDto, PostmasterConnectionDtoFromJSON, PostmasterConnectionDtoToJSON, PostmasterConnectionStatusDto, PostmasterConnectionStatusDtoFromJSON, PostmasterConnectionStatusDtoToJSON, PostmasterDomainDto, PostmasterDomainDtoFromJSON, PostmasterDomainDtoToJSON, PostmasterTrafficStatsListDto, PostmasterTrafficStatsListDtoFromJSON, PostmasterTrafficStatsListDtoToJSON, } from '../models'; export interface CreateDomainMonitorPostmasterConnectionRequest { createPostmasterConnectionOptions: CreatePostmasterConnectionOptions; } export interface ExchangeDomainMonitorPostmasterCodeRequest { exchangePostmasterCodeOptions: ExchangePostmasterCodeOptions; } export interface GetDomainMonitorPostmasterTrafficStatsRequest { domain: string; startDate?: Date; endDate?: Date; } export interface SyncDomainMonitorPostmasterTrafficStatsRequest { domain: string; startDate?: Date; endDate?: Date; } /** * */ export class DomainMonitorPostmasterControllerApi extends runtime.BaseAPI { /** * Create Postmaster OAuth connection URL */ async createDomainMonitorPostmasterConnectionRaw( requestParameters: CreateDomainMonitorPostmasterConnectionRequest, initOverrides?: RequestInit ): Promise> { if ( requestParameters.createPostmasterConnectionOptions === null || requestParameters.createPostmasterConnectionOptions === undefined ) { throw new runtime.RequiredError( 'createPostmasterConnectionOptions', 'Required parameter requestParameters.createPostmasterConnectionOptions was null or undefined when calling createDomainMonitorPostmasterConnection.' ); } 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: `/domain-monitor/postmaster/connect`, method: 'POST', headers: headerParameters, query: queryParameters, body: CreatePostmasterConnectionOptionsToJSON( requestParameters.createPostmasterConnectionOptions ), }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => CreatePostmasterConnectionResultFromJSON(jsonValue) ); } /** * Create Postmaster OAuth connection URL */ async createDomainMonitorPostmasterConnection( requestParameters: CreateDomainMonitorPostmasterConnectionRequest, initOverrides?: RequestInit ): Promise { const response = await this.createDomainMonitorPostmasterConnectionRaw( requestParameters, initOverrides ); return await response.value(); } /** * Disconnect Postmaster OAuth */ async deleteDomainMonitorPostmasterConnectionRaw( initOverrides?: RequestInit ): Promise> { 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: `/domain-monitor/postmaster/connection`, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.VoidApiResponse(response); } /** * Disconnect Postmaster OAuth */ async deleteDomainMonitorPostmasterConnection( initOverrides?: RequestInit ): Promise { await this.deleteDomainMonitorPostmasterConnectionRaw(initOverrides); } /** * Exchange Postmaster OAuth authorization code */ async exchangeDomainMonitorPostmasterCodeRaw( requestParameters: ExchangeDomainMonitorPostmasterCodeRequest, initOverrides?: RequestInit ): Promise> { if ( requestParameters.exchangePostmasterCodeOptions === null || requestParameters.exchangePostmasterCodeOptions === undefined ) { throw new runtime.RequiredError( 'exchangePostmasterCodeOptions', 'Required parameter requestParameters.exchangePostmasterCodeOptions was null or undefined when calling exchangeDomainMonitorPostmasterCode.' ); } 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: `/domain-monitor/postmaster/oauth-exchange`, method: 'POST', headers: headerParameters, query: queryParameters, body: ExchangePostmasterCodeOptionsToJSON( requestParameters.exchangePostmasterCodeOptions ), }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => PostmasterConnectionDtoFromJSON(jsonValue) ); } /** * Exchange Postmaster OAuth authorization code */ async exchangeDomainMonitorPostmasterCode( requestParameters: ExchangeDomainMonitorPostmasterCodeRequest, initOverrides?: RequestInit ): Promise { const response = await this.exchangeDomainMonitorPostmasterCodeRaw( requestParameters, initOverrides ); return await response.value(); } /** * Get Postmaster connection status */ async getDomainMonitorPostmasterConnectionRaw( initOverrides?: RequestInit ): Promise> { 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: `/domain-monitor/postmaster/connection`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => PostmasterConnectionStatusDtoFromJSON(jsonValue) ); } /** * Get Postmaster connection status */ async getDomainMonitorPostmasterConnection( initOverrides?: RequestInit ): Promise { const response = await this.getDomainMonitorPostmasterConnectionRaw( initOverrides ); return await response.value(); } /** * List local Postmaster domain snapshots */ async getDomainMonitorPostmasterDomainsRaw( initOverrides?: RequestInit ): Promise>> { 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: `/domain-monitor/postmaster/domains`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PostmasterDomainDtoFromJSON) ); } /** * List local Postmaster domain snapshots */ async getDomainMonitorPostmasterDomains( initOverrides?: RequestInit ): Promise> { const response = await this.getDomainMonitorPostmasterDomainsRaw( initOverrides ); return await response.value(); } /** * Get local Postmaster traffic stats */ async getDomainMonitorPostmasterTrafficStatsRaw( requestParameters: GetDomainMonitorPostmasterTrafficStatsRequest, initOverrides?: RequestInit ): Promise> { if ( requestParameters.domain === null || requestParameters.domain === undefined ) { throw new runtime.RequiredError( 'domain', 'Required parameter requestParameters.domain was null or undefined when calling getDomainMonitorPostmasterTrafficStats.' ); } const queryParameters: any = {}; if (requestParameters.startDate !== undefined) { queryParameters['startDate'] = (requestParameters.startDate as any) .toISOString() .substr(0, 10); } if (requestParameters.endDate !== undefined) { queryParameters['endDate'] = (requestParameters.endDate as any) .toISOString() .substr(0, 10); } 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: `/domain-monitor/postmaster/domains/{domain}/traffic-stats`.replace( `{${'domain'}}`, encodeURIComponent(String(requestParameters.domain)) ), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => PostmasterTrafficStatsListDtoFromJSON(jsonValue) ); } /** * Get local Postmaster traffic stats */ async getDomainMonitorPostmasterTrafficStats( requestParameters: GetDomainMonitorPostmasterTrafficStatsRequest, initOverrides?: RequestInit ): Promise { const response = await this.getDomainMonitorPostmasterTrafficStatsRaw( requestParameters, initOverrides ); return await response.value(); } /** * Sync Postmaster domains */ async syncDomainMonitorPostmasterDomainsRaw( initOverrides?: RequestInit ): Promise>> { 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: `/domain-monitor/postmaster/domains/sync`, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PostmasterDomainDtoFromJSON) ); } /** * Sync Postmaster domains */ async syncDomainMonitorPostmasterDomains( initOverrides?: RequestInit ): Promise> { const response = await this.syncDomainMonitorPostmasterDomainsRaw( initOverrides ); return await response.value(); } /** * Sync Postmaster traffic stats */ async syncDomainMonitorPostmasterTrafficStatsRaw( requestParameters: SyncDomainMonitorPostmasterTrafficStatsRequest, initOverrides?: RequestInit ): Promise> { if ( requestParameters.domain === null || requestParameters.domain === undefined ) { throw new runtime.RequiredError( 'domain', 'Required parameter requestParameters.domain was null or undefined when calling syncDomainMonitorPostmasterTrafficStats.' ); } const queryParameters: any = {}; if (requestParameters.startDate !== undefined) { queryParameters['startDate'] = (requestParameters.startDate as any) .toISOString() .substr(0, 10); } if (requestParameters.endDate !== undefined) { queryParameters['endDate'] = (requestParameters.endDate as any) .toISOString() .substr(0, 10); } 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: `/domain-monitor/postmaster/domains/{domain}/traffic-stats/sync`.replace( `{${'domain'}}`, encodeURIComponent(String(requestParameters.domain)) ), method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => PostmasterTrafficStatsListDtoFromJSON(jsonValue) ); } /** * Sync Postmaster traffic stats */ async syncDomainMonitorPostmasterTrafficStats( requestParameters: SyncDomainMonitorPostmasterTrafficStatsRequest, initOverrides?: RequestInit ): Promise { const response = await this.syncDomainMonitorPostmasterTrafficStatsRaw( requestParameters, initOverrides ); return await response.value(); } }