mailersend
Advanced tools
Comparing version 2.1.2 to 2.2.0
@@ -8,4 +8,7 @@ import { RequestService, APIResponse } from "../../services/request.service"; | ||
single(identityId: string): Promise<APIResponse>; | ||
singleByEmail(email: string): Promise<APIResponse>; | ||
update(identityId: string, data: IdentityUpdate): Promise<APIResponse>; | ||
updateByEMail(email: string, data: IdentityUpdate): Promise<APIResponse>; | ||
delete(identityId: string): Promise<APIResponse>; | ||
deleteByEmail(email: string): Promise<APIResponse>; | ||
} |
@@ -91,2 +91,12 @@ "use strict"; | ||
}; | ||
IdentityModule.prototype.singleByEmail = function (email) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.get("/identities/email/".concat(email))]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
IdentityModule.prototype.update = function (identityId, data) { | ||
@@ -102,2 +112,12 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
IdentityModule.prototype.updateByEMail = function (email, data) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.put("/identities/email/".concat(email), data)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
IdentityModule.prototype.delete = function (identityId) { | ||
@@ -113,4 +133,14 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
IdentityModule.prototype.deleteByEmail = function (email) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.deleteReq("/identities/email/".concat(email))]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return IdentityModule; | ||
}(request_service_1.RequestService)); | ||
exports.IdentityModule = IdentityModule; |
{ | ||
"name": "mailersend", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "Node.js helper module for MailerSend API", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -53,5 +53,8 @@ <a href="https://www.mailersend.com"><img src="https://www.mailersend.com/images/logo.svg" width="200px"/></a> | ||
- [Get identity](#get-identity) | ||
- [Get identity by email](#get-identity-by-email-address) | ||
- [Create identity](#create-identity) | ||
- [Update identity](#update-identity) | ||
- [Update identity by email](#update-identity-by-email-address) | ||
- [Delete identity](#delete-identity) | ||
- [Delete identity by email](#delete-identity-by-email-address) | ||
- [Inbounds](#inbound) | ||
@@ -801,2 +804,18 @@ - [Get inbound list](#get-inbound-list) | ||
### Get identity by email address | ||
```js | ||
import 'dotenv/config'; | ||
import { MailerSend } from "mailersend"; | ||
const mailerSend = new MailerSend({ | ||
apiKey: process.env.API_KEY, | ||
}); | ||
mailerSend.email.identity.singleByEmail('email_address') | ||
.then((response) => console.log(response.body)) | ||
.catch((error) => console.log(error.body)); | ||
``` | ||
### Create identity | ||
@@ -852,2 +871,28 @@ | ||
### Update identity by email address | ||
```js | ||
import 'dotenv/config'; | ||
import { MailerSend, Inbound, InboundFilterType } from "mailersend"; | ||
const mailerSend = new MailerSend({ | ||
apiKey: process.env.API_KEY, | ||
}); | ||
const data = { | ||
domain_id: 'string', | ||
email: 'email@yourdomain.com', | ||
name: 'name', | ||
personal_note: 'Personal note', | ||
reply_to_name: 'Reply Name', | ||
reply_to_email: 'repy@yourdomain.com', | ||
add_note: true, | ||
}; | ||
mailerSend.email.identity.updateByEmail('email_address', data) | ||
.then((response) => console.log(response.body)) | ||
.catch((error) => console.log(error.body)); | ||
``` | ||
### Delete identity | ||
@@ -869,2 +914,18 @@ | ||
### Delete identity by email address | ||
```js | ||
import 'dotenv/config'; | ||
import { MailerSend } from "mailersend"; | ||
const mailerSend = new MailerSend({ | ||
apiKey: process.env.API_KEY, | ||
}); | ||
mailerSend.email.identity.deleteByEmail('email_address') | ||
.then((response) => console.log(response.body)) | ||
.catch((error) => console.log(error.body)); | ||
``` | ||
## Inbound | ||
@@ -871,0 +932,0 @@ |
225549
3736
2067