@foru-ms/sdk 1.3.0 → 1.3.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.
- package/README.md +11 -8
- package/dist/resources/Notifications.d.ts +3 -3
- package/dist/resources/Notifications.js +2 -2
- package/dist/resources/PrivateMessages.d.ts +1 -1
- package/dist/resources/Reports.d.ts +4 -4
- package/dist/resources/Reports.js +2 -2
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
- package/src/resources/Notifications.ts +4 -4
- package/src/resources/PrivateMessages.ts +1 -1
- package/src/resources/Reports.ts +5 -5
- package/src/types.ts +3 -3
package/README.md
CHANGED
|
@@ -301,12 +301,12 @@ Check the `/examples` directory for detailed examples:
|
|
|
301
301
|
|
|
302
302
|
### Notifications (`client.notifications`)
|
|
303
303
|
|
|
304
|
-
* `list(params?: { userId?: string;
|
|
304
|
+
* `list(params?: { userId?: string; status?: string; filter?: 'newest' | 'oldest'; cursor?: string; limit?: number })`: List notifications for a user. `limit` controls page size (1-50, default: 15).
|
|
305
305
|
* `create(payload: { threadId?: string; postId?: string; privateMessageId?: string; notifierId?: string; notifiedId: string; type: string; description?: string; extendedData?: Record<string, any> })`: Create a notification manually.
|
|
306
306
|
* `retrieve(id: string, userId?: string)`: Get a notification by ID.
|
|
307
|
-
* `update(id: string, payload: { userId?: string;
|
|
307
|
+
* `update(id: string, payload: { userId?: string; status: string })`: Update a notification's status.
|
|
308
308
|
* `delete(id: string, userId?: string)`: Delete a notification.
|
|
309
|
-
* `markAllAsRead(userId?: string,
|
|
309
|
+
* `markAllAsRead(userId?: string, status?: string)`: Bulk update status for all of a user's notifications. Default status is `'read'`.
|
|
310
310
|
|
|
311
311
|
### Search (`client.search`)
|
|
312
312
|
|
|
@@ -343,17 +343,17 @@ Check the `/examples` directory for detailed examples:
|
|
|
343
343
|
* `create(payload: { title?: string; body: string; recipientId: string; senderId?: string; extendedData?: Record<string, any> })`: Send a new private message.
|
|
344
344
|
* `retrieve(id: string, userId?: string)`: Get a message by ID.
|
|
345
345
|
* `reply(id: string, payload: { body: string; senderId?: string; title?: string; extendedData?: Record<string, any> })`: Reply to a message thread.
|
|
346
|
-
* `update(id: string, payload: { body?: string; extendedData?: Record<string, any> })`: Update a message (only sender can update).
|
|
346
|
+
* `update(id: string, payload: { status?: string; body?: string; extendedData?: Record<string, any> })`: Update a message (only sender can update).
|
|
347
347
|
* `delete(id: string)`: Delete a message (participants can delete).
|
|
348
348
|
|
|
349
349
|
### Reports (`client.reports`)
|
|
350
350
|
|
|
351
|
-
* `list(params?: { reporterId?: string; reportedId?: string;
|
|
351
|
+
* `list(params?: { reporterId?: string; reportedId?: string; status?: string; cursor?: string; filter?: 'newest' | 'oldest'; limit?: number })`: List reports with filtering options. `limit` controls page size (1-50, default: 15).
|
|
352
352
|
* `create(payload: { reporterId?: string; reportedId?: string; threadId?: string; postId?: string; privateMessageId?: string; type?: string; description?: string; extendedData?: Record<string, any> })`: Submit a new report.
|
|
353
353
|
* `retrieve(id: string)`: Get a report by ID.
|
|
354
|
-
* `update(id: string, payload: { threadId?: string; postId?: string; privateMessageId?: string; reportedId?: string; reporterId?: string; type?: string; description?: string;
|
|
355
|
-
* `updateStatus(id: string,
|
|
356
|
-
* `batchUpdate(payload: { reportIds: string[];
|
|
354
|
+
* `update(id: string, payload: { threadId?: string; postId?: string; privateMessageId?: string; reportedId?: string; reporterId?: string; type?: string; description?: string; status?: string; extendedData?: Record<string, any> })`: Update report details (full update).
|
|
355
|
+
* `updateStatus(id: string, status: string)`: Update status of a report (partial update).
|
|
356
|
+
* `batchUpdate(payload: { reportIds: string[]; status: string })`: Bulk update status for multiple reports.
|
|
357
357
|
* `delete(id: string)`: Delete a report.
|
|
358
358
|
|
|
359
359
|
### Roles (`client.roles`)
|
|
@@ -553,6 +553,9 @@ We welcome contributions! Please see our contributing guidelines for more inform
|
|
|
553
553
|
|
|
554
554
|
## Changelog
|
|
555
555
|
|
|
556
|
+
### v1.3.1
|
|
557
|
+
- Updated Notifications, PrivateMessages, Reports to use `status` (string) instead of `read` (boolean)
|
|
558
|
+
|
|
556
559
|
### v1.3.0
|
|
557
560
|
- Added Auth resource, authentication example, and related types
|
|
558
561
|
|
|
@@ -5,17 +5,17 @@ export declare class NotificationsResource {
|
|
|
5
5
|
constructor(client: ForumClient);
|
|
6
6
|
list(params?: {
|
|
7
7
|
userId?: string;
|
|
8
|
-
|
|
8
|
+
status?: string;
|
|
9
9
|
filter?: 'newest' | 'oldest';
|
|
10
10
|
cursor?: string;
|
|
11
11
|
limit?: number;
|
|
12
12
|
}): Promise<NotificationListResponse>;
|
|
13
|
-
markAllAsRead(userId?: string,
|
|
13
|
+
markAllAsRead(userId?: string, status?: string): Promise<{
|
|
14
14
|
count: number;
|
|
15
15
|
}>;
|
|
16
16
|
retrieve(id: string): Promise<Notification>;
|
|
17
17
|
update(id: string, payload: {
|
|
18
|
-
|
|
18
|
+
status: string;
|
|
19
19
|
}): Promise<Notification>;
|
|
20
20
|
delete(id: string): Promise<Notification & {
|
|
21
21
|
deleted: boolean;
|
|
@@ -18,10 +18,10 @@ class NotificationsResource {
|
|
|
18
18
|
method: 'GET',
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
async markAllAsRead(userId,
|
|
21
|
+
async markAllAsRead(userId, status = 'read') {
|
|
22
22
|
return this.client.request('/notifications', {
|
|
23
23
|
method: 'PATCH',
|
|
24
|
-
body: JSON.stringify({ userId,
|
|
24
|
+
body: JSON.stringify({ userId, status }),
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
async retrieve(id) {
|
|
@@ -25,7 +25,7 @@ export declare class PrivateMessagesResource {
|
|
|
25
25
|
extendedData?: Record<string, any>;
|
|
26
26
|
}): Promise<PrivateMessage>;
|
|
27
27
|
update(id: string, payload: {
|
|
28
|
-
|
|
28
|
+
status?: string;
|
|
29
29
|
extendedData?: Record<string, any>;
|
|
30
30
|
}): Promise<PrivateMessage>;
|
|
31
31
|
delete(id: string): Promise<PrivateMessage & {
|
|
@@ -6,7 +6,7 @@ export declare class ReportsResource {
|
|
|
6
6
|
list(params?: {
|
|
7
7
|
reporterId?: string;
|
|
8
8
|
reportedId?: string;
|
|
9
|
-
|
|
9
|
+
status?: string;
|
|
10
10
|
cursor?: string;
|
|
11
11
|
filter?: 'newest' | 'oldest';
|
|
12
12
|
limit?: number;
|
|
@@ -23,7 +23,7 @@ export declare class ReportsResource {
|
|
|
23
23
|
}): Promise<Report>;
|
|
24
24
|
batchUpdate(payload: {
|
|
25
25
|
reportIds: string[];
|
|
26
|
-
|
|
26
|
+
status: string;
|
|
27
27
|
}): Promise<{
|
|
28
28
|
count?: number;
|
|
29
29
|
message?: string;
|
|
@@ -37,11 +37,11 @@ export declare class ReportsResource {
|
|
|
37
37
|
reporterId?: string;
|
|
38
38
|
type?: string;
|
|
39
39
|
description?: string;
|
|
40
|
-
|
|
40
|
+
status?: string;
|
|
41
41
|
extendedData?: Record<string, any>;
|
|
42
42
|
}): Promise<Report>;
|
|
43
43
|
delete(id: string): Promise<Report & {
|
|
44
44
|
deleted: boolean;
|
|
45
45
|
}>;
|
|
46
|
-
updateStatus(id: string,
|
|
46
|
+
updateStatus(id: string, status: string): Promise<Report>;
|
|
47
47
|
}
|
|
@@ -46,10 +46,10 @@ class ReportsResource {
|
|
|
46
46
|
method: 'DELETE',
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
async updateStatus(id,
|
|
49
|
+
async updateStatus(id, status) {
|
|
50
50
|
return this.client.request(`/report/${id}`, {
|
|
51
51
|
method: 'PATCH',
|
|
52
|
-
body: JSON.stringify({
|
|
52
|
+
body: JSON.stringify({ status }),
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export interface Notification {
|
|
|
160
160
|
notifiedId: string;
|
|
161
161
|
type: string;
|
|
162
162
|
description?: string;
|
|
163
|
-
|
|
163
|
+
status: string;
|
|
164
164
|
createdAt: string;
|
|
165
165
|
extendedData?: Record<string, any>;
|
|
166
166
|
post?: Post;
|
|
@@ -237,7 +237,7 @@ export interface PrivateMessage {
|
|
|
237
237
|
recipientId: string;
|
|
238
238
|
title?: string;
|
|
239
239
|
body: string;
|
|
240
|
-
|
|
240
|
+
status: string;
|
|
241
241
|
parentId?: string;
|
|
242
242
|
children?: PrivateMessage[];
|
|
243
243
|
sender?: User;
|
|
@@ -260,7 +260,7 @@ export interface Report {
|
|
|
260
260
|
privateMessageId?: string;
|
|
261
261
|
type: string;
|
|
262
262
|
description?: string;
|
|
263
|
-
|
|
263
|
+
status: string;
|
|
264
264
|
createdAt: string;
|
|
265
265
|
post?: Post;
|
|
266
266
|
thread?: Thread;
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ export class NotificationsResource {
|
|
|
10
10
|
|
|
11
11
|
async list(params?: {
|
|
12
12
|
userId?: string;
|
|
13
|
-
|
|
13
|
+
status?: string;
|
|
14
14
|
filter?: 'newest' | 'oldest';
|
|
15
15
|
cursor?: string;
|
|
16
16
|
limit?: number;
|
|
@@ -29,10 +29,10 @@ export class NotificationsResource {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
async markAllAsRead(userId?: string,
|
|
32
|
+
async markAllAsRead(userId?: string, status: string = 'read'): Promise<{ count: number }> {
|
|
33
33
|
return this.client.request<{ count: number }>('/notifications', {
|
|
34
34
|
method: 'PATCH',
|
|
35
|
-
body: JSON.stringify({ userId,
|
|
35
|
+
body: JSON.stringify({ userId, status }),
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@ export class NotificationsResource {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
async update(id: string, payload: {
|
|
45
|
+
async update(id: string, payload: { status: string }): Promise<Notification> {
|
|
46
46
|
return this.client.request<Notification>(`/notification/${id}`, {
|
|
47
47
|
method: 'PATCH',
|
|
48
48
|
body: JSON.stringify(payload),
|
|
@@ -61,7 +61,7 @@ export class PrivateMessagesResource {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
async update(id: string, payload: {
|
|
64
|
-
|
|
64
|
+
status?: string;
|
|
65
65
|
extendedData?: Record<string, any>;
|
|
66
66
|
}): Promise<PrivateMessage> {
|
|
67
67
|
return this.client.request<PrivateMessage>(`/private-message/${id}`, {
|
package/src/resources/Reports.ts
CHANGED
|
@@ -11,7 +11,7 @@ export class ReportsResource {
|
|
|
11
11
|
async list(params?: {
|
|
12
12
|
reporterId?: string;
|
|
13
13
|
reportedId?: string;
|
|
14
|
-
|
|
14
|
+
status?: string;
|
|
15
15
|
cursor?: string;
|
|
16
16
|
filter?: 'newest' | 'oldest';
|
|
17
17
|
limit?: number;
|
|
@@ -48,7 +48,7 @@ export class ReportsResource {
|
|
|
48
48
|
|
|
49
49
|
async batchUpdate(payload: {
|
|
50
50
|
reportIds: string[];
|
|
51
|
-
|
|
51
|
+
status: string;
|
|
52
52
|
}): Promise<{ count?: number; message?: string }> {
|
|
53
53
|
return this.client.request<{ count?: number; message?: string }>('/reports', {
|
|
54
54
|
method: 'PATCH',
|
|
@@ -70,7 +70,7 @@ export class ReportsResource {
|
|
|
70
70
|
reporterId?: string;
|
|
71
71
|
type?: string;
|
|
72
72
|
description?: string;
|
|
73
|
-
|
|
73
|
+
status?: string;
|
|
74
74
|
extendedData?: Record<string, any>;
|
|
75
75
|
}): Promise<Report> {
|
|
76
76
|
return this.client.request<Report>(`/report/${id}`, {
|
|
@@ -85,10 +85,10 @@ export class ReportsResource {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
async updateStatus(id: string,
|
|
88
|
+
async updateStatus(id: string, status: string): Promise<Report> {
|
|
89
89
|
return this.client.request<Report>(`/report/${id}`, {
|
|
90
90
|
method: 'PATCH',
|
|
91
|
-
body: JSON.stringify({
|
|
91
|
+
body: JSON.stringify({ status }),
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
}
|
package/src/types.ts
CHANGED
|
@@ -181,7 +181,7 @@ export interface Notification {
|
|
|
181
181
|
notifiedId: string;
|
|
182
182
|
type: string;
|
|
183
183
|
description?: string;
|
|
184
|
-
|
|
184
|
+
status: string;
|
|
185
185
|
createdAt: string;
|
|
186
186
|
extendedData?: Record<string, any>;
|
|
187
187
|
post?: Post;
|
|
@@ -264,7 +264,7 @@ export interface PrivateMessage {
|
|
|
264
264
|
recipientId: string;
|
|
265
265
|
title?: string;
|
|
266
266
|
body: string;
|
|
267
|
-
|
|
267
|
+
status: string;
|
|
268
268
|
parentId?: string;
|
|
269
269
|
children?: PrivateMessage[];
|
|
270
270
|
sender?: User;
|
|
@@ -289,7 +289,7 @@ export interface Report {
|
|
|
289
289
|
privateMessageId?: string;
|
|
290
290
|
type: string;
|
|
291
291
|
description?: string;
|
|
292
|
-
|
|
292
|
+
status: string;
|
|
293
293
|
createdAt: string;
|
|
294
294
|
post?: Post;
|
|
295
295
|
thread?: Thread;
|