mailgun.js 12.1.1 → 12.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AMD/definitions.amd.js +1 -1
- package/AMD/mailgun.amd.js +2 -2
- package/CHANGELOG.md +23 -0
- package/CJS/definitions.cjs +1 -1
- package/CJS/mailgun.node.cjs +2 -2
- package/ESM/definitions.browser.js +1 -1
- package/ESM/definitions.node.js +1 -1
- package/ESM/mailgun.browser.js +2 -2
- package/ESM/mailgun.node.js +2 -2
- package/README.md +548 -96
- package/Types/Classes/Domains/domainsClient.d.ts +13 -2
- package/Types/Classes/Domains/domainsKeys.d.ts +19 -0
- package/Types/Classes/Messages.d.ts +19 -1
- package/Types/Classes/Subaccounts.d.ts +6 -1
- package/Types/Classes/common/Request.d.ts +3 -3
- package/Types/Interfaces/Domains/DomainKeys.d.ts +11 -0
- package/Types/Interfaces/Domains/index.d.ts +1 -0
- package/Types/Interfaces/Subaccounts/ISubaccountsClient.d.ts +4 -1
- package/Types/Types/Common/RequestOptions.d.ts +6 -3
- package/Types/Types/Domains/DomainKeys.d.ts +70 -0
- package/Types/Types/Domains/index.d.ts +1 -0
- package/Types/Types/Messages/Messages.d.ts +58 -0
- package/Types/Types/Subaccounts/Subaccounts.d.ts +52 -3
- package/Types/index.js +387 -34
- package/package.json +1 -1
- package/version.md +1 -1
package/Types/index.js
CHANGED
|
@@ -4532,17 +4532,128 @@ var SubaccountsClient = /** @class */ (function () {
|
|
|
4532
4532
|
function SubaccountsClient(request) {
|
|
4533
4533
|
this.request = request;
|
|
4534
4534
|
}
|
|
4535
|
+
SubaccountsClient.prototype.convertToDate = function (data) {
|
|
4536
|
+
var res = __assign(__assign({}, data), { created_at: new Date(data.created_at), updated_at: new Date(data.updated_at) });
|
|
4537
|
+
return res;
|
|
4538
|
+
};
|
|
4535
4539
|
SubaccountsClient.prototype.list = function (query) {
|
|
4536
|
-
return this
|
|
4537
|
-
|
|
4540
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4541
|
+
var res;
|
|
4542
|
+
return __generator(this, function (_a) {
|
|
4543
|
+
switch (_a.label) {
|
|
4544
|
+
case 0: return [4 /*yield*/, this.request.get('/v5/accounts/subaccounts', query)];
|
|
4545
|
+
case 1:
|
|
4546
|
+
res = _a.sent();
|
|
4547
|
+
return [2 /*return*/, {
|
|
4548
|
+
total: res.body.total,
|
|
4549
|
+
subaccounts: res.body.subaccounts.map(this.convertToDate)
|
|
4550
|
+
}];
|
|
4551
|
+
}
|
|
4552
|
+
});
|
|
4553
|
+
});
|
|
4538
4554
|
};
|
|
4539
4555
|
SubaccountsClient.prototype.get = function (id) {
|
|
4540
|
-
return this
|
|
4541
|
-
|
|
4556
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4557
|
+
var res;
|
|
4558
|
+
return __generator(this, function (_a) {
|
|
4559
|
+
switch (_a.label) {
|
|
4560
|
+
case 0: return [4 /*yield*/, this.request.get("/v5/accounts/subaccounts/".concat(id))];
|
|
4561
|
+
case 1:
|
|
4562
|
+
res = _a.sent();
|
|
4563
|
+
return [2 /*return*/, {
|
|
4564
|
+
subaccount: this.convertToDate(res.body.subaccount)
|
|
4565
|
+
}];
|
|
4566
|
+
}
|
|
4567
|
+
});
|
|
4568
|
+
});
|
|
4542
4569
|
};
|
|
4543
4570
|
SubaccountsClient.prototype.create = function (name) {
|
|
4544
|
-
return this
|
|
4545
|
-
|
|
4571
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4572
|
+
var res;
|
|
4573
|
+
return __generator(this, function (_a) {
|
|
4574
|
+
switch (_a.label) {
|
|
4575
|
+
case 0: return [4 /*yield*/, this.request.postWithFD('/v5/accounts/subaccounts', { name: name })];
|
|
4576
|
+
case 1:
|
|
4577
|
+
res = _a.sent();
|
|
4578
|
+
return [2 /*return*/, {
|
|
4579
|
+
subaccount: this.convertToDate(res.body.subaccount)
|
|
4580
|
+
}];
|
|
4581
|
+
}
|
|
4582
|
+
});
|
|
4583
|
+
});
|
|
4584
|
+
};
|
|
4585
|
+
SubaccountsClient.prototype.destroy = function (id) {
|
|
4586
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4587
|
+
var response, error_1;
|
|
4588
|
+
return __generator(this, function (_a) {
|
|
4589
|
+
switch (_a.label) {
|
|
4590
|
+
case 0:
|
|
4591
|
+
_a.trys.push([0, 2, , 3]);
|
|
4592
|
+
this.request.setSubaccountHeader(id);
|
|
4593
|
+
return [4 /*yield*/, this.request.delete('/v5/accounts/subaccounts')];
|
|
4594
|
+
case 1:
|
|
4595
|
+
response = _a.sent();
|
|
4596
|
+
this.request.resetSubaccountHeader();
|
|
4597
|
+
return [2 /*return*/, response.body];
|
|
4598
|
+
case 2:
|
|
4599
|
+
error_1 = _a.sent();
|
|
4600
|
+
this.request.resetSubaccountHeader();
|
|
4601
|
+
throw error_1;
|
|
4602
|
+
case 3: return [2 /*return*/];
|
|
4603
|
+
}
|
|
4604
|
+
});
|
|
4605
|
+
});
|
|
4606
|
+
};
|
|
4607
|
+
SubaccountsClient.prototype.getMonthlySendingLimit = function (id) {
|
|
4608
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4609
|
+
var response;
|
|
4610
|
+
return __generator(this, function (_a) {
|
|
4611
|
+
switch (_a.label) {
|
|
4612
|
+
case 0: return [4 /*yield*/, this.request.get("/v5/accounts/subaccounts/".concat(id, "/limit/custom/monthly"))];
|
|
4613
|
+
case 1:
|
|
4614
|
+
response = _a.sent();
|
|
4615
|
+
return [2 /*return*/, response.body];
|
|
4616
|
+
}
|
|
4617
|
+
});
|
|
4618
|
+
});
|
|
4619
|
+
};
|
|
4620
|
+
SubaccountsClient.prototype.setMonthlySendingLimit = function (id, limit) {
|
|
4621
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4622
|
+
var customLimit, response;
|
|
4623
|
+
return __generator(this, function (_a) {
|
|
4624
|
+
switch (_a.label) {
|
|
4625
|
+
case 0:
|
|
4626
|
+
customLimit = { query: "limit=".concat(limit) };
|
|
4627
|
+
return [4 /*yield*/, this.request.put("/v5/accounts/subaccounts/".concat(id, "/limit/custom/monthly"), undefined, customLimit)];
|
|
4628
|
+
case 1:
|
|
4629
|
+
response = _a.sent();
|
|
4630
|
+
return [2 /*return*/, response.body];
|
|
4631
|
+
}
|
|
4632
|
+
});
|
|
4633
|
+
});
|
|
4634
|
+
};
|
|
4635
|
+
SubaccountsClient.prototype.updateSubaccountFeature = function (id, features) {
|
|
4636
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4637
|
+
var keys, readyFeatures, response;
|
|
4638
|
+
return __generator(this, function (_a) {
|
|
4639
|
+
switch (_a.label) {
|
|
4640
|
+
case 0:
|
|
4641
|
+
keys = ['email_preview', 'inbox_placement', 'sending', 'validations', 'validations_bulk'];
|
|
4642
|
+
readyFeatures = keys.reduce(function (acc, currentFeatureName) {
|
|
4643
|
+
if (currentFeatureName in features && typeof features[currentFeatureName] === 'boolean') {
|
|
4644
|
+
acc[currentFeatureName] = JSON.stringify({
|
|
4645
|
+
enabled: features[currentFeatureName]
|
|
4646
|
+
});
|
|
4647
|
+
}
|
|
4648
|
+
return acc;
|
|
4649
|
+
}, {});
|
|
4650
|
+
return [4 /*yield*/, this.request.put("/v5/accounts/subaccounts/".concat(id, "/features"), readyFeatures)];
|
|
4651
|
+
case 1:
|
|
4652
|
+
response = _a.sent();
|
|
4653
|
+
return [2 /*return*/, response.body];
|
|
4654
|
+
}
|
|
4655
|
+
});
|
|
4656
|
+
});
|
|
4546
4657
|
};
|
|
4547
4658
|
SubaccountsClient.prototype.enable = function (id) {
|
|
4548
4659
|
return this.request.post("/v5/accounts/subaccounts/".concat(id, "/enable"))
|
|
@@ -4702,11 +4813,16 @@ var Request = /** @class */ (function () {
|
|
|
4702
4813
|
Request.prototype.request = function (method, url, onCallOptions, config) {
|
|
4703
4814
|
var _a;
|
|
4704
4815
|
return __awaiter(this, void 0, void 0, function () {
|
|
4705
|
-
var options, params,
|
|
4816
|
+
var options, params, fullUrl;
|
|
4706
4817
|
return __generator(this, function (_b) {
|
|
4707
4818
|
options = __assign({}, onCallOptions);
|
|
4708
4819
|
params = {};
|
|
4709
|
-
|
|
4820
|
+
if (config === null || config === void 0 ? void 0 : config.isStorageAPI) {
|
|
4821
|
+
fullUrl = url;
|
|
4822
|
+
}
|
|
4823
|
+
else {
|
|
4824
|
+
fullUrl = urljoin(this.url, url);
|
|
4825
|
+
}
|
|
4710
4826
|
if ((options === null || options === void 0 ? void 0 : options.query) && Object.getOwnPropertyNames(options === null || options === void 0 ? void 0 : options.query).length > 0) {
|
|
4711
4827
|
if ((_a = options === null || options === void 0 ? void 0 : options.query) === null || _a === void 0 ? void 0 : _a.searchParams) {
|
|
4712
4828
|
params.params = new URLSearchParams(options.query.searchParams);
|
|
@@ -4718,7 +4834,7 @@ var Request = /** @class */ (function () {
|
|
|
4718
4834
|
if (options === null || options === void 0 ? void 0 : options.body) {
|
|
4719
4835
|
params.data = options === null || options === void 0 ? void 0 : options.body;
|
|
4720
4836
|
}
|
|
4721
|
-
return [2 /*return*/, this.requestProvider.makeRequest(
|
|
4837
|
+
return [2 /*return*/, this.requestProvider.makeRequest(fullUrl, method.toUpperCase(), params, config)];
|
|
4722
4838
|
});
|
|
4723
4839
|
});
|
|
4724
4840
|
};
|
|
@@ -4801,8 +4917,8 @@ var Request = /** @class */ (function () {
|
|
|
4801
4917
|
Request.prototype.put = function (url, data, queryObject) {
|
|
4802
4918
|
return this.command('put', url, data, {}, queryObject);
|
|
4803
4919
|
};
|
|
4804
|
-
Request.prototype.delete = function (url, data) {
|
|
4805
|
-
return this.command('delete', url, data);
|
|
4920
|
+
Request.prototype.delete = function (url, data, queryObject) {
|
|
4921
|
+
return this.command('delete', url, data, {}, { query: queryObject });
|
|
4806
4922
|
};
|
|
4807
4923
|
return Request;
|
|
4808
4924
|
}());
|
|
@@ -4844,7 +4960,7 @@ var Domain = /** @class */ (function () {
|
|
|
4844
4960
|
}());
|
|
4845
4961
|
|
|
4846
4962
|
var DomainsClient = /** @class */ (function () {
|
|
4847
|
-
function DomainsClient(request, domainCredentialsClient, domainTemplatesClient, domainTagsClient, domainTracking, logger) {
|
|
4963
|
+
function DomainsClient(request, domainCredentialsClient, domainTemplatesClient, domainTagsClient, domainTracking, domainKeysClient, logger) {
|
|
4848
4964
|
if (logger === void 0) { logger = console; }
|
|
4849
4965
|
this.request = request;
|
|
4850
4966
|
this.domainCredentials = domainCredentialsClient;
|
|
@@ -4852,6 +4968,7 @@ var DomainsClient = /** @class */ (function () {
|
|
|
4852
4968
|
this.domainTags = domainTagsClient;
|
|
4853
4969
|
this.logger = logger;
|
|
4854
4970
|
this.domainTracking = domainTracking;
|
|
4971
|
+
this.domainKeys = domainKeysClient;
|
|
4855
4972
|
}
|
|
4856
4973
|
DomainsClient.prototype._handleBoolValues = function (data) {
|
|
4857
4974
|
var propsForReplacement = data;
|
|
@@ -4992,28 +5109,25 @@ var DomainsClient = /** @class */ (function () {
|
|
|
4992
5109
|
}
|
|
4993
5110
|
return this.request.delete(urljoin('/v3/domains', domain, 'ips', 'ip_pool', searchParams));
|
|
4994
5111
|
};
|
|
5112
|
+
/**
|
|
5113
|
+
* @deprecated "domains.updateDKIMAuthority" method is deprecated,
|
|
5114
|
+
* and moved into the "domains.domainKeys.updateDKIMAuthority".
|
|
5115
|
+
* Current method will be removed in the future releases.
|
|
5116
|
+
*/
|
|
4995
5117
|
DomainsClient.prototype.updateDKIMAuthority = function (domain, data) {
|
|
4996
|
-
|
|
4997
|
-
return this.
|
|
4998
|
-
.then(function (res) { return res; })
|
|
4999
|
-
.then(function (res) { return res.body; });
|
|
5118
|
+
this.logger.warn('"domains.updateDKIMAuthority" method is deprecated. Please use "domains.domainKeys.updateDKIMAuthority" instead');
|
|
5119
|
+
return this.domainKeys.updateDKIMAuthority(domain, data);
|
|
5000
5120
|
};
|
|
5121
|
+
/**
|
|
5122
|
+
* @deprecated "domains.updateDKIMSelector" method is deprecated,
|
|
5123
|
+
* and moved into the "domains.domainKeys.updateDKIMSelector".
|
|
5124
|
+
* Current method will be removed in the future releases.
|
|
5125
|
+
*/
|
|
5001
5126
|
DomainsClient.prototype.updateDKIMSelector = function (domain, data) {
|
|
5002
|
-
var _a;
|
|
5003
5127
|
return __awaiter(this, void 0, void 0, function () {
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
case 0:
|
|
5008
|
-
options = { query: "dkim_selector=".concat(data.dkimSelector) };
|
|
5009
|
-
return [4 /*yield*/, this.request.put("/v3/domains/".concat(domain, "/dkim_selector"), {}, options)];
|
|
5010
|
-
case 1:
|
|
5011
|
-
res = _b.sent();
|
|
5012
|
-
return [2 /*return*/, {
|
|
5013
|
-
status: res.status,
|
|
5014
|
-
message: (_a = res === null || res === void 0 ? void 0 : res.body) === null || _a === void 0 ? void 0 : _a.message
|
|
5015
|
-
}];
|
|
5016
|
-
}
|
|
5128
|
+
return __generator(this, function (_a) {
|
|
5129
|
+
this.logger.warn('"domains.updateDKIMSelector" method is deprecated. Please use domains.domainKeys.updateDKIMSelector instead');
|
|
5130
|
+
return [2 /*return*/, this.domainKeys.updateDKIMSelector(domain, data)];
|
|
5017
5131
|
});
|
|
5018
5132
|
});
|
|
5019
5133
|
};
|
|
@@ -5476,9 +5590,6 @@ var MessagesClient = /** @class */ (function () {
|
|
|
5476
5590
|
'o:require-tls',
|
|
5477
5591
|
'o:skip-verification'
|
|
5478
5592
|
]);
|
|
5479
|
-
if (!data || Object.keys(data).length === 0) {
|
|
5480
|
-
throw APIError.getUserDataError('Message data object can not be empty', 'Message data object can not be empty');
|
|
5481
|
-
}
|
|
5482
5593
|
return Object.keys(data).reduce(function (acc, key) {
|
|
5483
5594
|
if (yesNoProperties.has(key) && typeof data[key] === 'boolean') {
|
|
5484
5595
|
acc[key] = data[key] ? 'yes' : 'no';
|
|
@@ -5493,6 +5604,9 @@ var MessagesClient = /** @class */ (function () {
|
|
|
5493
5604
|
return __assign({ status: response.status }, response.body);
|
|
5494
5605
|
};
|
|
5495
5606
|
MessagesClient.prototype.create = function (domain, data) {
|
|
5607
|
+
if (!data || Object.keys(data).length === 0) {
|
|
5608
|
+
throw APIError.getUserDataError('Message data object can not be empty', 'Message data object can not be empty');
|
|
5609
|
+
}
|
|
5496
5610
|
if (data.message) {
|
|
5497
5611
|
return this.request.postWithFD("/v3/".concat(domain, "/messages.mime"), data)
|
|
5498
5612
|
.then(this._parseResponse);
|
|
@@ -5501,6 +5615,95 @@ var MessagesClient = /** @class */ (function () {
|
|
|
5501
5615
|
return this.request.postWithFD("/v3/".concat(domain, "/messages"), modifiedData)
|
|
5502
5616
|
.then(this._parseResponse);
|
|
5503
5617
|
};
|
|
5618
|
+
MessagesClient.prototype.retrieveStoredEmail = function (domain, storageKey) {
|
|
5619
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5620
|
+
var res;
|
|
5621
|
+
return __generator(this, function (_a) {
|
|
5622
|
+
switch (_a.label) {
|
|
5623
|
+
case 0: return [4 /*yield*/, this.request.get("/v3/domains/".concat(domain, "/messages/").concat(storageKey))];
|
|
5624
|
+
case 1:
|
|
5625
|
+
res = _a.sent();
|
|
5626
|
+
return [2 /*return*/, res.body];
|
|
5627
|
+
}
|
|
5628
|
+
});
|
|
5629
|
+
});
|
|
5630
|
+
};
|
|
5631
|
+
/**
|
|
5632
|
+
* domain: string
|
|
5633
|
+
* Domain name used to send the message
|
|
5634
|
+
*
|
|
5635
|
+
* storageKey: string
|
|
5636
|
+
* Storage key from the email's associated events
|
|
5637
|
+
* (Example: Accepted/Delivered events storage.key field)
|
|
5638
|
+
*
|
|
5639
|
+
* recipients: string
|
|
5640
|
+
* Email address of the recipient(s). You can use commas to separate multiple recipients
|
|
5641
|
+
*/
|
|
5642
|
+
MessagesClient.prototype.resendEmail = function (domain, storageKey, recipients) {
|
|
5643
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5644
|
+
var res;
|
|
5645
|
+
return __generator(this, function (_a) {
|
|
5646
|
+
switch (_a.label) {
|
|
5647
|
+
case 0: return [4 /*yield*/, this.request.postWithFD("/v3/domains/".concat(domain, "/messages/").concat(storageKey), { to: recipients })];
|
|
5648
|
+
case 1:
|
|
5649
|
+
res = _a.sent();
|
|
5650
|
+
return [2 /*return*/, this._parseResponse(res)];
|
|
5651
|
+
}
|
|
5652
|
+
});
|
|
5653
|
+
});
|
|
5654
|
+
};
|
|
5655
|
+
MessagesClient.prototype.getMessagesQueueStatus = function (domain) {
|
|
5656
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
5657
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5658
|
+
var res, apiResponse, result;
|
|
5659
|
+
return __generator(this, function (_l) {
|
|
5660
|
+
switch (_l.label) {
|
|
5661
|
+
case 0: return [4 /*yield*/, this.request.get("/v3/domains/".concat(domain, "/sending_queues"))];
|
|
5662
|
+
case 1:
|
|
5663
|
+
res = _l.sent();
|
|
5664
|
+
apiResponse = res.body;
|
|
5665
|
+
result = {
|
|
5666
|
+
regular: {
|
|
5667
|
+
is_disabled: (_a = apiResponse.regular) === null || _a === void 0 ? void 0 : _a.is_disabled,
|
|
5668
|
+
disabled: {
|
|
5669
|
+
until: ((_c = (_b = apiResponse.regular) === null || _b === void 0 ? void 0 : _b.disabled) === null || _c === void 0 ? void 0 : _c.until) ? new Date(apiResponse.regular.disabled.until) : '',
|
|
5670
|
+
reason: ((_e = (_d = apiResponse.regular) === null || _d === void 0 ? void 0 : _d.disabled) === null || _e === void 0 ? void 0 : _e.reason) || '',
|
|
5671
|
+
}
|
|
5672
|
+
},
|
|
5673
|
+
scheduled: {
|
|
5674
|
+
is_disabled: (_f = apiResponse.scheduled) === null || _f === void 0 ? void 0 : _f.is_disabled,
|
|
5675
|
+
disabled: {
|
|
5676
|
+
until: ((_h = (_g = apiResponse.scheduled) === null || _g === void 0 ? void 0 : _g.disabled) === null || _h === void 0 ? void 0 : _h.until) ? new Date(apiResponse.scheduled.disabled.until) : '',
|
|
5677
|
+
reason: ((_k = (_j = apiResponse.scheduled) === null || _j === void 0 ? void 0 : _j.disabled) === null || _k === void 0 ? void 0 : _k.reason) || '',
|
|
5678
|
+
}
|
|
5679
|
+
}
|
|
5680
|
+
};
|
|
5681
|
+
return [2 /*return*/, result];
|
|
5682
|
+
}
|
|
5683
|
+
});
|
|
5684
|
+
});
|
|
5685
|
+
};
|
|
5686
|
+
/** Deletes all scheduled and undelivered mail from the domain queue.
|
|
5687
|
+
* https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/messages/delete-v3--domain-name--envelopes
|
|
5688
|
+
*/
|
|
5689
|
+
MessagesClient.prototype.clearMessagesQueue = function (domain, storageUrl) {
|
|
5690
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5691
|
+
var allowedStorageUrls, res;
|
|
5692
|
+
return __generator(this, function (_a) {
|
|
5693
|
+
switch (_a.label) {
|
|
5694
|
+
case 0:
|
|
5695
|
+
allowedStorageUrls = ['storage-us-east4.api.mailgun.net', 'storage-us-west1.api.mailgun.net', 'storage-europe-west1.api.mailgun.net'];
|
|
5696
|
+
if (!allowedStorageUrls.includes(storageUrl)) {
|
|
5697
|
+
throw APIError.getUserDataError('Invalid storage URL', 'The provided storage URL is not allowed.');
|
|
5698
|
+
}
|
|
5699
|
+
return [4 /*yield*/, this.request.command('delete', "https://".concat(storageUrl, "/v3/").concat(domain, "/envelopes"), undefined, { isStorageAPI: true })];
|
|
5700
|
+
case 1:
|
|
5701
|
+
res = _a.sent();
|
|
5702
|
+
return [2 /*return*/, res.body];
|
|
5703
|
+
}
|
|
5704
|
+
});
|
|
5705
|
+
});
|
|
5706
|
+
};
|
|
5504
5707
|
return MessagesClient;
|
|
5505
5708
|
}());
|
|
5506
5709
|
|
|
@@ -6761,6 +6964,155 @@ var DomainTrackingClient = /** @class */ (function () {
|
|
|
6761
6964
|
return DomainTrackingClient;
|
|
6762
6965
|
}());
|
|
6763
6966
|
|
|
6967
|
+
var DomainKeysClient = /** @class */ (function (_super) {
|
|
6968
|
+
__extends(DomainKeysClient, _super);
|
|
6969
|
+
function DomainKeysClient(request) {
|
|
6970
|
+
var _this = _super.call(this, request) || this;
|
|
6971
|
+
_this.request = request;
|
|
6972
|
+
_this.baseRoute = '/v3/domains/';
|
|
6973
|
+
return _this;
|
|
6974
|
+
}
|
|
6975
|
+
DomainKeysClient.prototype._parseDomainKeysList = function (response) {
|
|
6976
|
+
return {
|
|
6977
|
+
items: response.items,
|
|
6978
|
+
};
|
|
6979
|
+
};
|
|
6980
|
+
DomainKeysClient.prototype.parseList = function (response) {
|
|
6981
|
+
response.body.items;
|
|
6982
|
+
this.parsePageLinks(response, '?', 'page');
|
|
6983
|
+
response.status;
|
|
6984
|
+
return {
|
|
6985
|
+
items: response.body.items,
|
|
6986
|
+
pages: this.parsePageLinks(response, '?', 'page'),
|
|
6987
|
+
status: response.status || 200,
|
|
6988
|
+
};
|
|
6989
|
+
};
|
|
6990
|
+
DomainKeysClient.prototype.list = function (domainName) {
|
|
6991
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6992
|
+
var res;
|
|
6993
|
+
return __generator(this, function (_a) {
|
|
6994
|
+
switch (_a.label) {
|
|
6995
|
+
case 0: return [4 /*yield*/, this.request.get(urljoin('v4/domains/', domainName, '/keys'))];
|
|
6996
|
+
case 1:
|
|
6997
|
+
res = _a.sent();
|
|
6998
|
+
return [2 /*return*/, __assign(__assign({}, this._parseDomainKeysList(res.body)), { status: res.status })];
|
|
6999
|
+
}
|
|
7000
|
+
});
|
|
7001
|
+
});
|
|
7002
|
+
};
|
|
7003
|
+
DomainKeysClient.prototype.listAll = function (query) {
|
|
7004
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7005
|
+
var preparedQuery, res;
|
|
7006
|
+
return __generator(this, function (_a) {
|
|
7007
|
+
switch (_a.label) {
|
|
7008
|
+
case 0:
|
|
7009
|
+
preparedQuery = __assign(__assign(__assign({}, ((query === null || query === void 0 ? void 0 : query.signingDomain)
|
|
7010
|
+
? { signing_domain: encodeURIComponent(query.signingDomain) }
|
|
7011
|
+
: {})), ((query === null || query === void 0 ? void 0 : query.selector) ? { selector: encodeURIComponent(query.selector) } : {})), { page: '', limit: '' });
|
|
7012
|
+
return [4 /*yield*/, this.requestListWithPages(urljoin('/v1/dkim/keys'), preparedQuery)];
|
|
7013
|
+
case 1:
|
|
7014
|
+
res = _a.sent();
|
|
7015
|
+
return [2 /*return*/, res];
|
|
7016
|
+
}
|
|
7017
|
+
});
|
|
7018
|
+
});
|
|
7019
|
+
};
|
|
7020
|
+
DomainKeysClient.prototype.create = function (data) {
|
|
7021
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7022
|
+
var preparedData, res;
|
|
7023
|
+
return __generator(this, function (_a) {
|
|
7024
|
+
switch (_a.label) {
|
|
7025
|
+
case 0:
|
|
7026
|
+
preparedData = {
|
|
7027
|
+
signing_domain: data.signingDomain,
|
|
7028
|
+
selector: data.selector,
|
|
7029
|
+
};
|
|
7030
|
+
if (data.bits) {
|
|
7031
|
+
preparedData.bits = data.bits;
|
|
7032
|
+
}
|
|
7033
|
+
if (data.pem) {
|
|
7034
|
+
preparedData.pem = data.pem;
|
|
7035
|
+
}
|
|
7036
|
+
return [4 /*yield*/, this.request.postWithFD(urljoin('v1/dkim/keys'), preparedData)];
|
|
7037
|
+
case 1:
|
|
7038
|
+
res = _a.sent();
|
|
7039
|
+
return [2 /*return*/, __assign({ status: res.status }, res.body)];
|
|
7040
|
+
}
|
|
7041
|
+
});
|
|
7042
|
+
});
|
|
7043
|
+
};
|
|
7044
|
+
DomainKeysClient.prototype.activate = function (domainName, selector) {
|
|
7045
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7046
|
+
var res;
|
|
7047
|
+
return __generator(this, function (_a) {
|
|
7048
|
+
switch (_a.label) {
|
|
7049
|
+
case 0: return [4 /*yield*/, this.request.put("/v4/domains/".concat(domainName, "/keys/").concat(selector, "/activate"))];
|
|
7050
|
+
case 1:
|
|
7051
|
+
res = _a.sent();
|
|
7052
|
+
return [2 /*return*/, __assign(__assign({}, res.body), { status: res.status })];
|
|
7053
|
+
}
|
|
7054
|
+
});
|
|
7055
|
+
});
|
|
7056
|
+
};
|
|
7057
|
+
DomainKeysClient.prototype.deactivate = function (domainName, selector) {
|
|
7058
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7059
|
+
var res;
|
|
7060
|
+
return __generator(this, function (_a) {
|
|
7061
|
+
switch (_a.label) {
|
|
7062
|
+
case 0: return [4 /*yield*/, this.request.put("/v4/domains/".concat(domainName, "/keys/").concat(selector, "/deactivate"))];
|
|
7063
|
+
case 1:
|
|
7064
|
+
res = _a.sent();
|
|
7065
|
+
return [2 /*return*/, __assign(__assign({}, res.body), { status: res.status })];
|
|
7066
|
+
}
|
|
7067
|
+
});
|
|
7068
|
+
});
|
|
7069
|
+
};
|
|
7070
|
+
DomainKeysClient.prototype.destroy = function (domain, selector) {
|
|
7071
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7072
|
+
var res;
|
|
7073
|
+
return __generator(this, function (_a) {
|
|
7074
|
+
switch (_a.label) {
|
|
7075
|
+
case 0: return [4 /*yield*/, this.request.delete(urljoin('v1/dkim/keys'), undefined, { signing_domain: domain, selector: selector })];
|
|
7076
|
+
case 1:
|
|
7077
|
+
res = _a.sent();
|
|
7078
|
+
return [2 /*return*/, res.body];
|
|
7079
|
+
}
|
|
7080
|
+
});
|
|
7081
|
+
});
|
|
7082
|
+
};
|
|
7083
|
+
DomainKeysClient.prototype.updateDKIMSelector = function (domain, data) {
|
|
7084
|
+
var _a;
|
|
7085
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7086
|
+
var options, res;
|
|
7087
|
+
return __generator(this, function (_b) {
|
|
7088
|
+
switch (_b.label) {
|
|
7089
|
+
case 0:
|
|
7090
|
+
options = { query: "dkim_selector=".concat(data.dkimSelector) };
|
|
7091
|
+
return [4 /*yield*/, this.request.put("/v3/domains/".concat(domain, "/dkim_selector"), {}, options)];
|
|
7092
|
+
case 1:
|
|
7093
|
+
res = _b.sent();
|
|
7094
|
+
return [2 /*return*/, {
|
|
7095
|
+
status: res.status,
|
|
7096
|
+
message: (_a = res === null || res === void 0 ? void 0 : res.body) === null || _a === void 0 ? void 0 : _a.message
|
|
7097
|
+
}];
|
|
7098
|
+
}
|
|
7099
|
+
});
|
|
7100
|
+
});
|
|
7101
|
+
};
|
|
7102
|
+
DomainKeysClient.prototype.updateDKIMAuthority = function (domain, data) {
|
|
7103
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7104
|
+
var options;
|
|
7105
|
+
return __generator(this, function (_a) {
|
|
7106
|
+
options = { query: "self=".concat(data.self) };
|
|
7107
|
+
return [2 /*return*/, this.request.put("/v3/domains/".concat(domain, "/dkim_authority"), {}, options)
|
|
7108
|
+
.then(function (res) { return res; })
|
|
7109
|
+
.then(function (res) { return res.body; })];
|
|
7110
|
+
});
|
|
7111
|
+
});
|
|
7112
|
+
};
|
|
7113
|
+
return DomainKeysClient;
|
|
7114
|
+
}(NavigationThruPages));
|
|
7115
|
+
|
|
6764
7116
|
var MailgunClient = /** @class */ (function () {
|
|
6765
7117
|
function MailgunClient(options, formData) {
|
|
6766
7118
|
var config = __assign({}, options);
|
|
@@ -6783,6 +7135,7 @@ var MailgunClient = /** @class */ (function () {
|
|
|
6783
7135
|
var domainTemplatesClient = new DomainTemplatesClient(this.request);
|
|
6784
7136
|
var domainTagsClient = new DomainTagsClient(this.request);
|
|
6785
7137
|
var domainTrackingClient = new DomainTrackingClient(this.request);
|
|
7138
|
+
var domainKeysClient = new DomainKeysClient(this.request);
|
|
6786
7139
|
var multipleValidationClient = new MultipleValidationClient(this.request);
|
|
6787
7140
|
var InboxPlacementsResultsSharingClient = new IPRSharingClient(this.request);
|
|
6788
7141
|
var seedsListsAttributes = new InboxPlacementsAttributesClient(this.request, '/v4/inbox/seedlists/a');
|
|
@@ -6792,7 +7145,7 @@ var MailgunClient = /** @class */ (function () {
|
|
|
6792
7145
|
var seedsListsClient = new SeedsListsClient(this.request, seedsListsAttributes, seedsListsFiltersClient);
|
|
6793
7146
|
var inboxPlacementsResultsClient = new InboxPlacementsResultsClient(this.request, resultsAttributesClient, resultsFiltersClient, InboxPlacementsResultsSharingClient);
|
|
6794
7147
|
var inboxPlacementsProvidersClient = new InboxPlacementsProvidersClient(this.request);
|
|
6795
|
-
this.domains = new DomainsClient(this.request, domainCredentialsClient, domainTemplatesClient, domainTagsClient, domainTrackingClient);
|
|
7148
|
+
this.domains = new DomainsClient(this.request, domainCredentialsClient, domainTemplatesClient, domainTagsClient, domainTrackingClient, domainKeysClient);
|
|
6796
7149
|
this.webhooks = new WebhooksClient(this.request);
|
|
6797
7150
|
this.events = new EventClient(this.request);
|
|
6798
7151
|
this.stats = new StatsClient(this.request);
|
package/package.json
CHANGED
package/version.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
12.
|
|
1
|
+
12.3.0
|