shred-api-client 1.13.0 → 1.13.2

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.
@@ -6,6 +6,7 @@ declare class NotificationAPI implements NotificationSchema {
6
6
  private env;
7
7
  private clientHTTP;
8
8
  constructor(env: Environment);
9
+ clearNotifications(ctx: Context): Promise<boolean>;
9
10
  markAsRead(ctx: Context, id: string): Promise<boolean>;
10
11
  getNotifications(ctx: Context): Promise<APIResponse<NotificationItem>>;
11
12
  deleteTrigger(ctx: Context, triggerId: string): Promise<boolean>;
@@ -10,6 +10,11 @@ class NotificationAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
+ async clearNotifications(ctx) {
14
+ const endpointData = Notification_schema_1.NotificationEndpoints.ClearNotifications;
15
+ const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, null, ctx);
16
+ return data;
17
+ }
13
18
  async markAsRead(ctx, id) {
14
19
  const endpointData = Notification_schema_1.NotificationEndpoints.MarkAsRead;
15
20
  const endpoint = endpointData.uri.replace(":id", id);
@@ -9,6 +9,7 @@ interface NotificationSchema {
9
9
  push: (context: Context, notification: NotificationDetail) => Promise<boolean>;
10
10
  getNotifications: (ctx: Context) => Promise<APIResponse<NotificationItem>>;
11
11
  markAsRead: (ctx: Context, id: string) => Promise<boolean>;
12
+ clearNotifications: (ctx: Context) => Promise<boolean>;
12
13
  }
13
14
  declare const NotificationEndpoints: {
14
15
  Create: {
@@ -39,6 +40,10 @@ declare const NotificationEndpoints: {
39
40
  uri: string;
40
41
  method: string;
41
42
  };
43
+ ClearNotifications: {
44
+ uri: string;
45
+ method: string;
46
+ };
42
47
  };
43
48
  type Criteria = {
44
49
  type: Notification.CriteriaType;
@@ -92,9 +97,14 @@ type NotificationItem = {
92
97
  triggerId?: string;
93
98
  title: string;
94
99
  body: string;
95
- status: "failed" | "delivered";
100
+ status: "failed" | "delivered" | "deleted";
96
101
  deliveredAt: number;
97
102
  openedAt?: number;
103
+ deletedAt?: number;
104
+ cta?: {
105
+ label: string;
106
+ url: string;
107
+ };
98
108
  metadata: Record<string, string | number>;
99
109
  error?: string;
100
110
  };
@@ -30,5 +30,9 @@ const NotificationEndpoints = {
30
30
  uri: "/notifications/:id/read/",
31
31
  method: "PUT",
32
32
  },
33
+ ClearNotifications: {
34
+ uri: "/notifications/clear/",
35
+ method: "DELETE",
36
+ },
33
37
  };
34
38
  exports.NotificationEndpoints = NotificationEndpoints;
@@ -82,7 +82,8 @@ declare enum Role {
82
82
  USER = "User",
83
83
  EDITOR = "Editor",
84
84
  QA = "QA",
85
- ADMIN = "ADMIN"
85
+ ADMIN = "ADMIN",
86
+ SYSTEM = "SYSTEM"
86
87
  }
87
88
  declare enum System {
88
89
  APP = "APP",
@@ -70,6 +70,7 @@ var Role;
70
70
  Role["EDITOR"] = "Editor";
71
71
  Role["QA"] = "QA";
72
72
  Role["ADMIN"] = "ADMIN";
73
+ Role["SYSTEM"] = "SYSTEM";
73
74
  })(Role || (exports.Role = Role = {}));
74
75
  var System;
75
76
  (function (System) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",