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.

415 lines (414 loc) 22.9 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.CampaignsApi = exports.CampaignsApiFactory = exports.CampaignsApiFp = exports.CampaignsApiAxiosParamCreator = 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"); /** * CampaignsApi - axios parameter creator * @export */ exports.CampaignsApiAxiosParamCreator = function (configuration) { return { /** * Delete the specific campaign. This does not cancel in progress email, see Cancel In Progress. Required Access Level: ModifyCampaigns * @summary Delete Campaign * @param {string} name Name of Campaign to delete * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNameDelete: (name, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'name' is not null or undefined common_1.assertParamExists('campaignsByNameDelete', 'name', name); const localVarPath = `/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: 'DELETE' }, 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 the specified campaign details. Required Access Level: ViewCampaigns * @summary Load Campaign * @param {string} name Name of Campaign to get * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNameGet: (name, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'name' is not null or undefined common_1.assertParamExists('campaignsByNameGet', 'name', name); const localVarPath = `/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, }; }), /** * Updates a previously added campaign. Only Active and Paused campaigns can be updated. Required Access Level: ModifyCampaigns * @summary Update Campaign * @param {string} name Name of Campaign to update * @param {Campaign} campaign JSON representation of a campaign * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNamePut: (name, campaign, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'name' is not null or undefined common_1.assertParamExists('campaignsByNamePut', 'name', name); // verify required parameter 'campaign' is not null or undefined common_1.assertParamExists('campaignsByNamePut', 'campaign', campaign); const localVarPath = `/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: 'PUT' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication apikey required yield common_1.setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = common_1.serializeDataIfNeeded(campaign, localVarRequestOptions, configuration); return { url: common_1.toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Returns a list all of your campaigns. Limited to 1000 results. Required Access Level: ViewCampaigns * @summary Load Campaigns * @param {string} [search] Text fragment used for searching in Campaign name (using the \&#39;contains\&#39; rule) * @param {number} [offset] How many items should be returned ahead. * @param {number} [limit] Maximum number of returned items. * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsGet: (search, offset, limit, options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/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 (search !== undefined) { localVarQueryParameter['search'] = search; } if (offset !== undefined) { localVarQueryParameter['offset'] = offset; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } 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, }; }), /** * Add a campaign for processing. Required Access Level: ModifyCampaigns * @summary Add Campaign * @param {Campaign} campaign JSON representation of a campaign * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsPost: (campaign, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'campaign' is not null or undefined common_1.assertParamExists('campaignsPost', 'campaign', campaign); const localVarPath = `/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: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication apikey required yield common_1.setApiKeyToObject(localVarHeaderParameter, "X-ElasticEmail-ApiKey", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = common_1.serializeDataIfNeeded(campaign, localVarRequestOptions, configuration); return { url: common_1.toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; /** * CampaignsApi - functional programming interface * @export */ exports.CampaignsApiFp = function (configuration) { const localVarAxiosParamCreator = exports.CampaignsApiAxiosParamCreator(configuration); return { /** * Delete the specific campaign. This does not cancel in progress email, see Cancel In Progress. Required Access Level: ModifyCampaigns * @summary Delete Campaign * @param {string} name Name of Campaign to delete * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNameDelete(name, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.campaignsByNameDelete(name, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Returns the specified campaign details. Required Access Level: ViewCampaigns * @summary Load Campaign * @param {string} name Name of Campaign to get * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNameGet(name, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.campaignsByNameGet(name, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Updates a previously added campaign. Only Active and Paused campaigns can be updated. Required Access Level: ModifyCampaigns * @summary Update Campaign * @param {string} name Name of Campaign to update * @param {Campaign} campaign JSON representation of a campaign * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNamePut(name, campaign, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.campaignsByNamePut(name, campaign, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Returns a list all of your campaigns. Limited to 1000 results. Required Access Level: ViewCampaigns * @summary Load Campaigns * @param {string} [search] Text fragment used for searching in Campaign name (using the \&#39;contains\&#39; rule) * @param {number} [offset] How many items should be returned ahead. * @param {number} [limit] Maximum number of returned items. * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsGet(search, offset, limit, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.campaignsGet(search, offset, limit, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Add a campaign for processing. Required Access Level: ModifyCampaigns * @summary Add Campaign * @param {Campaign} campaign JSON representation of a campaign * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsPost(campaign, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.campaignsPost(campaign, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, }; }; /** * CampaignsApi - factory interface * @export */ exports.CampaignsApiFactory = function (configuration, basePath, axios) { const localVarFp = exports.CampaignsApiFp(configuration); return { /** * Delete the specific campaign. This does not cancel in progress email, see Cancel In Progress. Required Access Level: ModifyCampaigns * @summary Delete Campaign * @param {string} name Name of Campaign to delete * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNameDelete(name, options) { return localVarFp.campaignsByNameDelete(name, options).then((request) => request(axios, basePath)); }, /** * Returns the specified campaign details. Required Access Level: ViewCampaigns * @summary Load Campaign * @param {string} name Name of Campaign to get * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNameGet(name, options) { return localVarFp.campaignsByNameGet(name, options).then((request) => request(axios, basePath)); }, /** * Updates a previously added campaign. Only Active and Paused campaigns can be updated. Required Access Level: ModifyCampaigns * @summary Update Campaign * @param {string} name Name of Campaign to update * @param {Campaign} campaign JSON representation of a campaign * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsByNamePut(name, campaign, options) { return localVarFp.campaignsByNamePut(name, campaign, options).then((request) => request(axios, basePath)); }, /** * Returns a list all of your campaigns. Limited to 1000 results. Required Access Level: ViewCampaigns * @summary Load Campaigns * @param {string} [search] Text fragment used for searching in Campaign name (using the \&#39;contains\&#39; rule) * @param {number} [offset] How many items should be returned ahead. * @param {number} [limit] Maximum number of returned items. * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsGet(search, offset, limit, options) { return localVarFp.campaignsGet(search, offset, limit, options).then((request) => request(axios, basePath)); }, /** * Add a campaign for processing. Required Access Level: ModifyCampaigns * @summary Add Campaign * @param {Campaign} campaign JSON representation of a campaign * @param {*} [options] Override http request option. * @throws {RequiredError} */ campaignsPost(campaign, options) { return localVarFp.campaignsPost(campaign, options).then((request) => request(axios, basePath)); }, }; }; /** * CampaignsApi - object-oriented interface * @export * @class CampaignsApi * @extends {BaseAPI} */ class CampaignsApi extends base_1.BaseAPI { /** * Delete the specific campaign. This does not cancel in progress email, see Cancel In Progress. Required Access Level: ModifyCampaigns * @summary Delete Campaign * @param {string} name Name of Campaign to delete * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CampaignsApi */ campaignsByNameDelete(name, options) { return exports.CampaignsApiFp(this.configuration).campaignsByNameDelete(name, options).then((request) => request(this.axios, this.basePath)); } /** * Returns the specified campaign details. Required Access Level: ViewCampaigns * @summary Load Campaign * @param {string} name Name of Campaign to get * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CampaignsApi */ campaignsByNameGet(name, options) { return exports.CampaignsApiFp(this.configuration).campaignsByNameGet(name, options).then((request) => request(this.axios, this.basePath)); } /** * Updates a previously added campaign. Only Active and Paused campaigns can be updated. Required Access Level: ModifyCampaigns * @summary Update Campaign * @param {string} name Name of Campaign to update * @param {Campaign} campaign JSON representation of a campaign * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CampaignsApi */ campaignsByNamePut(name, campaign, options) { return exports.CampaignsApiFp(this.configuration).campaignsByNamePut(name, campaign, options).then((request) => request(this.axios, this.basePath)); } /** * Returns a list all of your campaigns. Limited to 1000 results. Required Access Level: ViewCampaigns * @summary Load Campaigns * @param {string} [search] Text fragment used for searching in Campaign name (using the \&#39;contains\&#39; rule) * @param {number} [offset] How many items should be returned ahead. * @param {number} [limit] Maximum number of returned items. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CampaignsApi */ campaignsGet(search, offset, limit, options) { return exports.CampaignsApiFp(this.configuration).campaignsGet(search, offset, limit, options).then((request) => request(this.axios, this.basePath)); } /** * Add a campaign for processing. Required Access Level: ModifyCampaigns * @summary Add Campaign * @param {Campaign} campaign JSON representation of a campaign * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CampaignsApi */ campaignsPost(campaign, options) { return exports.CampaignsApiFp(this.configuration).campaignsPost(campaign, options).then((request) => request(this.axios, this.basePath)); } } exports.CampaignsApi = CampaignsApi;