@trycourier/courier 2.7.0 → 2.8.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/CHANGELOG.md +6 -1
- package/README.md +4 -0
- package/lib/client.js +14 -0
- package/lib/types.d.ts +16 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased][unreleased]
|
|
7
7
|
|
|
8
|
+
## [v2.8.0] - 2021-10-29
|
|
9
|
+
|
|
10
|
+
- adds GET /messages/{messageId}/output API
|
|
11
|
+
|
|
8
12
|
## [v2.7.0] - 2021-10-21
|
|
9
13
|
|
|
10
14
|
- adds GET /messages/{messageId}/history API
|
|
@@ -169,7 +173,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
169
173
|
|
|
170
174
|
## v1.0.1 - 2019-07-12
|
|
171
175
|
|
|
172
|
-
[unreleased]: https://github.com/trycourier/courier-node/compare/v2.
|
|
176
|
+
[unreleased]: https://github.com/trycourier/courier-node/compare/v2.8.0...HEAD
|
|
177
|
+
[v2.8.0]: https://github.com/trycourier/courier-node/compare/v2.7.0...v2.8.0
|
|
173
178
|
[v2.7.0]: https://github.com/trycourier/courier-node/compare/v2.6.0...v2.7.0
|
|
174
179
|
[v2.6.0]: https://github.com/trycourier/courier-node/compare/v2.4.0...v2.6.0
|
|
175
180
|
[v2.4.0]: https://github.com/trycourier/courier-node/compare/v2.3.0...v2.4.0
|
package/README.md
CHANGED
|
@@ -84,6 +84,10 @@ async function run() {
|
|
|
84
84
|
const { results } = await courier.getMessageHistory(messageId);
|
|
85
85
|
console.log(results);
|
|
86
86
|
|
|
87
|
+
// Example: get a message output
|
|
88
|
+
const { results } = await courier.getMessageOutput(messageId);
|
|
89
|
+
console.log(results);
|
|
90
|
+
|
|
87
91
|
// Example: get all messages
|
|
88
92
|
const { paging, results } = await courier.getMessages();
|
|
89
93
|
console.log(results);
|
package/lib/client.js
CHANGED
|
@@ -97,6 +97,19 @@ var getMessageHistory = function (options) {
|
|
|
97
97
|
});
|
|
98
98
|
}); };
|
|
99
99
|
};
|
|
100
|
+
var getMessageOutput = function (options) {
|
|
101
|
+
return function (messageId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
+
var res;
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
switch (_a.label) {
|
|
105
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/messages/" + messageId + "/output")];
|
|
106
|
+
case 1:
|
|
107
|
+
res = _a.sent();
|
|
108
|
+
return [2 /*return*/, res.data];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}); };
|
|
112
|
+
};
|
|
100
113
|
var getMessages = function (options) {
|
|
101
114
|
return function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
115
|
var res;
|
|
@@ -129,6 +142,7 @@ exports.client = function (options) {
|
|
|
129
142
|
getBrands: brands_1.getBrands(options),
|
|
130
143
|
getMessage: getMessage(options),
|
|
131
144
|
getMessageHistory: getMessageHistory(options),
|
|
145
|
+
getMessageOutput: getMessageOutput(options),
|
|
132
146
|
getMessages: getMessages(options),
|
|
133
147
|
getProfile: profile_1.getProfile(options),
|
|
134
148
|
getRecipientSubscriptions: profile_1.getRecipientSubscriptions(options),
|
package/lib/types.d.ts
CHANGED
|
@@ -188,6 +188,21 @@ export interface IProviderErrorMessageHistory extends IRoutedMessageHistory<"UND
|
|
|
188
188
|
export interface ICourierMessageGetHistoryResponse {
|
|
189
189
|
results: Array<IEnqueuedMessageHistory | IMappedMessageHistory | IProfileLoadedMessageHistory | IRenderedMessageHistory | IRoutedMessageHistory<RoutedMessageHistoryTypes> | IDeliveredMessageHistory | IProviderErrorMessageHistory | IUndeliverableMessageHistory>;
|
|
190
190
|
}
|
|
191
|
+
export interface IApiMessageOutputItem {
|
|
192
|
+
channel: string;
|
|
193
|
+
channel_id: string;
|
|
194
|
+
content: {
|
|
195
|
+
html?: string;
|
|
196
|
+
title?: string;
|
|
197
|
+
blocks?: any[];
|
|
198
|
+
body?: string;
|
|
199
|
+
subject?: string;
|
|
200
|
+
text?: string;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
export interface ICourierMessageGetOutputResponse {
|
|
204
|
+
results: IApiMessageOutputItem[];
|
|
205
|
+
}
|
|
191
206
|
export interface ICourierProfileDeleteParameters {
|
|
192
207
|
recipientId: string;
|
|
193
208
|
}
|
|
@@ -250,6 +265,7 @@ export interface ICourierClient {
|
|
|
250
265
|
}) => Promise<ICourierBrandGetAllResponse>;
|
|
251
266
|
getMessage: (messageId: string) => Promise<ICourierMessageGetResponse>;
|
|
252
267
|
getMessageHistory: (messageId: string) => Promise<ICourierMessageGetHistoryResponse>;
|
|
268
|
+
getMessageOutput: (messageId: string) => Promise<ICourierMessageGetOutputResponse>;
|
|
253
269
|
getMessages: (params?: ICourierMessagesGetParameters) => Promise<ICourierMessagesGetResponse>;
|
|
254
270
|
getProfile: (params: ICourierProfileGetParameters) => Promise<ICourierProfileGetResponse>;
|
|
255
271
|
deleteProfile: (params: ICourierProfileDeleteParameters) => Promise<void>;
|