@scryme/chat 2.13.4 → 2.15.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/dist/sdk.d.ts +316 -17
- package/dist/sdk.js +444 -12
- package/package.json +1 -1
- package/src/__tests__/sdk.test.ts +224 -2
- package/src/sdk.ts +582 -53
package/src/sdk.ts
CHANGED
|
@@ -16,6 +16,13 @@ import type {
|
|
|
16
16
|
MarkAsReadDto,
|
|
17
17
|
UsersControllerSearchUsersParams,
|
|
18
18
|
DmsControllerGetMessagesParams,
|
|
19
|
+
CreateMessageDto,
|
|
20
|
+
V3CreateWebhookDto,
|
|
21
|
+
V3UpdateWebhookDto,
|
|
22
|
+
CreateChannelIncomingWebhookDto,
|
|
23
|
+
UpdateChannelIncomingWebhookDto,
|
|
24
|
+
ExecuteChannelIncomingWebhookDto,
|
|
25
|
+
V3ChannelIncomingWebhooksControllerExecuteWebhookByChannelIdParams,
|
|
19
26
|
V3WorkspacesControllerGetWorkspacesResult,
|
|
20
27
|
V3WorkspacesControllerGetWorkspaceBySlugResult,
|
|
21
28
|
V3WorkspacesControllerProvisionWorkspaceResult,
|
|
@@ -46,10 +53,51 @@ import type {
|
|
|
46
53
|
UsersControllerGetMeResult,
|
|
47
54
|
UsersControllerGetUserResult,
|
|
48
55
|
UsersControllerSearchUsersResult,
|
|
56
|
+
DmsControllerAddReactionBody,
|
|
57
|
+
DmsControllerAddReactionResult,
|
|
58
|
+
DmsControllerRemoveReactionResult,
|
|
59
|
+
V3WebhooksControllerGetWebhooksResult,
|
|
60
|
+
V3WebhooksControllerCreateWebhookResult,
|
|
61
|
+
V3WebhooksControllerGetWebhookResult,
|
|
62
|
+
V3WebhooksControllerUpdateWebhookResult,
|
|
63
|
+
V3WebhooksControllerDeleteWebhookResult,
|
|
64
|
+
V3ChannelIncomingWebhooksControllerGetChannelWebhooksResult,
|
|
65
|
+
V3ChannelIncomingWebhooksControllerCreateChannelWebhookResult,
|
|
66
|
+
V3ChannelIncomingWebhooksControllerGetChannelWebhookResult,
|
|
67
|
+
V3ChannelIncomingWebhooksControllerUpdateChannelWebhookResult,
|
|
68
|
+
V3ChannelIncomingWebhooksControllerDeleteChannelWebhookResult,
|
|
69
|
+
V3ChannelIncomingWebhooksControllerExecuteWebhookByUrlTokenResult,
|
|
70
|
+
V3ChannelIncomingWebhooksControllerExecuteWebhookByChannelIdResult,
|
|
71
|
+
V3OAuthControllerGetTokenResult,
|
|
49
72
|
} from './generated/v3-server';
|
|
50
73
|
|
|
51
74
|
// --- High-fidelity Response and Entity Interfaces for Excellent DX ---
|
|
52
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Represents a message attachment.
|
|
78
|
+
*/
|
|
79
|
+
export interface MessageAttachment {
|
|
80
|
+
id: string;
|
|
81
|
+
messageId?: string | null;
|
|
82
|
+
name: string;
|
|
83
|
+
type: string;
|
|
84
|
+
url: string;
|
|
85
|
+
size?: string | null;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Represents a user reaction to a message.
|
|
91
|
+
*/
|
|
92
|
+
export interface MessageReaction {
|
|
93
|
+
id: string;
|
|
94
|
+
messageId: string;
|
|
95
|
+
userId: string;
|
|
96
|
+
emoji: string;
|
|
97
|
+
customEmojiId?: string | null;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
53
101
|
/**
|
|
54
102
|
* Represents a workspace in the Scryme platform (Enterprise M2M API V3).
|
|
55
103
|
*/
|
|
@@ -67,7 +115,7 @@ export interface V3Workspace {
|
|
|
67
115
|
/** Industry categorization of the workspace. */
|
|
68
116
|
industry?: string | null;
|
|
69
117
|
/** Custom branding configuration object. */
|
|
70
|
-
brandingConfig?:
|
|
118
|
+
brandingConfig?: Record<string, unknown> | null;
|
|
71
119
|
/** ISO timestamp when the workspace was created. */
|
|
72
120
|
createdAt: string;
|
|
73
121
|
/** ISO timestamp when the workspace was last updated. */
|
|
@@ -324,9 +372,9 @@ export interface ChannelMessage {
|
|
|
324
372
|
/** Optional identifier of the root thread message. */
|
|
325
373
|
threadId?: string | null;
|
|
326
374
|
/** Optional attachments uploaded with the message. */
|
|
327
|
-
attachments?:
|
|
375
|
+
attachments?: MessageAttachment[];
|
|
328
376
|
/** Reactions associated with this message. */
|
|
329
|
-
reactions?:
|
|
377
|
+
reactions?: MessageReaction[];
|
|
330
378
|
}
|
|
331
379
|
|
|
332
380
|
/**
|
|
@@ -360,7 +408,7 @@ export interface DmConversation {
|
|
|
360
408
|
};
|
|
361
409
|
}[];
|
|
362
410
|
/** Messages belonging to this DM conversation. */
|
|
363
|
-
messages?:
|
|
411
|
+
messages?: ChannelMessage[];
|
|
364
412
|
/** Metadata count summaries for the conversation. */
|
|
365
413
|
_count?: {
|
|
366
414
|
/** Total number of messages in the conversation. */
|
|
@@ -534,7 +582,7 @@ export class ScrymeSDK {
|
|
|
534
582
|
* Generates the default request configuration containing the authorization headers and baseURL.
|
|
535
583
|
* @returns Request configuration object.
|
|
536
584
|
*/
|
|
537
|
-
private async getRequestConfig(): Promise<
|
|
585
|
+
private async getRequestConfig(): Promise<AxiosRequestConfig> {
|
|
538
586
|
const token = await this.getOrFetchToken();
|
|
539
587
|
return {
|
|
540
588
|
baseURL: `${this.baseURL}/api`,
|
|
@@ -554,7 +602,7 @@ export class ScrymeSDK {
|
|
|
554
602
|
get: (target, prop) => {
|
|
555
603
|
const originalMethod = Reflect.get(target, prop);
|
|
556
604
|
if (typeof originalMethod === 'function') {
|
|
557
|
-
return async (...args:
|
|
605
|
+
return async (...args: unknown[]) => {
|
|
558
606
|
const config = await this.getRequestConfig();
|
|
559
607
|
const arity = originalMethod.length;
|
|
560
608
|
const newArgs = [...args];
|
|
@@ -562,13 +610,13 @@ export class ScrymeSDK {
|
|
|
562
610
|
// Orval generated functions accept `options` as their last parameter.
|
|
563
611
|
// If the user provided options, we merge them with our default request config.
|
|
564
612
|
if (args.length >= arity && typeof args[args.length - 1] === 'object') {
|
|
565
|
-
const userOptions = args[args.length - 1];
|
|
613
|
+
const userOptions = args[args.length - 1] as AxiosRequestConfig;
|
|
566
614
|
newArgs[args.length - 1] = {
|
|
567
615
|
...userOptions,
|
|
568
616
|
baseURL: config.baseURL,
|
|
569
617
|
headers: {
|
|
570
618
|
...config.headers,
|
|
571
|
-
...userOptions
|
|
619
|
+
...userOptions?.headers,
|
|
572
620
|
},
|
|
573
621
|
};
|
|
574
622
|
} else {
|
|
@@ -579,12 +627,12 @@ export class ScrymeSDK {
|
|
|
579
627
|
newArgs.push(config);
|
|
580
628
|
}
|
|
581
629
|
|
|
582
|
-
return originalMethod(...newArgs);
|
|
630
|
+
return (originalMethod as (...a: unknown[]) => unknown)(...newArgs);
|
|
583
631
|
};
|
|
584
632
|
}
|
|
585
633
|
return originalMethod;
|
|
586
634
|
},
|
|
587
|
-
}) as
|
|
635
|
+
}) as unknown as ReturnType<typeof getSkyrmeChatAPI>;
|
|
588
636
|
}
|
|
589
637
|
|
|
590
638
|
// --- High-level nested namespace chains for excellent DX ---
|
|
@@ -601,7 +649,7 @@ export class ScrymeSDK {
|
|
|
601
649
|
* @returns List of workspaces returned exactly from the endpoint.
|
|
602
650
|
*/
|
|
603
651
|
list: async (options?: AxiosRequestConfig): Promise<V3WorkspacesResponse> => {
|
|
604
|
-
return this.raw.v3WorkspacesControllerGetWorkspaces(options) as
|
|
652
|
+
return this.raw.v3WorkspacesControllerGetWorkspaces(options) as unknown as V3WorkspacesResponse;
|
|
605
653
|
},
|
|
606
654
|
/**
|
|
607
655
|
* Retrieves detailed information of a specific workspace by its slug.
|
|
@@ -610,7 +658,7 @@ export class ScrymeSDK {
|
|
|
610
658
|
* @returns Workspace details returned exactly from the endpoint.
|
|
611
659
|
*/
|
|
612
660
|
get: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspaceResponse> => {
|
|
613
|
-
return this.raw.v3WorkspacesControllerGetWorkspaceBySlug(slug, options) as
|
|
661
|
+
return this.raw.v3WorkspacesControllerGetWorkspaceBySlug(slug, options) as unknown as V3WorkspaceResponse;
|
|
614
662
|
},
|
|
615
663
|
/**
|
|
616
664
|
* Provisions a new workspace inside the organization.
|
|
@@ -622,7 +670,7 @@ export class ScrymeSDK {
|
|
|
622
670
|
data: V3ProvisionWorkspaceDto,
|
|
623
671
|
options?: AxiosRequestConfig
|
|
624
672
|
): Promise<V3ProvisionWorkspaceResponse> => {
|
|
625
|
-
return this.raw.v3WorkspacesControllerProvisionWorkspace(data, options) as
|
|
673
|
+
return this.raw.v3WorkspacesControllerProvisionWorkspace(data, options) as unknown as V3ProvisionWorkspaceResponse;
|
|
626
674
|
},
|
|
627
675
|
/**
|
|
628
676
|
* Updates the configurations and metadata of an existing workspace.
|
|
@@ -636,7 +684,7 @@ export class ScrymeSDK {
|
|
|
636
684
|
data: V3UpdateWorkspaceDto,
|
|
637
685
|
options?: AxiosRequestConfig
|
|
638
686
|
): Promise<V3WorkspaceResponse> => {
|
|
639
|
-
return this.raw.v3WorkspacesControllerUpdateWorkspace(slug, data, options) as
|
|
687
|
+
return this.raw.v3WorkspacesControllerUpdateWorkspace(slug, data, options) as unknown as V3WorkspaceResponse;
|
|
640
688
|
},
|
|
641
689
|
/**
|
|
642
690
|
* Permanently deletes a specific workspace by its slug.
|
|
@@ -645,7 +693,7 @@ export class ScrymeSDK {
|
|
|
645
693
|
* @returns Deletion status response exactly from the endpoint.
|
|
646
694
|
*/
|
|
647
695
|
delete: async (slug: string, options?: AxiosRequestConfig): Promise<V3DeleteWorkspaceResponse> => {
|
|
648
|
-
return this.raw.v3WorkspacesControllerDeleteWorkspace(slug, options) as
|
|
696
|
+
return this.raw.v3WorkspacesControllerDeleteWorkspace(slug, options) as unknown as V3DeleteWorkspaceResponse;
|
|
649
697
|
},
|
|
650
698
|
/**
|
|
651
699
|
* Operations for managing workspace members, including listing, adding, role updates, and removal.
|
|
@@ -658,7 +706,7 @@ export class ScrymeSDK {
|
|
|
658
706
|
* @returns List of workspace members exactly from the endpoint.
|
|
659
707
|
*/
|
|
660
708
|
list: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspaceMembersResponse> => {
|
|
661
|
-
return this.raw.v3WorkspacesControllerGetWorkspaceMembers(slug, options) as
|
|
709
|
+
return this.raw.v3WorkspacesControllerGetWorkspaceMembers(slug, options) as unknown as V3WorkspaceMembersResponse;
|
|
662
710
|
},
|
|
663
711
|
/**
|
|
664
712
|
* Adds a new member to the workspace.
|
|
@@ -672,7 +720,7 @@ export class ScrymeSDK {
|
|
|
672
720
|
data: V3AddMemberDto,
|
|
673
721
|
options?: AxiosRequestConfig
|
|
674
722
|
): Promise<V3AddWorkspaceMemberResponse> => {
|
|
675
|
-
return this.raw.v3WorkspacesControllerAddWorkspaceMember(slug, data, options) as
|
|
723
|
+
return this.raw.v3WorkspacesControllerAddWorkspaceMember(slug, data, options) as unknown as V3AddWorkspaceMemberResponse;
|
|
676
724
|
},
|
|
677
725
|
/**
|
|
678
726
|
* Retrieves membership details of a specific member in a workspace.
|
|
@@ -686,7 +734,7 @@ export class ScrymeSDK {
|
|
|
686
734
|
memberId: string,
|
|
687
735
|
options?: AxiosRequestConfig
|
|
688
736
|
): Promise<V3GetWorkspaceMemberResponse> => {
|
|
689
|
-
return this.raw.v3WorkspacesControllerGetWorkspaceMember(slug, memberId, options) as
|
|
737
|
+
return this.raw.v3WorkspacesControllerGetWorkspaceMember(slug, memberId, options) as unknown as V3GetWorkspaceMemberResponse;
|
|
690
738
|
},
|
|
691
739
|
/**
|
|
692
740
|
* Updates the role or configuration of a workspace member.
|
|
@@ -702,7 +750,7 @@ export class ScrymeSDK {
|
|
|
702
750
|
data: V3UpdateMemberRoleDto,
|
|
703
751
|
options?: AxiosRequestConfig
|
|
704
752
|
): Promise<V3UpdateWorkspaceMemberResponse> => {
|
|
705
|
-
return this.raw.v3WorkspacesControllerUpdateWorkspaceMember(slug, memberId, data, options) as
|
|
753
|
+
return this.raw.v3WorkspacesControllerUpdateWorkspaceMember(slug, memberId, data, options) as unknown as V3UpdateWorkspaceMemberResponse;
|
|
706
754
|
},
|
|
707
755
|
/**
|
|
708
756
|
* Removes a member from the workspace.
|
|
@@ -716,7 +764,7 @@ export class ScrymeSDK {
|
|
|
716
764
|
memberId: string,
|
|
717
765
|
options?: AxiosRequestConfig
|
|
718
766
|
): Promise<V3DeleteWorkspaceMemberResponse> => {
|
|
719
|
-
return this.raw.v3WorkspacesControllerDeleteWorkspaceMember(slug, memberId, options) as
|
|
767
|
+
return this.raw.v3WorkspacesControllerDeleteWorkspaceMember(slug, memberId, options) as unknown as V3DeleteWorkspaceMemberResponse;
|
|
720
768
|
},
|
|
721
769
|
},
|
|
722
770
|
/**
|
|
@@ -730,7 +778,7 @@ export class ScrymeSDK {
|
|
|
730
778
|
* @returns List of channels returned exactly from the endpoint.
|
|
731
779
|
*/
|
|
732
780
|
list: async (slug: string, options?: AxiosRequestConfig): Promise<WorkspaceChannel[]> => {
|
|
733
|
-
return this.raw.channelsControllerGetWorkspaceChannels(slug, options) as
|
|
781
|
+
return this.raw.channelsControllerGetWorkspaceChannels(slug, options) as unknown as WorkspaceChannel[];
|
|
734
782
|
},
|
|
735
783
|
/**
|
|
736
784
|
* Creates a new channel within a workspace.
|
|
@@ -744,7 +792,7 @@ export class ScrymeSDK {
|
|
|
744
792
|
data: CreateWorkspaceChannelDto,
|
|
745
793
|
options?: AxiosRequestConfig
|
|
746
794
|
): Promise<WorkspaceChannel> => {
|
|
747
|
-
return this.raw.channelsControllerCreateChannel(slug, data, options) as
|
|
795
|
+
return this.raw.channelsControllerCreateChannel(slug, data, options) as unknown as WorkspaceChannel;
|
|
748
796
|
},
|
|
749
797
|
},
|
|
750
798
|
};
|
|
@@ -763,7 +811,7 @@ export class ScrymeSDK {
|
|
|
763
811
|
* @returns Channel details returned exactly from the endpoint.
|
|
764
812
|
*/
|
|
765
813
|
get: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<WorkspaceChannel> => {
|
|
766
|
-
return this.raw.channelsControllerGetChannel(slug, channelId, options) as
|
|
814
|
+
return this.raw.channelsControllerGetChannel(slug, channelId, options) as unknown as WorkspaceChannel;
|
|
767
815
|
},
|
|
768
816
|
/**
|
|
769
817
|
* Updates configuration, description, icon or status of an existing channel.
|
|
@@ -779,7 +827,7 @@ export class ScrymeSDK {
|
|
|
779
827
|
data: UpdateWorkspaceChannelDto,
|
|
780
828
|
options?: AxiosRequestConfig
|
|
781
829
|
): Promise<WorkspaceChannel> => {
|
|
782
|
-
return this.raw.channelsControllerUpdateChannel(slug, channelId, data, options) as
|
|
830
|
+
return this.raw.channelsControllerUpdateChannel(slug, channelId, data, options) as unknown as WorkspaceChannel;
|
|
783
831
|
},
|
|
784
832
|
/**
|
|
785
833
|
* Permanently deletes a channel from a workspace.
|
|
@@ -789,7 +837,7 @@ export class ScrymeSDK {
|
|
|
789
837
|
* @returns Success status indicating that the channel was deleted exactly from the endpoint.
|
|
790
838
|
*/
|
|
791
839
|
delete: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<{ success: boolean }> => {
|
|
792
|
-
return this.raw.channelsControllerDeleteChannel(slug, channelId, options) as
|
|
840
|
+
return this.raw.channelsControllerDeleteChannel(slug, channelId, options) as unknown as { success: boolean };
|
|
793
841
|
},
|
|
794
842
|
/**
|
|
795
843
|
* Sub-namespace for managing messages inside a channel.
|
|
@@ -807,29 +855,101 @@ export class ScrymeSDK {
|
|
|
807
855
|
params?: ChannelsControllerGetMessagesParams,
|
|
808
856
|
options?: AxiosRequestConfig
|
|
809
857
|
): Promise<{ messages: ChannelMessage[]; nextCursor?: string }> => {
|
|
810
|
-
return this.raw.channelsControllerGetMessages(channelId, params, options) as
|
|
858
|
+
return this.raw.channelsControllerGetMessages(channelId, params, options) as unknown as { messages: ChannelMessage[]; nextCursor?: string };
|
|
811
859
|
},
|
|
812
860
|
/**
|
|
813
861
|
* Sends a new message to a channel.
|
|
814
862
|
* @param channelId Unique identifier of the target channel.
|
|
815
|
-
* @param
|
|
863
|
+
* @param data The message content string or structured CreateMessageDto object.
|
|
864
|
+
* @param options Optional request config override.
|
|
816
865
|
* @returns The created message exactly from the endpoint.
|
|
817
866
|
*/
|
|
818
|
-
create: async (
|
|
819
|
-
|
|
867
|
+
create: async (
|
|
868
|
+
channelId: string,
|
|
869
|
+
data: CreateMessageDto | string,
|
|
870
|
+
options?: AxiosRequestConfig
|
|
871
|
+
): Promise<ChannelMessage> => {
|
|
872
|
+
const payload = typeof data === 'string' ? { content: data } : data;
|
|
873
|
+
return this.raw.channelsControllerCreateMessage(channelId, {
|
|
874
|
+
...options,
|
|
875
|
+
data: payload,
|
|
876
|
+
}) as unknown as ChannelMessage;
|
|
877
|
+
},
|
|
878
|
+
/**
|
|
879
|
+
* Updates the content of a previously sent message in a channel.
|
|
880
|
+
* @param channelId Unique identifier of the channel containing the message.
|
|
881
|
+
* @param messageId Unique identifier of the message to update.
|
|
882
|
+
* @param data The new content payload.
|
|
883
|
+
* @param options Optional request config override.
|
|
884
|
+
* @returns The updated message details exactly from the endpoint.
|
|
885
|
+
*/
|
|
886
|
+
update: async (
|
|
887
|
+
channelId: string,
|
|
888
|
+
messageId: string,
|
|
889
|
+
data: ChannelsControllerUpdateMessageBody,
|
|
890
|
+
options?: AxiosRequestConfig
|
|
891
|
+
): Promise<ChannelMessage> => {
|
|
892
|
+
return this.raw.channelsControllerUpdateMessage(channelId, messageId, data, options) as unknown as ChannelMessage;
|
|
893
|
+
},
|
|
894
|
+
/**
|
|
895
|
+
* Permanently deletes a message in a channel.
|
|
896
|
+
* @param channelId Unique identifier of the channel containing the message.
|
|
897
|
+
* @param messageId Unique identifier of the message to delete.
|
|
898
|
+
* @param options Optional request config override.
|
|
899
|
+
* @returns Success status indicating that the message was deleted exactly from the endpoint.
|
|
900
|
+
*/
|
|
901
|
+
delete: async (
|
|
902
|
+
channelId: string,
|
|
903
|
+
messageId: string,
|
|
904
|
+
options?: AxiosRequestConfig
|
|
905
|
+
): Promise<{ success: boolean }> => {
|
|
906
|
+
return this.raw.channelsControllerDeleteMessage(channelId, messageId, options) as unknown as { success: boolean };
|
|
907
|
+
},
|
|
908
|
+
/**
|
|
909
|
+
* Adds a reaction (emoji) to a message in a channel.
|
|
910
|
+
* @param channelId Unique identifier of the channel containing the message.
|
|
911
|
+
* @param messageId Unique identifier of the message.
|
|
912
|
+
* @param data Object containing the target emoji character.
|
|
913
|
+
* @param options Optional request config override.
|
|
914
|
+
* @returns The reaction response returned exactly from the endpoint.
|
|
915
|
+
*/
|
|
916
|
+
addReaction: async (
|
|
917
|
+
channelId: string,
|
|
918
|
+
messageId: string,
|
|
919
|
+
data: ChannelsControllerAddReactionBody,
|
|
920
|
+
options?: AxiosRequestConfig
|
|
921
|
+
): Promise<ChannelsControllerAddReactionResult> => {
|
|
922
|
+
return this.raw.channelsControllerAddReaction(channelId, messageId, data, options) as unknown as ChannelsControllerAddReactionResult;
|
|
923
|
+
},
|
|
924
|
+
/**
|
|
925
|
+
* Removes a reaction (emoji) from a message in a channel.
|
|
926
|
+
* @param channelId Unique identifier of the channel containing the message.
|
|
927
|
+
* @param messageId Unique identifier of the message.
|
|
928
|
+
* @param emoji The emoji character to remove.
|
|
929
|
+
* @param options Optional request config override.
|
|
930
|
+
* @returns The reaction removal response returned exactly from the endpoint.
|
|
931
|
+
*/
|
|
932
|
+
removeReaction: async (
|
|
933
|
+
channelId: string,
|
|
934
|
+
messageId: string,
|
|
935
|
+
emoji: string,
|
|
936
|
+
options?: AxiosRequestConfig
|
|
937
|
+
): Promise<ChannelsControllerRemoveReactionResult> => {
|
|
938
|
+
return this.raw.channelsControllerRemoveReaction(channelId, messageId, emoji, options) as unknown as ChannelsControllerRemoveReactionResult;
|
|
820
939
|
},
|
|
821
940
|
},
|
|
822
941
|
};
|
|
823
942
|
}
|
|
824
943
|
|
|
825
944
|
/**
|
|
826
|
-
* Operations for modifying, reacting to, or deleting existing channel messages.
|
|
945
|
+
* Operations for modifying, reacting to, or deleting existing messages (both channel & direct messages).
|
|
946
|
+
* Automatically intercepts direct messages starting with 'dm-' and routes them correctly.
|
|
827
947
|
*/
|
|
828
948
|
public get message() {
|
|
829
949
|
return {
|
|
830
950
|
/**
|
|
831
951
|
* Updates the content of a previously sent message.
|
|
832
|
-
* @param channelId Unique identifier of the channel containing the message.
|
|
952
|
+
* @param channelId Unique identifier of the channel or DM conversation containing the message.
|
|
833
953
|
* @param messageId Unique identifier of the message to update.
|
|
834
954
|
* @param data The new content payload.
|
|
835
955
|
* @param options Optional request config override.
|
|
@@ -838,14 +958,17 @@ export class ScrymeSDK {
|
|
|
838
958
|
update: async (
|
|
839
959
|
channelId: string,
|
|
840
960
|
messageId: string,
|
|
841
|
-
data: ChannelsControllerUpdateMessageBody,
|
|
961
|
+
data: ChannelsControllerUpdateMessageBody | UpdateDmMessageDto,
|
|
842
962
|
options?: AxiosRequestConfig
|
|
843
963
|
): Promise<ChannelMessage> => {
|
|
844
|
-
|
|
964
|
+
if (channelId.startsWith('dm-')) {
|
|
965
|
+
return this.raw.dmsControllerUpdateMessage(channelId, messageId, data as UpdateDmMessageDto, options) as unknown as ChannelMessage;
|
|
966
|
+
}
|
|
967
|
+
return this.raw.channelsControllerUpdateMessage(channelId, messageId, data as ChannelsControllerUpdateMessageBody, options) as unknown as ChannelMessage;
|
|
845
968
|
},
|
|
846
969
|
/**
|
|
847
970
|
* Permanently deletes a message.
|
|
848
|
-
* @param channelId Unique identifier of the channel containing the message.
|
|
971
|
+
* @param channelId Unique identifier of the channel or DM conversation containing the message.
|
|
849
972
|
* @param messageId Unique identifier of the message to delete.
|
|
850
973
|
* @param options Optional request config override.
|
|
851
974
|
* @returns Success status indicating that the message was deleted exactly from the endpoint.
|
|
@@ -855,11 +978,14 @@ export class ScrymeSDK {
|
|
|
855
978
|
messageId: string,
|
|
856
979
|
options?: AxiosRequestConfig
|
|
857
980
|
): Promise<{ success: boolean }> => {
|
|
858
|
-
|
|
981
|
+
if (channelId.startsWith('dm-')) {
|
|
982
|
+
return this.raw.dmsControllerDeleteMessage(channelId, messageId, options) as unknown as { success: boolean };
|
|
983
|
+
}
|
|
984
|
+
return this.raw.channelsControllerDeleteMessage(channelId, messageId, options) as unknown as { success: boolean };
|
|
859
985
|
},
|
|
860
986
|
/**
|
|
861
987
|
* Adds a reaction (emoji) to a message.
|
|
862
|
-
* @param channelId Unique identifier of the channel containing the message.
|
|
988
|
+
* @param channelId Unique identifier of the channel or DM conversation containing the message.
|
|
863
989
|
* @param messageId Unique identifier of the message.
|
|
864
990
|
* @param data Object containing the target emoji character.
|
|
865
991
|
* @param options Optional request config override.
|
|
@@ -868,14 +994,17 @@ export class ScrymeSDK {
|
|
|
868
994
|
addReaction: async (
|
|
869
995
|
channelId: string,
|
|
870
996
|
messageId: string,
|
|
871
|
-
data: ChannelsControllerAddReactionBody,
|
|
997
|
+
data: ChannelsControllerAddReactionBody | DmsControllerAddReactionBody,
|
|
872
998
|
options?: AxiosRequestConfig
|
|
873
|
-
): Promise<
|
|
874
|
-
|
|
999
|
+
): Promise<ChannelsControllerAddReactionResult | DmsControllerAddReactionResult> => {
|
|
1000
|
+
if (channelId.startsWith('dm-')) {
|
|
1001
|
+
return this.raw.dmsControllerAddReaction(channelId, messageId, data as DmsControllerAddReactionBody, options) as unknown as DmsControllerAddReactionResult;
|
|
1002
|
+
}
|
|
1003
|
+
return this.raw.channelsControllerAddReaction(channelId, messageId, data as ChannelsControllerAddReactionBody, options) as unknown as ChannelsControllerAddReactionResult;
|
|
875
1004
|
},
|
|
876
1005
|
/**
|
|
877
1006
|
* Removes a reaction (emoji) from a message.
|
|
878
|
-
* @param channelId Unique identifier of the channel containing the message.
|
|
1007
|
+
* @param channelId Unique identifier of the channel or DM conversation containing the message.
|
|
879
1008
|
* @param messageId Unique identifier of the message.
|
|
880
1009
|
* @param emoji The emoji character to remove.
|
|
881
1010
|
* @param options Optional request config override.
|
|
@@ -886,8 +1015,11 @@ export class ScrymeSDK {
|
|
|
886
1015
|
messageId: string,
|
|
887
1016
|
emoji: string,
|
|
888
1017
|
options?: AxiosRequestConfig
|
|
889
|
-
): Promise<
|
|
890
|
-
|
|
1018
|
+
): Promise<ChannelsControllerRemoveReactionResult | DmsControllerRemoveReactionResult> => {
|
|
1019
|
+
if (channelId.startsWith('dm-')) {
|
|
1020
|
+
return this.raw.dmsControllerRemoveReaction(channelId, messageId, emoji, options) as unknown as DmsControllerRemoveReactionResult;
|
|
1021
|
+
}
|
|
1022
|
+
return this.raw.channelsControllerRemoveReaction(channelId, messageId, emoji, options) as unknown as ChannelsControllerRemoveReactionResult;
|
|
891
1023
|
},
|
|
892
1024
|
};
|
|
893
1025
|
}
|
|
@@ -903,7 +1035,7 @@ export class ScrymeSDK {
|
|
|
903
1035
|
* @returns List of active DM conversations returned exactly from the endpoint.
|
|
904
1036
|
*/
|
|
905
1037
|
list: async (options?: AxiosRequestConfig): Promise<DmConversation[]> => {
|
|
906
|
-
return this.raw.dmsControllerGetDms(options) as
|
|
1038
|
+
return this.raw.dmsControllerGetDms(options) as unknown as DmConversation[];
|
|
907
1039
|
},
|
|
908
1040
|
/**
|
|
909
1041
|
* Creates/initiates a direct message conversation with specified users.
|
|
@@ -912,7 +1044,7 @@ export class ScrymeSDK {
|
|
|
912
1044
|
* @returns Details of the created DM conversation exactly from the endpoint.
|
|
913
1045
|
*/
|
|
914
1046
|
create: async (data: CreateDmDto, options?: AxiosRequestConfig): Promise<DmConversation> => {
|
|
915
|
-
return this.raw.dmsControllerCreateDm(data, options) as
|
|
1047
|
+
return this.raw.dmsControllerCreateDm(data, options) as unknown as DmConversation;
|
|
916
1048
|
},
|
|
917
1049
|
/**
|
|
918
1050
|
* Retrieves details of a specific direct message conversation.
|
|
@@ -921,7 +1053,7 @@ export class ScrymeSDK {
|
|
|
921
1053
|
* @returns Detailed direct message conversation object exactly from the endpoint.
|
|
922
1054
|
*/
|
|
923
1055
|
get: async (dmId: string, options?: AxiosRequestConfig): Promise<DmConversation> => {
|
|
924
|
-
return this.raw.dmsControllerGetDm(dmId, options) as
|
|
1056
|
+
return this.raw.dmsControllerGetDm(dmId, options) as unknown as DmConversation;
|
|
925
1057
|
},
|
|
926
1058
|
/**
|
|
927
1059
|
* Deletes/closes an active direct message conversation.
|
|
@@ -930,7 +1062,7 @@ export class ScrymeSDK {
|
|
|
930
1062
|
* @returns Success status indicating that the DM conversation was deleted exactly from the endpoint.
|
|
931
1063
|
*/
|
|
932
1064
|
delete: async (dmId: string, options?: AxiosRequestConfig): Promise<{ success: boolean }> => {
|
|
933
|
-
return this.raw.dmsControllerDeleteDm(dmId, options) as
|
|
1065
|
+
return this.raw.dmsControllerDeleteDm(dmId, options) as unknown as { success: boolean };
|
|
934
1066
|
},
|
|
935
1067
|
/**
|
|
936
1068
|
* Sub-namespace for managing direct messages in a specific DM conversation.
|
|
@@ -948,16 +1080,87 @@ export class ScrymeSDK {
|
|
|
948
1080
|
params?: DmsControllerGetMessagesParams,
|
|
949
1081
|
options?: AxiosRequestConfig
|
|
950
1082
|
): Promise<{ messages: ChannelMessage[]; nextCursor?: string }> => {
|
|
951
|
-
return this.raw.dmsControllerGetMessages(dmId, params, options) as
|
|
1083
|
+
return this.raw.dmsControllerGetMessages(dmId, params, options) as unknown as { messages: ChannelMessage[]; nextCursor?: string };
|
|
952
1084
|
},
|
|
953
1085
|
/**
|
|
954
1086
|
* Sends a new message in a direct message conversation.
|
|
955
1087
|
* @param dmId Unique identifier of the direct message conversation.
|
|
956
|
-
* @param
|
|
1088
|
+
* @param data The message content string or structured CreateMessageDto object.
|
|
1089
|
+
* @param options Optional request config override.
|
|
957
1090
|
* @returns The sent message exactly from the endpoint.
|
|
958
1091
|
*/
|
|
959
|
-
create: async (
|
|
960
|
-
|
|
1092
|
+
create: async (
|
|
1093
|
+
dmId: string,
|
|
1094
|
+
data: CreateMessageDto | { content: string } | string,
|
|
1095
|
+
options?: AxiosRequestConfig
|
|
1096
|
+
): Promise<ChannelMessage> => {
|
|
1097
|
+
const payload = typeof data === 'string' ? { content: data } : data;
|
|
1098
|
+
return this.raw.dmsControllerCreateMessage(dmId, {
|
|
1099
|
+
...options,
|
|
1100
|
+
data: payload,
|
|
1101
|
+
}) as unknown as ChannelMessage;
|
|
1102
|
+
},
|
|
1103
|
+
/**
|
|
1104
|
+
* Updates the content of a previously sent direct message.
|
|
1105
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
1106
|
+
* @param messageId Unique identifier of the message to update.
|
|
1107
|
+
* @param data The new content payload.
|
|
1108
|
+
* @param options Optional request config override.
|
|
1109
|
+
* @returns The updated message details exactly from the endpoint.
|
|
1110
|
+
*/
|
|
1111
|
+
update: async (
|
|
1112
|
+
dmId: string,
|
|
1113
|
+
messageId: string,
|
|
1114
|
+
data: UpdateDmMessageDto,
|
|
1115
|
+
options?: AxiosRequestConfig
|
|
1116
|
+
): Promise<ChannelMessage> => {
|
|
1117
|
+
return this.raw.dmsControllerUpdateMessage(dmId, messageId, data, options) as unknown as ChannelMessage;
|
|
1118
|
+
},
|
|
1119
|
+
/**
|
|
1120
|
+
* Permanently deletes a direct message.
|
|
1121
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
1122
|
+
* @param messageId Unique identifier of the message to delete.
|
|
1123
|
+
* @param options Optional request config override.
|
|
1124
|
+
* @returns Success status indicating that the message was deleted exactly from the endpoint.
|
|
1125
|
+
*/
|
|
1126
|
+
delete: async (
|
|
1127
|
+
dmId: string,
|
|
1128
|
+
messageId: string,
|
|
1129
|
+
options?: AxiosRequestConfig
|
|
1130
|
+
): Promise<{ success: boolean }> => {
|
|
1131
|
+
return this.raw.dmsControllerDeleteMessage(dmId, messageId, options) as unknown as { success: boolean };
|
|
1132
|
+
},
|
|
1133
|
+
/**
|
|
1134
|
+
* Adds a reaction (emoji) to a direct message.
|
|
1135
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
1136
|
+
* @param messageId Unique identifier of the message.
|
|
1137
|
+
* @param data Object containing the target emoji character.
|
|
1138
|
+
* @param options Optional request config override.
|
|
1139
|
+
* @returns The reaction response returned exactly from the endpoint.
|
|
1140
|
+
*/
|
|
1141
|
+
addReaction: async (
|
|
1142
|
+
dmId: string,
|
|
1143
|
+
messageId: string,
|
|
1144
|
+
data: DmsControllerAddReactionBody,
|
|
1145
|
+
options?: AxiosRequestConfig
|
|
1146
|
+
): Promise<DmsControllerAddReactionResult> => {
|
|
1147
|
+
return this.raw.dmsControllerAddReaction(dmId, messageId, data, options) as unknown as DmsControllerAddReactionResult;
|
|
1148
|
+
},
|
|
1149
|
+
/**
|
|
1150
|
+
* Removes a reaction (emoji) from a direct message.
|
|
1151
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
1152
|
+
* @param messageId Unique identifier of the message.
|
|
1153
|
+
* @param emoji The emoji character to remove.
|
|
1154
|
+
* @param options Optional request config override.
|
|
1155
|
+
* @returns The reaction removal response returned exactly from the endpoint.
|
|
1156
|
+
*/
|
|
1157
|
+
removeReaction: async (
|
|
1158
|
+
dmId: string,
|
|
1159
|
+
messageId: string,
|
|
1160
|
+
emoji: string,
|
|
1161
|
+
options?: AxiosRequestConfig
|
|
1162
|
+
): Promise<DmsControllerRemoveReactionResult> => {
|
|
1163
|
+
return this.raw.dmsControllerRemoveReaction(dmId, messageId, emoji, options) as unknown as DmsControllerRemoveReactionResult;
|
|
961
1164
|
},
|
|
962
1165
|
},
|
|
963
1166
|
};
|
|
@@ -975,7 +1178,7 @@ export class ScrymeSDK {
|
|
|
975
1178
|
* @returns The active user's profile returned exactly from the endpoint.
|
|
976
1179
|
*/
|
|
977
1180
|
me: async (options?: AxiosRequestConfig): Promise<UserProfile> => {
|
|
978
|
-
return this.raw.usersControllerGetMe(options) as
|
|
1181
|
+
return this.raw.usersControllerGetMe(options) as unknown as UserProfile;
|
|
979
1182
|
},
|
|
980
1183
|
/**
|
|
981
1184
|
* Retrieves the public profile of a user by their user ID.
|
|
@@ -984,7 +1187,7 @@ export class ScrymeSDK {
|
|
|
984
1187
|
* @returns Public user profile returned exactly from the endpoint.
|
|
985
1188
|
*/
|
|
986
1189
|
get: async (userId: string, options?: AxiosRequestConfig): Promise<UserProfile> => {
|
|
987
|
-
return this.raw.usersControllerGetUser(userId, options) as
|
|
1190
|
+
return this.raw.usersControllerGetUser(userId, options) as unknown as UserProfile;
|
|
988
1191
|
},
|
|
989
1192
|
/**
|
|
990
1193
|
* Searches the organization or workspace directory for user profiles matching specific queries.
|
|
@@ -996,7 +1199,333 @@ export class ScrymeSDK {
|
|
|
996
1199
|
params: UsersControllerSearchUsersParams,
|
|
997
1200
|
options?: AxiosRequestConfig
|
|
998
1201
|
): Promise<UserProfile[]> => {
|
|
999
|
-
return this.raw.usersControllerSearchUsers(params, options) as
|
|
1202
|
+
return this.raw.usersControllerSearchUsers(params, options) as unknown as UserProfile[];
|
|
1203
|
+
},
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Operations for managing webhooks (both standard workspace webhooks and channel incoming webhooks).
|
|
1209
|
+
*/
|
|
1210
|
+
public get webhooks() {
|
|
1211
|
+
return {
|
|
1212
|
+
/**
|
|
1213
|
+
* Lists all configured webhooks for a workspace. Requires webhooks:read scope.
|
|
1214
|
+
* @param slug The unique workspace slug.
|
|
1215
|
+
* @param options Optional request config override.
|
|
1216
|
+
*/
|
|
1217
|
+
list: async (slug: string, options?: AxiosRequestConfig): Promise<V3WebhooksControllerGetWebhooksResult> => {
|
|
1218
|
+
return this.raw.v3WebhooksControllerGetWebhooks(slug, options) as unknown as V3WebhooksControllerGetWebhooksResult;
|
|
1219
|
+
},
|
|
1220
|
+
/**
|
|
1221
|
+
* Creates a new standard webhook for a workspace. Requires webhooks:write scope.
|
|
1222
|
+
* @param slug The unique workspace slug.
|
|
1223
|
+
* @param data Configuration options for the standard webhook.
|
|
1224
|
+
* @param options Optional request config override.
|
|
1225
|
+
*/
|
|
1226
|
+
create: async (slug: string, data: V3CreateWebhookDto, options?: AxiosRequestConfig): Promise<V3WebhooksControllerCreateWebhookResult> => {
|
|
1227
|
+
return this.raw.v3WebhooksControllerCreateWebhook(slug, data, options) as unknown as V3WebhooksControllerCreateWebhookResult;
|
|
1228
|
+
},
|
|
1229
|
+
/**
|
|
1230
|
+
* Retrieves details of a specific webhook. Requires webhooks:read scope.
|
|
1231
|
+
* @param slug The unique workspace slug.
|
|
1232
|
+
* @param webhookId The unique webhook identifier.
|
|
1233
|
+
* @param options Optional request config override.
|
|
1234
|
+
*/
|
|
1235
|
+
get: async (slug: string, webhookId: string, options?: AxiosRequestConfig): Promise<V3WebhooksControllerGetWebhookResult> => {
|
|
1236
|
+
return this.raw.v3WebhooksControllerGetWebhook(slug, webhookId, options) as unknown as V3WebhooksControllerGetWebhookResult;
|
|
1237
|
+
},
|
|
1238
|
+
/**
|
|
1239
|
+
* Updates a standard webhook for a workspace. Requires webhooks:write scope.
|
|
1240
|
+
* @param slug The unique workspace slug.
|
|
1241
|
+
* @param webhookId The unique webhook identifier.
|
|
1242
|
+
* @param data Fields to update on the webhook.
|
|
1243
|
+
* @param options Optional request config override.
|
|
1244
|
+
*/
|
|
1245
|
+
update: async (
|
|
1246
|
+
slug: string,
|
|
1247
|
+
webhookId: string,
|
|
1248
|
+
data: V3UpdateWebhookDto,
|
|
1249
|
+
options?: AxiosRequestConfig
|
|
1250
|
+
): Promise<V3WebhooksControllerUpdateWebhookResult> => {
|
|
1251
|
+
return this.raw.v3WebhooksControllerUpdateWebhook(slug, webhookId, data, options) as unknown as V3WebhooksControllerUpdateWebhookResult;
|
|
1252
|
+
},
|
|
1253
|
+
/**
|
|
1254
|
+
* Permanently deletes a standard webhook. Requires webhooks:write scope.
|
|
1255
|
+
* @param slug The unique workspace slug.
|
|
1256
|
+
* @param webhookId The unique webhook identifier.
|
|
1257
|
+
* @param options Optional request config override.
|
|
1258
|
+
*/
|
|
1259
|
+
delete: async (slug: string, webhookId: string, options?: AxiosRequestConfig): Promise<V3WebhooksControllerDeleteWebhookResult> => {
|
|
1260
|
+
return this.raw.v3WebhooksControllerDeleteWebhook(slug, webhookId, options) as unknown as V3WebhooksControllerDeleteWebhookResult;
|
|
1261
|
+
},
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Sub-namespace for managing channel incoming webhooks.
|
|
1265
|
+
*/
|
|
1266
|
+
incoming: {
|
|
1267
|
+
/**
|
|
1268
|
+
* Lists incoming webhooks configured for a specific channel. Requires webhooks:read scope.
|
|
1269
|
+
* @param slug The unique workspace slug.
|
|
1270
|
+
* @param channelId The unique channel identifier.
|
|
1271
|
+
* @param options Optional request config override.
|
|
1272
|
+
*/
|
|
1273
|
+
list: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<V3ChannelIncomingWebhooksControllerGetChannelWebhooksResult> => {
|
|
1274
|
+
return this.raw.v3ChannelIncomingWebhooksControllerGetChannelWebhooks(slug, channelId, options) as unknown as V3ChannelIncomingWebhooksControllerGetChannelWebhooksResult;
|
|
1275
|
+
},
|
|
1276
|
+
/**
|
|
1277
|
+
* Creates an incoming webhook for a specific channel. Requires webhooks:write scope.
|
|
1278
|
+
* @param slug The unique workspace slug.
|
|
1279
|
+
* @param channelId The unique channel identifier.
|
|
1280
|
+
* @param data Configuration options for the incoming webhook.
|
|
1281
|
+
* @param options Optional request config override.
|
|
1282
|
+
*/
|
|
1283
|
+
create: async (
|
|
1284
|
+
slug: string,
|
|
1285
|
+
channelId: string,
|
|
1286
|
+
data: CreateChannelIncomingWebhookDto,
|
|
1287
|
+
options?: AxiosRequestConfig
|
|
1288
|
+
): Promise<V3ChannelIncomingWebhooksControllerCreateChannelWebhookResult> => {
|
|
1289
|
+
return this.raw.v3ChannelIncomingWebhooksControllerCreateChannelWebhook(slug, channelId, data, options) as unknown as V3ChannelIncomingWebhooksControllerCreateChannelWebhookResult;
|
|
1290
|
+
},
|
|
1291
|
+
/**
|
|
1292
|
+
* Retrieves details of a specific channel incoming webhook. Requires webhooks:read scope.
|
|
1293
|
+
* @param slug The unique workspace slug.
|
|
1294
|
+
* @param channelId The unique channel identifier.
|
|
1295
|
+
* @param webhookId The unique webhook identifier.
|
|
1296
|
+
* @param options Optional request config override.
|
|
1297
|
+
*/
|
|
1298
|
+
get: async (slug: string, channelId: string, webhookId: string, options?: AxiosRequestConfig): Promise<V3ChannelIncomingWebhooksControllerGetChannelWebhookResult> => {
|
|
1299
|
+
return this.raw.v3ChannelIncomingWebhooksControllerGetChannelWebhook(slug, channelId, webhookId, options) as unknown as V3ChannelIncomingWebhooksControllerGetChannelWebhookResult;
|
|
1300
|
+
},
|
|
1301
|
+
/**
|
|
1302
|
+
* Updates a channel incoming webhook. Requires webhooks:write scope.
|
|
1303
|
+
* @param slug The unique workspace slug.
|
|
1304
|
+
* @param channelId The unique channel identifier.
|
|
1305
|
+
* @param webhookId The unique webhook identifier.
|
|
1306
|
+
* @param data Fields to update on the incoming webhook.
|
|
1307
|
+
* @param options Optional request config override.
|
|
1308
|
+
*/
|
|
1309
|
+
update: async (
|
|
1310
|
+
slug: string,
|
|
1311
|
+
channelId: string,
|
|
1312
|
+
webhookId: string,
|
|
1313
|
+
data: UpdateChannelIncomingWebhookDto,
|
|
1314
|
+
options?: AxiosRequestConfig
|
|
1315
|
+
): Promise<V3ChannelIncomingWebhooksControllerUpdateChannelWebhookResult> => {
|
|
1316
|
+
return this.raw.v3ChannelIncomingWebhooksControllerUpdateChannelWebhook(
|
|
1317
|
+
slug,
|
|
1318
|
+
channelId,
|
|
1319
|
+
webhookId,
|
|
1320
|
+
data,
|
|
1321
|
+
options
|
|
1322
|
+
) as unknown as V3ChannelIncomingWebhooksControllerUpdateChannelWebhookResult;
|
|
1323
|
+
},
|
|
1324
|
+
/**
|
|
1325
|
+
* Deletes a channel incoming webhook. Requires webhooks:write scope.
|
|
1326
|
+
* @param slug The unique workspace slug.
|
|
1327
|
+
* @param channelId The unique channel identifier.
|
|
1328
|
+
* @param webhookId The unique webhook identifier.
|
|
1329
|
+
* @param options Optional request config override.
|
|
1330
|
+
*/
|
|
1331
|
+
delete: async (
|
|
1332
|
+
slug: string,
|
|
1333
|
+
channelId: string,
|
|
1334
|
+
webhookId: string,
|
|
1335
|
+
options?: AxiosRequestConfig
|
|
1336
|
+
): Promise<V3ChannelIncomingWebhooksControllerDeleteChannelWebhookResult> => {
|
|
1337
|
+
return this.raw.v3ChannelIncomingWebhooksControllerDeleteChannelWebhook(slug, channelId, webhookId, options) as unknown as V3ChannelIncomingWebhooksControllerDeleteChannelWebhookResult;
|
|
1338
|
+
},
|
|
1339
|
+
/**
|
|
1340
|
+
* Executes an incoming webhook using its unique url token directly. No auth headers required.
|
|
1341
|
+
* @param token The unique webhook token from the webhook URL.
|
|
1342
|
+
* @param data The payload payload consisting of content/attachments/metadata.
|
|
1343
|
+
* @param options Optional request config override.
|
|
1344
|
+
*/
|
|
1345
|
+
executeByUrlToken: async (
|
|
1346
|
+
token: string,
|
|
1347
|
+
data: ExecuteChannelIncomingWebhookDto,
|
|
1348
|
+
options?: AxiosRequestConfig
|
|
1349
|
+
): Promise<V3ChannelIncomingWebhooksControllerExecuteWebhookByUrlTokenResult> => {
|
|
1350
|
+
return this.raw.v3ChannelIncomingWebhooksControllerExecuteWebhookByUrlToken(token, data, options) as unknown as V3ChannelIncomingWebhooksControllerExecuteWebhookByUrlTokenResult;
|
|
1351
|
+
},
|
|
1352
|
+
/**
|
|
1353
|
+
* Executes an incoming webhook by channel ID.
|
|
1354
|
+
* @param channelId The target channel identifier.
|
|
1355
|
+
* @param data The payload payload consisting of content/attachments/metadata.
|
|
1356
|
+
* @param params Optional query parameters like token or signature.
|
|
1357
|
+
* @param options Optional request config override.
|
|
1358
|
+
*/
|
|
1359
|
+
executeByChannelId: async (
|
|
1360
|
+
channelId: string,
|
|
1361
|
+
data: ExecuteChannelIncomingWebhookDto,
|
|
1362
|
+
params?: V3ChannelIncomingWebhooksControllerExecuteWebhookByChannelIdParams,
|
|
1363
|
+
options?: AxiosRequestConfig
|
|
1364
|
+
): Promise<V3ChannelIncomingWebhooksControllerExecuteWebhookByChannelIdResult> => {
|
|
1365
|
+
return this.raw.v3ChannelIncomingWebhooksControllerExecuteWebhookByChannelId(
|
|
1366
|
+
channelId,
|
|
1367
|
+
data,
|
|
1368
|
+
params,
|
|
1369
|
+
options
|
|
1370
|
+
) as unknown as V3ChannelIncomingWebhooksControllerExecuteWebhookByChannelIdResult;
|
|
1371
|
+
},
|
|
1372
|
+
},
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* First-class namespace for Machine-to-Machine (M2M) operations,
|
|
1378
|
+
* grouping V3 Enterprise M2M APIs into logical, highly cohesive spaces.
|
|
1379
|
+
*/
|
|
1380
|
+
public get m2m() {
|
|
1381
|
+
return {
|
|
1382
|
+
/**
|
|
1383
|
+
* M2M Workspace Operations (Provisioning, Retrieval, and Lifecycle management).
|
|
1384
|
+
*/
|
|
1385
|
+
workspace: {
|
|
1386
|
+
/**
|
|
1387
|
+
* Provisions a brand new tenant workspace in the organization.
|
|
1388
|
+
* @param data Configuration payload for workspace name, slug, owner, and initial setups.
|
|
1389
|
+
* @param options Optional request config override.
|
|
1390
|
+
*/
|
|
1391
|
+
provision: async (
|
|
1392
|
+
data: V3ProvisionWorkspaceDto,
|
|
1393
|
+
options?: AxiosRequestConfig
|
|
1394
|
+
): Promise<V3ProvisionWorkspaceResponse> => {
|
|
1395
|
+
return this.raw.v3WorkspacesControllerProvisionWorkspace(data, options) as unknown as V3ProvisionWorkspaceResponse;
|
|
1396
|
+
},
|
|
1397
|
+
/**
|
|
1398
|
+
* Retrieves detailed information of a specific workspace by its slug.
|
|
1399
|
+
* @param slug The unique workspace slug.
|
|
1400
|
+
* @param options Optional request config override.
|
|
1401
|
+
*/
|
|
1402
|
+
get: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspaceResponse> => {
|
|
1403
|
+
return this.raw.v3WorkspacesControllerGetWorkspaceBySlug(slug, options) as unknown as V3WorkspaceResponse;
|
|
1404
|
+
},
|
|
1405
|
+
/**
|
|
1406
|
+
* Lists all workspaces under the organization context.
|
|
1407
|
+
* @param options Optional request config override.
|
|
1408
|
+
*/
|
|
1409
|
+
list: async (options?: AxiosRequestConfig): Promise<V3WorkspacesResponse> => {
|
|
1410
|
+
return this.raw.v3WorkspacesControllerGetWorkspaces(options) as unknown as V3WorkspacesResponse;
|
|
1411
|
+
},
|
|
1412
|
+
/**
|
|
1413
|
+
* Updates configuration and branding metadata of a specific workspace.
|
|
1414
|
+
* @param slug The unique workspace slug.
|
|
1415
|
+
* @param data Workspace update DTO.
|
|
1416
|
+
* @param options Optional request config override.
|
|
1417
|
+
*/
|
|
1418
|
+
update: async (
|
|
1419
|
+
slug: string,
|
|
1420
|
+
data: V3UpdateWorkspaceDto,
|
|
1421
|
+
options?: AxiosRequestConfig
|
|
1422
|
+
): Promise<V3WorkspaceResponse> => {
|
|
1423
|
+
return this.raw.v3WorkspacesControllerUpdateWorkspace(slug, data, options) as unknown as V3WorkspaceResponse;
|
|
1424
|
+
},
|
|
1425
|
+
/**
|
|
1426
|
+
* Permanently deletes a specific workspace by its slug.
|
|
1427
|
+
* @param slug The unique workspace slug.
|
|
1428
|
+
* @param options Optional request config override.
|
|
1429
|
+
*/
|
|
1430
|
+
delete: async (slug: string, options?: AxiosRequestConfig): Promise<V3DeleteWorkspaceResponse> => {
|
|
1431
|
+
return this.raw.v3WorkspacesControllerDeleteWorkspace(slug, options) as unknown as V3DeleteWorkspaceResponse;
|
|
1432
|
+
},
|
|
1433
|
+
},
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* M2M Workspace Membership Operations (Adding, modifying roles, and removing workspace members).
|
|
1437
|
+
*/
|
|
1438
|
+
member: {
|
|
1439
|
+
/**
|
|
1440
|
+
* Lists all members currently in a workspace.
|
|
1441
|
+
* @param slug The unique workspace slug.
|
|
1442
|
+
* @param options Optional request config override.
|
|
1443
|
+
*/
|
|
1444
|
+
list: async (slug: string, options?: AxiosRequestConfig): Promise<V3WorkspaceMembersResponse> => {
|
|
1445
|
+
return this.raw.v3WorkspacesControllerGetWorkspaceMembers(slug, options) as unknown as V3WorkspaceMembersResponse;
|
|
1446
|
+
},
|
|
1447
|
+
/**
|
|
1448
|
+
* Adds a new member to a workspace.
|
|
1449
|
+
* @param slug The unique workspace slug.
|
|
1450
|
+
* @param data Configuration containing user email and target role.
|
|
1451
|
+
* @param options Optional request config override.
|
|
1452
|
+
*/
|
|
1453
|
+
add: async (
|
|
1454
|
+
slug: string,
|
|
1455
|
+
data: V3AddMemberDto,
|
|
1456
|
+
options?: AxiosRequestConfig
|
|
1457
|
+
): Promise<V3AddWorkspaceMemberResponse> => {
|
|
1458
|
+
return this.raw.v3WorkspacesControllerAddWorkspaceMember(slug, data, options) as unknown as V3AddWorkspaceMemberResponse;
|
|
1459
|
+
},
|
|
1460
|
+
/**
|
|
1461
|
+
* Retrieves membership details of a specific workspace member.
|
|
1462
|
+
* @param slug The unique workspace slug.
|
|
1463
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
1464
|
+
* @param options Optional request config override.
|
|
1465
|
+
*/
|
|
1466
|
+
get: async (
|
|
1467
|
+
slug: string,
|
|
1468
|
+
memberId: string,
|
|
1469
|
+
options?: AxiosRequestConfig
|
|
1470
|
+
): Promise<V3GetWorkspaceMemberResponse> => {
|
|
1471
|
+
return this.raw.v3WorkspacesControllerGetWorkspaceMember(slug, memberId, options) as unknown as V3GetWorkspaceMemberResponse;
|
|
1472
|
+
},
|
|
1473
|
+
/**
|
|
1474
|
+
* Updates the role or settings of an existing member in a workspace.
|
|
1475
|
+
* @param slug The unique workspace slug.
|
|
1476
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
1477
|
+
* @param data Updated role.
|
|
1478
|
+
* @param options Optional request config override.
|
|
1479
|
+
*/
|
|
1480
|
+
update: async (
|
|
1481
|
+
slug: string,
|
|
1482
|
+
memberId: string,
|
|
1483
|
+
data: V3UpdateMemberRoleDto,
|
|
1484
|
+
options?: AxiosRequestConfig
|
|
1485
|
+
): Promise<V3UpdateWorkspaceMemberResponse> => {
|
|
1486
|
+
return this.raw.v3WorkspacesControllerUpdateWorkspaceMember(slug, memberId, data, options) as unknown as V3UpdateWorkspaceMemberResponse;
|
|
1487
|
+
},
|
|
1488
|
+
/**
|
|
1489
|
+
* Removes a member from a workspace.
|
|
1490
|
+
* @param slug The unique workspace slug.
|
|
1491
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
1492
|
+
* @param options Optional request config override.
|
|
1493
|
+
*/
|
|
1494
|
+
delete: async (
|
|
1495
|
+
slug: string,
|
|
1496
|
+
memberId: string,
|
|
1497
|
+
options?: AxiosRequestConfig
|
|
1498
|
+
): Promise<V3DeleteWorkspaceMemberResponse> => {
|
|
1499
|
+
return this.raw.v3WorkspacesControllerDeleteWorkspaceMember(slug, memberId, options) as unknown as V3DeleteWorkspaceMemberResponse;
|
|
1500
|
+
},
|
|
1501
|
+
},
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* M2M Authentication and Token Management Utilities.
|
|
1505
|
+
*/
|
|
1506
|
+
auth: {
|
|
1507
|
+
/**
|
|
1508
|
+
* Explicitly exchanges Client Credentials for a V3 access token.
|
|
1509
|
+
* @param clientId The unique M2M Client ID.
|
|
1510
|
+
* @param clientSecret The secure M2M Client Secret.
|
|
1511
|
+
* @param options Optional request config override.
|
|
1512
|
+
*/
|
|
1513
|
+
token: async (clientId: string, clientSecret: string, options?: AxiosRequestConfig): Promise<V3OAuthControllerGetTokenResult> => {
|
|
1514
|
+
return this.raw.v3OAuthControllerGetToken(
|
|
1515
|
+
{
|
|
1516
|
+
client_id: clientId,
|
|
1517
|
+
client_secret: clientSecret,
|
|
1518
|
+
grant_type: 'client_credentials',
|
|
1519
|
+
},
|
|
1520
|
+
options
|
|
1521
|
+
) as unknown as V3OAuthControllerGetTokenResult;
|
|
1522
|
+
},
|
|
1523
|
+
/**
|
|
1524
|
+
* Dynamically retrieves the current cached M2M token, or proactively fetches a new one.
|
|
1525
|
+
*/
|
|
1526
|
+
getOrFetchToken: async (): Promise<string | null> => {
|
|
1527
|
+
return this.getOrFetchToken();
|
|
1528
|
+
},
|
|
1000
1529
|
},
|
|
1001
1530
|
};
|
|
1002
1531
|
}
|