/* 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 { CreateInboxRetentionPolicyForAccountOptions, CreateInboxRetentionPolicyForAccountOptionsFromJSON, CreateInboxRetentionPolicyForAccountOptionsToJSON, EmptyResponseDto, EmptyResponseDtoFromJSON, EmptyResponseDtoToJSON, InboxRetentionPolicyDto, InboxRetentionPolicyDtoFromJSON, InboxRetentionPolicyDtoToJSON, InboxRetentionPolicyOptionalDto, InboxRetentionPolicyOptionalDtoFromJSON, InboxRetentionPolicyOptionalDtoToJSON, InboxRetentionPolicyRunDto, InboxRetentionPolicyRunDtoFromJSON, InboxRetentionPolicyRunDtoToJSON, JsonNode, JsonNodeFromJSON, JsonNodeToJSON, PageEntityAutomationItems, PageEntityAutomationItemsFromJSON, PageEntityAutomationItemsToJSON, PageEntityEventItems, PageEntityEventItemsFromJSON, PageEntityEventItemsToJSON, PageEntityFavouriteItems, PageEntityFavouriteItemsFromJSON, PageEntityFavouriteItemsToJSON, PageInboxRetentionPolicyRunProjection, PageInboxRetentionPolicyRunProjectionFromJSON, PageInboxRetentionPolicyRunProjectionToJSON, UserInfoDto, UserInfoDtoFromJSON, UserInfoDtoToJSON, } from '../models'; export interface CreateOrUpdateInboxRetentionPolicyForAccountRequest { createInboxRetentionPolicyForAccountOptions: CreateInboxRetentionPolicyForAccountOptions; } export interface GetEntityAutomationsRequest { page?: number; size?: number; sort?: GetEntityAutomationsSortEnum; since?: Date; before?: Date; inboxId?: string; phoneId?: string; filter?: GetEntityAutomationsFilterEnum; } export interface GetEntityEventsRequest { page?: number; size?: number; sort?: GetEntityEventsSortEnum; since?: Date; before?: Date; inboxId?: string; emailId?: string; phoneId?: string; smsId?: string; attachmentId?: string; filter?: GetEntityEventsFilterEnum; } export interface GetEntityFavoritesRequest { page?: number; size?: number; sort?: GetEntityFavoritesSortEnum; since?: Date; before?: Date; filter?: GetEntityFavoritesFilterEnum; } export interface GetInboxRetentionPolicyRunRequest { runId: string; } export interface GetInboxRetentionPolicyRunsRequest { page?: number; size?: number; sort?: GetInboxRetentionPolicyRunsSortEnum; } export interface GetJsonPropertyAsStringRequest { property: string; jsonNode: JsonNode; } /** * */ export class UserControllerApi extends runtime.BaseAPI { /** * Start an asynchronous inbox retention policy run for your account */ async createInboxRetentionPolicyRunRaw( 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: `/user/inbox-retention-policies/account/run`, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => InboxRetentionPolicyRunDtoFromJSON(jsonValue) ); } /** * Start an asynchronous inbox retention policy run for your account */ async createInboxRetentionPolicyRun( initOverrides?: RequestInit ): Promise { const response = await this.createInboxRetentionPolicyRunRaw(initOverrides); return await response.value(); } /** * Create inbox retention policy for your global account */ async createOrUpdateInboxRetentionPolicyForAccountRaw( requestParameters: CreateOrUpdateInboxRetentionPolicyForAccountRequest, initOverrides?: RequestInit ): Promise> { if ( requestParameters.createInboxRetentionPolicyForAccountOptions === null || requestParameters.createInboxRetentionPolicyForAccountOptions === undefined ) { throw new runtime.RequiredError( 'createInboxRetentionPolicyForAccountOptions', 'Required parameter requestParameters.createInboxRetentionPolicyForAccountOptions was null or undefined when calling createOrUpdateInboxRetentionPolicyForAccount.' ); } 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: `/user/inbox-retention-policies/account`, method: 'POST', headers: headerParameters, query: queryParameters, body: CreateInboxRetentionPolicyForAccountOptionsToJSON( requestParameters.createInboxRetentionPolicyForAccountOptions ), }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => InboxRetentionPolicyDtoFromJSON(jsonValue) ); } /** * Create inbox retention policy for your global account */ async createOrUpdateInboxRetentionPolicyForAccount( requestParameters: CreateOrUpdateInboxRetentionPolicyForAccountRequest, initOverrides?: RequestInit ): Promise { const response = await this.createOrUpdateInboxRetentionPolicyForAccountRaw( requestParameters, initOverrides ); return await response.value(); } /** * Delete inbox retention policy for your global account */ async deleteInboxRetentionPolicyForAccountRaw( 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: `/user/inbox-retention-policies/account`, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => EmptyResponseDtoFromJSON(jsonValue) ); } /** * Delete inbox retention policy for your global account */ async deleteInboxRetentionPolicyForAccount( initOverrides?: RequestInit ): Promise { const response = await this.deleteInboxRetentionPolicyForAccountRaw( initOverrides ); return await response.value(); } /** */ async getEntityAutomationsRaw( requestParameters: GetEntityAutomationsRequest, initOverrides?: RequestInit ): Promise> { 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(); } if (requestParameters.inboxId !== undefined) { queryParameters['inboxId'] = requestParameters.inboxId; } if (requestParameters.phoneId !== undefined) { queryParameters['phoneId'] = requestParameters.phoneId; } if (requestParameters.filter !== undefined) { queryParameters['filter'] = requestParameters.filter; } 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: `/user/automations`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => PageEntityAutomationItemsFromJSON(jsonValue) ); } /** */ async getEntityAutomations( requestParameters: GetEntityAutomationsRequest, initOverrides?: RequestInit ): Promise { const response = await this.getEntityAutomationsRaw( requestParameters, initOverrides ); return await response.value(); } /** */ async getEntityEventsRaw( requestParameters: GetEntityEventsRequest, initOverrides?: RequestInit ): Promise> { 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(); } if (requestParameters.inboxId !== undefined) { queryParameters['inboxId'] = requestParameters.inboxId; } if (requestParameters.emailId !== undefined) { queryParameters['emailId'] = requestParameters.emailId; } if (requestParameters.phoneId !== undefined) { queryParameters['phoneId'] = requestParameters.phoneId; } if (requestParameters.smsId !== undefined) { queryParameters['smsId'] = requestParameters.smsId; } if (requestParameters.attachmentId !== undefined) { queryParameters['attachmentId'] = requestParameters.attachmentId; } if (requestParameters.filter !== undefined) { queryParameters['filter'] = requestParameters.filter; } 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: `/user/events`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => PageEntityEventItemsFromJSON(jsonValue) ); } /** */ async getEntityEvents( requestParameters: GetEntityEventsRequest, initOverrides?: RequestInit ): Promise { const response = await this.getEntityEventsRaw( requestParameters, initOverrides ); return await response.value(); } /** */ async getEntityFavoritesRaw( requestParameters: GetEntityFavoritesRequest, initOverrides?: RequestInit ): Promise> { 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(); } if (requestParameters.filter !== undefined) { queryParameters['filter'] = requestParameters.filter; } 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: `/user/favorites`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => PageEntityFavouriteItemsFromJSON(jsonValue) ); } /** */ async getEntityFavorites( requestParameters: GetEntityFavoritesRequest, initOverrides?: RequestInit ): Promise { const response = await this.getEntityFavoritesRaw( requestParameters, initOverrides ); return await response.value(); } /** * Get inbox retention policy for your global account */ async getInboxRetentionPolicyForAccountRaw( 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: `/user/inbox-retention-policies/account`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => InboxRetentionPolicyOptionalDtoFromJSON(jsonValue) ); } /** * Get inbox retention policy for your global account */ async getInboxRetentionPolicyForAccount( initOverrides?: RequestInit ): Promise { const response = await this.getInboxRetentionPolicyForAccountRaw( initOverrides ); return await response.value(); } /** * Get a previously submitted inbox retention policy run for your account */ async getInboxRetentionPolicyRunRaw( requestParameters: GetInboxRetentionPolicyRunRequest, initOverrides?: RequestInit ): Promise> { if ( requestParameters.runId === null || requestParameters.runId === undefined ) { throw new runtime.RequiredError( 'runId', 'Required parameter requestParameters.runId was null or undefined when calling getInboxRetentionPolicyRun.' ); } 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: `/user/inbox-retention-policies/runs/{runId}`.replace( `{${'runId'}}`, encodeURIComponent(String(requestParameters.runId)) ), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => InboxRetentionPolicyRunDtoFromJSON(jsonValue) ); } /** * Get a previously submitted inbox retention policy run for your account */ async getInboxRetentionPolicyRun( requestParameters: GetInboxRetentionPolicyRunRequest, initOverrides?: RequestInit ): Promise { const response = await this.getInboxRetentionPolicyRunRaw( requestParameters, initOverrides ); return await response.value(); } /** * List recent inbox retention policy runs for your account */ async getInboxRetentionPolicyRunsRaw( requestParameters: GetInboxRetentionPolicyRunsRequest, initOverrides?: RequestInit ): Promise> { 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; } 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: `/user/inbox-retention-policies/runs`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => PageInboxRetentionPolicyRunProjectionFromJSON(jsonValue) ); } /** * List recent inbox retention policy runs for your account */ async getInboxRetentionPolicyRuns( requestParameters: GetInboxRetentionPolicyRunsRequest, initOverrides?: RequestInit ): Promise { const response = await this.getInboxRetentionPolicyRunsRaw( requestParameters, initOverrides ); return await response.value(); } /** * Utility function to extract properties from JSON objects in language where this is cumbersome. */ async getJsonPropertyAsStringRaw( requestParameters: GetJsonPropertyAsStringRequest, initOverrides?: RequestInit ): Promise> { if ( requestParameters.property === null || requestParameters.property === undefined ) { throw new runtime.RequiredError( 'property', 'Required parameter requestParameters.property was null or undefined when calling getJsonPropertyAsString.' ); } if ( requestParameters.jsonNode === null || requestParameters.jsonNode === undefined ) { throw new runtime.RequiredError( 'jsonNode', 'Required parameter requestParameters.jsonNode was null or undefined when calling getJsonPropertyAsString.' ); } const queryParameters: any = {}; if (requestParameters.property !== undefined) { queryParameters['property'] = requestParameters.property; } 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: `/user/json/pluck`, method: 'POST', headers: headerParameters, query: queryParameters, body: JsonNodeToJSON(requestParameters.jsonNode), }, initOverrides ); return new runtime.TextApiResponse(response) as any; } /** * Utility function to extract properties from JSON objects in language where this is cumbersome. */ async getJsonPropertyAsString( requestParameters: GetJsonPropertyAsStringRequest, initOverrides?: RequestInit ): Promise { const response = await this.getJsonPropertyAsStringRaw( requestParameters, initOverrides ); return await response.value(); } /** * Get account information for your user */ async getUserInfoRaw( 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: `/user/info`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides ); return new runtime.JSONApiResponse(response, (jsonValue) => UserInfoDtoFromJSON(jsonValue) ); } /** * Get account information for your user */ async getUserInfo(initOverrides?: RequestInit): Promise { const response = await this.getUserInfoRaw(initOverrides); return await response.value(); } } /** * @export * @enum {string} */ export enum GetEntityAutomationsSortEnum { ASC = 'ASC', DESC = 'DESC', } /** * @export * @enum {string} */ export enum GetEntityAutomationsFilterEnum { FORWARDER = 'INBOX_FORWARDER', REPLIER = 'INBOX_REPLIER', RULESET = 'INBOX_RULESET', } /** * @export * @enum {string} */ export enum GetEntityEventsSortEnum { ASC = 'ASC', DESC = 'DESC', } /** * @export * @enum {string} */ export enum GetEntityEventsFilterEnum { WEBHOOK_EVENT = 'WEBHOOK_EVENT', INBOX_FORWARDER_EVENT = 'INBOX_FORWARDER_EVENT', INBOX_REPLIER_EVENT = 'INBOX_REPLIER_EVENT', INBOX_RULESET_EVENT = 'INBOX_RULESET_EVENT', ALIAS_EVENT = 'ALIAS_EVENT', } /** * @export * @enum {string} */ export enum GetEntityFavoritesSortEnum { ASC = 'ASC', DESC = 'DESC', } /** * @export * @enum {string} */ export enum GetEntityFavoritesFilterEnum { INBOX = 'INBOX', EMAIL = 'EMAIL', ATTACHMENT = 'ATTACHMENT', PHONE = 'PHONE', SMS = 'SMS', } /** * @export * @enum {string} */ export enum GetInboxRetentionPolicyRunsSortEnum { ASC = 'ASC', DESC = 'DESC', }