@foru-ms/sdk 1.2.2 → 1.2.3

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.
Files changed (2) hide show
  1. package/README.md +109 -78
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -187,53 +187,66 @@ Check the `/examples` directory for detailed examples:
187
187
 
188
188
  ### Threads (`client.threads`)
189
189
 
190
-
191
- * `list(params: { limit?: number; filter?: 'newest' | 'oldest'; tagId?: string; cursor?: string })`: List threads.
190
+ **Thread Management**
191
+ * `list(params: { query?: string; tagId?: string; filter?: 'newest' | 'oldest'; type?: 'created' | 'liked' | 'disliked' | 'upvoted' | 'downvoted' | 'subscribed'; cursor?: string; userId?: string })`: List threads with filtering options.
192
192
  * `create(payload: CreateThreadPayload)`: Create a new thread.
193
193
  * `retrieve(id: string)`: Get a thread by ID.
194
194
  * `update(id: string, payload: UpdateThreadPayload)`: Update a thread.
195
195
  * `delete(id: string)`: Delete a thread.
196
- * `getPosts(id: string, params: { cursor?: string; filter?: 'newest' | 'oldest' })`: Get posts in a thread.
197
- * `like(id: string, userId: string, extendedData?: any)`: Like a thread.
198
- * `unlike(id: string, userId: string)`: Unlike a thread.
199
- * `getLikes(id: string, params?: { cursor?: string })`: Get users who liked a thread.
200
- * `dislike(id: string, userId: string, extendedData?: any)`: Dislike a thread.
201
- * `undislike(id: string, userId: string)`: Remove dislike from a thread.
202
- * `getDislikes(id: string, params?: { cursor?: string })`: Get users who disliked a thread.
203
- * `subscribe(id: string, userId: string)`: Subscribe to a thread.
204
- * `unsubscribe(id: string, userId: string)`: Unsubscribe from a thread.
205
- * `getSubscribers(id: string, params?: { cursor?: string })`: Get users subscribed to a thread.
206
- * `upvote(id: string, userId: string, extendedData?: any)`: Upvote a thread.
207
- * `unupvote(id: string, userId: string)`: Remove upvote from a thread.
208
- * `getUpvotes(id: string, params?: { cursor?: string })`: Get users who upvoted a thread.
209
- * `downvote(id: string, userId: string, extendedData?: any)`: Downvote a thread.
210
- * `undownvote(id: string, userId: string)`: Remove downvote from a thread.
211
- * `getDownvotes(id: string, params?: { cursor?: string })`: Get users who downvoted a thread.
212
- * `getPoll(id: string, userId?: string)`: Get poll results.
213
- * `vote(id: string, userId: string, optionId: string)`: Vote in a thread poll.
214
- * `voteUpdate(id: string, userId: string, optionId: string)`: Change vote.
215
- * `unvote(id: string, userId: string)`: Remove vote.
196
+ * `getPosts(id: string, params: { query?: string; cursor?: string; filter?: 'newest' | 'oldest' })`: Get posts in a thread.
197
+
198
+ **Thread Interactions**
199
+ * `like(id: string, userId?: string, extendedData?: any)`: Like a thread.
200
+ * `unlike(id: string, userId?: string)`: Unlike a thread.
201
+ * `getLikes(id: string, params?: { cursor?: string })`: Get users who liked a thread with pagination.
202
+ * `dislike(id: string, userId?: string, extendedData?: any)`: Dislike a thread.
203
+ * `undislike(id: string, userId?: string)`: Remove dislike from a thread.
204
+ * `getDislikes(id: string, params?: { cursor?: string })`: Get users who disliked a thread with pagination.
205
+ * `upvote(id: string, userId?: string, extendedData?: any)`: Upvote a thread.
206
+ * `unupvote(id: string, userId?: string)`: Remove upvote from a thread.
207
+ * `getUpvotes(id: string, params?: { cursor?: string })`: Get users who upvoted a thread with pagination.
208
+ * `downvote(id: string, userId?: string, extendedData?: any)`: Downvote a thread.
209
+ * `undownvote(id: string, userId?: string)`: Remove downvote from a thread.
210
+ * `getDownvotes(id: string, params?: { cursor?: string })`: Get users who downvoted a thread with pagination.
211
+
212
+ **Thread Subscriptions**
213
+ * `subscribe(id: string, userId?: string, extendedData?: any)`: Subscribe to a thread.
214
+ * `unsubscribe(id: string, userId?: string)`: Unsubscribe from a thread.
215
+ * `getSubscribers(id: string, params?: { cursor?: string })`: Get users subscribed to a thread with pagination.
216
+
217
+ **Thread Polls**
218
+ * `createPoll(id: string, payload: { title?: string; expiresAt?: string; options: Array<{ title: string; color?: string; extendedData?: any }>, extendedData?: any })`: Create a poll for a thread.
219
+ * `getPoll(id: string)`: Get poll details and configuration.
220
+ * `updatePoll(id: string, payload: { title?: string; expiresAt?: string; closed?: boolean; options?: Array<{ id?: string; title?: string; color?: string; extendedData?: any }>; extendedData?: any })`: Update poll configuration.
221
+ * `deletePoll(id: string)`: Delete a poll from a thread.
222
+ * `getPollResults(id: string, userId?: string)`: Get poll results with vote counts.
223
+ * `vote(id: string, userId?: string, optionId: string)`: Cast a vote in a thread poll.
224
+ * `voteUpdate(id: string, userId?: string, optionId: string)`: Change an existing vote.
225
+ * `unvote(id: string, userId?: string)`: Remove your vote from a poll.
216
226
 
217
227
  ### Posts (`client.posts`)
218
228
 
219
- * `list(params: { limit?: number; cursor?: string; filter?: 'newest' | 'oldest'; threadId?: string })`: List posts (flat).
220
- * `create(payload: CreatePostPayload)`: Create a reply.
229
+ **Post Management**
230
+ * `list(params: { query?: string; filter?: 'newest' | 'oldest'; type?: 'created' | 'liked' | 'disliked' | 'upvoted' | 'downvoted'; cursor?: string; userId?: string })`: List posts with filtering options.
231
+ * `create(payload: CreatePostPayload)`: Create a new post/reply.
221
232
  * `retrieve(id: string)`: Get a post by ID.
222
233
  * `update(id: string, payload: UpdatePostPayload)`: Update a post.
223
- * `delete(id: string)`: Delete a post.
224
- * `getChildren(id: string, params: { cursor?: string; filter?: 'newest' | 'oldest' })`: Get child posts (nested replies).
225
- * `like(id: string, userId: string, extendedData?: any)`: Like a post.
226
- * `unlike(id: string, userId: string)`: Unlike a post.
227
- * `getLikes(id: string, params?: { cursor?: string })`: Get users who liked a post.
228
- * `dislike(id: string, userId: string, extendedData?: any)`: Dislike a post.
229
- * `undislike(id: string, userId: string)`: Remove dislike.
230
- * `getDislikes(id: string, params?: { cursor?: string })`: Get users who disliked a post.
231
- * `upvote(id: string, userId: string, extendedData?: any)`: Upvote a post.
232
- * `unupvote(id: string, userId: string)`: Remove upvote.
233
- * `getUpvotes(id: string, params?: { cursor?: string })`: Get users who upvoted a post.
234
- * `downvote(id: string, userId: string, extendedData?: any)`: Downvote a post.
235
- * `undownvote(id: string, userId: string)`: Remove downvote.
236
- * `getDownvotes(id: string, params?: { cursor?: string })`: Get users who downvoted a post.
234
+ * `delete(id: string, payload?: { userId?: string })`: Delete a post.
235
+ * `getChildren(id: string, params?: { query?: string; cursor?: string; filter?: 'newest' | 'oldest' })`: Get child posts (nested replies).
236
+
237
+ **Post Interactions**
238
+ * `like(id: string, userId?: string, extendedData?: any)`: Like a post.
239
+ * `unlike(id: string, userId?: string)`: Unlike a post.
240
+ * `getLikes(id: string, params?: { cursor?: string })`: Get users who liked a post with pagination.
241
+ * `dislike(id: string, userId?: string, extendedData?: any)`: Dislike a post.
242
+ * `undislike(id: string, userId?: string)`: Remove dislike from a post.
243
+ * `getDislikes(id: string, params?: { cursor?: string })`: Get users who disliked a post with pagination.
244
+ * `upvote(id: string, userId?: string, extendedData?: any)`: Upvote a post.
245
+ * `unupvote(id: string, userId?: string)`: Remove upvote from a post.
246
+ * `getUpvotes(id: string, params?: { cursor?: string })`: Get users who upvoted a post with pagination.
247
+ * `downvote(id: string, userId?: string, extendedData?: any)`: Downvote a post.
248
+ * `undownvote(id: string, userId?: string)`: Remove downvote from a post.
249
+ * `getDownvotes(id: string, params?: { cursor?: string })`: Get users who downvoted a post with pagination.
237
250
 
238
251
  ### Users (`client.users`)
239
252
 
@@ -246,32 +259,32 @@ Check the `/examples` directory for detailed examples:
246
259
  * `getPosts(id: string, params?: { query?: string; cursor?: string; filter?: 'newest' | 'oldest' })`: Get all posts created by a user.
247
260
  * `getFollowers(id: string, params?: { query?: string; cursor?: string; filter?: 'newest' | 'oldest' })`: Get user's followers.
248
261
  * `getFollowing(id: string, params?: { query?: string; cursor?: string; filter?: 'newest' | 'oldest' })`: Get who a user follows.
249
- * `follow(id: string, followerId: string, extendedData?: any)`: Follow a user.
250
- * `unfollow(id: string, followerId: string)`: Unfollow a user.
262
+ * `follow(id: string, followerId?: string, extendedData?: any)`: Follow a user.
263
+ * `unfollow(id: string, followerId?: string)`: Unfollow a user.
251
264
 
252
265
 
253
266
  ### Tags (`client.tags`)
254
267
 
255
- * `list(params?: { query?: string; cursor?: string })`: List tags.
268
+ * `list(params?: { query?: string; cursor?: string })`: List all tags.
269
+ * `listSubscribed(params: { userId?: string; query?: string; cursor?: string })`: List tags a user is subscribed to.
256
270
  * `create(payload: { name: string; description?: string; color?: string; extendedData?: Record<string, any> })`: Create a tag.
257
- * `retrieve(id: string, params?: { userId?: string })`: Get a tag.
271
+ * `retrieve(id: string, params?: { userId?: string })`: Get a tag with optional user context.
258
272
  * `update(id: string, payload: { name?: string; description?: string; color?: string; extendedData?: Record<string, any> })`: Update a tag.
259
273
  * `delete(id: string)`: Delete a tag.
260
274
  * `getThreads(id: string, params?: { query?: string; cursor?: string; filter?: 'newest' | 'oldest' })`: Get all threads with a specific tag.
261
- * `subscribe(id: string, userId: string)`: Subscribe to a tag.
262
- * `unsubscribe(id: string, userId: string)`: Unsubscribe from a tag.
263
- * `getSubscribers(id: string, params?: { cursor?: string })`: Get users subscribed to a tag.
264
- * `listSubscribed(params: { userId: string; query?: string; cursor?: string })`: List tags a user is subscribed to.
275
+ * `subscribe(id: string, userId?: string)`: Subscribe to a tag.
276
+ * `unsubscribe(id: string, userId?: string)`: Unsubscribe from a tag.
277
+ * `getSubscribers(id: string, params?: { cursor?: string })`: Get users subscribed to a tag with pagination.
265
278
 
266
279
 
267
280
  ### Notifications (`client.notifications`)
268
281
 
269
- * `list(params: { userId: string; read?: boolean; filter?: 'newest' | 'oldest'; cursor?: string })`: List notifications.
270
- * `markAllAsRead(userId: string, read?: boolean)`: Bulk update read status. Default is `true`.
271
- * `create(payload: { threadId?: string; postId?: string; privateMessageId?: string; notifierId: string; notifiedId: string; type: string; description?: string; extendedData?: Record<string, any> })`: Create a notification manually.
272
- * `retrieve(id: string)`: Get a notification.
273
- * `update(id: string, payload: { read: boolean })`: Update a notification.
274
- * `delete(id: string)`: Delete a notification.
282
+ * `list(params: { userId?: string; read?: boolean; filter?: 'newest' | 'oldest'; cursor?: string })`: List notifications for a user.
283
+ * `create(payload: { threadId?: string; postId?: string; privateMessageId?: string; notifierId?: string; notifiedId: string; type: string; description?: string; extendedData?: Record<string, any> })`: Create a notification manually.
284
+ * `retrieve(id: string, userId?: string)`: Get a notification by ID.
285
+ * `update(id: string, payload: { userId?: string; read: boolean })`: Update a notification's read status.
286
+ * `delete(id: string, userId?: string)`: Delete a notification.
287
+ * `markAllAsRead(userId?: string, read?: boolean)`: Bulk update read status for all of a user's notifications. Default read status is `true`.
275
288
 
276
289
  ### Search (`client.search`)
277
290
 
@@ -279,12 +292,13 @@ Check the `/examples` directory for detailed examples:
279
292
 
280
293
  ### Webhooks (`client.webhooks`)
281
294
 
282
- * `list()`: List webhooks.
283
- * `create(payload: { name: string; url: string; events: string[] })`: Create a webhook.
284
- * `retrieve(id: string)`: Get a webhook.
285
- * `update(id: string, payload: any)`: Update a webhook.
295
+ * `list()`: List all webhooks for your instance.
296
+ * `create(payload: { name: string; url: string; events: string[] })`: Create a new webhook subscription.
297
+ * `retrieve(id: string)`: Get a webhook by ID.
298
+ * `update(id: string, payload: { name?: string; url?: string; events?: string[]; active?: boolean })`: Update a webhook configuration.
286
299
  * `delete(id: string)`: Delete a webhook.
287
- * `getDeliveries(id: string, params: { cursor?: string })`: Get webhook delivery history.
300
+ * `getDeliveries(id: string, params?: { cursor?: string })`: Get webhook delivery history with pagination. Track successful and failed deliveries.
301
+ * `verifySignature(payload: any, signature: string, timestamp: string, secret: string, maxAge?: number)`: Verify webhook signature for security. Uses HMAC-SHA256. Default maxAge is 5 minutes to prevent replay attacks.
288
302
 
289
303
  ### Stats (`client.stats`)
290
304
 
@@ -292,46 +306,49 @@ Check the `/examples` directory for detailed examples:
292
306
 
293
307
  ### Integrations (`client.integrations`)
294
308
 
295
- * `list()`: Get all configured integrations.
296
- * `create(payload: { type: 'SLACK' | 'DISCORD' | 'SALESFORCE' | 'HUBSPOT' | 'OKTA' | 'AUTH0'; name: string; config: any })`: Configure an integration (Slack, Discord, etc.).
297
- * `retrieve(id: string)`: Get integration details.
298
- * `update(id: string, payload: { name?: string; config?: any; active?: boolean })`: Update an integration.
309
+ * `list()`: Get all configured integrations for your instance.
310
+ * `create(payload: { type: 'SLACK' | 'DISCORD' | 'SALESFORCE' | 'HUBSPOT' | 'OKTA' | 'AUTH0'; name: string; config: any })`: Configure a new integration (Slack, Discord, CRM, or SSO).
311
+ * `retrieve(id: string)`: Get integration details by ID.
312
+ * `update(id: string, payload: { name?: string; type?: string; enabled?: boolean; config?: any })`: Update an integration configuration.
299
313
  * `delete(id: string)`: Remove an integration.
314
+ * `test(integrationId: string)`: Send a test message to verify integration is working correctly.
315
+ * `oauthAuthorize(provider: 'hubspot' | 'salesforce')`: Initiate OAuth flow for a provider (redirects to provider).
316
+ * `oauthCallback(provider: string, code: string, state: string)`: Handle OAuth callback from provider.
300
317
 
301
318
  ### Private Messages (`client.privateMessages`)
302
319
 
303
320
  * `list(params?: { query?: string; userId?: string; filter?: 'newest' | 'oldest'; cursor?: string })`: List private messages.
304
- * `create(payload: { title?: string; body: string; recipientId: string; senderId?: string; extendedData?: Record<string, any> })`: Send a direct message.
305
- * `retrieve(id: string)`: Get a message thread.
306
- * `reply(id: string, payload: { body: string; senderId: string; recipientId: string; extendedData?: Record<string, any> })`: Reply to a message.
307
- * `update(id: string, payload: { read?: boolean; extendedData?: Record<string, any> })`: Update a message (e.g., mark as read).
308
- * `delete(id: string)`: Delete a message.
321
+ * `create(payload: { title?: string; body: string; recipientId: string; senderId?: string; extendedData?: Record<string, any> })`: Send a new private message.
322
+ * `retrieve(id: string, userId?: string)`: Get a message by ID.
323
+ * `reply(id: string, payload: { body: string; senderId?: string; title?: string; extendedData?: Record<string, any> })`: Reply to a message thread.
324
+ * `update(id: string, payload: { body?: string; extendedData?: Record<string, any> })`: Update a message (only sender can update).
325
+ * `delete(id: string)`: Delete a message (participants can delete).
309
326
 
310
327
  ### Reports (`client.reports`)
311
328
 
312
- * `list(params?: { reporterId?: string; reportedId?: string; read?: boolean; cursor?: string; filter?: 'newest' | 'oldest' })`: List reports.
313
- * `create(payload: { reporterId: string; reportedId?: string; threadId?: string; postId?: string; privateMessageId?: string; type?: string; description?: string; extendedData?: Record<string, any> })`: Submit a report.
314
- * `batchUpdate(payload: { reportIds: string[]; read: boolean })`: Bulk update status.
315
- * `retrieve(id: string)`: Get a report.
316
- * `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.
329
+ * `list(params?: { reporterId?: string; reportedId?: string; read?: boolean; cursor?: string; filter?: 'newest' | 'oldest' })`: List reports with filtering options.
330
+ * `create(payload: { reporterId?: string; reportedId?: string; threadId?: string; postId?: string; privateMessageId?: string; type?: string; description?: string; extendedData?: Record<string, any> })`: Submit a new report.
331
+ * `retrieve(id: string)`: Get a report by ID.
332
+ * `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).
333
+ * `updateStatus(id: string, read: boolean)`: Update read status of a report (partial update).
334
+ * `batchUpdate(payload: { reportIds: string[]; read: boolean })`: Bulk update read status for multiple reports.
317
335
  * `delete(id: string)`: Delete a report.
318
- * `updateStatus(id: string, read: boolean)`: Update read status of a report.
319
336
 
320
337
  ### Roles (`client.roles`)
321
338
 
322
339
  * `list(params?: { filter?: 'newest' | 'oldest'; cursor?: string })`: List user roles.
323
340
  * `create(payload: { name: string; description?: string; color?: string; extendedData?: Record<string, any> })`: Create a new role.
324
- * `retrieve(id: string)`: Get a role.
341
+ * `retrieve(id: string)`: Get a role by ID.
325
342
  * `update(id: string, payload: { name?: string; description?: string; color?: string; extendedData?: Record<string, any> })`: Update a role.
326
343
  * `delete(id: string)`: Delete a role.
327
344
 
328
345
  ### SSO (`client.sso`)
329
346
 
330
- * `list()`: List SSO providers.
331
- * `create(payload: { provider: 'OKTA' | 'AUTH0' | 'SAML'; domain: string; config: any })`: Configure SSO.
332
- * `retrieve(id: string)`: Get SSO provider details.
333
- * `update(id: string, payload: { domain?: string; config?: any; active?: boolean })`: Update SSO configuration.
334
- * `delete(id: string)`: Remove SSO provider.
347
+ * `list()`: List all SSO providers configured for your instance.
348
+ * `create(payload: { provider: 'OKTA' | 'AUTH0' | 'SAML'; domain: string; config: any })`: Configure a new SSO provider.
349
+ * `retrieve(id: string)`: Get SSO provider details by ID.
350
+ * `update(id: string, payload: { name?: string; type?: 'SAML' | 'OIDC' | 'OAUTH2'; enabled?: boolean; config?: any })`: Update SSO configuration.
351
+ * `delete(id: string)`: Remove an SSO provider.
335
352
 
336
353
  ## Types
337
354
 
@@ -513,6 +530,20 @@ We welcome contributions! Please see our contributing guidelines for more inform
513
530
 
514
531
  ## Changelog
515
532
 
533
+ ### v1.2.3
534
+ - README documentation update
535
+ - Enhanced all API reference sections with:
536
+ - Better organization with categorized subsections (Management, Interactions, Subscriptions, Polls)
537
+ - Corrected optional vs required parameters throughout
538
+ - Added missing methods documentation (poll CRUD, webhook deliveries, integration OAuth, etc.)
539
+ - Improved clarity and consistency across all resource sections
540
+ - Added detailed descriptions for complex operations
541
+
542
+ ### v1.2.2
543
+ - Added Auth resource with authentication methods
544
+ - Introduced comprehensive SDK type definitions
545
+ - Updated documentation
546
+
516
547
  ### v1.2.1
517
548
  - README.md formatting and updates
518
549
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foru-ms/sdk",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "JavaScript SDK for Foru.ms",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",