shred-api-client 1.13.0 → 1.13.1
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
|
};
|