/* 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 { ChannelLogStatusSummary } from '../ee-api-models'; // @ts-ignore import type { 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: RawAxiosRequestConfig = {}): Promise => { // 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: RawAxiosRequestConfig = {}): Promise => { 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: RawAxiosRequestConfig = {}): Promise => { // 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: RawAxiosRequestConfig = {}): Promise => { 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 | null} [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 | null, options: RawAxiosRequestConfig = {}): Promise => { // 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?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsCampaignsByNameGet(name, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['StatisticsApi.statisticsCampaignsByNameGet']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || 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} */ async statisticsCampaignsGet(limit?: number, offset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsCampaignsGet(limit, offset, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['StatisticsApi.statisticsCampaignsGet']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || 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} */ async statisticsChannelsByNameGet(name: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsChannelsByNameGet(name, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['StatisticsApi.statisticsChannelsByNameGet']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || 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} */ async statisticsChannelsGet(limit?: number, offset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsChannelsGet(limit, offset, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['StatisticsApi.statisticsChannelsGet']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || 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 | null} [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 | null, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.statisticsGet(from, to, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['StatisticsApi.statisticsGet']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * 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?: RawAxiosRequestConfig): AxiosPromise { 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?: RawAxiosRequestConfig): AxiosPromise> { 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?: RawAxiosRequestConfig): AxiosPromise { 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?: RawAxiosRequestConfig): AxiosPromise> { 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 | null} [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 | null, options?: RawAxiosRequestConfig): AxiosPromise { 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?: RawAxiosRequestConfig): AxiosPromise; /** * 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?: RawAxiosRequestConfig): AxiosPromise>; /** * 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?: RawAxiosRequestConfig): AxiosPromise; /** * 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?: RawAxiosRequestConfig): AxiosPromise>; /** * 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 | null} [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 | null, options?: RawAxiosRequestConfig): AxiosPromise; } /** * 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?: RawAxiosRequestConfig) { 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?: RawAxiosRequestConfig) { 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?: RawAxiosRequestConfig) { 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?: RawAxiosRequestConfig) { 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 | null} [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 | null, options?: RawAxiosRequestConfig) { return StatisticsApiFp(this.configuration).statisticsGet(from, to, options).then((request) => request(this.axios, this.basePath)); } }