@trycourier/courier
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -6,2 +6,8 @@ # Change Log | ||
## [v1.4.0] - 2020-06-29 | ||
### Added | ||
- Support /messages/:messageId via client.getMessage(:messageId) @rileylnapier | ||
## [v1.3.0] - 2020-03-10 | ||
@@ -8,0 +14,0 @@ |
@@ -59,2 +59,15 @@ "use strict"; | ||
}; | ||
var getMessage = function (options) { | ||
return function (messageId) { return __awaiter(void 0, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.get("/messages/" + messageId)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res.data]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
var replaceProfile = function (options) { | ||
@@ -105,2 +118,3 @@ return function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
return { | ||
getMessage: getMessage(options), | ||
getProfile: getProfile(options), | ||
@@ -107,0 +121,0 @@ mergeProfile: mergeProfile(options), |
@@ -48,2 +48,23 @@ export declare type HttpMethodClient = <T>(url: string, body?: object) => Promise<{ | ||
} | ||
export interface ICourierMessageGetResponse { | ||
enqueued?: number; | ||
event?: string; | ||
id: string; | ||
notification?: string; | ||
providers?: Array<{ | ||
channel: { | ||
name: string; | ||
template: string; | ||
}; | ||
provider: string; | ||
reference: { | ||
"x-message-id": string; | ||
}; | ||
sent: number; | ||
status: string; | ||
}>; | ||
recipient: string; | ||
sent?: number; | ||
status: string; | ||
} | ||
export declare type ICourierChannelClassification = "direct_message" | "email" | "push" | "webhook"; | ||
@@ -55,2 +76,3 @@ export interface ICourierProfilePreferences { | ||
send: (params: ICourierSendParameters) => Promise<ICourierSendResponse>; | ||
getMessage: (messageId: string) => Promise<ICourierMessageGetResponse>; | ||
replaceProfile: (params: ICourierProfilePutParameters) => Promise<ICourierProfilePutResponse>; | ||
@@ -57,0 +79,0 @@ mergeProfile: (params: ICourierProfilePostParameters) => Promise<ICourierProfilePostResponse>; |
{ | ||
"name": "@trycourier/courier", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A node.js module for communicating with the Courier REST API.", | ||
@@ -36,2 +36,2 @@ "main": "lib/index.js", | ||
} | ||
} | ||
} |
@@ -58,2 +58,6 @@ # `@trycourier/courier` | ||
// Example: get a message status | ||
const messageStatus = await courier.getMessage(messageId); | ||
console.log(messageStatus); | ||
// Example: replace a recipient's profile | ||
@@ -60,0 +64,0 @@ const { status: replaceStatus } = await courier.replaceProfile({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15402
237
97