@trycourier/courier
Advanced tools
Comparing version 1.7.3 to 2.0.0
@@ -8,2 +8,6 @@ # Change Log | ||
## [v2.0.0] - 2021-03-03 | ||
- supports adding subscription preferences (#35) | ||
## [v1.7.3] - 2021-03-03 | ||
@@ -139,3 +143,4 @@ | ||
[unreleased]: https://github.com/trycourier/courier-node/compare/v1.7.3...HEAD | ||
[unreleased]: https://github.com/trycourier/courier-node/compare/v2.0.0...HEAD | ||
[v2.0.0]: https://github.com/trycourier/courier-node/compare/v1.7.3...v2.0.0 | ||
[v1.7.3]: https://github.com/trycourier/courier-node/compare/v1.7.2...v1.7.3 | ||
@@ -142,0 +147,0 @@ [v1.7.2]: https://github.com/trycourier/courier-node/compare/v1.7.1...v1.7.2 |
@@ -131,6 +131,8 @@ "use strict"; | ||
var subscribe = function (options) { | ||
return function (listId, recipientId) { return __awaiter(void 0, void 0, void 0, function () { | ||
return function (listId, recipientId, preferences) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.put("/lists/" + listId + "/subscriptions/" + recipientId)]; | ||
case 0: return [4 /*yield*/, options.httpClient.put("/lists/" + listId + "/subscriptions/" + recipientId, { | ||
preferences: preferences | ||
})]; | ||
case 1: | ||
@@ -137,0 +139,0 @@ _a.sent(); |
@@ -0,1 +1,2 @@ | ||
import { ICourierNotificationPreferences } from "../preferences/types"; | ||
import { ICourierPaging, ICourierSendConfig, ICourierSendListOrPatternParams, ICourierSendResponse } from "../types"; | ||
@@ -23,4 +24,5 @@ export interface ICourierList { | ||
export interface ICourierListRecipient { | ||
recipient: string; | ||
recipientId: string; | ||
created?: string; | ||
preferences?: ICourierRecipientPreferences; | ||
} | ||
@@ -38,9 +40,9 @@ export interface ICourierListGetSubscriptionsResponse { | ||
} | ||
export interface ICourierRecipientPreference { | ||
categories?: string; | ||
notifications: string; | ||
export interface ICourierRecipientPreferences { | ||
categories?: ICourierNotificationPreferences; | ||
notifications: ICourierNotificationPreferences; | ||
} | ||
export interface ICourierPutSubscriptionsRecipient { | ||
recipientId: string; | ||
preferences?: ICourierRecipientPreference; | ||
preferences?: ICourierRecipientPreferences; | ||
} | ||
@@ -57,4 +59,4 @@ export interface ICourierClientLists { | ||
send: (params: ICourierSendListOrPatternParams, config?: ICourierSendConfig) => Promise<ICourierSendResponse>; | ||
subscribe: (listId: string, recipientId: string) => Promise<void>; | ||
subscribe: (listId: string, recipientId: string, preferences?: ICourierRecipientPreferences) => Promise<void>; | ||
unsubscribe: (listId: string, recipientId: string) => Promise<void>; | ||
} |
@@ -1,13 +0,10 @@ | ||
export interface ICourierPreferencesGetResponse { | ||
categories: { | ||
[notificationId: string]: { | ||
status: string; | ||
}; | ||
export interface ICourierNotificationPreferences { | ||
[id: string]: { | ||
status: PreferenceStatus; | ||
}; | ||
notifications: { | ||
[notificationId: string]: { | ||
status: string; | ||
}; | ||
}; | ||
} | ||
export interface ICourierPreferencesGetResponse { | ||
categories?: ICourierNotificationPreferences; | ||
notifications: ICourierNotificationPreferences; | ||
} | ||
export interface ICourierPreferencesListResponse { | ||
@@ -22,14 +19,6 @@ uncategorized: Array<{}>; | ||
} | ||
export declare type PreferenceStatus = "OPTED_OUT" | "OPTED_IN" | undefined; | ||
export declare type PreferenceStatus = "OPTED_OUT" | "OPTED_IN"; | ||
export interface IRecipientPreferences { | ||
categories?: { | ||
[categoryId: string]: { | ||
status: PreferenceStatus; | ||
}; | ||
}; | ||
notifications: { | ||
[notificationId: string]: { | ||
status: PreferenceStatus; | ||
}; | ||
}; | ||
categories?: ICourierNotificationPreferences; | ||
notifications: ICourierNotificationPreferences; | ||
} | ||
@@ -36,0 +25,0 @@ export interface ICourierPreferencesPutResponse { |
{ | ||
"name": "@trycourier/courier", | ||
"version": "1.7.3", | ||
"version": "2.0.0", | ||
"description": "A node.js module for communicating with the Courier REST API.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
51859
864