@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.
336 lines (319 loc) • 16.6 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
var _DomainData = _interopRequireDefault(require("../model/DomainData"));
var _DomainDetail = _interopRequireDefault(require("../model/DomainDetail"));
var _DomainPayload = _interopRequireDefault(require("../model/DomainPayload"));
var _DomainUpdatePayload = _interopRequireDefault(require("../model/DomainUpdatePayload"));
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.
*
*/
/**
* Domains service.
* @module api/DomainsApi
* @version 4.0.26
*/
var DomainsApi = exports["default"] = /*#__PURE__*/function () {
/**
* Constructs a new DomainsApi.
* @alias module:api/DomainsApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function DomainsApi(apiClient) {
_classCallCheck(this, DomainsApi);
this.apiClient = apiClient || _ApiClient["default"].instance;
}
/**
* Callback function to receive the result of the domainsByDomainDelete operation.
* @callback module:api/DomainsApi~domainsByDomainDeleteCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**
* Delete Domain
* Deletes configured domain from Account. Required Access Level: ModifySettings
* @param {String} domain Name of the given domain
* @param {module:api/DomainsApi~domainsByDomainDeleteCallback} callback The callback function, accepting three arguments: error, data, response
*/
return _createClass(DomainsApi, [{
key: "domainsByDomainDelete",
value: function domainsByDomainDelete(domain, callback) {
var postBody = null;
// verify the required parameter 'domain' is set
if (domain === undefined || domain === null) {
throw new Error("Missing the required parameter 'domain' when calling domainsByDomainDelete");
}
var pathParams = {
'domain': domain
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['apikey'];
var contentTypes = [];
var accepts = [];
var returnType = null;
return this.apiClient.callApi('/domains/{domain}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the domainsByDomainGet operation.
* @callback module:api/DomainsApi~domainsByDomainGetCallback
* @param {String} error Error message, if any.
* @param {module:model/DomainData} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Load Domain
* Retrieve a domain configured for this Account. Required Access Level: ViewSettings
* @param {String} domain Name of the given domain
* @param {module:api/DomainsApi~domainsByDomainGetCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DomainData}
*/
}, {
key: "domainsByDomainGet",
value: function domainsByDomainGet(domain, callback) {
var postBody = null;
// verify the required parameter 'domain' is set
if (domain === undefined || domain === null) {
throw new Error("Missing the required parameter 'domain' when calling domainsByDomainGet");
}
var pathParams = {
'domain': domain
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['apikey'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = _DomainData["default"];
return this.apiClient.callApi('/domains/{domain}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the domainsByDomainPut operation.
* @callback module:api/DomainsApi~domainsByDomainPutCallback
* @param {String} error Error message, if any.
* @param {module:model/DomainDetail} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Update Domain
* Updates the specified domain. Required Access Level: ModifySettings
* @param {String} domain Name of the given domain
* @param {module:model/DomainUpdatePayload} domainUpdatePayload Updated Domain resource
* @param {module:api/DomainsApi~domainsByDomainPutCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DomainDetail}
*/
}, {
key: "domainsByDomainPut",
value: function domainsByDomainPut(domain, domainUpdatePayload, callback) {
var postBody = domainUpdatePayload;
// verify the required parameter 'domain' is set
if (domain === undefined || domain === null) {
throw new Error("Missing the required parameter 'domain' when calling domainsByDomainPut");
}
// verify the required parameter 'domainUpdatePayload' is set
if (domainUpdatePayload === undefined || domainUpdatePayload === null) {
throw new Error("Missing the required parameter 'domainUpdatePayload' when calling domainsByDomainPut");
}
var pathParams = {
'domain': domain
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['apikey'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = _DomainDetail["default"];
return this.apiClient.callApi('/domains/{domain}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the domainsByDomainRestrictedGet operation.
* @callback module:api/DomainsApi~domainsByDomainRestrictedGetCallback
* @param {String} error Error message, if any.
* @param {Boolean} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Check for domain restriction
* Checking if domain is from free provider, or restricted. Required Access Level: ViewSettings
* @param {String} domain Name of the given domain
* @param {module:api/DomainsApi~domainsByDomainRestrictedGetCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Boolean}
*/
}, {
key: "domainsByDomainRestrictedGet",
value: function domainsByDomainRestrictedGet(domain, callback) {
var postBody = null;
// verify the required parameter 'domain' is set
if (domain === undefined || domain === null) {
throw new Error("Missing the required parameter 'domain' when calling domainsByDomainRestrictedGet");
}
var pathParams = {
'domain': domain
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['apikey'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = 'Boolean';
return this.apiClient.callApi('/domains/{domain}/restricted', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the domainsByDomainVerificationPut operation.
* @callback module:api/DomainsApi~domainsByDomainVerificationPutCallback
* @param {String} error Error message, if any.
* @param {module:model/DomainData} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Verify Domain
* Verifies that required DNS records exist for specified domain. Required Access Level: ModifySettings
* @param {String} domain Name of the given domain
* @param {String} body Tracking type used in the Tracking verification
* @param {module:api/DomainsApi~domainsByDomainVerificationPutCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DomainData}
*/
}, {
key: "domainsByDomainVerificationPut",
value: function domainsByDomainVerificationPut(domain, body, callback) {
var postBody = body;
// verify the required parameter 'domain' is set
if (domain === undefined || domain === null) {
throw new Error("Missing the required parameter 'domain' when calling domainsByDomainVerificationPut");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling domainsByDomainVerificationPut");
}
var pathParams = {
'domain': domain
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['apikey'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = _DomainData["default"];
return this.apiClient.callApi('/domains/{domain}/verification', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the domainsByEmailDefaultPatch operation.
* @callback module:api/DomainsApi~domainsByEmailDefaultPatchCallback
* @param {String} error Error message, if any.
* @param {module:model/DomainDetail} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Set Default
* Sets a verified email address as default sender. Required Access Level: ModifySettings
* @param {String} email Default email sender, example: mail@yourdomain.com
* @param {module:api/DomainsApi~domainsByEmailDefaultPatchCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DomainDetail}
*/
}, {
key: "domainsByEmailDefaultPatch",
value: function domainsByEmailDefaultPatch(email, callback) {
var postBody = null;
// verify the required parameter 'email' is set
if (email === undefined || email === null) {
throw new Error("Missing the required parameter 'email' when calling domainsByEmailDefaultPatch");
}
var pathParams = {
'email': email
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['apikey'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = _DomainDetail["default"];
return this.apiClient.callApi('/domains/{email}/default', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the domainsGet operation.
* @callback module:api/DomainsApi~domainsGetCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/DomainDetail>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Load Domains
* Returns a list of all domains configured for this Account. Required Access Level: ViewSettings
* @param {module:api/DomainsApi~domainsGetCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/DomainDetail>}
*/
}, {
key: "domainsGet",
value: function domainsGet(callback) {
var postBody = null;
var pathParams = {};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['apikey'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = [_DomainDetail["default"]];
return this.apiClient.callApi('/domains', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the domainsPost operation.
* @callback module:api/DomainsApi~domainsPostCallback
* @param {String} error Error message, if any.
* @param {module:model/DomainDetail} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Add Domain
* Add new domain to Account. Required Access Level: ModifySettings
* @param {module:model/DomainPayload} domainPayload Domain to add
* @param {module:api/DomainsApi~domainsPostCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DomainDetail}
*/
}, {
key: "domainsPost",
value: function domainsPost(domainPayload, callback) {
var postBody = domainPayload;
// verify the required parameter 'domainPayload' is set
if (domainPayload === undefined || domainPayload === null) {
throw new Error("Missing the required parameter 'domainPayload' when calling domainsPost");
}
var pathParams = {};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['apikey'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = _DomainDetail["default"];
return this.apiClient.callApi('/domains', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
}]);
}();