/* tslint:disable */
/* eslint-disable */
/**
* Elastic Email REST API
* This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach. Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used. The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request. To start using this API, you will need your Access Token (available here). Remember to keep it safe. Required access levels are listed in the given request’s description. Downloadable library clients can be found in our Github repository here
*
* The version of the OpenAPI document: 4.0.0
* Contact: support@elasticemail.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { Webhook } from '../ee-api-models';
// @ts-ignore
import type { WebhookCreatePayload } from '../ee-api-models';
// @ts-ignore
import type { WebhookUpdatePayload } from '../ee-api-models';
/**
* WebhookApi - axios parameter creator
* @export
*/
export const WebhookApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Delete the specified notifications webhook. Required Access Level: ModifyWebNotifications
* @summary Delete Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookByPublicidDelete: async (publicid: string, options: RawAxiosRequestConfig = {}): Promise => {
// verify required parameter 'publicid' is not null or undefined
assertParamExists('webhookByPublicidDelete', 'publicid', publicid)
const localVarPath = `/webhook/{publicid}`
.replace(`{${"publicid"}}`, encodeURIComponent(String(publicid)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication apikey required
await setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Load notifications webhook details. Required Access Level: ViewWebNotifications
* @summary Load Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookByPublicidGet: async (publicid: string, options: RawAxiosRequestConfig = {}): Promise => {
// verify required parameter 'publicid' is not null or undefined
assertParamExists('webhookByPublicidGet', 'publicid', publicid)
const localVarPath = `/webhook/{publicid}`
.replace(`{${"publicid"}}`, encodeURIComponent(String(publicid)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication apikey required
await setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Update notification webhook. Required Access Level: ModifyWebNotifications
* @summary Update Webhook
* @param {string} publicid
* @param {WebhookUpdatePayload} webhookUpdatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookByPublicidPut: async (publicid: string, webhookUpdatePayload: WebhookUpdatePayload, options: RawAxiosRequestConfig = {}): Promise => {
// verify required parameter 'publicid' is not null or undefined
assertParamExists('webhookByPublicidPut', 'publicid', publicid)
// verify required parameter 'webhookUpdatePayload' is not null or undefined
assertParamExists('webhookByPublicidPut', 'webhookUpdatePayload', webhookUpdatePayload)
const localVarPath = `/webhook/{publicid}`
.replace(`{${"publicid"}}`, encodeURIComponent(String(publicid)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication apikey required
await setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(webhookUpdatePayload, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Returns a list of notification webhooks. Required Access Level: ViewWebNotifications
* @summary Load Webhooks
* @param {number} [limit] Maximum number of returned items.
* @param {number} [offset] How many items should be returned ahead.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookGet: async (limit?: number, offset?: number, options: RawAxiosRequestConfig = {}): Promise => {
const localVarPath = `/webhook`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication apikey required
await setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration)
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (offset !== undefined) {
localVarQueryParameter['offset'] = offset;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Add a notification webhook. Required Access Level: ModifyWebNotifications
* @summary Add Webhook
* @param {WebhookCreatePayload} webhookCreatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookPost: async (webhookCreatePayload: WebhookCreatePayload, options: RawAxiosRequestConfig = {}): Promise => {
// verify required parameter 'webhookCreatePayload' is not null or undefined
assertParamExists('webhookPost', 'webhookCreatePayload', webhookCreatePayload)
const localVarPath = `/webhook`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication apikey required
await setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(webhookCreatePayload, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* WebhookApi - functional programming interface
* @export
*/
export const WebhookApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = WebhookApiAxiosParamCreator(configuration)
return {
/**
* Delete the specified notifications webhook. Required Access Level: ModifyWebNotifications
* @summary Delete Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async webhookByPublicidDelete(publicid: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
const localVarAxiosArgs = await localVarAxiosParamCreator.webhookByPublicidDelete(publicid, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhookApi.webhookByPublicidDelete']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Load notifications webhook details. Required Access Level: ViewWebNotifications
* @summary Load Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async webhookByPublicidGet(publicid: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
const localVarAxiosArgs = await localVarAxiosParamCreator.webhookByPublicidGet(publicid, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhookApi.webhookByPublicidGet']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Update notification webhook. Required Access Level: ModifyWebNotifications
* @summary Update Webhook
* @param {string} publicid
* @param {WebhookUpdatePayload} webhookUpdatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async webhookByPublicidPut(publicid: string, webhookUpdatePayload: WebhookUpdatePayload, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
const localVarAxiosArgs = await localVarAxiosParamCreator.webhookByPublicidPut(publicid, webhookUpdatePayload, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhookApi.webhookByPublicidPut']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Returns a list of notification webhooks. Required Access Level: ViewWebNotifications
* @summary Load Webhooks
* @param {number} [limit] Maximum number of returned items.
* @param {number} [offset] How many items should be returned ahead.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async webhookGet(limit?: number, offset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.webhookGet(limit, offset, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhookApi.webhookGet']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Add a notification webhook. Required Access Level: ModifyWebNotifications
* @summary Add Webhook
* @param {WebhookCreatePayload} webhookCreatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async webhookPost(webhookCreatePayload: WebhookCreatePayload, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
const localVarAxiosArgs = await localVarAxiosParamCreator.webhookPost(webhookCreatePayload, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhookApi.webhookPost']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* WebhookApi - factory interface
* @export
*/
export const WebhookApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = WebhookApiFp(configuration)
return {
/**
* Delete the specified notifications webhook. Required Access Level: ModifyWebNotifications
* @summary Delete Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookByPublicidDelete(publicid: string, options?: RawAxiosRequestConfig): AxiosPromise {
return localVarFp.webhookByPublicidDelete(publicid, options).then((request) => request(axios, basePath));
},
/**
* Load notifications webhook details. Required Access Level: ViewWebNotifications
* @summary Load Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookByPublicidGet(publicid: string, options?: RawAxiosRequestConfig): AxiosPromise {
return localVarFp.webhookByPublicidGet(publicid, options).then((request) => request(axios, basePath));
},
/**
* Update notification webhook. Required Access Level: ModifyWebNotifications
* @summary Update Webhook
* @param {string} publicid
* @param {WebhookUpdatePayload} webhookUpdatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookByPublicidPut(publicid: string, webhookUpdatePayload: WebhookUpdatePayload, options?: RawAxiosRequestConfig): AxiosPromise {
return localVarFp.webhookByPublicidPut(publicid, webhookUpdatePayload, options).then((request) => request(axios, basePath));
},
/**
* Returns a list of notification webhooks. Required Access Level: ViewWebNotifications
* @summary Load Webhooks
* @param {number} [limit] Maximum number of returned items.
* @param {number} [offset] How many items should be returned ahead.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookGet(limit?: number, offset?: number, options?: RawAxiosRequestConfig): AxiosPromise> {
return localVarFp.webhookGet(limit, offset, options).then((request) => request(axios, basePath));
},
/**
* Add a notification webhook. Required Access Level: ModifyWebNotifications
* @summary Add Webhook
* @param {WebhookCreatePayload} webhookCreatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
webhookPost(webhookCreatePayload: WebhookCreatePayload, options?: RawAxiosRequestConfig): AxiosPromise {
return localVarFp.webhookPost(webhookCreatePayload, options).then((request) => request(axios, basePath));
},
};
};
/**
* WebhookApi - interface
* @export
* @interface WebhookApi
*/
export interface WebhookApiInterface {
/**
* Delete the specified notifications webhook. Required Access Level: ModifyWebNotifications
* @summary Delete Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApiInterface
*/
webhookByPublicidDelete(publicid: string, options?: RawAxiosRequestConfig): AxiosPromise;
/**
* Load notifications webhook details. Required Access Level: ViewWebNotifications
* @summary Load Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApiInterface
*/
webhookByPublicidGet(publicid: string, options?: RawAxiosRequestConfig): AxiosPromise;
/**
* Update notification webhook. Required Access Level: ModifyWebNotifications
* @summary Update Webhook
* @param {string} publicid
* @param {WebhookUpdatePayload} webhookUpdatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApiInterface
*/
webhookByPublicidPut(publicid: string, webhookUpdatePayload: WebhookUpdatePayload, options?: RawAxiosRequestConfig): AxiosPromise;
/**
* Returns a list of notification webhooks. Required Access Level: ViewWebNotifications
* @summary Load Webhooks
* @param {number} [limit] Maximum number of returned items.
* @param {number} [offset] How many items should be returned ahead.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApiInterface
*/
webhookGet(limit?: number, offset?: number, options?: RawAxiosRequestConfig): AxiosPromise>;
/**
* Add a notification webhook. Required Access Level: ModifyWebNotifications
* @summary Add Webhook
* @param {WebhookCreatePayload} webhookCreatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApiInterface
*/
webhookPost(webhookCreatePayload: WebhookCreatePayload, options?: RawAxiosRequestConfig): AxiosPromise;
}
/**
* WebhookApi - object-oriented interface
* @export
* @class WebhookApi
* @extends {BaseAPI}
*/
export class WebhookApi extends BaseAPI implements WebhookApiInterface {
/**
* Delete the specified notifications webhook. Required Access Level: ModifyWebNotifications
* @summary Delete Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApi
*/
public webhookByPublicidDelete(publicid: string, options?: RawAxiosRequestConfig) {
return WebhookApiFp(this.configuration).webhookByPublicidDelete(publicid, options).then((request) => request(this.axios, this.basePath));
}
/**
* Load notifications webhook details. Required Access Level: ViewWebNotifications
* @summary Load Webhook
* @param {string} publicid
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApi
*/
public webhookByPublicidGet(publicid: string, options?: RawAxiosRequestConfig) {
return WebhookApiFp(this.configuration).webhookByPublicidGet(publicid, options).then((request) => request(this.axios, this.basePath));
}
/**
* Update notification webhook. Required Access Level: ModifyWebNotifications
* @summary Update Webhook
* @param {string} publicid
* @param {WebhookUpdatePayload} webhookUpdatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApi
*/
public webhookByPublicidPut(publicid: string, webhookUpdatePayload: WebhookUpdatePayload, options?: RawAxiosRequestConfig) {
return WebhookApiFp(this.configuration).webhookByPublicidPut(publicid, webhookUpdatePayload, options).then((request) => request(this.axios, this.basePath));
}
/**
* Returns a list of notification webhooks. Required Access Level: ViewWebNotifications
* @summary Load Webhooks
* @param {number} [limit] Maximum number of returned items.
* @param {number} [offset] How many items should be returned ahead.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApi
*/
public webhookGet(limit?: number, offset?: number, options?: RawAxiosRequestConfig) {
return WebhookApiFp(this.configuration).webhookGet(limit, offset, options).then((request) => request(this.axios, this.basePath));
}
/**
* Add a notification webhook. Required Access Level: ModifyWebNotifications
* @summary Add Webhook
* @param {WebhookCreatePayload} webhookCreatePayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhookApi
*/
public webhookPost(webhookCreatePayload: WebhookCreatePayload, options?: RawAxiosRequestConfig) {
return WebhookApiFp(this.configuration).webhookPost(webhookCreatePayload, options).then((request) => request(this.axios, this.basePath));
}
}