@trycourier/courier 5.4.0 → 5.6.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/README.md CHANGED
@@ -748,6 +748,7 @@ const { audienceId } = await courier.audiences.put({
748
748
  // To retrieve list of members in a given audience, you can use the following:
749
749
  const { items: audienceMembers } = await courier.audiences.listMembers(
750
750
  audienceId
751
+ cursor: "<CURSOR>", // optional
751
752
  );
752
753
 
753
754
  // To send a notification to all users that match the given filter criteria, you can use the following:
@@ -3,7 +3,11 @@ import * as AudienceTypes from "./types";
3
3
  export declare const audiences: (options: ICourierClientConfiguration) => {
4
4
  delete: (audienceId: string) => Promise<void>;
5
5
  get: (audienceId: string) => Promise<AudienceTypes.IAudience>;
6
- listAudiences: () => Promise<AudienceTypes.IAudienceListResponse>;
7
- listMembers: (audienceId: string) => Promise<AudienceTypes.IAudienceMemberListResponse>;
6
+ listAudiences: (params?: {
7
+ cursor: string;
8
+ } | undefined) => Promise<AudienceTypes.IAudienceListResponse>;
9
+ listMembers: (audienceId: string, params?: {
10
+ cursor: string;
11
+ } | undefined) => Promise<AudienceTypes.IAudienceMemberListResponse>;
8
12
  put: (audience: Omit<AudienceTypes.IAudience, "created_at" | "updated_at">) => Promise<AudienceTypes.IAudience>;
9
13
  };
@@ -61,11 +61,11 @@ var getAudience = function (options) {
61
61
  }); };
62
62
  };
63
63
  var listAudiences = function (options) {
64
- return function () { return __awaiter(void 0, void 0, void 0, function () {
64
+ return function (params) { return __awaiter(void 0, void 0, void 0, function () {
65
65
  var response;
66
66
  return __generator(this, function (_a) {
67
67
  switch (_a.label) {
68
- case 0: return [4 /*yield*/, options.httpClient.get("/audiences")];
68
+ case 0: return [4 /*yield*/, options.httpClient.get("/audiences", params)];
69
69
  case 1:
70
70
  response = _a.sent();
71
71
  return [2 /*return*/, response.data];
@@ -74,11 +74,11 @@ var listAudiences = function (options) {
74
74
  }); };
75
75
  };
76
76
  var listMembers = function (options) {
77
- return function (audienceId) { return __awaiter(void 0, void 0, void 0, function () {
77
+ return function (audienceId, params) { return __awaiter(void 0, void 0, void 0, function () {
78
78
  var response;
79
79
  return __generator(this, function (_a) {
80
80
  switch (_a.label) {
81
- case 0: return [4 /*yield*/, options.httpClient.get("/audiences/" + audienceId + "/members")];
81
+ case 0: return [4 /*yield*/, options.httpClient.get("/audiences/" + audienceId + "/members", params)];
82
82
  case 1:
83
83
  response = _a.sent();
84
84
  return [2 /*return*/, response.data];
@@ -54,8 +54,12 @@ export interface IAudiencePutResponse {
54
54
  export interface ICourierClientAudiences {
55
55
  delete: (id: string) => Promise<void>;
56
56
  get: (id: string) => Promise<IAudience>;
57
- listAudiences: () => Promise<IAudienceListResponse>;
58
- listMembers: (id: string) => Promise<IAudienceMemberListResponse>;
57
+ listAudiences: (params?: {
58
+ cursor: string;
59
+ }) => Promise<IAudienceListResponse>;
60
+ listMembers: (id: string, params?: {
61
+ cursor: string;
62
+ }) => Promise<IAudienceMemberListResponse>;
59
63
  put: (audience: Omit<IAudience, "created_at" | "updated_at">) => Promise<IAudience>;
60
64
  }
61
65
  export {};
@@ -169,6 +169,9 @@ export interface MessageContext {
169
169
  }
170
170
  export interface MessageData extends Record<string, any> {
171
171
  }
172
+ export interface MessageDelay {
173
+ duration?: number;
174
+ }
172
175
  export declare type RuleType = "snooze" | "channel_preferences" | "status";
173
176
  export interface IRule<T extends RuleType> {
174
177
  type: T;
@@ -275,6 +278,7 @@ export interface BaseMessage {
275
278
  channels?: MessageChannels;
276
279
  context?: MessageContext;
277
280
  data?: MessageData;
281
+ delay?: MessageDelay;
278
282
  metadata?: MessageMetadata;
279
283
  providers?: MessageProviders;
280
284
  routing?: Routing;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/courier",
3
- "version": "5.4.0",
3
+ "version": "5.6.0",
4
4
  "description": "A node.js module for communicating with the Courier REST API.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",