UNPKG

@elasticemail/elasticemail-client

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.

230 lines (219 loc) 11.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _ChannelLogStatusSummary = _interopRequireDefault(require("../model/ChannelLogStatusSummary")); var _LogStatusSummary = _interopRequireDefault(require("../model/LogStatusSummary")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * 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. * */ /** * Statistics service. * @module api/StatisticsApi * @version 4.0.26 */ var StatisticsApi = exports["default"] = /*#__PURE__*/function () { /** * Constructs a new StatisticsApi. * @alias module:api/StatisticsApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function StatisticsApi(apiClient) { _classCallCheck(this, StatisticsApi); this.apiClient = apiClient || _ApiClient["default"].instance; } /** * Callback function to receive the result of the statisticsCampaignsByNameGet operation. * @callback module:api/StatisticsApi~statisticsCampaignsByNameGetCallback * @param {String} error Error message, if any. * @param {module:model/ChannelLogStatusSummary} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Load Campaign Stats * Retrieve stats of an existing campaign. Required Access Level: ViewChannels * @param {String} name The name of the campaign to get. * @param {module:api/StatisticsApi~statisticsCampaignsByNameGetCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ChannelLogStatusSummary} */ return _createClass(StatisticsApi, [{ key: "statisticsCampaignsByNameGet", value: function statisticsCampaignsByNameGet(name, callback) { var postBody = null; // verify the required parameter 'name' is set if (name === undefined || name === null) { throw new Error("Missing the required parameter 'name' when calling statisticsCampaignsByNameGet"); } var pathParams = { 'name': name }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = ['apikey']; var contentTypes = []; var accepts = ['application/json']; var returnType = _ChannelLogStatusSummary["default"]; return this.apiClient.callApi('/statistics/campaigns/{name}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the statisticsCampaignsGet operation. * @callback module:api/StatisticsApi~statisticsCampaignsGetCallback * @param {String} error Error message, if any. * @param {Array.<module:model/ChannelLogStatusSummary>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Load Campaigns Stats * Returns a list of your Campaigns' stats. Required Access Level: ViewChannels * @param {Object} opts Optional parameters * @param {Number} [limit] Maximum number of returned items. * @param {Number} [offset] How many items should be returned ahead. * @param {module:api/StatisticsApi~statisticsCampaignsGetCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/ChannelLogStatusSummary>} */ }, { key: "statisticsCampaignsGet", value: function statisticsCampaignsGet(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'limit': opts['limit'], 'offset': opts['offset'] }; var headerParams = {}; var formParams = {}; var authNames = ['apikey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_ChannelLogStatusSummary["default"]]; return this.apiClient.callApi('/statistics/campaigns', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the statisticsChannelsByNameGet operation. * @callback module:api/StatisticsApi~statisticsChannelsByNameGetCallback * @param {String} error Error message, if any. * @param {module:model/ChannelLogStatusSummary} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Load Channel Stats * Retrieve an existing channel stats. Required Access Level: ViewChannels * @param {String} name The name of the channel to get. * @param {module:api/StatisticsApi~statisticsChannelsByNameGetCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ChannelLogStatusSummary} */ }, { key: "statisticsChannelsByNameGet", value: function statisticsChannelsByNameGet(name, callback) { var postBody = null; // verify the required parameter 'name' is set if (name === undefined || name === null) { throw new Error("Missing the required parameter 'name' when calling statisticsChannelsByNameGet"); } var pathParams = { 'name': name }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = ['apikey']; var contentTypes = []; var accepts = ['application/json']; var returnType = _ChannelLogStatusSummary["default"]; return this.apiClient.callApi('/statistics/channels/{name}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the statisticsChannelsGet operation. * @callback module:api/StatisticsApi~statisticsChannelsGetCallback * @param {String} error Error message, if any. * @param {Array.<module:model/ChannelLogStatusSummary>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Load Channels Stats * Returns a list of your Channels' stats. Required Access Level: ViewChannels * @param {Object} opts Optional parameters * @param {Number} [limit] Maximum number of returned items. * @param {Number} [offset] How many items should be returned ahead. * @param {module:api/StatisticsApi~statisticsChannelsGetCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/ChannelLogStatusSummary>} */ }, { key: "statisticsChannelsGet", value: function statisticsChannelsGet(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'limit': opts['limit'], 'offset': opts['offset'] }; var headerParams = {}; var formParams = {}; var authNames = ['apikey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_ChannelLogStatusSummary["default"]]; return this.apiClient.callApi('/statistics/channels', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the statisticsGet operation. * @callback module:api/StatisticsApi~statisticsGetCallback * @param {String} error Error message, if any. * @param {module:model/LogStatusSummary} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Load Statistics * Returns basic statistics. Required Access Level: ViewReports * @param {Date} from Starting date for search in YYYY-MM-DDThh:mm:ss format. * @param {Object} opts Optional parameters * @param {Date} [to] Ending date for search in YYYY-MM-DDThh:mm:ss format. * @param {module:api/StatisticsApi~statisticsGetCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/LogStatusSummary} */ }, { key: "statisticsGet", value: function statisticsGet(from, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'from' is set if (from === undefined || from === null) { throw new Error("Missing the required parameter 'from' when calling statisticsGet"); } var pathParams = {}; var queryParams = { 'from': from, 'to': opts['to'] }; var headerParams = {}; var formParams = {}; var authNames = ['apikey']; var contentTypes = []; var accepts = ['application/json']; var returnType = _LogStatusSummary["default"]; return this.apiClient.callApi('/statistics', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } }]); }();