@plunk/node
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -27,9 +27,4 @@ import { PublishParams } from "../types/events"; | ||
* Sends a transactional email with Plunk | ||
* @param {Object} email | ||
* @param {string} email.to - The event you want to publish | ||
* @param {string} email.subject - The event you want to publish | ||
* @param {string} email.body - The email associated with this event | ||
* @param {boolean=} email.withUnsubscribe - Whether to include an unsubscribe link hosted by Plunk in the email | ||
*/ | ||
send: ({ to, subject, body, withUnsubscribe }: SendParams) => Promise<{ | ||
send: (body: SendParams) => Promise<{ | ||
success: true; | ||
@@ -36,0 +31,0 @@ }>; |
@@ -31,13 +31,8 @@ "use strict"; | ||
* Sends a transactional email with Plunk | ||
* @param {Object} email | ||
* @param {string} email.to - The event you want to publish | ||
* @param {string} email.subject - The event you want to publish | ||
* @param {string} email.body - The email associated with this event | ||
* @param {boolean=} email.withUnsubscribe - Whether to include an unsubscribe link hosted by Plunk in the email | ||
*/ | ||
send: ({ to, subject, body, withUnsubscribe }) => tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
send: (body) => tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return yield (0, request_1.request)(this.client, { | ||
method: "POST", | ||
url: "/send", | ||
body: { to, subject, body, withUnsubscribe: withUnsubscribe !== null && withUnsubscribe !== void 0 ? withUnsubscribe : false }, | ||
body: Object.assign({}, body), | ||
}); | ||
@@ -44,0 +39,0 @@ }), |
@@ -1,2 +0,2 @@ | ||
export interface SendParams { | ||
export interface SendParamsWithoutTemplate { | ||
to: string; | ||
@@ -7,1 +7,7 @@ subject: string; | ||
} | ||
export interface SendParamsWithTemplate { | ||
to: string; | ||
template: string; | ||
withUnsubscribe?: boolean; | ||
} | ||
export declare type SendParams = SendParamsWithTemplate | SendParamsWithoutTemplate; |
{ | ||
"name": "@plunk/node", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Official Node.js library for useplunk.com", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -9,2 +9,3 @@ # Plunk Node.js | ||
- [Events](#events) | ||
- [Email](#emails) | ||
@@ -11,0 +12,0 @@ ![Card](https://www.useplunk.com/assets/card.png) |
66
9508
211