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.

424 lines (423 loc) 23 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.TemplatesApi = exports.TemplatesApiFactory = exports.TemplatesApiFp = exports.TemplatesApiAxiosParamCreator = 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"); /** * TemplatesApi - axios parameter creator * @export */ exports.TemplatesApiAxiosParamCreator = function (configuration) { return { /** * Delete template with the specified name. Required Access Level: ModifyTemplates * @summary Delete Template * @param {string} name Name of template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNameDelete: (name, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'name' is not null or undefined common_1.assertParamExists('templatesByNameDelete', 'name', name); const localVarPath = `/templates/{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, }; }), /** * Load detailed information of the specified template. Required Access Level: ViewTemplates * @summary Load Template * @param {string} name Name of template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNameGet: (name, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'name' is not null or undefined common_1.assertParamExists('templatesByNameGet', 'name', name); const localVarPath = `/templates/{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, }; }), /** * Update existing template, overwriting existing data. Required Access Level: ModifyTemplates * @summary Update Template * @param {string} name Name of template. * @param {TemplatePayload} templatePayload * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNamePut: (name, templatePayload, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'name' is not null or undefined common_1.assertParamExists('templatesByNamePut', 'name', name); // verify required parameter 'templatePayload' is not null or undefined common_1.assertParamExists('templatesByNamePut', 'templatePayload', templatePayload); const localVarPath = `/templates/{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(templatePayload, localVarRequestOptions, configuration); return { url: common_1.toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Returns a list of templates for the specified type. Required Access Level: ViewTemplates * @summary Load Templates * @param {Array<TemplateScope>} scopeType Return templates with specified scope only * @param {Array<TemplateType>} [templateTypes] Return templates with specified type only * @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} */ templatesGet: (scopeType, templateTypes, limit, offset, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'scopeType' is not null or undefined common_1.assertParamExists('templatesGet', 'scopeType', scopeType); const localVarPath = `/templates`; // 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 (scopeType) { localVarQueryParameter['scopeType'] = scopeType; } if (templateTypes) { localVarQueryParameter['templateTypes'] = templateTypes; } 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, }; }), /** * Add a new Template. Required Access Level: ModifyTemplates * @summary Add Template * @param {TemplatePayload} templatePayload * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesPost: (templatePayload, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'templatePayload' is not null or undefined common_1.assertParamExists('templatesPost', 'templatePayload', templatePayload); const localVarPath = `/templates`; // 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(templatePayload, localVarRequestOptions, configuration); return { url: common_1.toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; /** * TemplatesApi - functional programming interface * @export */ exports.TemplatesApiFp = function (configuration) { const localVarAxiosParamCreator = exports.TemplatesApiAxiosParamCreator(configuration); return { /** * Delete template with the specified name. Required Access Level: ModifyTemplates * @summary Delete Template * @param {string} name Name of template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNameDelete(name, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.templatesByNameDelete(name, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Load detailed information of the specified template. Required Access Level: ViewTemplates * @summary Load Template * @param {string} name Name of template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNameGet(name, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.templatesByNameGet(name, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Update existing template, overwriting existing data. Required Access Level: ModifyTemplates * @summary Update Template * @param {string} name Name of template. * @param {TemplatePayload} templatePayload * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNamePut(name, templatePayload, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.templatesByNamePut(name, templatePayload, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Returns a list of templates for the specified type. Required Access Level: ViewTemplates * @summary Load Templates * @param {Array<TemplateScope>} scopeType Return templates with specified scope only * @param {Array<TemplateType>} [templateTypes] Return templates with specified type only * @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} */ templatesGet(scopeType, templateTypes, limit, offset, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.templatesGet(scopeType, templateTypes, limit, offset, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Add a new Template. Required Access Level: ModifyTemplates * @summary Add Template * @param {TemplatePayload} templatePayload * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesPost(templatePayload, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.templatesPost(templatePayload, options); return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, }; }; /** * TemplatesApi - factory interface * @export */ exports.TemplatesApiFactory = function (configuration, basePath, axios) { const localVarFp = exports.TemplatesApiFp(configuration); return { /** * Delete template with the specified name. Required Access Level: ModifyTemplates * @summary Delete Template * @param {string} name Name of template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNameDelete(name, options) { return localVarFp.templatesByNameDelete(name, options).then((request) => request(axios, basePath)); }, /** * Load detailed information of the specified template. Required Access Level: ViewTemplates * @summary Load Template * @param {string} name Name of template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNameGet(name, options) { return localVarFp.templatesByNameGet(name, options).then((request) => request(axios, basePath)); }, /** * Update existing template, overwriting existing data. Required Access Level: ModifyTemplates * @summary Update Template * @param {string} name Name of template. * @param {TemplatePayload} templatePayload * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesByNamePut(name, templatePayload, options) { return localVarFp.templatesByNamePut(name, templatePayload, options).then((request) => request(axios, basePath)); }, /** * Returns a list of templates for the specified type. Required Access Level: ViewTemplates * @summary Load Templates * @param {Array<TemplateScope>} scopeType Return templates with specified scope only * @param {Array<TemplateType>} [templateTypes] Return templates with specified type only * @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} */ templatesGet(scopeType, templateTypes, limit, offset, options) { return localVarFp.templatesGet(scopeType, templateTypes, limit, offset, options).then((request) => request(axios, basePath)); }, /** * Add a new Template. Required Access Level: ModifyTemplates * @summary Add Template * @param {TemplatePayload} templatePayload * @param {*} [options] Override http request option. * @throws {RequiredError} */ templatesPost(templatePayload, options) { return localVarFp.templatesPost(templatePayload, options).then((request) => request(axios, basePath)); }, }; }; /** * TemplatesApi - object-oriented interface * @export * @class TemplatesApi * @extends {BaseAPI} */ class TemplatesApi extends base_1.BaseAPI { /** * Delete template with the specified name. Required Access Level: ModifyTemplates * @summary Delete Template * @param {string} name Name of template. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TemplatesApi */ templatesByNameDelete(name, options) { return exports.TemplatesApiFp(this.configuration).templatesByNameDelete(name, options).then((request) => request(this.axios, this.basePath)); } /** * Load detailed information of the specified template. Required Access Level: ViewTemplates * @summary Load Template * @param {string} name Name of template. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TemplatesApi */ templatesByNameGet(name, options) { return exports.TemplatesApiFp(this.configuration).templatesByNameGet(name, options).then((request) => request(this.axios, this.basePath)); } /** * Update existing template, overwriting existing data. Required Access Level: ModifyTemplates * @summary Update Template * @param {string} name Name of template. * @param {TemplatePayload} templatePayload * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TemplatesApi */ templatesByNamePut(name, templatePayload, options) { return exports.TemplatesApiFp(this.configuration).templatesByNamePut(name, templatePayload, options).then((request) => request(this.axios, this.basePath)); } /** * Returns a list of templates for the specified type. Required Access Level: ViewTemplates * @summary Load Templates * @param {Array<TemplateScope>} scopeType Return templates with specified scope only * @param {Array<TemplateType>} [templateTypes] Return templates with specified type only * @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 TemplatesApi */ templatesGet(scopeType, templateTypes, limit, offset, options) { return exports.TemplatesApiFp(this.configuration).templatesGet(scopeType, templateTypes, limit, offset, options).then((request) => request(this.axios, this.basePath)); } /** * Add a new Template. Required Access Level: ModifyTemplates * @summary Add Template * @param {TemplatePayload} templatePayload * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TemplatesApi */ templatesPost(templatePayload, options) { return exports.TemplatesApiFp(this.configuration).templatesPost(templatePayload, options).then((request) => request(this.axios, this.basePath)); } } exports.TemplatesApi = TemplatesApi;