@scryme/chat 2.13.3 → 2.13.4

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/src/sdk.ts CHANGED
@@ -48,20 +48,385 @@ import type {
48
48
  UsersControllerSearchUsersResult,
49
49
  } from './generated/v3-server';
50
50
 
51
+ // --- High-fidelity Response and Entity Interfaces for Excellent DX ---
52
+
53
+ /**
54
+ * Represents a workspace in the Scryme platform (Enterprise M2M API V3).
55
+ */
56
+ export interface V3Workspace {
57
+ /** Unique workspace identifier. */
58
+ id: string;
59
+ /** Display name of the workspace. */
60
+ name: string;
61
+ /** Unique URL-friendly slug representing the workspace. */
62
+ slug: string;
63
+ /** Description of the workspace. */
64
+ description?: string | null;
65
+ /** Icon identifier or URL. */
66
+ icon?: string | null;
67
+ /** Industry categorization of the workspace. */
68
+ industry?: string | null;
69
+ /** Custom branding configuration object. */
70
+ brandingConfig?: any;
71
+ /** ISO timestamp when the workspace was created. */
72
+ createdAt: string;
73
+ /** ISO timestamp when the workspace was last updated. */
74
+ updatedAt?: string;
75
+ }
76
+
77
+ /**
78
+ * Envelope response containing a list of workspaces.
79
+ */
80
+ export interface V3WorkspacesResponse {
81
+ /** Indicates whether the API call was successful. */
82
+ success: boolean;
83
+ /** The payload of the response containing the workspaces. */
84
+ data: {
85
+ /** List of workspaces returned by the API. */
86
+ workspaces: V3Workspace[];
87
+ };
88
+ /** ISO timestamp of when the response was generated. */
89
+ timestamp: string;
90
+ }
91
+
92
+ /**
93
+ * Envelope response containing a single workspace.
94
+ */
95
+ export interface V3WorkspaceResponse {
96
+ /** Indicates whether the API call was successful. */
97
+ success: boolean;
98
+ /** The payload of the response containing the workspace. */
99
+ data: {
100
+ /** The retrieved workspace details. */
101
+ workspace: V3Workspace;
102
+ };
103
+ /** ISO timestamp of when the response was generated. */
104
+ timestamp: string;
105
+ }
106
+
107
+ /**
108
+ * Envelope response containing provisioned workspace details and its default system bot.
109
+ */
110
+ export interface V3ProvisionWorkspaceResponse {
111
+ /** Indicates whether the API call was successful. */
112
+ success: boolean;
113
+ /** The payload containing details of the newly provisioned workspace and bot. */
114
+ data: {
115
+ /** Basic details of the provisioned workspace. */
116
+ workspace: {
117
+ /** Unique workspace identifier. */
118
+ id: string;
119
+ /** Display name of the workspace. */
120
+ name: string;
121
+ /** Unique slug for the workspace. */
122
+ slug: string;
123
+ };
124
+ /** Details of the automatically generated system bot for the workspace. */
125
+ bot: {
126
+ /** Unique identifier of the bot. */
127
+ id: string;
128
+ /** Client ID used for bot authentication. */
129
+ clientId: string;
130
+ /** Client Secret used for bot authentication. */
131
+ clientSecret: string;
132
+ };
133
+ };
134
+ /** ISO timestamp of when the response was generated. */
135
+ timestamp: string;
136
+ }
137
+
138
+ /**
139
+ * Envelope response containing workspace deletion confirmation.
140
+ */
141
+ export interface V3DeleteWorkspaceResponse {
142
+ /** Indicates whether the API call was successful. */
143
+ success: boolean;
144
+ /** The payload indicating deletion status. */
145
+ data: {
146
+ /** True if the workspace was deleted successfully. */
147
+ success: boolean;
148
+ };
149
+ /** ISO timestamp of when the response was generated. */
150
+ timestamp: string;
151
+ }
152
+
153
+ /**
154
+ * Details of a member belonging to a workspace.
155
+ */
156
+ export interface V3WorkspaceMember {
157
+ /** Unique membership identifier. */
158
+ id: string;
159
+ /** Unique workspace identifier. */
160
+ workspaceId: string;
161
+ /** Unique user identifier. */
162
+ userId: string;
163
+ /** Associated department identifier if the member is assigned to one. */
164
+ departmentId?: string | null;
165
+ /** The member's role (e.g., owner, admin, moderator, member, guest). */
166
+ role: string;
167
+ /** Type of member (e.g., regular user, bot, guest). */
168
+ memberType: string;
169
+ /** ISO timestamp of when the member joined the workspace. */
170
+ joinedAt: string;
171
+ /** Member's notification preferences. */
172
+ notificationPreference: string;
173
+ /** Nested basic details of the member's user profile. */
174
+ user: {
175
+ /** Unique user identifier. */
176
+ id: string;
177
+ /** Full name of the user. */
178
+ name: string;
179
+ /** Email address of the user. */
180
+ email: string;
181
+ /** URL to the user's avatar image. */
182
+ avatar?: string | null;
183
+ /** Current status message or indicator of the user. */
184
+ status?: string | null;
185
+ };
186
+ }
187
+
188
+ /**
189
+ * Envelope response containing a list of workspace members.
190
+ */
191
+ export interface V3WorkspaceMembersResponse {
192
+ /** Indicates whether the API call was successful. */
193
+ success: boolean;
194
+ /** The payload containing workspace members. */
195
+ data: {
196
+ /** List of members belonging to the workspace. */
197
+ members: V3WorkspaceMember[];
198
+ };
199
+ /** ISO timestamp of when the response was generated. */
200
+ timestamp: string;
201
+ }
202
+
203
+ /**
204
+ * Envelope response containing a newly added workspace member.
205
+ */
206
+ export interface V3AddWorkspaceMemberResponse {
207
+ /** Indicates whether the API call was successful. */
208
+ success: boolean;
209
+ /** The payload containing the added workspace member. */
210
+ data: {
211
+ /** Details of the added member. */
212
+ member: V3WorkspaceMember;
213
+ };
214
+ /** ISO timestamp of when the response was generated. */
215
+ timestamp: string;
216
+ }
217
+
218
+ /**
219
+ * Envelope response containing details of a specific workspace member.
220
+ */
221
+ export interface V3GetWorkspaceMemberResponse {
222
+ /** Indicates whether the API call was successful. */
223
+ success: boolean;
224
+ /** The payload containing the workspace member details. */
225
+ data: {
226
+ /** Details of the workspace member. */
227
+ member: V3WorkspaceMember;
228
+ };
229
+ /** ISO timestamp of when the response was generated. */
230
+ timestamp: string;
231
+ }
232
+
233
+ /**
234
+ * Envelope response containing the updated workspace member details.
235
+ */
236
+ export interface V3UpdateWorkspaceMemberResponse {
237
+ /** Indicates whether the API call was successful. */
238
+ success: boolean;
239
+ /** The payload containing the updated workspace member. */
240
+ data: {
241
+ /** Details of the updated member. */
242
+ member: V3WorkspaceMember;
243
+ };
244
+ /** ISO timestamp of when the response was generated. */
245
+ timestamp: string;
246
+ }
247
+
248
+ /**
249
+ * Envelope response containing workspace member removal confirmation.
250
+ */
251
+ export interface V3DeleteWorkspaceMemberResponse {
252
+ /** Indicates whether the API call was successful. */
253
+ success: boolean;
254
+ /** The payload indicating deletion status. */
255
+ data: {
256
+ /** True if the workspace member was removed successfully. */
257
+ success: boolean;
258
+ };
259
+ /** ISO timestamp of when the response was generated. */
260
+ timestamp: string;
261
+ }
262
+
263
+ /**
264
+ * Represents a channel in a workspace.
265
+ */
266
+ export interface WorkspaceChannel {
267
+ /** Unique channel identifier. */
268
+ id: string;
269
+ /** Display name of the channel. */
270
+ name: string;
271
+ /** Unique URL-friendly slug representing the channel. */
272
+ slug: string;
273
+ /** Optional icon name or identifier for the channel. */
274
+ icon?: string;
275
+ /** Type of the channel. */
276
+ type: 'public' | 'private';
277
+ /** Optional descriptive text about the channel. */
278
+ description?: string | null;
279
+ /** True if the channel is private and restricted. */
280
+ isPrivate: boolean;
281
+ /** Unique workspace identifier. */
282
+ workspaceId: string;
283
+ /** Optional parent channel or category identifier. */
284
+ parentId?: string | null;
285
+ /** ISO timestamp when the channel was created. */
286
+ createdAt: string;
287
+ /** ISO timestamp when the channel was last updated. */
288
+ updatedAt: string;
289
+ /** Unread message count in this channel for the active user. */
290
+ unreadCount?: number;
291
+ /** Mentions count in this channel for the active user. */
292
+ mentionCount?: number;
293
+ }
294
+
295
+ /**
296
+ * Represents a message sent to a workspace channel or direct message conversation.
297
+ */
298
+ export interface ChannelMessage {
299
+ /** Unique message identifier. */
300
+ id: string;
301
+ /** The text content of the message. */
302
+ content: string;
303
+ /** ISO timestamp when the message was sent. */
304
+ createdAt: string;
305
+ /** ISO timestamp when the message was last updated. */
306
+ updatedAt: string;
307
+ /** The unique channel identifier if sent within a channel. */
308
+ channelId: string;
309
+ /** Unique identifier of the user who sent the message. */
310
+ userId: string;
311
+ /** Basic profile details of the user who sent the message. */
312
+ user: {
313
+ /** Unique user identifier. */
314
+ id: string;
315
+ /** Display name of the user. */
316
+ name: string;
317
+ /** Username of the user. */
318
+ username?: string;
319
+ /** URL to the user's avatar image. */
320
+ avatar?: string | null;
321
+ };
322
+ /** Optional identifier of the message this message is replying to. */
323
+ replyToId?: string | null;
324
+ /** Optional identifier of the root thread message. */
325
+ threadId?: string | null;
326
+ /** Optional attachments uploaded with the message. */
327
+ attachments?: any[];
328
+ /** Reactions associated with this message. */
329
+ reactions?: any[];
330
+ }
331
+
332
+ /**
333
+ * Represents a direct message conversation between users.
334
+ */
335
+ export interface DmConversation {
336
+ /** Unique conversation identifier. */
337
+ id: string;
338
+ /** ISO timestamp when the DM conversation was created. */
339
+ createdAt: string;
340
+ /** ISO timestamp when the DM conversation was last updated. */
341
+ updatedAt: string;
342
+ /** List of participant profiles in this conversation. */
343
+ participants: {
344
+ /** Participant record ID. */
345
+ id: string;
346
+ /** Unique user ID of the participant. */
347
+ userId: string;
348
+ /** Associated conversation ID. */
349
+ conversationId: string;
350
+ /** Profile details of the participant user. */
351
+ user: {
352
+ /** Unique user identifier. */
353
+ id: string;
354
+ /** Display name of the user. */
355
+ name: string;
356
+ /** Username of the user. */
357
+ username?: string;
358
+ /** URL to the user's avatar image. */
359
+ avatar?: string | null;
360
+ };
361
+ }[];
362
+ /** Messages belonging to this DM conversation. */
363
+ messages?: any[];
364
+ /** Metadata count summaries for the conversation. */
365
+ _count?: {
366
+ /** Total number of messages in the conversation. */
367
+ messages: number;
368
+ };
369
+ }
370
+
371
+ /**
372
+ * Public or private profile information of a user.
373
+ */
374
+ export interface UserProfile {
375
+ /** Unique user identifier. */
376
+ id: string;
377
+ /** Display name of the user. */
378
+ name: string;
379
+ /** Unique username of the user. */
380
+ username: string;
381
+ /** Email address of the user (available only on self profile or with appropriate access). */
382
+ email?: string;
383
+ /** URL to the user's avatar image. */
384
+ avatar?: string | null;
385
+ /** Current status message or custom presence text. */
386
+ status?: string | null;
387
+ /** Global application role of the user (e.g., admin, member). */
388
+ role?: string;
389
+ /** ISO timestamp when the user account was created. */
390
+ createdAt?: string;
391
+ }
392
+
393
+ /**
394
+ * Configuration options for initializing the Scryme SDK.
395
+ */
51
396
  export interface ScrymeSDKOptions {
397
+ /**
398
+ * The base URL of the Scryme API server.
399
+ * If not provided, the SDK will automatically resolve it from localStorage or environment variables.
400
+ */
52
401
  baseURL?: string;
402
+ /** OAuth2 Client ID for Machine-to-Machine (M2M) authentication. */
53
403
  clientId?: string;
404
+ /** OAuth2 Client Secret for Machine-to-Machine (M2M) authentication. */
54
405
  clientSecret?: string;
406
+ /** Static Bearer token or pre-fetched session token. */
55
407
  token?: string;
56
408
  }
57
409
 
410
+ /**
411
+ * The primary client SDK class for accessing the Scryme Chat platform APIs.
412
+ * Supports automated OAuth2 Token management and provides clean, type-safe namespaces.
413
+ */
58
414
  export class ScrymeSDK {
415
+ /** The currently cached access token. */
59
416
  private token: string | null = null;
417
+ /** Timestamp in milliseconds indicating when the cached token will expire. */
60
418
  private tokenExpiresAt: number | null = null;
419
+ /** Normalized base URL of the target API server. */
61
420
  public baseURL: string;
421
+ /** OAuth2 Client ID used for client credentials flow. */
62
422
  private clientId?: string;
423
+ /** OAuth2 Client Secret used for client credentials flow. */
63
424
  private clientSecret?: string;
64
425
 
426
+ /**
427
+ * Synchronizes the authentication token to local storage and the global configuration.
428
+ * @param token The token to synchronize.
429
+ */
65
430
  private syncToken(token: string | null) {
66
431
  if (!token) return;
67
432
  setGlobalToken(token);
@@ -72,6 +437,10 @@ export class ScrymeSDK {
72
437
  }
73
438
  }
74
439
 
440
+ /**
441
+ * Constructs a new ScrymeSDK instance.
442
+ * @param options Configuration options for baseURL, tokens, and credentials.
443
+ */
75
444
  constructor(options: ScrymeSDKOptions = {}) {
76
445
  this.clientId = options.clientId;
77
446
  this.clientSecret = options.clientSecret;
@@ -93,7 +462,9 @@ export class ScrymeSDK {
93
462
  const env = g.process?.env || g.__env__ || {};
94
463
  const isProd =
95
464
  env.NODE_ENV === 'production' ||
96
- (typeof window !== 'undefined' && window.location.hostname !== 'localhost' && window.location.hostname !== '127.0.0.1');
465
+ (typeof window !== 'undefined' &&
466
+ window.location.hostname !== 'localhost' &&
467
+ window.location.hostname !== '127.0.0.1');
97
468
 
98
469
  url =
99
470
  env.API_URL ||
@@ -105,7 +476,9 @@ export class ScrymeSDK {
105
476
  }
106
477
 
107
478
  /**
108
- * Automatically retrieves or refreshes the M2M OAuth2 Token using client_credentials
479
+ * Automatically retrieves a cached token, or fetches a new one via M2M OAuth2 Client Credentials
480
+ * if a clientId and clientSecret are configured.
481
+ * @returns A promise resolving to the token string, or null if unauthenticated.
109
482
  */
110
483
  public async getOrFetchToken(): Promise<string | null> {
111
484
  // If we already have a token and it is not expired, return it
@@ -158,7 +531,8 @@ export class ScrymeSDK {
158
531
  }
159
532
 
160
533
  /**
161
- * Gets the axios request config containing authorization and base url
534
+ * Generates the default request configuration containing the authorization headers and baseURL.
535
+ * @returns Request configuration object.
162
536
  */
163
537
  private async getRequestConfig(): Promise<any> {
164
538
  const token = await this.getOrFetchToken();
@@ -215,124 +589,413 @@ export class ScrymeSDK {
215
589
 
216
590
  // --- High-level nested namespace chains for excellent DX ---
217
591
 
592
+ /**
593
+ * Operations for managing workspaces, including creation, updating, retrieval,
594
+ * members, and channels.
595
+ */
218
596
  public get workspace() {
219
597
  return {
220
- list: async (options?: AxiosRequestConfig): Promise<V3WorkspacesControllerGetWorkspacesResult> => {
598
+ /**
599
+ * Lists all workspaces in the authenticated organization context.
600
+ * @param options Optional request config override.
601
+ * @returns List of workspaces returned exactly from the endpoint.
602
+ */
603
+ list: async (options?: AxiosRequestConfig): Promise<V3WorkspacesResponse> => {
221
604
  return this.raw.v3WorkspacesControllerGetWorkspaces(options) as any;
222
605
  },
223
- get: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerGetWorkspaceBySlugResult> => {
606
+ /**
607
+ * Retrieves detailed information of a specific workspace by its slug.
608
+ * @param slug The unique workspace slug identifier.
609
+ * @param options Optional request config override.
610
+ * @returns Workspace details returned exactly from the endpoint.
611
+ */
612
+ get: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspaceResponse> => {
224
613
  return this.raw.v3WorkspacesControllerGetWorkspaceBySlug(slug, options) as any;
225
614
  },
226
- create: async (data: V3ProvisionWorkspaceDto, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerProvisionWorkspaceResult> => {
615
+ /**
616
+ * Provisions a new workspace inside the organization.
617
+ * @param data Workspace creation and configuration data.
618
+ * @param options Optional request config override.
619
+ * @returns Provisioned workspace and bot configuration exactly from the endpoint.
620
+ */
621
+ create: async (
622
+ data: V3ProvisionWorkspaceDto,
623
+ options?: AxiosRequestConfig
624
+ ): Promise<V3ProvisionWorkspaceResponse> => {
227
625
  return this.raw.v3WorkspacesControllerProvisionWorkspace(data, options) as any;
228
626
  },
229
- update: async (slug: string, data: V3UpdateWorkspaceDto, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerUpdateWorkspaceResult> => {
627
+ /**
628
+ * Updates the configurations and metadata of an existing workspace.
629
+ * @param slug The unique workspace slug identifier.
630
+ * @param data Fields to update.
631
+ * @param options Optional request config override.
632
+ * @returns The updated workspace details exactly from the endpoint.
633
+ */
634
+ update: async (
635
+ slug: string,
636
+ data: V3UpdateWorkspaceDto,
637
+ options?: AxiosRequestConfig
638
+ ): Promise<V3WorkspaceResponse> => {
230
639
  return this.raw.v3WorkspacesControllerUpdateWorkspace(slug, data, options) as any;
231
640
  },
232
- delete: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerDeleteWorkspaceResult> => {
641
+ /**
642
+ * Permanently deletes a specific workspace by its slug.
643
+ * @param slug The unique workspace slug identifier.
644
+ * @param options Optional request config override.
645
+ * @returns Deletion status response exactly from the endpoint.
646
+ */
647
+ delete: async (slug: string, options?: AxiosRequestConfig): Promise<V3DeleteWorkspaceResponse> => {
233
648
  return this.raw.v3WorkspacesControllerDeleteWorkspace(slug, options) as any;
234
649
  },
650
+ /**
651
+ * Operations for managing workspace members, including listing, adding, role updates, and removal.
652
+ */
235
653
  members: {
236
- list: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerGetWorkspaceMembersResult> => {
654
+ /**
655
+ * Lists all members currently in a workspace.
656
+ * @param slug The unique workspace slug identifier.
657
+ * @param options Optional request config override.
658
+ * @returns List of workspace members exactly from the endpoint.
659
+ */
660
+ list: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspaceMembersResponse> => {
237
661
  return this.raw.v3WorkspacesControllerGetWorkspaceMembers(slug, options) as any;
238
662
  },
239
- add: async (slug: string, data: V3AddMemberDto, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerAddWorkspaceMemberResult> => {
663
+ /**
664
+ * Adds a new member to the workspace.
665
+ * @param slug The unique workspace slug identifier.
666
+ * @param data Input DTO containing the user's email and role.
667
+ * @param options Optional request config override.
668
+ * @returns Newly added member details exactly from the endpoint.
669
+ */
670
+ add: async (
671
+ slug: string,
672
+ data: V3AddMemberDto,
673
+ options?: AxiosRequestConfig
674
+ ): Promise<V3AddWorkspaceMemberResponse> => {
240
675
  return this.raw.v3WorkspacesControllerAddWorkspaceMember(slug, data, options) as any;
241
676
  },
242
- get: async (slug: string, memberId: string, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerGetWorkspaceMemberResult> => {
677
+ /**
678
+ * Retrieves membership details of a specific member in a workspace.
679
+ * @param slug The unique workspace slug identifier.
680
+ * @param memberId Unique ID of the workspace member (user ID).
681
+ * @param options Optional request config override.
682
+ * @returns Workspace member details exactly from the endpoint.
683
+ */
684
+ get: async (
685
+ slug: string,
686
+ memberId: string,
687
+ options?: AxiosRequestConfig
688
+ ): Promise<V3GetWorkspaceMemberResponse> => {
243
689
  return this.raw.v3WorkspacesControllerGetWorkspaceMember(slug, memberId, options) as any;
244
690
  },
245
- update: async (slug: string, memberId: string, data: V3UpdateMemberRoleDto, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerUpdateWorkspaceMemberResult> => {
691
+ /**
692
+ * Updates the role or configuration of a workspace member.
693
+ * @param slug The unique workspace slug identifier.
694
+ * @param memberId Unique ID of the workspace member (user ID).
695
+ * @param data Update details containing the target role.
696
+ * @param options Optional request config override.
697
+ * @returns The updated workspace member details exactly from the endpoint.
698
+ */
699
+ update: async (
700
+ slug: string,
701
+ memberId: string,
702
+ data: V3UpdateMemberRoleDto,
703
+ options?: AxiosRequestConfig
704
+ ): Promise<V3UpdateWorkspaceMemberResponse> => {
246
705
  return this.raw.v3WorkspacesControllerUpdateWorkspaceMember(slug, memberId, data, options) as any;
247
706
  },
248
- delete: async (slug: string, memberId: string, options?: AxiosRequestConfig): Promise<V3WorkspacesControllerDeleteWorkspaceMemberResult> => {
707
+ /**
708
+ * Removes a member from the workspace.
709
+ * @param slug The unique workspace slug identifier.
710
+ * @param memberId Unique ID of the workspace member (user ID).
711
+ * @param options Optional request config override.
712
+ * @returns Workspace member deletion confirmation exactly from the endpoint.
713
+ */
714
+ delete: async (
715
+ slug: string,
716
+ memberId: string,
717
+ options?: AxiosRequestConfig
718
+ ): Promise<V3DeleteWorkspaceMemberResponse> => {
249
719
  return this.raw.v3WorkspacesControllerDeleteWorkspaceMember(slug, memberId, options) as any;
250
720
  },
251
721
  },
722
+ /**
723
+ * Operations for listing and creating channels inside a workspace.
724
+ */
252
725
  channels: {
253
- list: async (slug: string, options?: AxiosRequestConfig): Promise<ChannelsControllerGetWorkspaceChannelsResult> => {
726
+ /**
727
+ * Lists all public channels (and private channels the user has access to) in a workspace.
728
+ * @param slug The unique workspace slug identifier.
729
+ * @param options Optional request config override.
730
+ * @returns List of channels returned exactly from the endpoint.
731
+ */
732
+ list: async (slug: string, options?: AxiosRequestConfig): Promise<WorkspaceChannel[]> => {
254
733
  return this.raw.channelsControllerGetWorkspaceChannels(slug, options) as any;
255
734
  },
256
- create: async (slug: string, data: CreateWorkspaceChannelDto, options?: AxiosRequestConfig): Promise<ChannelsControllerCreateChannelResult> => {
735
+ /**
736
+ * Creates a new channel within a workspace.
737
+ * @param slug The unique workspace slug identifier.
738
+ * @param data Configuration DTO for the new channel.
739
+ * @param options Optional request config override.
740
+ * @returns Details of the created channel exactly from the endpoint.
741
+ */
742
+ create: async (
743
+ slug: string,
744
+ data: CreateWorkspaceChannelDto,
745
+ options?: AxiosRequestConfig
746
+ ): Promise<WorkspaceChannel> => {
257
747
  return this.raw.channelsControllerCreateChannel(slug, data, options) as any;
258
748
  },
259
749
  },
260
750
  };
261
751
  }
262
752
 
753
+ /**
754
+ * Operations for managing specific channels and channel message actions.
755
+ */
263
756
  public get channel() {
264
757
  return {
265
- get: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<ChannelsControllerGetChannelResult> => {
758
+ /**
759
+ * Retrieves detailed information of a specific channel.
760
+ * @param slug The unique workspace slug identifier.
761
+ * @param channelId Unique identifier of the channel.
762
+ * @param options Optional request config override.
763
+ * @returns Channel details returned exactly from the endpoint.
764
+ */
765
+ get: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<WorkspaceChannel> => {
266
766
  return this.raw.channelsControllerGetChannel(slug, channelId, options) as any;
267
767
  },
268
- update: async (slug: string, channelId: string, data: UpdateWorkspaceChannelDto, options?: AxiosRequestConfig): Promise<ChannelsControllerUpdateChannelResult> => {
768
+ /**
769
+ * Updates configuration, description, icon or status of an existing channel.
770
+ * @param slug The unique workspace slug identifier.
771
+ * @param channelId Unique identifier of the channel.
772
+ * @param data Configuration options to update.
773
+ * @param options Optional request config override.
774
+ * @returns The updated channel details exactly from the endpoint.
775
+ */
776
+ update: async (
777
+ slug: string,
778
+ channelId: string,
779
+ data: UpdateWorkspaceChannelDto,
780
+ options?: AxiosRequestConfig
781
+ ): Promise<WorkspaceChannel> => {
269
782
  return this.raw.channelsControllerUpdateChannel(slug, channelId, data, options) as any;
270
783
  },
271
- delete: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<ChannelsControllerDeleteChannelResult> => {
784
+ /**
785
+ * Permanently deletes a channel from a workspace.
786
+ * @param slug The unique workspace slug identifier.
787
+ * @param channelId Unique identifier of the channel to delete.
788
+ * @param options Optional request config override.
789
+ * @returns Success status indicating that the channel was deleted exactly from the endpoint.
790
+ */
791
+ delete: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<{ success: boolean }> => {
272
792
  return this.raw.channelsControllerDeleteChannel(slug, channelId, options) as any;
273
793
  },
794
+ /**
795
+ * Sub-namespace for managing messages inside a channel.
796
+ */
274
797
  message: {
275
- list: async (channelId: string, params?: ChannelsControllerGetMessagesParams, options?: AxiosRequestConfig): Promise<ChannelsControllerGetMessagesResult> => {
798
+ /**
799
+ * Lists messages in a channel with cursor pagination support.
800
+ * @param channelId Unique identifier of the channel.
801
+ * @param params Query parameters for limiting, sorting, or pagination cursors.
802
+ * @param options Optional request config override.
803
+ * @returns Object containing the messages array and next pagination cursor exactly from the endpoint.
804
+ */
805
+ list: async (
806
+ channelId: string,
807
+ params?: ChannelsControllerGetMessagesParams,
808
+ options?: AxiosRequestConfig
809
+ ): Promise<{ messages: ChannelMessage[]; nextCursor?: string }> => {
276
810
  return this.raw.channelsControllerGetMessages(channelId, params, options) as any;
277
811
  },
278
- create: async (channelId: string, options?: AxiosRequestConfig): Promise<ChannelsControllerCreateMessageResult> => {
812
+ /**
813
+ * Sends a new message to a channel.
814
+ * @param channelId Unique identifier of the target channel.
815
+ * @param options Optional request config override. Note that standard message data (like text content) can be passed inside options.data.
816
+ * @returns The created message exactly from the endpoint.
817
+ */
818
+ create: async (channelId: string, options?: AxiosRequestConfig): Promise<ChannelMessage> => {
279
819
  return this.raw.channelsControllerCreateMessage(channelId, options) as any;
280
820
  },
281
821
  },
282
822
  };
283
823
  }
284
824
 
825
+ /**
826
+ * Operations for modifying, reacting to, or deleting existing channel messages.
827
+ */
285
828
  public get message() {
286
829
  return {
287
- update: async (channelId: string, messageId: string, data: ChannelsControllerUpdateMessageBody, options?: AxiosRequestConfig): Promise<ChannelsControllerUpdateMessageResult> => {
830
+ /**
831
+ * Updates the content of a previously sent message.
832
+ * @param channelId Unique identifier of the channel containing the message.
833
+ * @param messageId Unique identifier of the message to update.
834
+ * @param data The new content payload.
835
+ * @param options Optional request config override.
836
+ * @returns The updated message details exactly from the endpoint.
837
+ */
838
+ update: async (
839
+ channelId: string,
840
+ messageId: string,
841
+ data: ChannelsControllerUpdateMessageBody,
842
+ options?: AxiosRequestConfig
843
+ ): Promise<ChannelMessage> => {
288
844
  return this.raw.channelsControllerUpdateMessage(channelId, messageId, data, options) as any;
289
845
  },
290
- delete: async (channelId: string, messageId: string, options?: AxiosRequestConfig): Promise<ChannelsControllerDeleteMessageResult> => {
846
+ /**
847
+ * Permanently deletes a message.
848
+ * @param channelId Unique identifier of the channel containing the message.
849
+ * @param messageId Unique identifier of the message to delete.
850
+ * @param options Optional request config override.
851
+ * @returns Success status indicating that the message was deleted exactly from the endpoint.
852
+ */
853
+ delete: async (
854
+ channelId: string,
855
+ messageId: string,
856
+ options?: AxiosRequestConfig
857
+ ): Promise<{ success: boolean }> => {
291
858
  return this.raw.channelsControllerDeleteMessage(channelId, messageId, options) as any;
292
859
  },
293
- addReaction: async (channelId: string, messageId: string, data: ChannelsControllerAddReactionBody, options?: AxiosRequestConfig): Promise<ChannelsControllerAddReactionResult> => {
860
+ /**
861
+ * Adds a reaction (emoji) to a message.
862
+ * @param channelId Unique identifier of the channel containing the message.
863
+ * @param messageId Unique identifier of the message.
864
+ * @param data Object containing the target emoji character.
865
+ * @param options Optional request config override.
866
+ * @returns The reaction response returned exactly from the endpoint.
867
+ */
868
+ addReaction: async (
869
+ channelId: string,
870
+ messageId: string,
871
+ data: ChannelsControllerAddReactionBody,
872
+ options?: AxiosRequestConfig
873
+ ): Promise<any> => {
294
874
  return this.raw.channelsControllerAddReaction(channelId, messageId, data, options) as any;
295
875
  },
296
- removeReaction: async (channelId: string, messageId: string, emoji: string, options?: AxiosRequestConfig): Promise<ChannelsControllerRemoveReactionResult> => {
876
+ /**
877
+ * Removes a reaction (emoji) from a message.
878
+ * @param channelId Unique identifier of the channel containing the message.
879
+ * @param messageId Unique identifier of the message.
880
+ * @param emoji The emoji character to remove.
881
+ * @param options Optional request config override.
882
+ * @returns The reaction removal response returned exactly from the endpoint.
883
+ */
884
+ removeReaction: async (
885
+ channelId: string,
886
+ messageId: string,
887
+ emoji: string,
888
+ options?: AxiosRequestConfig
889
+ ): Promise<any> => {
297
890
  return this.raw.channelsControllerRemoveReaction(channelId, messageId, emoji, options) as any;
298
891
  },
299
892
  };
300
893
  }
301
894
 
895
+ /**
896
+ * Operations for managing direct messages (DMs) and direct message conversations.
897
+ */
302
898
  public get dm() {
303
899
  return {
304
- list: async (options?: AxiosRequestConfig): Promise<DmsControllerGetDmsResult> => {
900
+ /**
901
+ * Lists all active direct message conversations for the authenticated user.
902
+ * @param options Optional request config override.
903
+ * @returns List of active DM conversations returned exactly from the endpoint.
904
+ */
905
+ list: async (options?: AxiosRequestConfig): Promise<DmConversation[]> => {
305
906
  return this.raw.dmsControllerGetDms(options) as any;
306
907
  },
307
- create: async (data: CreateDmDto, options?: AxiosRequestConfig): Promise<DmsControllerCreateDmResult> => {
908
+ /**
909
+ * Creates/initiates a direct message conversation with specified users.
910
+ * @param data Create direct message details containing target participant IDs.
911
+ * @param options Optional request config override.
912
+ * @returns Details of the created DM conversation exactly from the endpoint.
913
+ */
914
+ create: async (data: CreateDmDto, options?: AxiosRequestConfig): Promise<DmConversation> => {
308
915
  return this.raw.dmsControllerCreateDm(data, options) as any;
309
916
  },
310
- get: async (dmId: string, options?: AxiosRequestConfig): Promise<DmsControllerGetDmResult> => {
917
+ /**
918
+ * Retrieves details of a specific direct message conversation.
919
+ * @param dmId Unique identifier of the direct message conversation.
920
+ * @param options Optional request config override.
921
+ * @returns Detailed direct message conversation object exactly from the endpoint.
922
+ */
923
+ get: async (dmId: string, options?: AxiosRequestConfig): Promise<DmConversation> => {
311
924
  return this.raw.dmsControllerGetDm(dmId, options) as any;
312
925
  },
313
- delete: async (dmId: string, options?: AxiosRequestConfig): Promise<DmsControllerDeleteDmResult> => {
926
+ /**
927
+ * Deletes/closes an active direct message conversation.
928
+ * @param dmId Unique identifier of the direct message conversation to close.
929
+ * @param options Optional request config override.
930
+ * @returns Success status indicating that the DM conversation was deleted exactly from the endpoint.
931
+ */
932
+ delete: async (dmId: string, options?: AxiosRequestConfig): Promise<{ success: boolean }> => {
314
933
  return this.raw.dmsControllerDeleteDm(dmId, options) as any;
315
934
  },
935
+ /**
936
+ * Sub-namespace for managing direct messages in a specific DM conversation.
937
+ */
316
938
  message: {
317
- list: async (dmId: string, params?: DmsControllerGetMessagesParams, options?: AxiosRequestConfig): Promise<DmsControllerGetMessagesResult> => {
939
+ /**
940
+ * Lists messages in a direct message conversation with cursor pagination.
941
+ * @param dmId Unique identifier of the direct message conversation.
942
+ * @param params Query parameters for pagination limits, cursors or search filters.
943
+ * @param options Optional request config override.
944
+ * @returns List of direct messages and next pagination cursor exactly from the endpoint.
945
+ */
946
+ list: async (
947
+ dmId: string,
948
+ params?: DmsControllerGetMessagesParams,
949
+ options?: AxiosRequestConfig
950
+ ): Promise<{ messages: ChannelMessage[]; nextCursor?: string }> => {
318
951
  return this.raw.dmsControllerGetMessages(dmId, params, options) as any;
319
952
  },
320
- create: async (dmId: string, options?: AxiosRequestConfig): Promise<DmsControllerCreateMessageResult> => {
953
+ /**
954
+ * Sends a new message in a direct message conversation.
955
+ * @param dmId Unique identifier of the direct message conversation.
956
+ * @param options Optional request config override. Note that content/attachments can be passed inside options.data.
957
+ * @returns The sent message exactly from the endpoint.
958
+ */
959
+ create: async (dmId: string, options?: AxiosRequestConfig): Promise<ChannelMessage> => {
321
960
  return this.raw.dmsControllerCreateMessage(dmId, options) as any;
322
961
  },
323
962
  },
324
963
  };
325
964
  }
326
965
 
966
+ /**
967
+ * Operations for retrieving information about the current user or other user profiles,
968
+ * as well as performing user searches.
969
+ */
327
970
  public get user() {
328
971
  return {
329
- me: async (options?: AxiosRequestConfig): Promise<UsersControllerGetMeResult> => {
972
+ /**
973
+ * Retrieves the profile details of the currently authenticated user.
974
+ * @param options Optional request config override.
975
+ * @returns The active user's profile returned exactly from the endpoint.
976
+ */
977
+ me: async (options?: AxiosRequestConfig): Promise<UserProfile> => {
330
978
  return this.raw.usersControllerGetMe(options) as any;
331
979
  },
332
- get: async (userId: string, options?: AxiosRequestConfig): Promise<UsersControllerGetUserResult> => {
980
+ /**
981
+ * Retrieves the public profile of a user by their user ID.
982
+ * @param userId Unique identifier of the target user.
983
+ * @param options Optional request config override.
984
+ * @returns Public user profile returned exactly from the endpoint.
985
+ */
986
+ get: async (userId: string, options?: AxiosRequestConfig): Promise<UserProfile> => {
333
987
  return this.raw.usersControllerGetUser(userId, options) as any;
334
988
  },
335
- search: async (params: UsersControllerSearchUsersParams, options?: AxiosRequestConfig): Promise<UsersControllerSearchUsersResult> => {
989
+ /**
990
+ * Searches the organization or workspace directory for user profiles matching specific queries.
991
+ * @param params Object containing search filters and query string parameters.
992
+ * @param options Optional request config override.
993
+ * @returns List of matching user profiles returned exactly from the endpoint.
994
+ */
995
+ search: async (
996
+ params: UsersControllerSearchUsersParams,
997
+ options?: AxiosRequestConfig
998
+ ): Promise<UserProfile[]> => {
336
999
  return this.raw.usersControllerSearchUsers(params, options) as any;
337
1000
  },
338
1001
  };