easemob-websdk 4.0.4-beta → 4.0.6-beta

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/Easemob-chat.d.ts CHANGED
@@ -114,6 +114,19 @@ export declare namespace EasemobChat {
114
114
  owner?: string;
115
115
  }
116
116
 
117
+ type multiDeviceEventType =
118
+ | 'chatThreadCreate'
119
+ | 'chatThreadDestroy'
120
+ | 'chatThreadJoin'
121
+ | 'chatThreadLeave'
122
+ | 'chatThreadNameUpdate';
123
+ interface ThreadMultiDeviceInfo {
124
+ operation: multiDeviceEventType;
125
+ chatThreadId?: string;
126
+ chatThreadName?: string;
127
+ parentId?: string;
128
+ }
129
+
117
130
  /**
118
131
  * The connection module is the module where the SDK creates long link, And all about links, friends, groups, and chat apis are all in this module
119
132
  *
@@ -730,6 +743,280 @@ export declare namespace EasemobChat {
730
743
  expire: number;
731
744
  }
732
745
 
746
+ interface SilentModeConversationType {
747
+ /** Silent mode type. */
748
+ type: string;
749
+ /** Silent mode duration, duration of Unix timestamp. */
750
+ ignoreDuration: number;
751
+ /** Silent mode interval. */
752
+ ignoreInterval: string;
753
+ }
754
+
755
+ interface ConversationSilentModeType {
756
+ /** User push map. */
757
+ user: {
758
+ [propname: UserId]: SilentModeConversationType;
759
+ };
760
+ /** Group push map. */
761
+ group: {
762
+ [propname: string]: SilentModeConversationType;
763
+ };
764
+ }
765
+
766
+ interface TranslationLanguageType {
767
+ /** Translation language. */
768
+ language: string;
769
+ }
770
+
771
+ enum SILENTMODETYPE {
772
+ /** All messsage. */
773
+ ALL = 'ALL',
774
+ /** @ messaage of myself. */
775
+ AT = 'AT',
776
+ /** None. */
777
+ NONE = 'NONE',
778
+ }
779
+
780
+ enum CONVERSATIONTYPE {
781
+ /** Single chat. */
782
+ SINGLECHAT = 'singleChat',
783
+ /** Group chat. */
784
+ GROUPCHAT = 'groupChat',
785
+ /** Chat room. */
786
+ CHATROOM = 'chatRoom',
787
+ }
788
+
789
+ type ConversationListType = {
790
+ /** Conversation id. */
791
+ id: string;
792
+ /** Conversation type. */
793
+ type: string;
794
+ };
795
+
796
+ interface SilentModeRemindType {
797
+ /** Silent mode type. */
798
+ paramType: 0;
799
+ /** Silent mode type. */
800
+ remindType: SILENTMODETYPE;
801
+ }
802
+
803
+ interface SilentModeDuration {
804
+ /** Silent mode type. */
805
+ paramType: 1;
806
+ /** Silent mode duration, duration of Unix timestamp. */
807
+ duration: number;
808
+ }
809
+
810
+ interface SilentModeInterval {
811
+ /** Silent mode type. */
812
+ paramType: 2;
813
+ /** Start time interval. */
814
+ startTime: Interval;
815
+ /** End time interval. */
816
+ endTime: Interval;
817
+ }
818
+
819
+ type Interval = {
820
+ /** Hours. */
821
+ hours: number;
822
+ /** Minutes. */
823
+ minutes: number;
824
+ };
825
+
826
+ type SilentModeParamType =
827
+ | SilentModeRemindType
828
+ | SilentModeDuration
829
+ | SilentModeInterval;
830
+
831
+ interface ChatThread {
832
+ /** The Message ID for creating thread. */
833
+ messageId: string;
834
+ /** Generally refers to the group ID. */
835
+ parentId: string;
836
+ /** The chatThread name. */
837
+ chatThreadName: SVGStringList;
838
+ }
839
+ interface ChatThreadOverview {
840
+ /** The thread ID. */
841
+ id: string;
842
+ /** Generally refers to the group ID. */
843
+ parentId: string; //parent
844
+ /** The thread name. */
845
+ name: string;
846
+ /** Overview of the latest news. */
847
+ lastMessage: LastMessage;
848
+ /** The thread create timestamp. */
849
+ createTimestamp: number;
850
+ /** The timestamp to update the thread overview. */
851
+ updateTimestamp: number;
852
+ /** The thread message count. */
853
+ messageCount: number;
854
+ }
855
+ interface LastMessage {
856
+ /** The message id. */
857
+ id: string;
858
+ /** The sender id. */
859
+ from: string;
860
+ /** The receiver id. */
861
+ to: string;
862
+ /** The time stamp. */
863
+ timestamp: number;
864
+ /** The message content. */
865
+ payload: any;
866
+ }
867
+ type Operation = 'create' | 'update' | 'delete' | 'update_msg';
868
+ interface ThreadNotifyServerMsg {
869
+ /** The event type. */
870
+ operation: Operation;
871
+ /** The message ID for creating thread. */
872
+ msg_parent_id?: string;
873
+ /** The thread ID. */
874
+ id: string;
875
+ /** The group ID of the thread. */
876
+ muc_parent_id: string;
877
+ /** The Thread Name. */
878
+ name: string;
879
+ /** The action occurrence time. */
880
+ timestamp: number;
881
+ /** The operator. */
882
+ from?: string;
883
+ /** The last message of Thread. */
884
+ last_message?: LastMessage;
885
+ /** The Thread message count. */
886
+ message_count?: number;
887
+ }
888
+ interface CreateChatThreadResult {
889
+ /** The Thread ID. */
890
+ chatThreadId: string;
891
+ }
892
+ interface ChangeChatThreadName {
893
+ /** The thread name. */
894
+ name: string;
895
+ }
896
+
897
+ interface ChatThreadMembers {
898
+ /** The list of thread members. */
899
+ affiliations: string[];
900
+ }
901
+
902
+ type RemoveMemberResult = {
903
+ /** The operation results. */
904
+ result: boolean;
905
+ /** The ID of thread member. */
906
+ user: UserId;
907
+ };
908
+
909
+ interface ChatThreadDetail {
910
+ /** The thread ID. */
911
+ id: string;
912
+ /** The thread name. */
913
+ name: string;
914
+ /** The thread owner. */
915
+ owner: string;
916
+ /** The creation time of the thread. */
917
+ created: number;
918
+ /** The number of thread members. */
919
+ affiliationsCount?: number;
920
+ //** Generally refers to the group ID. */
921
+ parentId: string;
922
+ /** The parent message ID. */
923
+ messageId: string;
924
+ }
925
+ interface JoinChatThreadResult {
926
+ /** Operation results. */
927
+ status: 'ok';
928
+ /** The chatThread detail. */
929
+ detail: ChatThreadDetail;
930
+ }
931
+ interface ChatThreadLastMessage {
932
+ /** The chatThread ID. */
933
+ chatThreadId: string;
934
+ /** The last message. */
935
+ lastMessage: MessageBody;
936
+ }
937
+
938
+ type onChatThreadChangeType =
939
+ | 'create'
940
+ | 'update'
941
+ | 'destroy'
942
+ | 'userRemove';
943
+ interface ThreadChangeInfo {
944
+ /** The thread ID. */
945
+ id: string;
946
+ /** The thread name. */
947
+ name: string;
948
+ /** The operator. */
949
+ operator: string;
950
+ /** The type of operation. */
951
+ operation: onChatThreadChangeType;
952
+ /** Generally refers to the group ID. */
953
+ parentId: string;
954
+ /** The parent message ID. */
955
+ messageId?: string;
956
+ /** The thread message count. */
957
+ messageCount?: number;
958
+ /** Overview of the latest news. */
959
+ // eslint-disable-next-line @typescript-eslint/ban-types
960
+ lastMessage?: MessageBody | {};
961
+ /** The operated object. */
962
+ userName?: string;
963
+ /** Operation time. */
964
+ timestamp?: number;
965
+ /** The creation time. */
966
+ createTimestamp?: number;
967
+ }
968
+ interface HistoryMessages {
969
+ //** The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is empty string, the data of the first page will be fetched.*/
970
+ cursor?: string;
971
+ /** The Historical messages. */
972
+ messages: MessageBody[];
973
+ }
974
+ interface conversationList {
975
+ /** The conversation ID. */
976
+ channel_id: string;
977
+ /** Overview of the latest news. */
978
+ lastMessage: LastMessage;
979
+ /** The number of unread messages. */
980
+ unread_num: number;
981
+ }
982
+
983
+ interface GetReactionDetailResult {
984
+ /** The reaction to be added to the message. The length is limited to 128 characters. */
985
+ reaction: string;
986
+ /** Whether the current user added this reaction.
987
+ * - `true`: Yes;
988
+ * - `false`: No.
989
+ */
990
+ isAddedBySelf: boolean;
991
+ /** The number of users that added this reaction. */
992
+ userCount: number;
993
+ /** The IDs of the users who added the reaction. */
994
+ userList: UserId[];
995
+ /** The cursor that specifies where to start to get data. If there is data on the next page, this method will return the cursor to indicate where to start to get data for the next query. If it is `null`, the data of the first page will be returned.*/
996
+ cursor: string;
997
+ }
998
+
999
+ interface ReactionListItem {
1000
+ /** The reaction added to the message. It cannot exceed 128 characters. */
1001
+ reaction: string;
1002
+ /** Whether the current user added this reaction.
1003
+ * - `true`: Yes;
1004
+ * - `false`: No.
1005
+ */
1006
+ isAddedBySelf: boolean;
1007
+ /** The number of users that added this reaction. */
1008
+ userCount: number;
1009
+ /** The IDs of the users who added the reaction. */
1010
+ userList: UserId[];
1011
+ }
1012
+
1013
+ interface GetReactionListResult {
1014
+ /** The ID of the message to which this reaction was added. */
1015
+ msgId: string;
1016
+ /** The reaction list of this message. */
1017
+ reactionList: ReactionListItem[];
1018
+ }
1019
+
733
1020
  enum Code {
734
1021
  REQUEST_SUCCESS = 0,
735
1022
  REQUEST_TIMEOUT = -1,
@@ -1684,6 +1971,7 @@ export declare namespace EasemobChat {
1684
1971
  approval: boolean;
1685
1972
  allowinvites: boolean;
1686
1973
  inviteNeedConfirm: boolean;
1974
+ maxusers: number;
1687
1975
  };
1688
1976
  success?: (res: AsyncResult<CreateGroupResult>) => void;
1689
1977
  error?: (error: ErrorEvent) => void;
@@ -1719,6 +2007,7 @@ export declare namespace EasemobChat {
1719
2007
  approval: boolean;
1720
2008
  allowinvites: boolean;
1721
2009
  inviteNeedConfirm: boolean;
2010
+ maxusers: number;
1722
2011
  };
1723
2012
  success?: (res: AsyncResult<CreateGroupResult>) => void;
1724
2013
  error?: (error: ErrorEvent) => void;
@@ -1776,6 +2065,7 @@ export declare namespace EasemobChat {
1776
2065
  * connection.getGroup()
1777
2066
  * ```
1778
2067
  * @since 1.4.11
2068
+ * @deprecated
1779
2069
  */
1780
2070
  getGroup(
1781
2071
  this: Connection,
@@ -1785,6 +2075,23 @@ export declare namespace EasemobChat {
1785
2075
  }
1786
2076
  ): Promise<AsyncResult<BaseGroupInfo[]>>;
1787
2077
 
2078
+ /**
2079
+ * Lists all the groups a user has joined.
2080
+ *
2081
+ * ```typescript
2082
+ * connection.getJoinedGroups()
2083
+ * ```
2084
+ */
2085
+ getJoinedGroups(
2086
+ this: Connection,
2087
+ params: {
2088
+ pageNum: number;
2089
+ pageSize: number;
2090
+ success?: (res: AsyncResult<BaseGroupInfo[]>) => void;
2091
+ error?: (error: ErrorEvent) => void;
2092
+ }
2093
+ ): Promise<AsyncResult<BaseGroupInfo[]>>;
2094
+
1788
2095
  /** @deprecated */
1789
2096
  changeOwner(
1790
2097
  this: Connection,
@@ -2780,6 +3087,21 @@ export declare namespace EasemobChat {
2780
3087
  }
2781
3088
  ): Promise<AsyncResult<SessionInfo[]>>;
2782
3089
 
3090
+ /**
3091
+ * Gets the conversation list and the latest message under the conversation.
3092
+ *
3093
+ * ```typescript
3094
+ * connection.getConversationList()
3095
+ * ```
3096
+ */
3097
+ getConversationList(
3098
+ this: Connection,
3099
+ params?: {
3100
+ success?: (res: AsyncResult<SessionInfo[]>) => void;
3101
+ error?: (error: ErrorEvent) => void;
3102
+ }
3103
+ ): Promise<AsyncResult<conversationList[]>>;
3104
+
2783
3105
  /**
2784
3106
  * Delete the session.
2785
3107
  *
@@ -2858,6 +3180,40 @@ export declare namespace EasemobChat {
2858
3180
  }
2859
3181
  ): Promise<MessageBody[]>;
2860
3182
 
3183
+ /**
3184
+ * Gets the message history.
3185
+ *
3186
+ * ```typescript
3187
+ * connection.getHistoryMessages({targetId:'user1',chatType:'groupChat', pageSize: 20})
3188
+ * ```
3189
+ */
3190
+ getHistoryMessages(
3191
+ this: Connection,
3192
+ options: {
3193
+ /** The user ID of the other party or the group ID. */
3194
+ targetId: string;
3195
+ /** The starting message ID for this query. The default value is -1, which means to start retrieving from the latest message. */
3196
+ cursor?: number | string | null;
3197
+ /** The number of messages to retrieve each time. The default value is 20,The maximum value is 50. */
3198
+ pageSize?: number;
3199
+ /** The chat type for SDK V4.0:
3200
+ * - `singleChat`: one-to-one chat;
3201
+ * - `groupchat`: group chat;
3202
+ * - `chatroom`: chat room.
3203
+ * - (Default)`singleChat`: No.
3204
+ */
3205
+ chatType?: 'singleChat' | 'groupChat' | 'chatRoom';
3206
+ /** Whether to select pull history messages in positive order(Pull message from the oldest to the latest).
3207
+ * - `up`: means searching from the newer messages to the older messages.
3208
+ * - `down`: means searching from the older messages to the newer messages.
3209
+ * - (Default)`up`.
3210
+ */
3211
+ searchDirection?: string;
3212
+ success?: (res: MessageBody[]) => void;
3213
+ fail?: (error: ErrorEvent) => void;
3214
+ }
3215
+ ): Promise<HistoryMessages>;
3216
+
2861
3217
  /**
2862
3218
  * Adds Contact.
2863
3219
  *
@@ -2964,7 +3320,7 @@ export declare namespace EasemobChat {
2964
3320
  * Recall a message
2965
3321
  *
2966
3322
  * ```typescript
2967
- * connection.recallMessage({mid: 'messageId', to: 'user1', type: 'singleChat'})
3323
+ * connection.recallMessage({mid: 'messageId', to: 'user1', type: 'singleChat', isChatThread: false})
2968
3324
  * ```
2969
3325
  */
2970
3326
  recallMessage(
@@ -2974,6 +3330,7 @@ export declare namespace EasemobChat {
2974
3330
  to: UserId;
2975
3331
  type?: 'chat' | 'groupchat' | 'chatroom'; // v3.0
2976
3332
  chatType?: 'singleChat' | 'groupChat' | 'chatRoom'; // v4.0
3333
+ isChatThread?: boolean;
2977
3334
  success?: (res: number) => void;
2978
3335
  fail?: (error: ErrorEvent) => void;
2979
3336
  }
@@ -3090,6 +3447,437 @@ export declare namespace EasemobChat {
3090
3447
  error?: (error: ErrorEvent) => void;
3091
3448
  }
3092
3449
  ): Promise<AsyncResult<SubscribePresenceResult>>;
3450
+
3451
+ /**
3452
+ * Reports a message.
3453
+ *
3454
+ * ```typescript
3455
+ * reportMessage({reportType: 'adult', reportReason: 'reason', messageId: 'id'})
3456
+ * ```
3457
+ */
3458
+ reportMessage(
3459
+ this: Connection,
3460
+ params: {
3461
+ reportType: string; // 举报类型。
3462
+ reportReason: string; // 举报原因。
3463
+ messageId: string;
3464
+ }
3465
+ ): Promise<void>;
3466
+
3467
+ /**
3468
+ * Set the DND Settings for the current login user.
3469
+ *
3470
+ * ```typescript
3471
+ * connection.setSilentModeForAll({options: {paramType: 0, remindType: 'ALL'}})
3472
+ * ```
3473
+ */
3474
+ setSilentModeForAll(
3475
+ this: Connection,
3476
+ params: {
3477
+ /** Options object include paramType,remindType,duration,startTime,endTime. */
3478
+ options: SilentModeParamType;
3479
+ success?: (
3480
+ res: AsyncResult<SilentModeConversationType>
3481
+ ) => void;
3482
+ error?: (error: ErrorEvent) => void;
3483
+ }
3484
+ ): Promise<AsyncResult<SilentModeConversationType>>;
3485
+
3486
+ /**
3487
+ * Get the DND Settings of the current user.
3488
+ *
3489
+ * ```typescript
3490
+ * connection.getSilentModeForAll()
3491
+ * ```
3492
+ */
3493
+ getSilentModeForAll(
3494
+ this: Connection,
3495
+ params?: {
3496
+ success?: (
3497
+ res: AsyncResult<SilentModeConversationType>
3498
+ ) => void;
3499
+ error?: (error: ErrorEvent) => void;
3500
+ }
3501
+ ): Promise<AsyncResult<SilentModeConversationType>>;
3502
+
3503
+ /**
3504
+ * Set the DND of the session.
3505
+ *
3506
+ * ```typescript
3507
+ * connection.setSilentModeForConversation({conversationId: '100', type: 'singleChat', params: {paramType: 0, remindType: 'ALL'}})
3508
+ * ```
3509
+ */
3510
+ setSilentModeForConversation(
3511
+ this: Connection,
3512
+ params: {
3513
+ /** The Conversation id.
3514
+ * For one-to-one chat, conversation ID is to chat user's name.
3515
+ * For group chat, conversation ID is group ID, different with group name.
3516
+ * For chat room, conversation ID is chat room ID, different with chat room name.
3517
+ * For help desk, it is same with one-to-one chat, conversation ID is also chat user's name.
3518
+ */
3519
+ conversationId: string;
3520
+ /** Conversation type. */
3521
+ type: CONVERSATIONTYPE;
3522
+ /** Options object include paramType,remindType,duration,startTime,endTime. */
3523
+ options: SilentModeParamType;
3524
+ success?: (
3525
+ res: AsyncResult<SilentModeConversationType>
3526
+ ) => void;
3527
+ error?: (error: ErrorEvent) => void;
3528
+ }
3529
+ ): Promise<AsyncResult<SilentModeConversationType>>;
3530
+
3531
+ /**
3532
+ * Clear the setting of offline push notification type for the session.
3533
+ *
3534
+ * ```typescript
3535
+ * connection.clearRemindTypeForConversation({conversationId: '123', type: 'singleChat'})
3536
+ * ```
3537
+ */
3538
+ clearRemindTypeForConversation(
3539
+ this: Connection,
3540
+ params: {
3541
+ /** Conversation id. */
3542
+ conversationId: string;
3543
+ /** Conversation type. */
3544
+ type: CONVERSATIONTYPE;
3545
+ success?: (
3546
+ res: AsyncResult<SilentModeConversationType>
3547
+ ) => void;
3548
+ error?: (error: ErrorEvent) => void;
3549
+ }
3550
+ ): Promise<AsyncResult<SilentModeConversationType>>;
3551
+
3552
+ /**
3553
+ * Gets the DND setting of the session.
3554
+ *
3555
+ * ```typescript
3556
+ * connection.getSilentModeForConversation({conversationId: '3333', type: 'singleChat'})
3557
+ * ```
3558
+ */
3559
+ getSilentModeForConversation(
3560
+ this: Connection,
3561
+ params: {
3562
+ /** Conversation id. */
3563
+ conversationId: string;
3564
+ /** Conversation type. */
3565
+ type: CONVERSATIONTYPE;
3566
+ success?: (
3567
+ res: AsyncResult<SilentModeConversationType>
3568
+ ) => void;
3569
+ error?: (error: ErrorEvent) => void;
3570
+ }
3571
+ ): Promise<AsyncResult<SilentModeConversationType>>;
3572
+
3573
+ /**
3574
+ * Obtain the DND Settings of specified sessions in batches.
3575
+ *
3576
+ * ```typescript
3577
+ * connection.getSilentModeForConversations({conversationList:[{id: 'test', type: 'singleChat'}, {id: '12345', type: 'groupChat'}]})
3578
+ * ```
3579
+ */
3580
+ getSilentModeForConversations(
3581
+ this: Connection,
3582
+ params: {
3583
+ /** Conversation list. */
3584
+ conversationList: ConversationListType[];
3585
+ success?: (
3586
+ res: AsyncResult<ConversationSilentModeType>
3587
+ ) => void;
3588
+ error?: (error: ErrorEvent) => void;
3589
+ }
3590
+ ): Promise<AsyncResult<ConversationSilentModeType>>;
3591
+
3592
+ /**
3593
+ * Set user push translation language.
3594
+ *
3595
+ * ```typescript
3596
+ * connection.setPushPerformLanguage({language: 'EU'})
3597
+ * ```
3598
+ */
3599
+ setPushPerformLanguage(
3600
+ this: Connection,
3601
+ params: {
3602
+ /** translation language */
3603
+ language: string;
3604
+ success?: (res: AsyncResult<TranslationLanguageType>) => void;
3605
+ error?: (error: ErrorEvent) => void;
3606
+ }
3607
+ ): Promise<AsyncResult<TranslationLanguageType>>;
3608
+
3609
+ /**
3610
+ * Gets the push translation language set by the user.
3611
+ *
3612
+ * ```typescript
3613
+ * connection.getPushPerformLanguage()
3614
+ * ```
3615
+ */
3616
+ getPushPerformLanguage(
3617
+ this: Connection,
3618
+ params?: {
3619
+ success?: (res: AsyncResult<TranslationLanguageType>) => void;
3620
+ error?: (error: ErrorEvent) => void;
3621
+ }
3622
+ ): Promise<AsyncResult<TranslationLanguageType>>;
3623
+
3624
+ /**
3625
+ * Creates a chatThread.
3626
+ *
3627
+ * ```typescript
3628
+ * connection.createChatThread({parentId: 'parentId',name: 'threadName',messageId: 'messageId'})
3629
+ * ```
3630
+ */
3631
+ createChatThread(
3632
+ this: Connection,
3633
+ params: {
3634
+ /** Generally refers to the group ID. */
3635
+ parentId: string;
3636
+ /** The chatThread name. */
3637
+ name: string;
3638
+ /** The parent message ID. */
3639
+ messageId: string;
3640
+ }
3641
+ ): Promise<AsyncResult<CreateChatThreadResult>>;
3642
+
3643
+ /**
3644
+ * Joins the chatThread.
3645
+ *
3646
+ * ```typescript
3647
+ * connection.joinChatThread({chatThreadId: 'chatThreadId'})
3648
+ * ```
3649
+ */
3650
+ joinChatThread(
3651
+ this: Connection,
3652
+ params: {
3653
+ /** The chatThread ID. */
3654
+ chatThreadId: string;
3655
+ }
3656
+ ): Promise<AsyncResult<JoinChatThreadResult>>;
3657
+
3658
+ /**
3659
+ * Leaves the chatThread.
3660
+ *
3661
+ * ```typescript
3662
+ * connection.leaveChatThread({chatThreadId: 'chatThreadId'})
3663
+ * ```
3664
+ */
3665
+ leaveChatThread(
3666
+ this: Connection,
3667
+ params: {
3668
+ /** The chatThread ID. */
3669
+ chatThreadId: string;
3670
+ }
3671
+ ): Promise<void>;
3672
+
3673
+ * Adds a reaction to the message.
3674
+ *
3675
+ * ```typescript
3676
+ * connection.addReaction({messageId: 'messageId', action: 'action'})
3677
+ * ```
3678
+ */
3679
+ addReaction(
3680
+ this: Connection,
3681
+ params: {
3682
+ /** The message ID. */
3683
+ messageId: string;
3684
+ /** The reaction to be added to the message. The length is limited to 128 characters. */
3685
+ reaction: string;
3686
+ }
3687
+ ): Promise<void>;
3688
+
3689
+ /**
3690
+ * Deletes the chatThread,group leader and administrator have this permission.
3691
+ *
3692
+ * ```typescript
3693
+ * connection.destroyChatThread({chatThreadId: 'chatThreadId'})
3694
+ * ```
3695
+ */
3696
+ destroyChatThread(
3697
+ this: Connection,
3698
+ params: {
3699
+ /** The chatThread ID. */
3700
+ chatThreadId: string;
3701
+ }
3702
+ ): Promise<void>;
3703
+
3704
+ * Removes a reaction from a message.
3705
+ *
3706
+ * ```typescript
3707
+ * connection.deleteReaction({reactionId: 'reactionId'})
3708
+ * ```
3709
+ */
3710
+ deleteReaction(
3711
+ this: Connection,
3712
+ params: {
3713
+ /** The message reaction to delete. */
3714
+ reaction: string;
3715
+ /** The message ID. */
3716
+ messageId: string;
3717
+ }
3718
+ ): Promise<void>;
3719
+
3720
+ /**
3721
+ * Modifies the chatThread name.
3722
+ *
3723
+ * ```typescript
3724
+ * connection.changeChatThreadName({chatThreadId: 'chatThreadId',name: 'name'})
3725
+ * ```
3726
+ */
3727
+ changeChatThreadName(
3728
+ this: Connection,
3729
+ params: {
3730
+ /** The chatThread ID. */
3731
+ chatThreadId: string;
3732
+ /** The chatThread name. */
3733
+ name: string;
3734
+ }
3735
+ ): Promise<AsyncResult<ChangeChatThreadName>>;
3736
+
3737
+ /**
3738
+ * Lists all members of the chatThread with pagination.
3739
+ *
3740
+ * ```typescript
3741
+ * connection.getChatThreadMembers({chatThreadId: 'chatThreadId',pageSize:20,cursor:'cursor'})
3742
+ * ```
3743
+ */
3744
+ getChatThreadMembers(
3745
+ this: Connection,
3746
+ params: {
3747
+ /** The Thread ID. */
3748
+ chatThreadId: string;
3749
+ /** The number of members per page. The default value is 20, and the maximum value is 50.*/
3750
+ pageSize?: number;
3751
+ /** The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is empty string, the data of the first page will be fetched.*/
3752
+ cursor?: string;
3753
+ }
3754
+ ): Promise<AsyncResult<ChatThreadMembers>>;
3755
+
3756
+ /**
3757
+ * Removes a member from the chatThread.
3758
+ *
3759
+ * ```typescript
3760
+ * connection.removeChatThreadMember({chatThreadId: 'chatThreadId',username:'username'})
3761
+ * ```
3762
+ */
3763
+ removeChatThreadMember(
3764
+ this: Connection,
3765
+ params: {
3766
+ /** The chatThread ID. */
3767
+ chatThreadId: string;
3768
+ /** The member ID to remove. */
3769
+ username: string;
3770
+ }
3771
+ ): Promise<AsyncResult<RemoveMemberResult>>;
3772
+
3773
+ /**
3774
+ * Gets the list of joined chatThreads with pagination.When parentId is not null, get the list of chatThread under the specified group.
3775
+ *
3776
+ * ```typescript
3777
+ * connection.getJoinedChatThreads({parentId: 'parentId',cursor: 'cursor',pageSize: 50})
3778
+ * ```
3779
+ */
3780
+ getJoinedChatThreads(
3781
+ this: Connection,
3782
+ params: {
3783
+ /** Generally refers to the group ID. */
3784
+ parentId?: string;
3785
+ /** The number of thread per page. The default value is 20, and the maximum value is 50. */
3786
+ pageSize?: number;
3787
+ /** The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is null, the data of the first page will be fetched.*/
3788
+ cursor?: string;
3789
+ }
3790
+ ): Promise<AsyncResult<ChatThreadDetail[]>>;
3791
+
3792
+ /**
3793
+ * Gets the thread list of the specified group with pagination.
3794
+ * ```typescript
3795
+ * connection.getChatThreads({parentId: 'parentId, cursor:'cursor' ,pageSize: 50})
3796
+ * ```
3797
+ */
3798
+ getChatThreads(
3799
+ this: Connection,
3800
+ params: {
3801
+ /** Generally refers to the group ID. */
3802
+ parentId: string;
3803
+ /** The number of thread per page. The default value is 20, and the maximum value is 50. */
3804
+ pageSize?: number;
3805
+ /** The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is empty string, the data of the first page will be fetched.*/
3806
+ cursor?: string;
3807
+ }
3808
+ ): Promise<AsyncResult<ChatThreadDetail[]>>;
3809
+
3810
+ /**
3811
+ * Gets the latest message content of the chatThread in batch,with a maximum of 20 messages.
3812
+ *
3813
+ * ```typescript
3814
+ * connection.getChatThreadLastMessage({chatThreadIds: ['chatThreadId1','chatThreadId2']})
3815
+ * ```
3816
+ */
3817
+ getChatThreadLastMessage(
3818
+ this: Connection,
3819
+ params: {
3820
+ /** The array of chatThread IDs to query.*/
3821
+ chatThreadIds: string[];
3822
+ }
3823
+ ): Promise<AsyncResult<ChatThreadLastMessage>>;
3824
+
3825
+ /**
3826
+ * Gets detail of the chatThread.
3827
+ *
3828
+ * ```typescript
3829
+ * connection.getChatThreadDetail({chatThreadId: 'chatThreadId'})
3830
+ * ```
3831
+ */
3832
+ getChatThreadDetail(
3833
+ this: Connection,
3834
+ params: {
3835
+ /** The chatThread ID. */
3836
+ chatThreadId: string;
3837
+ }
3838
+ ): Promise<AsyncResult<ChatThreadDetail>>;
3839
+
3840
+ * Gets the reaction list for the message.
3841
+ *
3842
+ * ```typescript
3843
+ * connection.getReactionList({chatType: 'chatType', messageId: 'messageId'})
3844
+ * ```
3845
+ */
3846
+ getReactionList(
3847
+ this: Connection,
3848
+ params: {
3849
+ /** The conversation type:
3850
+ * - singleChat;
3851
+ * - groupChat;
3852
+ */
3853
+ chatType: 'singleChat' | 'groupChat';
3854
+ /** The message ID. */
3855
+ messageId: string | Array<string>;
3856
+ /** The group ID. */
3857
+ groupId?: string;
3858
+ }
3859
+ ): Promise<AsyncResult<GetReactionListResult[]>>;
3860
+
3861
+ /**
3862
+ * Gets the details of a reaction.
3863
+ *
3864
+ * ```typescript
3865
+ * getReactionDetail({messageId: 'messageId', reaction: 'reaction', cursor: '', pageSize: 20})
3866
+ * ```
3867
+ */
3868
+ getReactionDetail(
3869
+ this: Connection,
3870
+ params: {
3871
+ /** The message ID. */
3872
+ messageId: string;
3873
+ /** The reactions to retrieve. */
3874
+ reaction: string;
3875
+ /** The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is null, the data of the first page will be retrieved.*/
3876
+ cursor?: string; // 默认为 null
3877
+ /** The number of reactions per page. The default value is 20, and the maximum value is 100. */
3878
+ pageSize?: number;
3879
+ }
3880
+ ): Promise<AsyncResult<GetReactionDetailResult>>;
3093
3881
  }
3094
3882
 
3095
3883
  /**
@@ -3106,6 +3894,21 @@ export declare namespace EasemobChat {
3106
3894
  | RecallMsgBody
3107
3895
  | ChannelMsgBody;
3108
3896
 
3897
+ interface ReactionMessage {
3898
+ /** The message sender. */
3899
+ from: string;
3900
+ /** The message recipient. */
3901
+ to: string;
3902
+ /** The conversation type. */
3903
+ chatType: 'singleChat' | 'groupChat';
3904
+ /** The reaction to be added to the message. The length is limited to 128 characters. */
3905
+ reactions: Reaction[];
3906
+ /** The ID of the message whose reaction updated. */
3907
+ messageId: string;
3908
+ /** The Unix timestamp for updating the reaction. */
3909
+ ts: number;
3910
+ }
3911
+
3109
3912
  type Event =
3110
3913
  | 'onOpened'
3111
3914
  | 'onPresence'
@@ -3177,6 +3980,9 @@ export declare namespace EasemobChat {
3177
3980
  onChatroomChange?: (msg: any) => void;
3178
3981
  onContactChange?: (msg: any) => void;
3179
3982
  onPresenceStatusChange?: (msg: PresenceType[]) => void;
3983
+ onChatThreadChange?: (msg: ThreadChangeInfo) => void;
3984
+ onMultiDeviceEvent?: (msg: ThreadMultiDeviceInfo) => void;
3985
+ onReactionChange?: (msg: ReactionMessage) => void;
3180
3986
  }
3181
3987
 
3182
3988
  interface HandlerData {
@@ -3347,6 +4153,23 @@ export declare namespace EasemobChat {
3347
4153
  filetype: string;
3348
4154
  data: File;
3349
4155
  }
4156
+
4157
+ interface Reaction {
4158
+ /** The content of the reaction to be added to the message. The length is limited to 128 characters. */
4159
+ reaction: string;
4160
+ /** The reaction count. */
4161
+ count: number;
4162
+ /** The reaction update operation. Once the reaction is updated, the onReactionChange callback is triggered. */
4163
+ op?: { operator: UserId; reactionType: 'create' | 'delete' }[];
4164
+ /** The IDs of the users that added the reaction. */
4165
+ userList: UserId[];
4166
+ /** Whether the current user has added this reaction.
4167
+ * - `true`: Yes.
4168
+ * - `false`: No.
4169
+ */
4170
+ isAddedBySelf?: boolean;
4171
+ }
4172
+
3350
4173
  interface PresenceMsg {
3351
4174
  type: OnPresenceMsgType;
3352
4175
  to: string;
@@ -3374,6 +4197,7 @@ export declare namespace EasemobChat {
3374
4197
  groupReadCount?: { [key: string]: number };
3375
4198
  ackContent?: string;
3376
4199
  chatType: 'singleChat' | 'groupChat';
4200
+ isChatThread?: boolean;
3377
4201
  }
3378
4202
  interface ReadParameters {
3379
4203
  type: 'read';
@@ -3387,6 +4211,7 @@ export declare namespace EasemobChat {
3387
4211
  id: string;
3388
4212
  ackContent?: string;
3389
4213
  chatType: 'singleChat' | 'groupChat';
4214
+ isChatThread?: boolean;
3390
4215
  }
3391
4216
 
3392
4217
  interface DeliveryParameters {
@@ -3405,6 +4230,7 @@ export declare namespace EasemobChat {
3405
4230
  type: 'delivery';
3406
4231
  to: string;
3407
4232
  from?: string;
4233
+ isChatThread?: boolean;
3408
4234
  }
3409
4235
 
3410
4236
  interface CreateDeliveryMsgParameters {
@@ -3412,6 +4238,7 @@ export declare namespace EasemobChat {
3412
4238
  type: 'delivery';
3413
4239
  to: string;
3414
4240
  from?: string;
4241
+ isChatThread?: boolean;
3415
4242
  }
3416
4243
 
3417
4244
  interface ChannelMsgSetParameters {
@@ -3425,6 +4252,7 @@ export declare namespace EasemobChat {
3425
4252
  group?: string;
3426
4253
  type: 'channel';
3427
4254
  time: number;
4255
+ isChatThread?: boolean;
3428
4256
  }
3429
4257
  interface ChannelParameters {
3430
4258
  type: 'channel';
@@ -3436,6 +4264,7 @@ export declare namespace EasemobChat {
3436
4264
  chatType: ChatType;
3437
4265
  to: string;
3438
4266
  from?: string;
4267
+ isChatThread?: boolean;
3439
4268
  }
3440
4269
 
3441
4270
  interface TextParameters {
@@ -3468,6 +4297,8 @@ export declare namespace EasemobChat {
3468
4297
  msgConfig?: { allowGroupAck?: boolean; languages?: string[] };
3469
4298
  translations?: TranslationResult;
3470
4299
  time: number;
4300
+ isChatThread?: boolean;
4301
+ reactions?: Reaction;
3471
4302
  }
3472
4303
 
3473
4304
  interface CreateTextMsgParameters {
@@ -3478,6 +4309,7 @@ export declare namespace EasemobChat {
3478
4309
  from?: string;
3479
4310
  ext?: { [key: string]: any };
3480
4311
  msgConfig?: { allowGroupAck?: boolean; languages?: string[] };
4312
+ isChatThread?: boolean;
3481
4313
  }
3482
4314
 
3483
4315
  interface CmdParameters {
@@ -3509,6 +4341,8 @@ export declare namespace EasemobChat {
3509
4341
  ext?: { [key: string]: any };
3510
4342
  msgConfig?: { [key: string]: any };
3511
4343
  time: number;
4344
+ isChatThread?: boolean;
4345
+ reactions?: Reaction;
3512
4346
  }
3513
4347
 
3514
4348
  interface CreateCmdMsgParameters {
@@ -3520,6 +4354,7 @@ export declare namespace EasemobChat {
3520
4354
  roomType?: boolean;
3521
4355
  ext?: { [key: string]: any };
3522
4356
  msgConfig?: { allowGroupAck: boolean };
4357
+ isChatThread?: boolean;
3523
4358
  }
3524
4359
 
3525
4360
  interface CustomParameters {
@@ -3554,6 +4389,8 @@ export declare namespace EasemobChat {
3554
4389
  ext?: { [key: string]: any };
3555
4390
  msgConfig?: { [key: string]: any };
3556
4391
  time: number;
4392
+ isChatThread?: boolean;
4393
+ reactions?: Reaction;
3557
4394
  }
3558
4395
 
3559
4396
  interface CreateCustomMsgParameters {
@@ -3565,6 +4402,7 @@ export declare namespace EasemobChat {
3565
4402
  from?: string;
3566
4403
  ext?: { [key: string]: any };
3567
4404
  msgConfig?: { allowGroupAck: boolean };
4405
+ isChatThread?: boolean;
3568
4406
  }
3569
4407
 
3570
4408
  interface LocationParameters {
@@ -3602,6 +4440,8 @@ export declare namespace EasemobChat {
3602
4440
  ext?: { [key: string]: any };
3603
4441
  time: number;
3604
4442
  msgConfig?: { allowGroupAck: boolean };
4443
+ isChatThread?: boolean;
4444
+ reactions?: Reaction;
3605
4445
  }
3606
4446
 
3607
4447
  interface CreateLocationMsgParameters {
@@ -3615,6 +4455,7 @@ export declare namespace EasemobChat {
3615
4455
  from?: string;
3616
4456
  ext?: { [key: string]: any };
3617
4457
  msgConfig?: { allowGroupAck: boolean };
4458
+ isChatThread?: boolean;
3618
4459
  }
3619
4460
 
3620
4461
  interface FileParameters {
@@ -3655,6 +4496,7 @@ export declare namespace EasemobChat {
3655
4496
  accessToken?: string;
3656
4497
  msgConfig?: { allowGroupAck: boolean };
3657
4498
  time: number;
4499
+ reactions?: Reaction;
3658
4500
  }
3659
4501
 
3660
4502
  interface CreateFileMsgParameters {
@@ -3676,6 +4518,7 @@ export declare namespace EasemobChat {
3676
4518
  filename: string;
3677
4519
  };
3678
4520
  msgConfig?: { allowGroupAck: boolean };
4521
+ isChatThread?: boolean;
3679
4522
  }
3680
4523
 
3681
4524
  interface ImgParameters {
@@ -3717,6 +4560,8 @@ export declare namespace EasemobChat {
3717
4560
  secret?: string;
3718
4561
  thumb?: string;
3719
4562
  thumb_secret?: string;
4563
+ isChatThread?: boolean;
4564
+ reactions?: Reaction;
3720
4565
  }
3721
4566
 
3722
4567
  interface CreateImgMsgParameters {
@@ -3740,6 +4585,7 @@ export declare namespace EasemobChat {
3740
4585
  filename: string;
3741
4586
  };
3742
4587
  msgConfig?: { allowGroupAck: boolean };
4588
+ isChatThread?: boolean;
3743
4589
  }
3744
4590
 
3745
4591
  interface AudioParameters {
@@ -3780,6 +4626,8 @@ export declare namespace EasemobChat {
3780
4626
  group?: string;
3781
4627
  msgConfig?: { [key: string]: any };
3782
4628
  time: number;
4629
+ isChatThread?: boolean;
4630
+ reactions?: Reaction;
3783
4631
  }
3784
4632
 
3785
4633
  interface CreateAudioMsgParameters {
@@ -3806,6 +4654,7 @@ export declare namespace EasemobChat {
3806
4654
  filename: string;
3807
4655
  };
3808
4656
  msgConfig?: { allowGroupAck: boolean };
4657
+ isChatThread?: boolean;
3809
4658
  }
3810
4659
 
3811
4660
  interface VideoParameters {
@@ -3846,6 +4695,8 @@ export declare namespace EasemobChat {
3846
4695
  msgConfig?: { [key: string]: any };
3847
4696
  group?: string;
3848
4697
  time: number;
4698
+ isChatThread?: boolean;
4699
+ reactions?: Reaction;
3849
4700
  }
3850
4701
 
3851
4702
  interface CreateVideoMsgParameters {
@@ -3869,6 +4720,7 @@ export declare namespace EasemobChat {
3869
4720
  filename: string;
3870
4721
  };
3871
4722
  msgConfig?: { allowGroupAck: boolean };
4723
+ isChatThread?: boolean;
3872
4724
  }
3873
4725
 
3874
4726
  interface ReceivedMsgBody {