/* 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 { AbstractWebhookPayload, AbstractWebhookPayloadFromJSON, AbstractWebhookPayloadToJSON, CreateWebhookOptions, CreateWebhookOptionsFromJSON, CreateWebhookOptionsToJSON, JSONSchemaDto, JSONSchemaDtoFromJSON, JSONSchemaDtoToJSON, PageWebhookProjection, PageWebhookProjectionFromJSON, PageWebhookProjectionToJSON, PageWebhookResult, PageWebhookResultFromJSON, PageWebhookResultToJSON, UnseenErrorCountDto, UnseenErrorCountDtoFromJSON, UnseenErrorCountDtoToJSON, WebhookDto, WebhookDtoFromJSON, WebhookDtoToJSON, WebhookEmailOpenedPayload, WebhookEmailOpenedPayloadFromJSON, WebhookEmailOpenedPayloadToJSON, WebhookEmailReadPayload, WebhookEmailReadPayloadFromJSON, WebhookEmailReadPayloadToJSON, WebhookNewAttachmentPayload, WebhookNewAttachmentPayloadFromJSON, WebhookNewAttachmentPayloadToJSON, WebhookNewContactPayload, WebhookNewContactPayloadFromJSON, WebhookNewContactPayloadToJSON, WebhookNewEmailPayload, WebhookNewEmailPayloadFromJSON, WebhookNewEmailPayloadToJSON, WebhookRedriveResult, WebhookRedriveResultFromJSON, WebhookRedriveResultToJSON, WebhookResultDto, WebhookResultDtoFromJSON, WebhookResultDtoToJSON, WebhookTestResult, WebhookTestResultFromJSON, WebhookTestResultToJSON, } from '../models'; export interface CreateWebhookRequest { inboxId: string; createWebhookOptions: CreateWebhookOptions; } export interface DeleteWebhookRequest { inboxId: string; webhookId: string; } export interface GetAllWebhookResultsRequest { page?: number; size?: number; sort?: GetAllWebhookResultsSortEnum; searchFilter?: string; since?: Date; before?: Date; unseenOnly?: boolean; } export interface GetAllWebhooksRequest { page?: number; size?: number; sort?: GetAllWebhooksSortEnum; searchFilter?: string; since?: Date; before?: Date; } export interface GetInboxWebhooksPaginatedRequest { inboxId: string; page?: number; size?: number; sort?: GetInboxWebhooksPaginatedSortEnum; searchFilter?: string; since?: Date; before?: Date; } export interface GetJsonSchemaForWebhookPayloadRequest { webhookId: string; } export interface GetTestWebhookPayloadRequest { eventName?: GetTestWebhookPayloadEventNameEnum; } export interface GetTestWebhookPayloadForWebhookRequest { webhookId: string; } export interface GetWebhookRequest { webhookId: string; } export interface GetWebhookResultRequest { webhookResultId: string; } export interface GetWebhookResultsRequest { webhookId: string; page?: number; size?: number; sort?: GetWebhookResultsSortEnum; searchFilter?: string; since?: Date; before?: Date; unseenOnly?: boolean; } export interface GetWebhookResultsUnseenErrorCountRequest { inboxId: string; } export interface GetWebhooksRequest { inboxId: string; } export interface RedriveWebhookResultRequest { webhookResultId: string; } export interface SendTestDataRequest { webhookId: string; } /** * WebhookControllerApi - interface * * @export * @interface WebhookControllerApiInterface */ export interface WebhookControllerApiInterface { /** * Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint. * @summary Attach a WebHook URL to an inbox * @param {string} inboxId * @param {CreateWebhookOptions} createWebhookOptions * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ createWebhookRaw(requestParameters: CreateWebhookRequest): Promise>; /** * Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint. * Attach a WebHook URL to an inbox */ createWebhook(requestParameters: CreateWebhookRequest): Promise; /** * * @summary Delete all webhooks * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ deleteAllWebhooksRaw(): Promise>; /** * Delete all webhooks */ deleteAllWebhooks(): Promise; /** * * @summary Delete and disable a Webhook for an Inbox * @param {string} inboxId * @param {string} webhookId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ deleteWebhookRaw(requestParameters: DeleteWebhookRequest): Promise>; /** * Delete and disable a Webhook for an Inbox */ deleteWebhook(requestParameters: DeleteWebhookRequest): Promise; /** * * @summary Get results for all webhooks * @param {number} [page] Optional page index in list pagination * @param {number} [size] Optional page size in list pagination * @param {'ASC' | 'DESC'} [sort] Optional createdAt sort direction ASC or DESC * @param {string} [searchFilter] Optional search filter * @param {Date} [since] Filter by created at after the given timestamp * @param {Date} [before] Filter by created at before the given timestamp * @param {boolean} [unseenOnly] Filter for unseen exceptions only * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getAllWebhookResultsRaw(requestParameters: GetAllWebhookResultsRequest): Promise>; /** * Get results for all webhooks */ getAllWebhookResults(requestParameters: GetAllWebhookResultsRequest): Promise; /** * List webhooks in paginated form. Allows for page index, page size, and sort direction. * @summary List Webhooks Paginated * @param {number} [page] Optional page index in list pagination * @param {number} [size] Optional page size for paginated result list. * @param {'ASC' | 'DESC'} [sort] Optional createdAt sort direction ASC or DESC * @param {string} [searchFilter] Optional search filter * @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 WebhookControllerApiInterface */ getAllWebhooksRaw(requestParameters: GetAllWebhooksRequest): Promise>; /** * List webhooks in paginated form. Allows for page index, page size, and sort direction. * List Webhooks Paginated */ getAllWebhooks(requestParameters: GetAllWebhooksRequest): Promise; /** * * @summary Get paginated webhooks for an Inbox * @param {string} inboxId * @param {number} [page] Optional page index in list pagination * @param {number} [size] Optional page size in list pagination * @param {'ASC' | 'DESC'} [sort] Optional createdAt sort direction ASC or DESC * @param {string} [searchFilter] Optional search filter * @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 WebhookControllerApiInterface */ getInboxWebhooksPaginatedRaw(requestParameters: GetInboxWebhooksPaginatedRequest): Promise>; /** * Get paginated webhooks for an Inbox */ getInboxWebhooksPaginated(requestParameters: GetInboxWebhooksPaginatedRequest): Promise; /** * Get JSON Schema definition for webhook payload * @param {string} webhookId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getJsonSchemaForWebhookPayloadRaw(requestParameters: GetJsonSchemaForWebhookPayloadRequest): Promise>; /** * Get JSON Schema definition for webhook payload */ getJsonSchemaForWebhookPayload(requestParameters: GetJsonSchemaForWebhookPayloadRequest): Promise; /** * Get test webhook payload example. Response content depends on eventName passed. Uses `EMAIL_RECEIVED` as default. * @param {'EMAIL_RECEIVED' | 'NEW_EMAIL' | 'NEW_CONTACT' | 'NEW_ATTACHMENT' | 'EMAIL_OPENED' | 'EMAIL_READ'} [eventName] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getTestWebhookPayloadRaw(requestParameters: GetTestWebhookPayloadRequest): Promise>; /** * Get test webhook payload example. Response content depends on eventName passed. Uses `EMAIL_RECEIVED` as default. */ getTestWebhookPayload(requestParameters: GetTestWebhookPayloadRequest): Promise; /** * Get webhook test payload for email opened event * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getTestWebhookPayloadEmailOpenedRaw(): Promise>; /** * Get webhook test payload for email opened event */ getTestWebhookPayloadEmailOpened(): Promise; /** * Get webhook test payload for email opened event * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getTestWebhookPayloadEmailReadRaw(): Promise>; /** * Get webhook test payload for email opened event */ getTestWebhookPayloadEmailRead(): Promise; /** * Get example payload for webhook * @param {string} webhookId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getTestWebhookPayloadForWebhookRaw(requestParameters: GetTestWebhookPayloadForWebhookRequest): Promise>; /** * Get example payload for webhook */ getTestWebhookPayloadForWebhook(requestParameters: GetTestWebhookPayloadForWebhookRequest): Promise; /** * * @summary Get webhook test payload for new attachment event * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getTestWebhookPayloadNewAttachmentRaw(): Promise>; /** * Get webhook test payload for new attachment event */ getTestWebhookPayloadNewAttachment(): Promise; /** * * @summary Get webhook test payload for new contact event * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getTestWebhookPayloadNewContactRaw(): Promise>; /** * Get webhook test payload for new contact event */ getTestWebhookPayloadNewContact(): Promise; /** * * @summary Get webhook test payload for new email event * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getTestWebhookPayloadNewEmailRaw(): Promise>; /** * Get webhook test payload for new email event */ getTestWebhookPayloadNewEmail(): Promise; /** * * @summary Get a webhook for an Inbox * @param {string} webhookId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getWebhookRaw(requestParameters: GetWebhookRequest): Promise>; /** * Get a webhook for an Inbox */ getWebhook(requestParameters: GetWebhookRequest): Promise; /** * * @summary Get a webhook result for a webhook * @param {string} webhookResultId Webhook Result ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getWebhookResultRaw(requestParameters: GetWebhookResultRequest): Promise>; /** * Get a webhook result for a webhook */ getWebhookResult(requestParameters: GetWebhookResultRequest): Promise; /** * * @summary Get a webhook results for a webhook * @param {string} webhookId ID of webhook to get results for * @param {number} [page] Optional page index in list pagination * @param {number} [size] Optional page size in list pagination * @param {'ASC' | 'DESC'} [sort] Optional createdAt sort direction ASC or DESC * @param {string} [searchFilter] Optional search filter * @param {Date} [since] Filter by created at after the given timestamp * @param {Date} [before] Filter by created at before the given timestamp * @param {boolean} [unseenOnly] Filter for unseen exceptions only * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getWebhookResultsRaw(requestParameters: GetWebhookResultsRequest): Promise>; /** * Get a webhook results for a webhook */ getWebhookResults(requestParameters: GetWebhookResultsRequest): Promise; /** * * @summary Get count of unseen webhook results with error status * @param {string} inboxId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getWebhookResultsUnseenErrorCountRaw(requestParameters: GetWebhookResultsUnseenErrorCountRequest): Promise>; /** * Get count of unseen webhook results with error status */ getWebhookResultsUnseenErrorCount(requestParameters: GetWebhookResultsUnseenErrorCountRequest): Promise; /** * * @summary Get all webhooks for an Inbox * @param {string} inboxId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ getWebhooksRaw(requestParameters: GetWebhooksRequest): Promise>>; /** * Get all webhooks for an Inbox */ getWebhooks(requestParameters: GetWebhooksRequest): Promise>; /** * Allows you to resend a webhook payload that was already sent. Webhooks that fail are retried automatically for 24 hours and then put in a dead letter queue. You can retry results manually using this method. * @summary Get a webhook result and try to resend the original webhook payload * @param {string} webhookResultId Webhook Result ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ redriveWebhookResultRaw(requestParameters: RedriveWebhookResultRequest): Promise>; /** * Allows you to resend a webhook payload that was already sent. Webhooks that fail are retried automatically for 24 hours and then put in a dead letter queue. You can retry results manually using this method. * Get a webhook result and try to resend the original webhook payload */ redriveWebhookResult(requestParameters: RedriveWebhookResultRequest): Promise; /** * * @summary Send webhook test data * @param {string} webhookId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhookControllerApiInterface */ sendTestDataRaw(requestParameters: SendTestDataRequest): Promise>; /** * Send webhook test data */ sendTestData(requestParameters: SendTestDataRequest): Promise; } /** * */ export class WebhookControllerApi extends runtime.BaseAPI implements WebhookControllerApiInterface { /** * Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint. * Attach a WebHook URL to an inbox */ async createWebhookRaw(requestParameters: CreateWebhookRequest): Promise> { if (requestParameters.inboxId === null || requestParameters.inboxId === undefined) { throw new runtime.RequiredError('inboxId','Required parameter requestParameters.inboxId was null or undefined when calling createWebhook.'); } if (requestParameters.createWebhookOptions === null || requestParameters.createWebhookOptions === undefined) { throw new runtime.RequiredError('createWebhookOptions','Required parameter requestParameters.createWebhookOptions was null or undefined when calling createWebhook.'); } 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: `/inboxes/{inboxId}/webhooks`.replace(`{${"inboxId"}}`, encodeURIComponent(String(requestParameters.inboxId))), method: 'POST', headers: headerParameters, query: queryParameters, body: CreateWebhookOptionsToJSON(requestParameters.createWebhookOptions), }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookDtoFromJSON(jsonValue)); } /** * Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint. * Attach a WebHook URL to an inbox */ async createWebhook(requestParameters: CreateWebhookRequest): Promise { const response = await this.createWebhookRaw(requestParameters); return await response.value(); } /** * Delete all webhooks */ async deleteAllWebhooksRaw(): 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: `/webhooks`, method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Delete all webhooks */ async deleteAllWebhooks(): Promise { await this.deleteAllWebhooksRaw(); } /** * Delete and disable a Webhook for an Inbox */ async deleteWebhookRaw(requestParameters: DeleteWebhookRequest): Promise> { if (requestParameters.inboxId === null || requestParameters.inboxId === undefined) { throw new runtime.RequiredError('inboxId','Required parameter requestParameters.inboxId was null or undefined when calling deleteWebhook.'); } if (requestParameters.webhookId === null || requestParameters.webhookId === undefined) { throw new runtime.RequiredError('webhookId','Required parameter requestParameters.webhookId was null or undefined when calling deleteWebhook.'); } 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: `/inboxes/{inboxId}/webhooks/{webhookId}`.replace(`{${"inboxId"}}`, encodeURIComponent(String(requestParameters.inboxId))).replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters.webhookId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Delete and disable a Webhook for an Inbox */ async deleteWebhook(requestParameters: DeleteWebhookRequest): Promise { await this.deleteWebhookRaw(requestParameters); } /** * Get results for all webhooks */ async getAllWebhookResultsRaw(requestParameters: GetAllWebhookResultsRequest): 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.searchFilter !== undefined) { queryParameters['searchFilter'] = requestParameters.searchFilter; } if (requestParameters.since !== undefined) { queryParameters['since'] = (requestParameters.since as any).toISOString(); } if (requestParameters.before !== undefined) { queryParameters['before'] = (requestParameters.before as any).toISOString(); } if (requestParameters.unseenOnly !== undefined) { queryParameters['unseenOnly'] = requestParameters.unseenOnly; } 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: `/webhooks/results`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => PageWebhookResultFromJSON(jsonValue)); } /** * Get results for all webhooks */ async getAllWebhookResults(requestParameters: GetAllWebhookResultsRequest): Promise { const response = await this.getAllWebhookResultsRaw(requestParameters); return await response.value(); } /** * List webhooks in paginated form. Allows for page index, page size, and sort direction. * List Webhooks Paginated */ async getAllWebhooksRaw(requestParameters: GetAllWebhooksRequest): 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.searchFilter !== undefined) { queryParameters['searchFilter'] = requestParameters.searchFilter; } 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: `/webhooks/paginated`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => PageWebhookProjectionFromJSON(jsonValue)); } /** * List webhooks in paginated form. Allows for page index, page size, and sort direction. * List Webhooks Paginated */ async getAllWebhooks(requestParameters: GetAllWebhooksRequest): Promise { const response = await this.getAllWebhooksRaw(requestParameters); return await response.value(); } /** * Get paginated webhooks for an Inbox */ async getInboxWebhooksPaginatedRaw(requestParameters: GetInboxWebhooksPaginatedRequest): Promise> { if (requestParameters.inboxId === null || requestParameters.inboxId === undefined) { throw new runtime.RequiredError('inboxId','Required parameter requestParameters.inboxId was null or undefined when calling getInboxWebhooksPaginated.'); } 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.searchFilter !== undefined) { queryParameters['searchFilter'] = requestParameters.searchFilter; } 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}/webhooks/paginated`.replace(`{${"inboxId"}}`, encodeURIComponent(String(requestParameters.inboxId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => PageWebhookProjectionFromJSON(jsonValue)); } /** * Get paginated webhooks for an Inbox */ async getInboxWebhooksPaginated(requestParameters: GetInboxWebhooksPaginatedRequest): Promise { const response = await this.getInboxWebhooksPaginatedRaw(requestParameters); return await response.value(); } /** * Get JSON Schema definition for webhook payload */ async getJsonSchemaForWebhookPayloadRaw(requestParameters: GetJsonSchemaForWebhookPayloadRequest): Promise> { if (requestParameters.webhookId === null || requestParameters.webhookId === undefined) { throw new runtime.RequiredError('webhookId','Required parameter requestParameters.webhookId was null or undefined when calling getJsonSchemaForWebhookPayload.'); } 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: `/webhooks/{webhookId}/schema`.replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters.webhookId))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => JSONSchemaDtoFromJSON(jsonValue)); } /** * Get JSON Schema definition for webhook payload */ async getJsonSchemaForWebhookPayload(requestParameters: GetJsonSchemaForWebhookPayloadRequest): Promise { const response = await this.getJsonSchemaForWebhookPayloadRaw(requestParameters); return await response.value(); } /** * Get test webhook payload example. Response content depends on eventName passed. Uses `EMAIL_RECEIVED` as default. */ async getTestWebhookPayloadRaw(requestParameters: GetTestWebhookPayloadRequest): Promise> { const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.eventName !== undefined) { queryParameters['eventName'] = requestParameters.eventName; } 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: `/webhooks/test`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => AbstractWebhookPayloadFromJSON(jsonValue)); } /** * Get test webhook payload example. Response content depends on eventName passed. Uses `EMAIL_RECEIVED` as default. */ async getTestWebhookPayload(requestParameters: GetTestWebhookPayloadRequest): Promise { const response = await this.getTestWebhookPayloadRaw(requestParameters); return await response.value(); } /** * Get webhook test payload for email opened event */ async getTestWebhookPayloadEmailOpenedRaw(): 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: `/webhooks/test/email-opened-payload`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookEmailOpenedPayloadFromJSON(jsonValue)); } /** * Get webhook test payload for email opened event */ async getTestWebhookPayloadEmailOpened(): Promise { const response = await this.getTestWebhookPayloadEmailOpenedRaw(); return await response.value(); } /** * Get webhook test payload for email opened event */ async getTestWebhookPayloadEmailReadRaw(): 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: `/webhooks/test/email-read-payload`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookEmailReadPayloadFromJSON(jsonValue)); } /** * Get webhook test payload for email opened event */ async getTestWebhookPayloadEmailRead(): Promise { const response = await this.getTestWebhookPayloadEmailReadRaw(); return await response.value(); } /** * Get example payload for webhook */ async getTestWebhookPayloadForWebhookRaw(requestParameters: GetTestWebhookPayloadForWebhookRequest): Promise> { if (requestParameters.webhookId === null || requestParameters.webhookId === undefined) { throw new runtime.RequiredError('webhookId','Required parameter requestParameters.webhookId was null or undefined when calling getTestWebhookPayloadForWebhook.'); } 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: `/webhooks/{webhookId}/example`.replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters.webhookId))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => AbstractWebhookPayloadFromJSON(jsonValue)); } /** * Get example payload for webhook */ async getTestWebhookPayloadForWebhook(requestParameters: GetTestWebhookPayloadForWebhookRequest): Promise { const response = await this.getTestWebhookPayloadForWebhookRaw(requestParameters); return await response.value(); } /** * Get webhook test payload for new attachment event */ async getTestWebhookPayloadNewAttachmentRaw(): 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: `/webhooks/test/new-attachment-payload`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookNewAttachmentPayloadFromJSON(jsonValue)); } /** * Get webhook test payload for new attachment event */ async getTestWebhookPayloadNewAttachment(): Promise { const response = await this.getTestWebhookPayloadNewAttachmentRaw(); return await response.value(); } /** * Get webhook test payload for new contact event */ async getTestWebhookPayloadNewContactRaw(): 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: `/webhooks/test/new-contact-payload`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookNewContactPayloadFromJSON(jsonValue)); } /** * Get webhook test payload for new contact event */ async getTestWebhookPayloadNewContact(): Promise { const response = await this.getTestWebhookPayloadNewContactRaw(); return await response.value(); } /** * Get webhook test payload for new email event */ async getTestWebhookPayloadNewEmailRaw(): 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: `/webhooks/test/new-email-payload`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookNewEmailPayloadFromJSON(jsonValue)); } /** * Get webhook test payload for new email event */ async getTestWebhookPayloadNewEmail(): Promise { const response = await this.getTestWebhookPayloadNewEmailRaw(); return await response.value(); } /** * Get a webhook for an Inbox */ async getWebhookRaw(requestParameters: GetWebhookRequest): Promise> { if (requestParameters.webhookId === null || requestParameters.webhookId === undefined) { throw new runtime.RequiredError('webhookId','Required parameter requestParameters.webhookId was null or undefined when calling getWebhook.'); } 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: `/webhooks/{webhookId}`.replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters.webhookId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookDtoFromJSON(jsonValue)); } /** * Get a webhook for an Inbox */ async getWebhook(requestParameters: GetWebhookRequest): Promise { const response = await this.getWebhookRaw(requestParameters); return await response.value(); } /** * Get a webhook result for a webhook */ async getWebhookResultRaw(requestParameters: GetWebhookResultRequest): Promise> { if (requestParameters.webhookResultId === null || requestParameters.webhookResultId === undefined) { throw new runtime.RequiredError('webhookResultId','Required parameter requestParameters.webhookResultId was null or undefined when calling getWebhookResult.'); } 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: `/webhooks/results/{webhookResultId}`.replace(`{${"webhookResultId"}}`, encodeURIComponent(String(requestParameters.webhookResultId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookResultDtoFromJSON(jsonValue)); } /** * Get a webhook result for a webhook */ async getWebhookResult(requestParameters: GetWebhookResultRequest): Promise { const response = await this.getWebhookResultRaw(requestParameters); return await response.value(); } /** * Get a webhook results for a webhook */ async getWebhookResultsRaw(requestParameters: GetWebhookResultsRequest): Promise> { if (requestParameters.webhookId === null || requestParameters.webhookId === undefined) { throw new runtime.RequiredError('webhookId','Required parameter requestParameters.webhookId was null or undefined when calling getWebhookResults.'); } 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.searchFilter !== undefined) { queryParameters['searchFilter'] = requestParameters.searchFilter; } if (requestParameters.since !== undefined) { queryParameters['since'] = (requestParameters.since as any).toISOString(); } if (requestParameters.before !== undefined) { queryParameters['before'] = (requestParameters.before as any).toISOString(); } if (requestParameters.unseenOnly !== undefined) { queryParameters['unseenOnly'] = requestParameters.unseenOnly; } 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: `/webhooks/{webhookId}/results`.replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters.webhookId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => PageWebhookResultFromJSON(jsonValue)); } /** * Get a webhook results for a webhook */ async getWebhookResults(requestParameters: GetWebhookResultsRequest): Promise { const response = await this.getWebhookResultsRaw(requestParameters); return await response.value(); } /** * Get count of unseen webhook results with error status */ async getWebhookResultsUnseenErrorCountRaw(requestParameters: GetWebhookResultsUnseenErrorCountRequest): Promise> { if (requestParameters.inboxId === null || requestParameters.inboxId === undefined) { throw new runtime.RequiredError('inboxId','Required parameter requestParameters.inboxId was null or undefined when calling getWebhookResultsUnseenErrorCount.'); } 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: `/webhooks/results/unseen-count`.replace(`{${"inboxId"}}`, encodeURIComponent(String(requestParameters.inboxId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => UnseenErrorCountDtoFromJSON(jsonValue)); } /** * Get count of unseen webhook results with error status */ async getWebhookResultsUnseenErrorCount(requestParameters: GetWebhookResultsUnseenErrorCountRequest): Promise { const response = await this.getWebhookResultsUnseenErrorCountRaw(requestParameters); return await response.value(); } /** * Get all webhooks for an Inbox */ async getWebhooksRaw(requestParameters: GetWebhooksRequest): Promise>> { if (requestParameters.inboxId === null || requestParameters.inboxId === undefined) { throw new runtime.RequiredError('inboxId','Required parameter requestParameters.inboxId was null or undefined when calling getWebhooks.'); } 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: `/inboxes/{inboxId}/webhooks`.replace(`{${"inboxId"}}`, encodeURIComponent(String(requestParameters.inboxId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(WebhookDtoFromJSON)); } /** * Get all webhooks for an Inbox */ async getWebhooks(requestParameters: GetWebhooksRequest): Promise> { const response = await this.getWebhooksRaw(requestParameters); return await response.value(); } /** * Allows you to resend a webhook payload that was already sent. Webhooks that fail are retried automatically for 24 hours and then put in a dead letter queue. You can retry results manually using this method. * Get a webhook result and try to resend the original webhook payload */ async redriveWebhookResultRaw(requestParameters: RedriveWebhookResultRequest): Promise> { if (requestParameters.webhookResultId === null || requestParameters.webhookResultId === undefined) { throw new runtime.RequiredError('webhookResultId','Required parameter requestParameters.webhookResultId was null or undefined when calling redriveWebhookResult.'); } 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: `/webhooks/results/{webhookResultId}/redrive`.replace(`{${"webhookResultId"}}`, encodeURIComponent(String(requestParameters.webhookResultId))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookRedriveResultFromJSON(jsonValue)); } /** * Allows you to resend a webhook payload that was already sent. Webhooks that fail are retried automatically for 24 hours and then put in a dead letter queue. You can retry results manually using this method. * Get a webhook result and try to resend the original webhook payload */ async redriveWebhookResult(requestParameters: RedriveWebhookResultRequest): Promise { const response = await this.redriveWebhookResultRaw(requestParameters); return await response.value(); } /** * Send webhook test data */ async sendTestDataRaw(requestParameters: SendTestDataRequest): Promise> { if (requestParameters.webhookId === null || requestParameters.webhookId === undefined) { throw new runtime.RequiredError('webhookId','Required parameter requestParameters.webhookId was null or undefined when calling sendTestData.'); } 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: `/webhooks/{webhookId}/test`.replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters.webhookId))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => WebhookTestResultFromJSON(jsonValue)); } /** * Send webhook test data */ async sendTestData(requestParameters: SendTestDataRequest): Promise { const response = await this.sendTestDataRaw(requestParameters); return await response.value(); } } /** * @export * @enum {string} */ export enum GetAllWebhookResultsSortEnum { ASC = 'ASC', DESC = 'DESC' } /** * @export * @enum {string} */ export enum GetAllWebhooksSortEnum { ASC = 'ASC', DESC = 'DESC' } /** * @export * @enum {string} */ export enum GetInboxWebhooksPaginatedSortEnum { ASC = 'ASC', DESC = 'DESC' } /** * @export * @enum {string} */ export enum GetTestWebhookPayloadEventNameEnum { EMAILRECEIVED = 'EMAIL_RECEIVED', NEWEMAIL = 'NEW_EMAIL', NEWCONTACT = 'NEW_CONTACT', NEWATTACHMENT = 'NEW_ATTACHMENT', EMAILOPENED = 'EMAIL_OPENED', EMAILREAD = 'EMAIL_READ' } /** * @export * @enum {string} */ export enum GetWebhookResultsSortEnum { ASC = 'ASC', DESC = 'DESC' }