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.

419 lines (418 loc) 22.3 kB
"use strict"; /* 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. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.StatisticsApi = exports.StatisticsApiFactory = exports.StatisticsApiFp = exports.StatisticsApiAxiosParamCreator = void 0; const axios_1 = require("axios"); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("../common"); // @ts-ignore const base_1 = require("../base"); /** * StatisticsApi - axios parameter creator * @export */ exports.StatisticsApiAxiosParamCreator = function (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, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'name' is not null or undefined common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication apikey required yield common_1.setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration); common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: common_1.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: (limit, offset, options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/statistics/campaigns`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication apikey required yield common_1.setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration); if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (offset !== undefined) { localVarQueryParameter['offset'] = offset; } common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: common_1.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: (name, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'name' is not null or undefined common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication apikey required yield common_1.setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration); common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: common_1.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: (limit, offset, options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/statistics/channels`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication apikey required yield common_1.setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration); if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (offset !== undefined) { localVarQueryParameter['offset'] = offset; } common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: common_1.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: (from, to, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'from' is not null or undefined common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication apikey required yield common_1.setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration); if (from !== undefined) { localVarQueryParameter['from'] = (from instanceof Date) ? from.toISOString() : from; } if (to !== undefined) { localVarQueryParameter['to'] = (to instanceof Date) ? to.toISOString() : to; } common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: common_1.toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; /** * StatisticsApi - functional programming interface * @export */ exports.StatisticsApiFp = function (configuration) { const localVarAxiosParamCreator = exports.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} */ statisticsCampaignsByNameGet(name, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.statisticsCampaignsByNameGet(name, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.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} */ statisticsCampaignsGet(limit, offset, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.statisticsCampaignsGet(limit, offset, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.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} */ statisticsChannelsByNameGet(name, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.statisticsChannelsByNameGet(name, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.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} */ statisticsChannelsGet(limit, offset, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.statisticsChannelsGet(limit, offset, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.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} */ statisticsGet(from, to, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.statisticsGet(from, to, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, }; }; /** * StatisticsApi - factory interface * @export */ exports.StatisticsApiFactory = function (configuration, basePath, axios) { const localVarFp = exports.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, options) { 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, offset, options) { 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, options) { 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, offset, options) { 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, to, options) { return localVarFp.statisticsGet(from, to, options).then((request) => request(axios, basePath)); }, }; }; /** * StatisticsApi - object-oriented interface * @export * @class StatisticsApi * @extends {BaseAPI} */ class StatisticsApi extends base_1.BaseAPI { /** * 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 */ statisticsCampaignsByNameGet(name, options) { return exports.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 */ statisticsCampaignsGet(limit, offset, options) { return exports.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 */ statisticsChannelsByNameGet(name, options) { return exports.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 */ statisticsChannelsGet(limit, offset, options) { return exports.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 */ statisticsGet(from, to, options) { return exports.StatisticsApiFp(this.configuration).statisticsGet(from, to, options).then((request) => request(this.axios, this.basePath)); } } exports.StatisticsApi = StatisticsApi;