@trycourier/courier 2.3.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 +24 -1
- package/README.md +146 -4
- package/lib/automations/index.js +39 -19
- package/lib/automations/types.d.ts +6 -2
- package/lib/client.js +53 -0
- package/lib/lists/types.d.ts +1 -1
- package/lib/notifications/index.d.ts +3 -0
- package/lib/notifications/index.js +152 -0
- package/lib/notifications/types.d.ts +83 -0
- package/lib/notifications/types.js +2 -0
- package/lib/profile.d.ts +2 -1
- package/lib/profile.js +13 -1
- package/lib/types.d.ts +112 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ 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
|
+
|
|
12
|
+
## [v2.7.0] - 2021-10-21
|
|
13
|
+
|
|
14
|
+
- adds GET /messages/{messageId}/history API
|
|
15
|
+
|
|
16
|
+
## [v2.6.0] - 2021-10-07
|
|
17
|
+
|
|
18
|
+
- Add support for DELETE /profiles/{recipient_id} (#58)
|
|
19
|
+
- adds GET /messages API
|
|
20
|
+
- adds idempotencyKey support in automations client
|
|
21
|
+
|
|
22
|
+
## [v2.4.0] - 2021-08-23
|
|
23
|
+
|
|
24
|
+
- adds notifications API
|
|
25
|
+
- type fix `put` method of `ICourierClientLists`
|
|
26
|
+
|
|
8
27
|
## [v2.3.0] - 2021-04-28
|
|
9
28
|
|
|
10
29
|
- adds support for update-profile step via `client.automations.invokeAdHocAutomation({...})`
|
|
@@ -154,7 +173,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
154
173
|
|
|
155
174
|
## v1.0.1 - 2019-07-12
|
|
156
175
|
|
|
157
|
-
[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
|
|
178
|
+
[v2.7.0]: https://github.com/trycourier/courier-node/compare/v2.6.0...v2.7.0
|
|
179
|
+
[v2.6.0]: https://github.com/trycourier/courier-node/compare/v2.4.0...v2.6.0
|
|
180
|
+
[v2.4.0]: https://github.com/trycourier/courier-node/compare/v2.3.0...v2.4.0
|
|
158
181
|
[v2.3.0]: https://github.com/trycourier/courier-node/compare/v2.2.0...v2.3.0
|
|
159
182
|
[v2.2.0]: https://github.com/trycourier/courier-node/compare/v2.1.0...v2.2.0
|
|
160
183
|
[v2.1.0]: https://github.com/trycourier/courier-node/compare/v2.0.0...v2.1.0
|
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://courier.com)
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/%40trycourier%2Fcourier)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This is the official node.js module for sending notifications with node.js with the [Courier](https://courier.com) REST API.
|
|
6
|
+
|
|
7
|
+
[Courier docs](https://docs.courier.com/docs) • [3 Different Ways To Send Emails With Node.js](https://www.courier.com/blog/how-to-send-emails-with-node-js?utm_campaign=General-Content-Distribution&utm_source=github&utm_medium=node-sdk)
|
|
6
8
|
|
|
7
9
|
## Installation (via [npm](https://www.npmjs.com/package/@trycourier/courier))
|
|
8
10
|
|
|
@@ -10,7 +12,11 @@ A node.js module for communicating with the Courier REST API.
|
|
|
10
12
|
npm install @trycourier/courier
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
##
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
You will need to get a Courier API key to get started. You can sign up and create one for free at [courier.com](https://courier.com).
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
14
20
|
|
|
15
21
|
```javascript
|
|
16
22
|
import { CourierClient } from "@trycourier/courier";
|
|
@@ -74,6 +80,18 @@ async function run() {
|
|
|
74
80
|
const messageStatus = await courier.getMessage(messageId);
|
|
75
81
|
console.log(messageStatus);
|
|
76
82
|
|
|
83
|
+
// Example: get a message history
|
|
84
|
+
const { results } = await courier.getMessageHistory(messageId);
|
|
85
|
+
console.log(results);
|
|
86
|
+
|
|
87
|
+
// Example: get a message output
|
|
88
|
+
const { results } = await courier.getMessageOutput(messageId);
|
|
89
|
+
console.log(results);
|
|
90
|
+
|
|
91
|
+
// Example: get all messages
|
|
92
|
+
const { paging, results } = await courier.getMessages();
|
|
93
|
+
console.log(results);
|
|
94
|
+
|
|
77
95
|
// Example: replace a recipient's profile
|
|
78
96
|
const { status: replaceStatus } = await courier.replaceProfile({
|
|
79
97
|
recipientId: "<RECIPIENT_ID>",
|
|
@@ -235,6 +253,130 @@ async function run() {
|
|
|
235
253
|
template: "TEMPLATE_NAME_OR_ID",
|
|
236
254
|
});
|
|
237
255
|
console.log(runId);
|
|
256
|
+
|
|
257
|
+
// Example: List notifications
|
|
258
|
+
const { paging, results } = await courier.notifications.list({});
|
|
259
|
+
console.log(results);
|
|
260
|
+
|
|
261
|
+
// Example: Get notification content
|
|
262
|
+
const { blocks, channels } = await courier.notifications.getContent(
|
|
263
|
+
"notification1"
|
|
264
|
+
);
|
|
265
|
+
console.log(blocks);
|
|
266
|
+
console.log(channels);
|
|
267
|
+
|
|
268
|
+
// Example: Get notification draft content
|
|
269
|
+
const { blocks, channels } = await courier.notifications.getDraftContent(
|
|
270
|
+
"notification1"
|
|
271
|
+
);
|
|
272
|
+
console.log(blocks);
|
|
273
|
+
console.log(channels);
|
|
274
|
+
|
|
275
|
+
// Example: Post notification variations
|
|
276
|
+
await courier.notifications.postVariations("notification1", {
|
|
277
|
+
blocks: [
|
|
278
|
+
{
|
|
279
|
+
id: "block_1d4c32e0-bca8-43f6-b5d5-8c043199bce6",
|
|
280
|
+
type: "text",
|
|
281
|
+
locales: {
|
|
282
|
+
fr_FR: "block fr 1",
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
id: "block_6d50a6e3-ecc3-4815-bf51-0202c6bf54e2",
|
|
287
|
+
type: "text",
|
|
288
|
+
locales: {
|
|
289
|
+
fr_FR: "block fr 2",
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
channels: [
|
|
294
|
+
{
|
|
295
|
+
id: "channel_1ba46024-f156-4ed7-893b-cb1cdcfbd36e",
|
|
296
|
+
type: "email",
|
|
297
|
+
locales: {
|
|
298
|
+
fr_FR: {
|
|
299
|
+
subject: "French Subject",
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "channel_2c2aad1c-30f0-4a55-8d8f-d213f32147bc",
|
|
305
|
+
type: "push",
|
|
306
|
+
locales: {
|
|
307
|
+
fr_FR: {
|
|
308
|
+
title: "French Title",
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// Example: Post notification draft variations
|
|
316
|
+
await courier.notifications.postDraftVariations("notification1", {
|
|
317
|
+
blocks: [
|
|
318
|
+
{
|
|
319
|
+
id: "block_1d4c32e0-bca8-43f6-b5d5-8c043199bce6",
|
|
320
|
+
type: "text",
|
|
321
|
+
locales: {
|
|
322
|
+
fr_FR: "block fr 1",
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: "block_6d50a6e3-ecc3-4815-bf51-0202c6bf54e2",
|
|
327
|
+
type: "text",
|
|
328
|
+
locales: {
|
|
329
|
+
fr_FR: "block fr 2",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
channels: [
|
|
334
|
+
{
|
|
335
|
+
id: "channel_1ba46024-f156-4ed7-893b-cb1cdcfbd36e",
|
|
336
|
+
type: "email",
|
|
337
|
+
locales: {
|
|
338
|
+
fr_FR: {
|
|
339
|
+
subject: "French Subject",
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
id: "channel_2c2aad1c-30f0-4a55-8d8f-d213f32147bc",
|
|
345
|
+
type: "push",
|
|
346
|
+
locales: {
|
|
347
|
+
fr_FR: {
|
|
348
|
+
title: "French Title",
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
],
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// Example: Get notification submission checks
|
|
356
|
+
const { checks } = await courier.notifications.getSubmissionChecks(
|
|
357
|
+
"notification1",
|
|
358
|
+
"submission1"
|
|
359
|
+
);
|
|
360
|
+
console.log(checks);
|
|
361
|
+
|
|
362
|
+
// Example: Put notification submission checks
|
|
363
|
+
const { checks } = await courier.notifications.putSubmissionChecks(
|
|
364
|
+
"notification1",
|
|
365
|
+
"submission1",
|
|
366
|
+
{
|
|
367
|
+
checks: [
|
|
368
|
+
{
|
|
369
|
+
id: "check1",
|
|
370
|
+
status: "RESOLVED",
|
|
371
|
+
type: "custom",
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
console.log(checks);
|
|
377
|
+
|
|
378
|
+
// Example: Cancel notification submission
|
|
379
|
+
await courier.notifications.cancelSubmission("notification1", "submission1");
|
|
238
380
|
}
|
|
239
381
|
|
|
240
382
|
run();
|
|
@@ -242,7 +384,7 @@ run();
|
|
|
242
384
|
|
|
243
385
|
### Idempotency
|
|
244
386
|
|
|
245
|
-
For `POST` methods, you can supply an `idempotencyKey` in the config parameter to ensure the idempotency of the API Call. We recommend that you use a `V4 UUID` for the key. Keys are eligible to be removed from the system after they're at least 24 hours old, and a new request is generated if a key is reused after the original has been removed. For more info, see [Idempotent Requests](https://docs.courier.com/reference/idempotent-requests) in the Courier
|
|
387
|
+
For `POST` methods, you can supply an `idempotencyKey` in the config parameter to ensure the idempotency of the API Call. We recommend that you use a `V4 UUID` for the key. Keys are eligible to be removed from the system after they're at least 24 hours old, and a new request is generated if a key is reused after the original has been removed. For more info, see [Idempotent Requests](https://docs.courier.com/reference/idempotent-requests) in the Courier documentation.
|
|
246
388
|
|
|
247
389
|
```javascript
|
|
248
390
|
import { CourierClient } from "@trycourier/courier";
|
package/lib/automations/index.js
CHANGED
|
@@ -38,18 +38,29 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.automations = void 0;
|
|
40
40
|
var invokeAdHocAutomation = function (options) {
|
|
41
|
-
return function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var res;
|
|
41
|
+
return function (params, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var axiosConfig, res;
|
|
43
43
|
return __generator(this, function (_a) {
|
|
44
44
|
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
case 0:
|
|
46
|
+
axiosConfig = {
|
|
47
|
+
headers: {}
|
|
48
|
+
};
|
|
49
|
+
if (config && config.idempotencyKey) {
|
|
50
|
+
axiosConfig.headers["Idempotency-Key"] = config.idempotencyKey;
|
|
51
|
+
}
|
|
52
|
+
if (config && config.idempotencyExpiry) {
|
|
53
|
+
axiosConfig.headers["x-idempotency-expiration"] =
|
|
54
|
+
config.idempotencyExpiry;
|
|
55
|
+
}
|
|
56
|
+
return [4 /*yield*/, options.httpClient.post("/automations/invoke", {
|
|
57
|
+
automation: params.automation,
|
|
58
|
+
brand: params.brand,
|
|
59
|
+
data: params.data,
|
|
60
|
+
profile: params.profile,
|
|
61
|
+
recipient: params.recipient,
|
|
62
|
+
template: params.template
|
|
63
|
+
}, axiosConfig)];
|
|
53
64
|
case 1:
|
|
54
65
|
res = _a.sent();
|
|
55
66
|
return [2 /*return*/, res.data];
|
|
@@ -58,17 +69,26 @@ var invokeAdHocAutomation = function (options) {
|
|
|
58
69
|
}); };
|
|
59
70
|
};
|
|
60
71
|
var invokeAutomationTemplate = function (options) {
|
|
61
|
-
return function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
62
|
-
var res;
|
|
72
|
+
return function (params, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
+
var axiosConfig, res;
|
|
63
74
|
return __generator(this, function (_a) {
|
|
64
75
|
switch (_a.label) {
|
|
65
|
-
case 0:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
case 0:
|
|
77
|
+
axiosConfig = {
|
|
78
|
+
headers: {}
|
|
79
|
+
};
|
|
80
|
+
if (config && config.idempotencyKey) {
|
|
81
|
+
axiosConfig.headers["Idempotency-Key"] = config.idempotencyKey;
|
|
82
|
+
axiosConfig.headers["x-idempotency-expiration"] =
|
|
83
|
+
config.idempotencyExpiry;
|
|
84
|
+
}
|
|
85
|
+
return [4 /*yield*/, options.httpClient.post("/automations/" + params.templateId + "/invoke", {
|
|
86
|
+
brand: params.brand,
|
|
87
|
+
data: params.data,
|
|
88
|
+
profile: params.profile,
|
|
89
|
+
recipient: params.recipient,
|
|
90
|
+
template: params.template
|
|
91
|
+
}, axiosConfig)];
|
|
72
92
|
case 1:
|
|
73
93
|
res = _a.sent();
|
|
74
94
|
return [2 /*return*/, res.data];
|
|
@@ -52,6 +52,10 @@ export interface ICourierAutomationInvokeParams {
|
|
|
52
52
|
export interface ICourierAutomationAdHocInvokeParams extends ICourierAutomationInvokeParams {
|
|
53
53
|
automation: IAutomation;
|
|
54
54
|
}
|
|
55
|
+
export interface ICourierAutomationConfig {
|
|
56
|
+
idempotencyKey?: string;
|
|
57
|
+
idempotencyExpiry?: number;
|
|
58
|
+
}
|
|
55
59
|
export interface ICourierAutomationInvokeTemplateParams extends ICourierAutomationInvokeParams {
|
|
56
60
|
templateId: string;
|
|
57
61
|
}
|
|
@@ -59,6 +63,6 @@ export interface ICourierAutomationInvokeResponse {
|
|
|
59
63
|
runId: string;
|
|
60
64
|
}
|
|
61
65
|
export interface ICourierClientAutomations {
|
|
62
|
-
invokeAdHocAutomation: (params: ICourierAutomationAdHocInvokeParams) => Promise<ICourierAutomationInvokeResponse>;
|
|
63
|
-
invokeAutomationTemplate: (params: ICourierAutomationInvokeTemplateParams) => Promise<ICourierAutomationInvokeResponse>;
|
|
66
|
+
invokeAdHocAutomation: (params: ICourierAutomationAdHocInvokeParams, config?: ICourierAutomationConfig) => Promise<ICourierAutomationInvokeResponse>;
|
|
67
|
+
invokeAutomationTemplate: (params: ICourierAutomationInvokeTemplateParams, config?: ICourierAutomationConfig) => Promise<ICourierAutomationInvokeResponse>;
|
|
64
68
|
}
|
package/lib/client.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.client = void 0;
|
|
|
40
40
|
var automations_1 = require("./automations");
|
|
41
41
|
var brands_1 = require("./brands");
|
|
42
42
|
var lists_1 = require("./lists");
|
|
43
|
+
var notifications_1 = require("./notifications");
|
|
43
44
|
var preferences_1 = require("./preferences");
|
|
44
45
|
var profile_1 = require("./profile");
|
|
45
46
|
var send = function (options) {
|
|
@@ -83,19 +84,71 @@ var getMessage = function (options) {
|
|
|
83
84
|
});
|
|
84
85
|
}); };
|
|
85
86
|
};
|
|
87
|
+
var getMessageHistory = function (options) {
|
|
88
|
+
return function (messageId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
+
var res;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/messages/" + messageId + "/history")];
|
|
93
|
+
case 1:
|
|
94
|
+
res = _a.sent();
|
|
95
|
+
return [2 /*return*/, res.data];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}); };
|
|
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
|
+
};
|
|
113
|
+
var getMessages = function (options) {
|
|
114
|
+
return function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
115
|
+
var res;
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
switch (_a.label) {
|
|
118
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/messages", {
|
|
119
|
+
cursor: params === null || params === void 0 ? void 0 : params.cursor,
|
|
120
|
+
event: params === null || params === void 0 ? void 0 : params.eventId,
|
|
121
|
+
list: params === null || params === void 0 ? void 0 : params.listId,
|
|
122
|
+
messageId: params === null || params === void 0 ? void 0 : params.messageId,
|
|
123
|
+
notification: params === null || params === void 0 ? void 0 : params.notificationId,
|
|
124
|
+
recipient: params === null || params === void 0 ? void 0 : params.recipientId,
|
|
125
|
+
status: params === null || params === void 0 ? void 0 : params.status
|
|
126
|
+
})];
|
|
127
|
+
case 1:
|
|
128
|
+
res = _a.sent();
|
|
129
|
+
return [2 /*return*/, res.data];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); };
|
|
133
|
+
};
|
|
86
134
|
exports.client = function (options) {
|
|
87
135
|
return {
|
|
88
136
|
addRecipientToLists: profile_1.addRecipientToLists(options),
|
|
89
137
|
automations: automations_1.automations(options),
|
|
90
138
|
createBrand: brands_1.createBrand(options),
|
|
91
139
|
deleteBrand: brands_1.deleteBrand(options),
|
|
140
|
+
deleteProfile: profile_1.deleteProfile(options),
|
|
92
141
|
getBrand: brands_1.getBrand(options),
|
|
93
142
|
getBrands: brands_1.getBrands(options),
|
|
94
143
|
getMessage: getMessage(options),
|
|
144
|
+
getMessageHistory: getMessageHistory(options),
|
|
145
|
+
getMessageOutput: getMessageOutput(options),
|
|
146
|
+
getMessages: getMessages(options),
|
|
95
147
|
getProfile: profile_1.getProfile(options),
|
|
96
148
|
getRecipientSubscriptions: profile_1.getRecipientSubscriptions(options),
|
|
97
149
|
lists: lists_1.lists(options),
|
|
98
150
|
mergeProfile: profile_1.mergeProfile(options),
|
|
151
|
+
notifications: notifications_1.notifications(options),
|
|
99
152
|
preferences: preferences_1.preferences(options),
|
|
100
153
|
removeRecipientFromAllLists: profile_1.removeRecipientFromAllLists(options),
|
|
101
154
|
replaceBrand: brands_1.replaceBrand(options),
|
package/lib/lists/types.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export interface ICourierClientLists {
|
|
|
55
55
|
getSubscriptions: (listId: string, params?: ICourierListGetSubscriptionsParams) => Promise<ICourierListGetSubscriptionsResponse>;
|
|
56
56
|
list: (params?: ICourierListGetAllParams) => Promise<ICourierListGetAllResponse>;
|
|
57
57
|
postSubscriptions: (listId: string, recipients: ICourierPutSubscriptionsRecipient[]) => Promise<void>;
|
|
58
|
-
put: (listId: string,
|
|
58
|
+
put: (listId: string, params: ICourierListPutParams) => Promise<void>;
|
|
59
59
|
putSubscriptions: (listId: string, recipients: ICourierPutSubscriptionsRecipient[]) => Promise<void>;
|
|
60
60
|
restore: (listId: string) => Promise<void>;
|
|
61
61
|
send: (params: ICourierSendListOrPatternParams, config?: ICourierSendConfig) => Promise<ICourierSendResponse>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.notifications = void 0;
|
|
40
|
+
var list = function (options) {
|
|
41
|
+
return function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var res;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/notifications", params)];
|
|
46
|
+
case 1:
|
|
47
|
+
res = _a.sent();
|
|
48
|
+
return [2 /*return*/, res.data];
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}); };
|
|
52
|
+
};
|
|
53
|
+
var getContent = function (options) {
|
|
54
|
+
return function (id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var res;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/notifications/" + id + "/content")];
|
|
59
|
+
case 1:
|
|
60
|
+
res = _a.sent();
|
|
61
|
+
return [2 /*return*/, res.data];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}); };
|
|
65
|
+
};
|
|
66
|
+
var getDraftContent = function (options) {
|
|
67
|
+
return function (id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
|
+
var res;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/notifications/" + id + "/draft/content")];
|
|
72
|
+
case 1:
|
|
73
|
+
res = _a.sent();
|
|
74
|
+
return [2 /*return*/, res.data];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
};
|
|
79
|
+
var postVariations = function (options) {
|
|
80
|
+
return function (id, params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0: return [4 /*yield*/, options.httpClient.post("/notifications/" + id + "/variations", params)];
|
|
84
|
+
case 1:
|
|
85
|
+
_a.sent();
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}); };
|
|
90
|
+
};
|
|
91
|
+
var postDraftVariations = function (options) {
|
|
92
|
+
return function (id, params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0: return [4 /*yield*/, options.httpClient.post("/notifications/" + id + "/draft/variations", params)];
|
|
96
|
+
case 1:
|
|
97
|
+
_a.sent();
|
|
98
|
+
return [2 /*return*/];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}); };
|
|
102
|
+
};
|
|
103
|
+
var getSubmissionChecks = function (options) {
|
|
104
|
+
return function (id, submissionId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
105
|
+
var res;
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/notifications/" + id + "/" + submissionId + "/checks")];
|
|
109
|
+
case 1:
|
|
110
|
+
res = _a.sent();
|
|
111
|
+
return [2 /*return*/, res.data];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}); };
|
|
115
|
+
};
|
|
116
|
+
var putSubmissionChecks = function (options) {
|
|
117
|
+
return function (id, submissionId, params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
+
var res;
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0: return [4 /*yield*/, options.httpClient.put("/notifications/" + id + "/" + submissionId + "/checks", params)];
|
|
122
|
+
case 1:
|
|
123
|
+
res = _a.sent();
|
|
124
|
+
return [2 /*return*/, res.data];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}); };
|
|
128
|
+
};
|
|
129
|
+
var cancelSubmission = function (options) {
|
|
130
|
+
return function (id, submissionId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
|
+
case 0: return [4 /*yield*/, options.httpClient.delete("/notifications/" + id + "/" + submissionId + "/checks")];
|
|
134
|
+
case 1:
|
|
135
|
+
_a.sent();
|
|
136
|
+
return [2 /*return*/];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}); };
|
|
140
|
+
};
|
|
141
|
+
exports.notifications = function (options) {
|
|
142
|
+
return {
|
|
143
|
+
cancelSubmission: cancelSubmission(options),
|
|
144
|
+
getContent: getContent(options),
|
|
145
|
+
getDraftContent: getDraftContent(options),
|
|
146
|
+
getSubmissionChecks: getSubmissionChecks(options),
|
|
147
|
+
list: list(options),
|
|
148
|
+
postDraftVariations: postDraftVariations(options),
|
|
149
|
+
postVariations: postVariations(options),
|
|
150
|
+
putSubmissionChecks: putSubmissionChecks(options)
|
|
151
|
+
};
|
|
152
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ICourierPaging } from "../types";
|
|
2
|
+
export interface ICourierNotificationListResponse {
|
|
3
|
+
paging: ICourierPaging;
|
|
4
|
+
results: Array<{
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export interface ICourierNotificationListParams {
|
|
10
|
+
cursor?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare type BlockType = "action" | "divider" | "image" | "jsonnet" | "list" | "markdown" | "quote" | "template" | "text";
|
|
13
|
+
export interface ICourierNotificationBlock {
|
|
14
|
+
alias?: string;
|
|
15
|
+
context?: string;
|
|
16
|
+
id: string;
|
|
17
|
+
type: BlockType;
|
|
18
|
+
content?: string | {
|
|
19
|
+
parent?: string;
|
|
20
|
+
children?: string;
|
|
21
|
+
};
|
|
22
|
+
locales?: {
|
|
23
|
+
[locale: string]: string | {
|
|
24
|
+
parent?: string;
|
|
25
|
+
children?: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
checksum?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ICourierNotificationChannel {
|
|
31
|
+
id: string;
|
|
32
|
+
type?: string;
|
|
33
|
+
content?: {
|
|
34
|
+
subject?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
};
|
|
37
|
+
locales?: {
|
|
38
|
+
[locale: string]: {
|
|
39
|
+
subject?: string;
|
|
40
|
+
title?: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
checksum?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ICourierNotificationGetContentResponse {
|
|
46
|
+
blocks?: ICourierNotificationBlock[];
|
|
47
|
+
channels?: ICourierNotificationChannel[];
|
|
48
|
+
checksum?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ICourierNotificationPostVariationsParams {
|
|
51
|
+
blocks?: ICourierNotificationBlock[];
|
|
52
|
+
channels?: ICourierNotificationChannel[];
|
|
53
|
+
}
|
|
54
|
+
export interface ICourierNotificationPostDraftVariationsParams {
|
|
55
|
+
blocks?: ICourierNotificationBlock[];
|
|
56
|
+
channels?: ICourierNotificationChannel[];
|
|
57
|
+
}
|
|
58
|
+
export declare type CheckStatus = "RESOLVED" | "FAILED" | "PENDING";
|
|
59
|
+
export interface ICheck {
|
|
60
|
+
id: string;
|
|
61
|
+
status: CheckStatus;
|
|
62
|
+
type: "custom";
|
|
63
|
+
updated: number;
|
|
64
|
+
}
|
|
65
|
+
export interface ICourierNotificationGetSubmissionChecksResponse {
|
|
66
|
+
checks: ICheck[];
|
|
67
|
+
}
|
|
68
|
+
export interface ICourierNotificationPutSubmissionChecksParams {
|
|
69
|
+
checks: Array<Omit<ICheck, "updated">>;
|
|
70
|
+
}
|
|
71
|
+
export interface ICourierNotificationPutSubmissionChecksResponse {
|
|
72
|
+
checks: ICheck[];
|
|
73
|
+
}
|
|
74
|
+
export interface ICourierClientNotifications {
|
|
75
|
+
list: (params: ICourierNotificationListParams) => Promise<ICourierNotificationListResponse>;
|
|
76
|
+
getContent: (id: string) => Promise<ICourierNotificationGetContentResponse>;
|
|
77
|
+
getDraftContent: (id: string) => Promise<ICourierNotificationGetContentResponse>;
|
|
78
|
+
postVariations: (id: string, params: ICourierNotificationPostVariationsParams) => Promise<void>;
|
|
79
|
+
postDraftVariations: (id: string, params: ICourierNotificationPostDraftVariationsParams) => Promise<void>;
|
|
80
|
+
getSubmissionChecks: (id: string, submissionId: string) => Promise<ICourierNotificationGetSubmissionChecksResponse>;
|
|
81
|
+
putSubmissionChecks: (id: string, submissionId: string, params: ICourierNotificationPutSubmissionChecksParams) => Promise<ICourierNotificationPutSubmissionChecksResponse>;
|
|
82
|
+
cancelSubmission: (id: string, submissionId: string) => Promise<void>;
|
|
83
|
+
}
|
package/lib/profile.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ICourierList } from "./lists/types";
|
|
2
|
-
import { ICourierClientConfiguration, ICourierProfileGetParameters, ICourierProfileGetResponse, ICourierProfileListsPostParameters, ICourierProfilePostConfig, ICourierProfilePostParameters, ICourierProfilePostResponse, ICourierProfilePutParameters, ICourierProfilePutResponse } from "./types";
|
|
2
|
+
import { ICourierClientConfiguration, ICourierProfileDeleteParameters, ICourierProfileGetParameters, ICourierProfileGetResponse, ICourierProfileListsPostParameters, ICourierProfilePostConfig, ICourierProfilePostParameters, ICourierProfilePostResponse, ICourierProfilePutParameters, ICourierProfilePutResponse } from "./types";
|
|
3
3
|
export declare const replaceProfile: (options: ICourierClientConfiguration) => (params: ICourierProfilePutParameters) => Promise<ICourierProfilePutResponse>;
|
|
4
4
|
export declare const mergeProfile: (options: ICourierClientConfiguration) => (params: ICourierProfilePostParameters, config?: ICourierProfilePostConfig | undefined) => Promise<ICourierProfilePostResponse>;
|
|
5
5
|
export declare const getProfile: (options: ICourierClientConfiguration) => (params: ICourierProfileGetParameters) => Promise<ICourierProfileGetResponse>;
|
|
6
|
+
export declare const deleteProfile: (options: ICourierClientConfiguration) => (params: ICourierProfileDeleteParameters) => Promise<void>;
|
|
6
7
|
export declare const getRecipientSubscriptions: (options: ICourierClientConfiguration) => (params: ICourierProfileGetParameters) => Promise<ICourierList[]>;
|
|
7
8
|
export declare const addRecipientToLists: (options: ICourierClientConfiguration) => (params: ICourierProfileListsPostParameters) => Promise<ICourierProfilePostResponse>;
|
|
8
9
|
export declare const removeRecipientFromAllLists: (options: ICourierClientConfiguration) => (params: ICourierProfileGetParameters) => Promise<ICourierProfilePostResponse>;
|
package/lib/profile.js
CHANGED
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.removeRecipientFromAllLists = exports.addRecipientToLists = exports.getRecipientSubscriptions = exports.getProfile = exports.mergeProfile = exports.replaceProfile = void 0;
|
|
39
|
+
exports.removeRecipientFromAllLists = exports.addRecipientToLists = exports.getRecipientSubscriptions = exports.deleteProfile = exports.getProfile = exports.mergeProfile = exports.replaceProfile = void 0;
|
|
40
40
|
exports.replaceProfile = function (options) {
|
|
41
41
|
return function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
42
|
var res;
|
|
@@ -87,6 +87,18 @@ exports.getProfile = function (options) {
|
|
|
87
87
|
});
|
|
88
88
|
}); };
|
|
89
89
|
};
|
|
90
|
+
exports.deleteProfile = function (options) {
|
|
91
|
+
return function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4 /*yield*/, options.httpClient.delete("/profiles/" + params.recipientId)];
|
|
95
|
+
case 1:
|
|
96
|
+
_a.sent();
|
|
97
|
+
return [2 /*return*/];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}); };
|
|
101
|
+
};
|
|
90
102
|
exports.getRecipientSubscriptions = function (options) {
|
|
91
103
|
return function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
104
|
var res;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from "axios";
|
|
2
2
|
import { ICourierClientAutomations } from "./automations/types";
|
|
3
3
|
import { ICourierClientLists, ICourierList } from "./lists/types";
|
|
4
|
+
import { ICourierClientNotifications } from "./notifications/types";
|
|
4
5
|
import { ICourierClientPreferences, IRecipientPreferences } from "./preferences/types";
|
|
5
6
|
export declare type HttpMethodClient = <T>(url: string, body?: object, config?: AxiosRequestConfig) => Promise<{
|
|
6
7
|
data: T;
|
|
@@ -78,6 +79,27 @@ export interface ICourierProfileGetParameters {
|
|
|
78
79
|
export interface ICourierProfileGetResponse {
|
|
79
80
|
profile: object;
|
|
80
81
|
}
|
|
82
|
+
export interface ICourierMessagesGetParameters {
|
|
83
|
+
cursor?: string;
|
|
84
|
+
eventId?: string;
|
|
85
|
+
listId?: string;
|
|
86
|
+
messageId?: string;
|
|
87
|
+
notificationId?: string;
|
|
88
|
+
recipientId?: string;
|
|
89
|
+
status?: string | string[];
|
|
90
|
+
}
|
|
91
|
+
export interface ICourierMessagesGetResponse {
|
|
92
|
+
paging: ICourierPaging;
|
|
93
|
+
results: Array<{
|
|
94
|
+
enqueued?: number;
|
|
95
|
+
event?: string;
|
|
96
|
+
id: string;
|
|
97
|
+
notification?: string;
|
|
98
|
+
recipient: string;
|
|
99
|
+
sent?: number;
|
|
100
|
+
status: string;
|
|
101
|
+
}>;
|
|
102
|
+
}
|
|
81
103
|
export interface ICourierMessageGetResponse {
|
|
82
104
|
enqueued?: number;
|
|
83
105
|
event?: string;
|
|
@@ -99,6 +121,91 @@ export interface ICourierMessageGetResponse {
|
|
|
99
121
|
sent?: number;
|
|
100
122
|
status: string;
|
|
101
123
|
}
|
|
124
|
+
export declare type MessageStatus = "CLICKED" | "DELIVERED" | "ENQUEUED" | "FILTERED" | "OPENED" | "SENT" | "SIMULATED" | "UNDELIVERABLE" | "UNMAPPED";
|
|
125
|
+
export declare type MessageHistoryType = MessageStatus | "DELIVERING" | "FILTERED" | "MAPPED" | "PROFILE_LOADED" | "RENDERED";
|
|
126
|
+
export declare type MessageStatusReason = "BOUNCED" | "FAILED" | "FILTERED" | "NO_CHANNELS" | "NO_PROVIDERS" | "OPT_IN_REQUIRED" | "PROVIDER_ERROR" | "UNPUBLISHED" | "UNSUBSCRIBED";
|
|
127
|
+
export declare type MessageStatusReasonCode = "HARD" | "SOFT";
|
|
128
|
+
export interface IMessageHistory<T extends MessageHistoryType> {
|
|
129
|
+
ts: number;
|
|
130
|
+
type: T;
|
|
131
|
+
}
|
|
132
|
+
export interface IEnqueuedMessageHistory extends IMessageHistory<"ENQUEUED"> {
|
|
133
|
+
data?: string | {
|
|
134
|
+
[key: string]: string;
|
|
135
|
+
};
|
|
136
|
+
event: string;
|
|
137
|
+
profile?: {
|
|
138
|
+
[key: string]: any;
|
|
139
|
+
};
|
|
140
|
+
override?: {
|
|
141
|
+
[key: string]: any;
|
|
142
|
+
};
|
|
143
|
+
recipient: string;
|
|
144
|
+
}
|
|
145
|
+
export interface IMappedMessageHistory extends IMessageHistory<"MAPPED"> {
|
|
146
|
+
event_id: string;
|
|
147
|
+
notification_id: string;
|
|
148
|
+
}
|
|
149
|
+
export interface IProfileLoadedMessageHistory extends IMessageHistory<"PROFILE_LOADED"> {
|
|
150
|
+
merged_profile?: {
|
|
151
|
+
[key: string]: any;
|
|
152
|
+
};
|
|
153
|
+
received_profile?: {
|
|
154
|
+
[key: string]: any;
|
|
155
|
+
};
|
|
156
|
+
stored_profile?: {
|
|
157
|
+
[key: string]: any;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
export interface IRenderedMessageHistory extends IRoutedMessageHistory<"RENDERED"> {
|
|
161
|
+
output: {
|
|
162
|
+
[key: string]: string;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export interface IUndeliverableMessageHistory extends IMessageHistory<"UNDELIVERABLE">, Partial<Omit<IRoutedMessageHistory<"UNDELIVERABLE">, "ts" | "type">> {
|
|
166
|
+
reason: MessageStatusReason;
|
|
167
|
+
reasonCode?: MessageStatusReasonCode;
|
|
168
|
+
}
|
|
169
|
+
export declare type RoutedMessageHistoryTypes = Extract<MessageHistoryType, "CLICKED" | "DELIVERED" | "DELIVERING" | "OPENED" | "RENDERED" | "SENT" | "UNDELIVERABLE">;
|
|
170
|
+
export interface IRoutedMessageHistory<T extends RoutedMessageHistoryTypes> extends IMessageHistory<T> {
|
|
171
|
+
channel: {
|
|
172
|
+
id: string;
|
|
173
|
+
label?: string;
|
|
174
|
+
};
|
|
175
|
+
integration: {
|
|
176
|
+
id: string;
|
|
177
|
+
provider: string;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
export interface IDeliveredMessageHistory extends IRoutedMessageHistory<"DELIVERED"> {
|
|
181
|
+
reference: {
|
|
182
|
+
[key: string]: string;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export interface IProviderErrorMessageHistory extends IRoutedMessageHistory<"UNDELIVERABLE"> {
|
|
186
|
+
error_message: string;
|
|
187
|
+
}
|
|
188
|
+
export interface ICourierMessageGetHistoryResponse {
|
|
189
|
+
results: Array<IEnqueuedMessageHistory | IMappedMessageHistory | IProfileLoadedMessageHistory | IRenderedMessageHistory | IRoutedMessageHistory<RoutedMessageHistoryTypes> | IDeliveredMessageHistory | IProviderErrorMessageHistory | IUndeliverableMessageHistory>;
|
|
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
|
+
}
|
|
206
|
+
export interface ICourierProfileDeleteParameters {
|
|
207
|
+
recipientId: string;
|
|
208
|
+
}
|
|
102
209
|
interface ICourierBrandSettings {
|
|
103
210
|
colors?: {
|
|
104
211
|
primary: string;
|
|
@@ -157,10 +264,15 @@ export interface ICourierClient {
|
|
|
157
264
|
cursor: string;
|
|
158
265
|
}) => Promise<ICourierBrandGetAllResponse>;
|
|
159
266
|
getMessage: (messageId: string) => Promise<ICourierMessageGetResponse>;
|
|
267
|
+
getMessageHistory: (messageId: string) => Promise<ICourierMessageGetHistoryResponse>;
|
|
268
|
+
getMessageOutput: (messageId: string) => Promise<ICourierMessageGetOutputResponse>;
|
|
269
|
+
getMessages: (params?: ICourierMessagesGetParameters) => Promise<ICourierMessagesGetResponse>;
|
|
160
270
|
getProfile: (params: ICourierProfileGetParameters) => Promise<ICourierProfileGetResponse>;
|
|
271
|
+
deleteProfile: (params: ICourierProfileDeleteParameters) => Promise<void>;
|
|
161
272
|
getRecipientSubscriptions: (params: ICourierProfileGetParameters) => Promise<ICourierList[]>;
|
|
162
273
|
lists: ICourierClientLists;
|
|
163
274
|
mergeProfile: (params: ICourierProfilePostParameters, config?: ICourierProfilePostConfig) => Promise<ICourierProfilePostResponse>;
|
|
275
|
+
notifications: ICourierClientNotifications;
|
|
164
276
|
preferences: ICourierClientPreferences;
|
|
165
277
|
removeRecipientFromAllLists: (params: ICourierProfileGetParameters) => Promise<ICourierProfilePostResponse>;
|
|
166
278
|
replaceBrand: (params: ICourierBrandPutParameters) => Promise<ICourierBrand>;
|