@foru-ms/sdk 1.3.0 → 1.3.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.
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; read?: boolean; filter?: 'newest' | 'oldest'; cursor?: string; limit?: number })`: List notifications for a user. `limit` controls page size (1-50, default: 15).
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; read: boolean })`: Update a notification's read status.
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, read?: boolean)`: Bulk update read status for all of a user's notifications. Default read status is `true`.
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; read?: boolean; cursor?: string; filter?: 'newest' | 'oldest'; limit?: number })`: List reports with filtering options. `limit` controls page size (1-50, default: 15).
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; read?: boolean; extendedData?: Record<string, any> })`: Update report details (full update).
355
- * `updateStatus(id: string, read: boolean)`: Update read status of a report (partial update).
356
- * `batchUpdate(payload: { reportIds: string[]; read: boolean })`: Bulk update read status for multiple reports.
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,12 @@ We welcome contributions! Please see our contributing guidelines for more inform
553
553
 
554
554
  ## Changelog
555
555
 
556
+ ### v1.3.2
557
+ - Fixed issue with optional parameters not being optional in typescript
558
+
559
+ ### v1.3.1
560
+ - Updated Notifications, PrivateMessages, Reports to use `status` (string) instead of `read` (boolean)
561
+
556
562
  ### v1.3.0
557
563
  - Added Auth resource, authentication example, and related types
558
564
 
@@ -5,17 +5,17 @@ export declare class NotificationsResource {
5
5
  constructor(client: ForumClient);
6
6
  list(params?: {
7
7
  userId?: string;
8
- read?: boolean;
8
+ status?: string;
9
9
  filter?: 'newest' | 'oldest';
10
10
  cursor?: string;
11
11
  limit?: number;
12
12
  }): Promise<NotificationListResponse>;
13
- markAllAsRead(userId?: string, read?: boolean): Promise<{
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
- read: boolean;
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, read = true) {
21
+ async markAllAsRead(userId, status = 'read') {
22
22
  return this.client.request('/notifications', {
23
23
  method: 'PATCH',
24
- body: JSON.stringify({ userId, read }),
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
- read?: boolean;
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
- read?: boolean;
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
- read: boolean;
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
- read?: boolean;
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, read: boolean): Promise<Report>;
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, read) {
49
+ async updateStatus(id, status) {
50
50
  return this.client.request(`/report/${id}`, {
51
51
  method: 'PATCH',
52
- body: JSON.stringify({ read }),
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
- read: boolean;
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
- read: boolean;
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
- read: boolean;
263
+ status?: string;
264
264
  createdAt: string;
265
265
  post?: Post;
266
266
  thread?: Thread;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foru-ms/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "JavaScript SDK for Foru.ms",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,7 +10,7 @@ export class NotificationsResource {
10
10
 
11
11
  async list(params?: {
12
12
  userId?: string;
13
- read?: boolean;
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, read: boolean = true): Promise<{ count: number }> {
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, read }),
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: { read: boolean }): Promise<Notification> {
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
- read?: boolean;
64
+ status?: string;
65
65
  extendedData?: Record<string, any>;
66
66
  }): Promise<PrivateMessage> {
67
67
  return this.client.request<PrivateMessage>(`/private-message/${id}`, {
@@ -11,7 +11,7 @@ export class ReportsResource {
11
11
  async list(params?: {
12
12
  reporterId?: string;
13
13
  reportedId?: string;
14
- read?: boolean;
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
- read: boolean;
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
- read?: boolean;
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, read: boolean): Promise<Report> {
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({ read }),
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
- read: boolean;
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
- read: boolean;
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
- read: boolean;
292
+ status?: string;
293
293
  createdAt: string;
294
294
  post?: Post;
295
295
  thread?: Thread;