UNPKG

@elasticemail/elasticemail-client-ts-axios

Version:

Official ElasticEmail SDK. This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach.

508 lines (456 loc) 24.9 kB
/* 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 <a target=\"_blank\" href=\"https://app.elasticemail.com/marketing/settings/new/manage-api\">here</a>). 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 <a target=\"_blank\" href=\"https://github.com/ElasticEmail?tab=repositories&q=%22rest+api%22+in%3Areadme\">here</a> * * 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, AxiosRequestConfig } 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, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { ChannelLogStatusSummary } from '../ee-api-models'; // @ts-ignore import { LogStatusSummary } from '../ee-api-models'; /** * StatisticsApi - axios parameter creator * @export */ export const StatisticsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Retrieve stats of an existing campaign. Required Access Level: ViewChannels * @summary Load Campaign Stats * @param {string} name The name of the campaign to get. * @param {*} [options] Override http request option. * @throws {RequiredError} */ statisticsCampaignsByNameGet: async (name: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'name' is not null or undefined assertParamExists('statisticsCampaignsByNameGet', 'name', name) const localVarPath = `/statistics/campaigns/{name}` .replace(`{${"name"}}`, encodeURIComponent(String(name))); // 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, }; }, /** * Returns a list of your Campaigns\' stats. Required Access Level: ViewChannels * @summary Load Campaigns Stats * @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} */ statisticsCampaignsGet: async (limit?: number, offset?: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { const localVarPath = `/statistics/campaigns`; // 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, }; }, /** * Retrieve an existing channel stats. Required Access Level: ViewChannels * @summary Load Channel Stats * @param {string} name The name of the channel to get. * @param {*} [options] Override http request option. * @throws {RequiredError} */ statisticsChannelsByNameGet: async (name: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'name' is not null or undefined assertParamExists('statisticsChannelsByNameGet', 'name', name) const localVarPath = `/statistics/channels/{name}` .replace(`{${"name"}}`, encodeURIComponent(String(name))); // 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, }; }, /** * Returns a list of your Channels\' stats. Required Access Level: ViewChannels * @summary Load Channels Stats * @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} */ statisticsChannelsGet: async (limit?: number, offset?: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { const localVarPath = `/statistics/channels`; // 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, }; }, /** * Returns basic statistics. Required Access Level: ViewReports * @summary Load Statistics * @param {string} from Starting date for search in YYYY-MM-DDThh:mm:ss format. * @param {string} [to] Ending date for search in YYYY-MM-DDThh:mm:ss format. * @param {*} [options] Override http request option. * @throws {RequiredError} */ statisticsGet: async (from: string, to?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'from' is not null or undefined assertParamExists('statisticsGet', 'from', from) const localVarPath = `/statistics`; // 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 (from !== undefined) { localVarQueryParameter['from'] = (from as any instanceof Date) ? (from as any).toISOString() : from; } if (to !== undefined) { localVarQueryParameter['to'] = (to as any instanceof Date) ? (to as any).toISOString() : to; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * StatisticsApi - functional programming interface * @export */ export const StatisticsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = StatisticsApiAxiosParamCreator(configuration) return { /** * Retrieve stats of an existing campaign. Required Access Level: ViewChannels * @summary Load Campaign Stats * @param {string} name The name of the campaign to get. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async statisticsCampaignsByNameGet(name: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ChannelLogStatusSummary>> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsCampaignsByNameGet(name, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a list of your Campaigns\' stats. Required Access Level: ViewChannels * @summary Load Campaigns Stats * @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 statisticsCampaignsGet(limit?: number, offset?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ChannelLogStatusSummary>>> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsCampaignsGet(limit, offset, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Retrieve an existing channel stats. Required Access Level: ViewChannels * @summary Load Channel Stats * @param {string} name The name of the channel to get. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async statisticsChannelsByNameGet(name: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ChannelLogStatusSummary>> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsChannelsByNameGet(name, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a list of your Channels\' stats. Required Access Level: ViewChannels * @summary Load Channels Stats * @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 statisticsChannelsGet(limit?: number, offset?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ChannelLogStatusSummary>>> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsChannelsGet(limit, offset, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns basic statistics. Required Access Level: ViewReports * @summary Load Statistics * @param {string} from Starting date for search in YYYY-MM-DDThh:mm:ss format. * @param {string} [to] Ending date for search in YYYY-MM-DDThh:mm:ss format. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async statisticsGet(from: string, to?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<LogStatusSummary>> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsGet(from, to, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * StatisticsApi - factory interface * @export */ export const StatisticsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = StatisticsApiFp(configuration) return { /** * Retrieve stats of an existing campaign. Required Access Level: ViewChannels * @summary Load Campaign Stats * @param {string} name The name of the campaign to get. * @param {*} [options] Override http request option. * @throws {RequiredError} */ statisticsCampaignsByNameGet(name: string, options?: any): AxiosPromise<ChannelLogStatusSummary> { return localVarFp.statisticsCampaignsByNameGet(name, options).then((request) => request(axios, basePath)); }, /** * Returns a list of your Campaigns\' stats. Required Access Level: ViewChannels * @summary Load Campaigns Stats * @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} */ statisticsCampaignsGet(limit?: number, offset?: number, options?: any): AxiosPromise<Array<ChannelLogStatusSummary>> { return localVarFp.statisticsCampaignsGet(limit, offset, options).then((request) => request(axios, basePath)); }, /** * Retrieve an existing channel stats. Required Access Level: ViewChannels * @summary Load Channel Stats * @param {string} name The name of the channel to get. * @param {*} [options] Override http request option. * @throws {RequiredError} */ statisticsChannelsByNameGet(name: string, options?: any): AxiosPromise<ChannelLogStatusSummary> { return localVarFp.statisticsChannelsByNameGet(name, options).then((request) => request(axios, basePath)); }, /** * Returns a list of your Channels\' stats. Required Access Level: ViewChannels * @summary Load Channels Stats * @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} */ statisticsChannelsGet(limit?: number, offset?: number, options?: any): AxiosPromise<Array<ChannelLogStatusSummary>> { return localVarFp.statisticsChannelsGet(limit, offset, options).then((request) => request(axios, basePath)); }, /** * Returns basic statistics. Required Access Level: ViewReports * @summary Load Statistics * @param {string} from Starting date for search in YYYY-MM-DDThh:mm:ss format. * @param {string} [to] Ending date for search in YYYY-MM-DDThh:mm:ss format. * @param {*} [options] Override http request option. * @throws {RequiredError} */ statisticsGet(from: string, to?: string, options?: any): AxiosPromise<LogStatusSummary> { return localVarFp.statisticsGet(from, to, options).then((request) => request(axios, basePath)); }, }; }; /** * StatisticsApi - interface * @export * @interface StatisticsApi */ export interface StatisticsApiInterface { /** * Retrieve stats of an existing campaign. Required Access Level: ViewChannels * @summary Load Campaign Stats * @param {string} name The name of the campaign to get. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StatisticsApiInterface */ statisticsCampaignsByNameGet(name: string, options?: AxiosRequestConfig): AxiosPromise<ChannelLogStatusSummary>; /** * Returns a list of your Campaigns\' stats. Required Access Level: ViewChannels * @summary Load Campaigns Stats * @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 StatisticsApiInterface */ statisticsCampaignsGet(limit?: number, offset?: number, options?: AxiosRequestConfig): AxiosPromise<Array<ChannelLogStatusSummary>>; /** * Retrieve an existing channel stats. Required Access Level: ViewChannels * @summary Load Channel Stats * @param {string} name The name of the channel to get. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StatisticsApiInterface */ statisticsChannelsByNameGet(name: string, options?: AxiosRequestConfig): AxiosPromise<ChannelLogStatusSummary>; /** * Returns a list of your Channels\' stats. Required Access Level: ViewChannels * @summary Load Channels Stats * @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 StatisticsApiInterface */ statisticsChannelsGet(limit?: number, offset?: number, options?: AxiosRequestConfig): AxiosPromise<Array<ChannelLogStatusSummary>>; /** * Returns basic statistics. Required Access Level: ViewReports * @summary Load Statistics * @param {string} from Starting date for search in YYYY-MM-DDThh:mm:ss format. * @param {string} [to] Ending date for search in YYYY-MM-DDThh:mm:ss format. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StatisticsApiInterface */ statisticsGet(from: string, to?: string, options?: AxiosRequestConfig): AxiosPromise<LogStatusSummary>; } /** * StatisticsApi - object-oriented interface * @export * @class StatisticsApi * @extends {BaseAPI} */ export class StatisticsApi extends BaseAPI implements StatisticsApiInterface { /** * Retrieve stats of an existing campaign. Required Access Level: ViewChannels * @summary Load Campaign Stats * @param {string} name The name of the campaign to get. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StatisticsApi */ public statisticsCampaignsByNameGet(name: string, options?: AxiosRequestConfig) { return StatisticsApiFp(this.configuration).statisticsCampaignsByNameGet(name, options).then((request) => request(this.axios, this.basePath)); } /** * Returns a list of your Campaigns\' stats. Required Access Level: ViewChannels * @summary Load Campaigns Stats * @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 StatisticsApi */ public statisticsCampaignsGet(limit?: number, offset?: number, options?: AxiosRequestConfig) { return StatisticsApiFp(this.configuration).statisticsCampaignsGet(limit, offset, options).then((request) => request(this.axios, this.basePath)); } /** * Retrieve an existing channel stats. Required Access Level: ViewChannels * @summary Load Channel Stats * @param {string} name The name of the channel to get. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StatisticsApi */ public statisticsChannelsByNameGet(name: string, options?: AxiosRequestConfig) { return StatisticsApiFp(this.configuration).statisticsChannelsByNameGet(name, options).then((request) => request(this.axios, this.basePath)); } /** * Returns a list of your Channels\' stats. Required Access Level: ViewChannels * @summary Load Channels Stats * @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 StatisticsApi */ public statisticsChannelsGet(limit?: number, offset?: number, options?: AxiosRequestConfig) { return StatisticsApiFp(this.configuration).statisticsChannelsGet(limit, offset, options).then((request) => request(this.axios, this.basePath)); } /** * Returns basic statistics. Required Access Level: ViewReports * @summary Load Statistics * @param {string} from Starting date for search in YYYY-MM-DDThh:mm:ss format. * @param {string} [to] Ending date for search in YYYY-MM-DDThh:mm:ss format. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StatisticsApi */ public statisticsGet(from: string, to?: string, options?: AxiosRequestConfig) { return StatisticsApiFp(this.configuration).statisticsGet(from, to, options).then((request) => request(this.axios, this.basePath)); } }