easemob-websdk 4.0.5 → 4.0.7

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
  *
@@ -815,39 +828,225 @@ export declare namespace EasemobChat {
815
828
  | SilentModeDuration
816
829
  | SilentModeInterval;
817
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
+
818
1020
  enum Code {
819
1021
  REQUEST_SUCCESS = 0,
820
1022
  REQUEST_TIMEOUT = -1,
821
1023
  REQUEST_UNKNOWN = -2,
822
1024
  REQUEST_PARAMETER_ERROR = -3,
1025
+ REQUEST_ABORT = -4,
823
1026
  WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR = 0,
824
1027
  WEBIM_CONNCTION_OPEN_ERROR = 1,
825
1028
  WEBIM_CONNCTION_AUTH_ERROR = 2,
826
1029
  WEBIM_CONNCTION_OPEN_USERGRID_ERROR = 3,
827
- WEBIM_CONNCTION_ATTACH_ERROR = 4, // unused
828
- WEBIM_CONNCTION_ATTACH_USERGRID_ERROR = 5, // unused
829
- WEBIM_CONNCTION_REOPEN_ERROR = 6, // unused
830
- WEBIM_CONNCTION_SERVER_CLOSE_ERROR = 7, //7 = client-side network offline (netE= RR_INTERNET_DISCONNECTED) unused
831
- WEBIM_CONNCTION_SERVER_ERROR = 8, //8 = offline by multi login unused
1030
+ WEBIM_CONNCTION_ATTACH_ERROR = 4,
1031
+ WEBIM_CONNCTION_ATTACH_USERGRID_ERROR = 5,
1032
+ WEBIM_CONNCTION_REOPEN_ERROR = 6,
1033
+ WEBIM_CONNCTION_SERVER_CLOSE_ERROR = 7,
1034
+ WEBIM_CONNCTION_SERVER_ERROR = 8,
832
1035
  WEBIM_CONNCTION_IQ_ERROR = 9,
833
- WEBIM_CONNCTION_USER_REMOVED = 207,
834
- WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE = 206,
835
- WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD = 216,
836
- WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE = 217,
837
1036
  WEBIM_CONNCTION_PING_ERROR = 10,
838
1037
  WEBIM_CONNCTION_NOTIFYVERSION_ERROR = 11,
839
1038
  WEBIM_CONNCTION_GETROSTER_ERROR = 12,
840
1039
  WEBIM_CONNCTION_CROSSDOMAIN_ERROR = 13,
841
1040
  WEBIM_CONNCTION_LISTENING_OUTOF_MAXRETRIES = 14,
842
1041
  WEBIM_CONNCTION_RECEIVEMSG_CONTENTERROR = 15,
843
- WEBIM_CONNCTION_DISCONNECTED = 16, //16 = server-side close the websocket connection
844
- WEBIM_CONNCTION_AJAX_ERROR = 17, // ajax error
1042
+ WEBIM_CONNCTION_DISCONNECTED = 16,
1043
+ WEBIM_CONNCTION_AJAX_ERROR = 17,
845
1044
  WEBIM_CONNCTION_JOINROOM_ERROR = 18,
846
1045
  WEBIM_CONNCTION_GETROOM_ERROR = 19,
847
- WEBIM_CONNCTION_GETROOMINFO_ERROR = 20, // unused
848
- WEBIM_CONNCTION_GETROOMMEMBER_ERROR = 21, // unused
849
- WEBIM_CONNCTION_GETROOMOCCUPANTS_ERROR = 22, // unused
850
- WEBIM_CONNCTION_LOAD_CHATROOM_ERROR = 23, // 获取聊天室失败,拉取历史消息失败(后面去掉)
1046
+ WEBIM_CONNCTION_GETROOMINFO_ERROR = 20,
1047
+ WEBIM_CONNCTION_GETROOMMEMBER_ERROR = 21,
1048
+ WEBIM_CONNCTION_GETROOMOCCUPANTS_ERROR = 22,
1049
+ WEBIM_CONNCTION_LOAD_CHATROOM_ERROR = 23,
851
1050
  WEBIM_CONNCTION_NOT_SUPPORT_CHATROOM_ERROR = 24,
852
1051
  WEBIM_CONNCTION_JOINCHATROOM_ERROR = 25,
853
1052
  WEBIM_CONNCTION_QUITCHATROOM_ERROR = 26,
@@ -855,24 +1054,34 @@ export declare namespace EasemobChat {
855
1054
  WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR = 28,
856
1055
  WEBIM_CONNCTION_SESSIONID_NOT_ASSIGN_ERROR = 29,
857
1056
  WEBIM_CONNCTION_RID_NOT_ASSIGN_ERROR = 30,
858
- WEBIM_CONNCTION_CALLBACK_INNER_ERROR = 31, //31 = 处理下行消息出错 try/catch抛出异常
859
- WEBIM_CONNCTION_CLIENT_OFFLINE = 32, //32 = client offline
860
- WEBIM_CONNCTION_CLIENT_LOGOUT = 33, //33 = client logout
861
- WEBIM_CONNCTION_CLIENT_TOO_MUCH_ERROR = 34, // 34 = Over amount of the tabs a user opened in the same browser
1057
+ WEBIM_CONNCTION_CALLBACK_INNER_ERROR = 31,
1058
+ WEBIM_CONNCTION_CLIENT_OFFLINE = 32,
1059
+ WEBIM_CONNCTION_CLIENT_LOGOUT = 33,
1060
+ WEBIM_CONNCTION_CLIENT_TOO_MUCH_ERROR = 34,
862
1061
  WEBIM_CONNECTION_ACCEPT_INVITATION_FROM_GROUP = 35,
863
1062
  WEBIM_CONNECTION_DECLINE_INVITATION_FROM_GROUP = 36,
864
1063
  WEBIM_CONNECTION_ACCEPT_JOIN_GROUP = 37,
865
1064
  WEBIM_CONNECTION_DECLINE_JOIN_GROUP = 38,
866
1065
  WEBIM_CONNECTION_CLOSED = 39,
867
1066
  WEBIM_CONNECTION_ERROR = 40,
1067
+ MAX_LIMIT = 50,
1068
+ MESSAGE_NOT_FOUND = 51,
1069
+ NO_PERMISSION = 52,
1070
+ OPERATION_UNSUPPORTED = 53,
868
1071
  WEBIM_UPLOADFILE_BROWSER_ERROR = 100,
869
1072
  WEBIM_UPLOADFILE_ERROR = 101,
870
1073
  WEBIM_UPLOADFILE_NO_LOGIN = 102,
871
1074
  WEBIM_UPLOADFILE_NO_FILE = 103,
872
- WEBIM_DOWNLOADFILE_ERROR = 200, // unused
873
- WEBIM_DOWNLOADFILE_NO_LOGIN = 201, // unused
874
- WEBIM_DOWNLOADFILE_BROWSER_ERROR = 202, // unused
875
- USER_NOT_FOUND = 204, // 用户不存在,如创建群拉人时不存在的用户报次错误
1075
+ WEBIM_DOWNLOADFILE_ERROR = 200,
1076
+ WEBIM_DOWNLOADFILE_NO_LOGIN = 201,
1077
+ WEBIM_DOWNLOADFILE_BROWSER_ERROR = 202,
1078
+ USER_NOT_FOUND = 204,
1079
+ WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE = 206,
1080
+ WEBIM_CONNCTION_USER_REMOVED = 207,
1081
+ WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD = 216,
1082
+ WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE = 217,
1083
+ USER_MUTED_BY_ADMIN = 219,
1084
+ USER_NOT_FRIEND = 221,
876
1085
  WEBIM_MESSAGE_REC_TEXT = 300,
877
1086
  WEBIM_MESSAGE_REC_TEXT_ERROR = 301,
878
1087
  WEBIM_MESSAGE_REC_EMOTION = 302,
@@ -899,23 +1108,34 @@ export declare namespace EasemobChat {
899
1108
  STATUS_CLOSED = 405,
900
1109
  STATUS_ERROR = 406,
901
1110
  SERVER_BUSY = 500,
902
- GROUP_NOT_EXIST = 605,
903
- GROUP_NOT_JOINED = 602, // 禁言等操作的人员不在群组中
1111
+ MESSAGE_INCLUDE_ILLEGAL_CONTENT = 501,
1112
+ MESSAGE_EXTERNAL_LOGIC_BLOCKED = 502,
1113
+ SERVER_UNKNOWN_ERROR = 503,
904
1114
  MESSAGE_RECALL_TIME_LIMIT = 504,
905
1115
  SERVICE_NOT_ENABLED = 505,
906
1116
  SERVICE_NOT_ALLOW_MESSAGING = 506,
907
- SERVICE_NOT_ALLOW_MESSAGING_MUTE = 507, // @since 4.0 被禁言
908
- SERVER_UNKNOWN_ERROR = 503, //未知异常
909
- MESSAGE_INCLUDE_ILLEGAL_CONTENT = 501, //消息内容包含非法或敏感词
910
- MESSAGE_EXTERNAL_LOGIC_BLOCKED = 502, // 消息被拦截
911
- PERMISSION_DENIED = 603, //权限问题
912
- WEBIM_LOAD_MSG_ERROR = 604, //消息发送失败下行
913
- GROUP_ALREADY_JOINED = 601, //|已在该群组中|调用 加入群组的 API 时如果已经在该群组中则提示该错误|
914
- // 700 参数校验
1117
+ SERVICE_NOT_ALLOW_MESSAGING_MUTE = 507,
1118
+ MESSAGE_MODERATION_BLOCKED = 508,
1119
+ GROUP_NOT_EXIST = 605,
1120
+ GROUP_NOT_JOINED = 602,
1121
+ GROUP_MEMBERS_FULL = 606,
1122
+ PERMISSION_DENIED = 603,
1123
+ WEBIM_LOAD_MSG_ERROR = 604,
1124
+ GROUP_ALREADY_JOINED = 601,
1125
+ GROUP_MEMBERS_LIMIT = 607,
915
1126
  REST_PARAMS_STATUS = 700,
916
- CHATROOM_MEMBERS_FULL = 704, // 聊天室人数达到上限
917
- CHATROOM_NOT_EXIST = 705, // The chat room does not exist
1127
+ CHATROOM_MEMBERS_FULL = 704,
1128
+ CHATROOM_NOT_EXIST = 705,
918
1129
  SDK_RUNTIME_ERROR = 999,
1130
+ PRESENCE_PARAM_EXCEED = 1100,
1131
+ REACTION_ALREADY_ADDED = 1101,
1132
+ REACTION_CREATING = 1102,
1133
+ REACTION_OPERATION_IS_ILLEGAL = 1103,
1134
+ TRANSLATION_NOT_VALID = 1200,
1135
+ TRANSLATION_TEXT_TOO_LONG = 1201,
1136
+ TRANSLATION_FAILED = 1204,
1137
+ THREAD_NOT_EXIST = 1300,
1138
+ THREAD_ALREADY_EXIST = 1301,
919
1139
  }
920
1140
 
921
1141
  /**
@@ -2885,6 +3105,21 @@ export declare namespace EasemobChat {
2885
3105
  }
2886
3106
  ): Promise<AsyncResult<SessionInfo[]>>;
2887
3107
 
3108
+ /**
3109
+ * Gets the conversation list and the latest message under the conversation.
3110
+ *
3111
+ * ```typescript
3112
+ * connection.getConversationList()
3113
+ * ```
3114
+ */
3115
+ getConversationList(
3116
+ this: Connection,
3117
+ params?: {
3118
+ success?: (res: AsyncResult<SessionInfo[]>) => void;
3119
+ error?: (error: ErrorEvent) => void;
3120
+ }
3121
+ ): Promise<AsyncResult<conversationList[]>>;
3122
+
2888
3123
  /**
2889
3124
  * Delete the session.
2890
3125
  *
@@ -2963,6 +3198,40 @@ export declare namespace EasemobChat {
2963
3198
  }
2964
3199
  ): Promise<MessageBody[]>;
2965
3200
 
3201
+ /**
3202
+ * Gets the message history.
3203
+ *
3204
+ * ```typescript
3205
+ * connection.getHistoryMessages({targetId:'user1',chatType:'groupChat', pageSize: 20})
3206
+ * ```
3207
+ */
3208
+ getHistoryMessages(
3209
+ this: Connection,
3210
+ options: {
3211
+ /** The user ID of the other party or the group ID. */
3212
+ targetId: string;
3213
+ /** The starting message ID for this query. The default value is -1, which means to start retrieving from the latest message. */
3214
+ cursor?: number | string | null;
3215
+ /** The number of messages to retrieve each time. The default value is 20,The maximum value is 50. */
3216
+ pageSize?: number;
3217
+ /** The chat type for SDK V4.0:
3218
+ * - `singleChat`: one-to-one chat;
3219
+ * - `groupchat`: group chat;
3220
+ * - `chatroom`: chat room.
3221
+ * - (Default)`singleChat`: No.
3222
+ */
3223
+ chatType?: 'singleChat' | 'groupChat' | 'chatRoom';
3224
+ /** Whether to select pull history messages in positive order(Pull message from the oldest to the latest).
3225
+ * - `up`: means searching from the newer messages to the older messages.
3226
+ * - `down`: means searching from the older messages to the newer messages.
3227
+ * - (Default)`up`.
3228
+ */
3229
+ searchDirection?: string;
3230
+ success?: (res: MessageBody[]) => void;
3231
+ fail?: (error: ErrorEvent) => void;
3232
+ }
3233
+ ): Promise<HistoryMessages>;
3234
+
2966
3235
  /**
2967
3236
  * Adds Contact.
2968
3237
  *
@@ -3069,7 +3338,7 @@ export declare namespace EasemobChat {
3069
3338
  * Recall a message
3070
3339
  *
3071
3340
  * ```typescript
3072
- * connection.recallMessage({mid: 'messageId', to: 'user1', type: 'singleChat'})
3341
+ * connection.recallMessage({mid: 'messageId', to: 'user1', type: 'singleChat', isChatThread: false})
3073
3342
  * ```
3074
3343
  */
3075
3344
  recallMessage(
@@ -3079,6 +3348,7 @@ export declare namespace EasemobChat {
3079
3348
  to: UserId;
3080
3349
  type?: 'chat' | 'groupchat' | 'chatroom'; // v3.0
3081
3350
  chatType?: 'singleChat' | 'groupChat' | 'chatRoom'; // v4.0
3351
+ isChatThread?: boolean;
3082
3352
  success?: (res: number) => void;
3083
3353
  fail?: (error: ErrorEvent) => void;
3084
3354
  }
@@ -3206,8 +3476,8 @@ export declare namespace EasemobChat {
3206
3476
  reportMessage(
3207
3477
  this: Connection,
3208
3478
  params: {
3209
- reportType: string; // 举报类型。
3210
- reportReason: string; // 举报原因。
3479
+ reportType: string;
3480
+ reportReason: string;
3211
3481
  messageId: string;
3212
3482
  }
3213
3483
  ): Promise<void>;
@@ -3368,6 +3638,267 @@ export declare namespace EasemobChat {
3368
3638
  error?: (error: ErrorEvent) => void;
3369
3639
  }
3370
3640
  ): Promise<AsyncResult<TranslationLanguageType>>;
3641
+
3642
+ /**
3643
+ * Creates a chatThread.
3644
+ *
3645
+ * ```typescript
3646
+ * connection.createChatThread({parentId: 'parentId',name: 'threadName',messageId: 'messageId'})
3647
+ * ```
3648
+ */
3649
+ createChatThread(
3650
+ this: Connection,
3651
+ params: {
3652
+ /** Generally refers to the group ID. */
3653
+ parentId: string;
3654
+ /** The chatThread name. */
3655
+ name: string;
3656
+ /** The parent message ID. */
3657
+ messageId: string;
3658
+ }
3659
+ ): Promise<AsyncResult<CreateChatThreadResult>>;
3660
+
3661
+ /**
3662
+ * Joins the chatThread.
3663
+ *
3664
+ * ```typescript
3665
+ * connection.joinChatThread({chatThreadId: 'chatThreadId'})
3666
+ * ```
3667
+ */
3668
+ joinChatThread(
3669
+ this: Connection,
3670
+ params: {
3671
+ /** The chatThread ID. */
3672
+ chatThreadId: string;
3673
+ }
3674
+ ): Promise<AsyncResult<JoinChatThreadResult>>;
3675
+
3676
+ /**
3677
+ * Leaves the chatThread.
3678
+ *
3679
+ * ```typescript
3680
+ * connection.leaveChatThread({chatThreadId: 'chatThreadId'})
3681
+ * ```
3682
+ */
3683
+ leaveChatThread(
3684
+ this: Connection,
3685
+ params: {
3686
+ /** The chatThread ID. */
3687
+ chatThreadId: string;
3688
+ }
3689
+ ): Promise<void>;
3690
+
3691
+ /**
3692
+ * Adds a reaction to the message.
3693
+ *
3694
+ * ```typescript
3695
+ * connection.addReaction({messageId: 'messageId', action: 'action'})
3696
+ * ```
3697
+ */
3698
+ addReaction(
3699
+ this: Connection,
3700
+ params: {
3701
+ /** The message ID. */
3702
+ messageId: string;
3703
+ /** The reaction to be added to the message. The length is limited to 128 characters. */
3704
+ reaction: string;
3705
+ }
3706
+ ): Promise<void>;
3707
+
3708
+ /**
3709
+ * Deletes the chatThread,group leader and administrator have this permission.
3710
+ *
3711
+ * ```typescript
3712
+ * connection.destroyChatThread({chatThreadId: 'chatThreadId'})
3713
+ * ```
3714
+ */
3715
+ destroyChatThread(
3716
+ this: Connection,
3717
+ params: {
3718
+ /** The chatThread ID. */
3719
+ chatThreadId: string;
3720
+ }
3721
+ ): Promise<void>;
3722
+
3723
+ /**
3724
+ * Removes a reaction from a message.
3725
+ *
3726
+ * ```typescript
3727
+ * connection.deleteReaction({reactionId: 'reactionId'})
3728
+ * ```
3729
+ */
3730
+ deleteReaction(
3731
+ this: Connection,
3732
+ params: {
3733
+ /** The message reaction to delete. */
3734
+ reaction: string;
3735
+ /** The message ID. */
3736
+ messageId: string;
3737
+ }
3738
+ ): Promise<void>;
3739
+
3740
+ /**
3741
+ * Modifies the chatThread name.
3742
+ *
3743
+ * ```typescript
3744
+ * connection.changeChatThreadName({chatThreadId: 'chatThreadId',name: 'name'})
3745
+ * ```
3746
+ */
3747
+ changeChatThreadName(
3748
+ this: Connection,
3749
+ params: {
3750
+ /** The chatThread ID. */
3751
+ chatThreadId: string;
3752
+ /** The chatThread name. */
3753
+ name: string;
3754
+ }
3755
+ ): Promise<AsyncResult<ChangeChatThreadName>>;
3756
+
3757
+ /**
3758
+ * Lists all members of the chatThread with pagination.
3759
+ *
3760
+ * ```typescript
3761
+ * connection.getChatThreadMembers({chatThreadId: 'chatThreadId',pageSize:20,cursor:'cursor'})
3762
+ * ```
3763
+ */
3764
+ getChatThreadMembers(
3765
+ this: Connection,
3766
+ params: {
3767
+ /** The Thread ID. */
3768
+ chatThreadId: string;
3769
+ /** The number of members per page. The default value is 20, and the maximum value is 50.*/
3770
+ pageSize?: number;
3771
+ /** 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.*/
3772
+ cursor?: string;
3773
+ }
3774
+ ): Promise<AsyncResult<ChatThreadMembers>>;
3775
+
3776
+ /**
3777
+ * Removes a member from the chatThread.
3778
+ *
3779
+ * ```typescript
3780
+ * connection.removeChatThreadMember({chatThreadId: 'chatThreadId',username:'username'})
3781
+ * ```
3782
+ */
3783
+ removeChatThreadMember(
3784
+ this: Connection,
3785
+ params: {
3786
+ /** The chatThread ID. */
3787
+ chatThreadId: string;
3788
+ /** The member ID to remove. */
3789
+ username: string;
3790
+ }
3791
+ ): Promise<AsyncResult<RemoveMemberResult>>;
3792
+
3793
+ /**
3794
+ * Gets the list of joined chatThreads with pagination.When parentId is not null, get the list of chatThread under the specified group.
3795
+ *
3796
+ * ```typescript
3797
+ * connection.getJoinedChatThreads({parentId: 'parentId',cursor: 'cursor',pageSize: 50})
3798
+ * ```
3799
+ */
3800
+ getJoinedChatThreads(
3801
+ this: Connection,
3802
+ params: {
3803
+ /** Generally refers to the group ID. */
3804
+ parentId?: string;
3805
+ /** The number of thread per page. The default value is 20, and the maximum value is 50. */
3806
+ pageSize?: number;
3807
+ /** 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.*/
3808
+ cursor?: string;
3809
+ }
3810
+ ): Promise<AsyncResult<ChatThreadDetail[]>>;
3811
+
3812
+ /**
3813
+ * Gets the thread list of the specified group with pagination.
3814
+ * ```typescript
3815
+ * connection.getChatThreads({parentId: 'parentId, cursor:'cursor' ,pageSize: 50})
3816
+ * ```
3817
+ */
3818
+ getChatThreads(
3819
+ this: Connection,
3820
+ params: {
3821
+ /** Generally refers to the group ID. */
3822
+ parentId: string;
3823
+ /** The number of thread per page. The default value is 20, and the maximum value is 50. */
3824
+ pageSize?: number;
3825
+ /** 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.*/
3826
+ cursor?: string;
3827
+ }
3828
+ ): Promise<AsyncResult<ChatThreadDetail[]>>;
3829
+
3830
+ /**
3831
+ * Gets the latest message content of the chatThread in batch,with a maximum of 20 messages.
3832
+ *
3833
+ * ```typescript
3834
+ * connection.getChatThreadLastMessage({chatThreadIds: ['chatThreadId1','chatThreadId2']})
3835
+ * ```
3836
+ */
3837
+ getChatThreadLastMessage(
3838
+ this: Connection,
3839
+ params: {
3840
+ /** The array of chatThread IDs to query.*/
3841
+ chatThreadIds: string[];
3842
+ }
3843
+ ): Promise<AsyncResult<ChatThreadLastMessage>>;
3844
+
3845
+ /**
3846
+ * Gets detail of the chatThread.
3847
+ *
3848
+ * ```typescript
3849
+ * connection.getChatThreadDetail({chatThreadId: 'chatThreadId'})
3850
+ * ```
3851
+ */
3852
+ getChatThreadDetail(
3853
+ this: Connection,
3854
+ params: {
3855
+ /** The chatThread ID. */
3856
+ chatThreadId: string;
3857
+ }
3858
+ ): Promise<AsyncResult<ChatThreadDetail>>;
3859
+
3860
+ /**
3861
+ * Gets the reaction list for the message.
3862
+ *
3863
+ * ```typescript
3864
+ * connection.getReactionList({chatType: 'chatType', messageId: 'messageId'})
3865
+ * ```
3866
+ */
3867
+ getReactionList(
3868
+ this: Connection,
3869
+ params: {
3870
+ /** The conversation type:
3871
+ * - singleChat;
3872
+ * - groupChat;
3873
+ */
3874
+ chatType: 'singleChat' | 'groupChat';
3875
+ /** The message ID. */
3876
+ messageId: string | Array<string>;
3877
+ /** The group ID. */
3878
+ groupId?: string;
3879
+ }
3880
+ ): Promise<AsyncResult<GetReactionListResult[]>>;
3881
+
3882
+ /**
3883
+ * Gets the details of a reaction.
3884
+ *
3885
+ * ```typescript
3886
+ * getReactionDetail({messageId: 'messageId', reaction: 'reaction', cursor: '', pageSize: 20})
3887
+ * ```
3888
+ */
3889
+ getReactionDetail(
3890
+ this: Connection,
3891
+ params: {
3892
+ /** The message ID. */
3893
+ messageId: string;
3894
+ /** The reactions to retrieve. */
3895
+ reaction: string;
3896
+ /** 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.*/
3897
+ cursor?: string; // 默认为 null
3898
+ /** The number of reactions per page. The default value is 20, and the maximum value is 100. */
3899
+ pageSize?: number;
3900
+ }
3901
+ ): Promise<AsyncResult<GetReactionDetailResult>>;
3371
3902
  }
3372
3903
 
3373
3904
  /**
@@ -3384,6 +3915,21 @@ export declare namespace EasemobChat {
3384
3915
  | RecallMsgBody
3385
3916
  | ChannelMsgBody;
3386
3917
 
3918
+ interface ReactionMessage {
3919
+ /** The message sender. */
3920
+ from: string;
3921
+ /** The message recipient. */
3922
+ to: string;
3923
+ /** The conversation type. */
3924
+ chatType: 'singleChat' | 'groupChat';
3925
+ /** The reaction to be added to the message. The length is limited to 128 characters. */
3926
+ reactions: Reaction[];
3927
+ /** The ID of the message whose reaction updated. */
3928
+ messageId: string;
3929
+ /** The Unix timestamp for updating the reaction. */
3930
+ ts: number;
3931
+ }
3932
+
3387
3933
  type Event =
3388
3934
  | 'onOpened'
3389
3935
  | 'onPresence'
@@ -3455,6 +4001,9 @@ export declare namespace EasemobChat {
3455
4001
  onChatroomChange?: (msg: any) => void;
3456
4002
  onContactChange?: (msg: any) => void;
3457
4003
  onPresenceStatusChange?: (msg: PresenceType[]) => void;
4004
+ onChatThreadChange?: (msg: ThreadChangeInfo) => void;
4005
+ onMultiDeviceEvent?: (msg: ThreadMultiDeviceInfo) => void;
4006
+ onReactionChange?: (msg: ReactionMessage) => void;
3458
4007
  }
3459
4008
 
3460
4009
  interface HandlerData {
@@ -3625,6 +4174,23 @@ export declare namespace EasemobChat {
3625
4174
  filetype: string;
3626
4175
  data: File;
3627
4176
  }
4177
+
4178
+ interface Reaction {
4179
+ /** The content of the reaction to be added to the message. The length is limited to 128 characters. */
4180
+ reaction: string;
4181
+ /** The reaction count. */
4182
+ count: number;
4183
+ /** The reaction update operation. Once the reaction is updated, the onReactionChange callback is triggered. */
4184
+ op?: { operator: UserId; reactionType: 'create' | 'delete' }[];
4185
+ /** The IDs of the users that added the reaction. */
4186
+ userList: UserId[];
4187
+ /** Whether the current user has added this reaction.
4188
+ * - `true`: Yes.
4189
+ * - `false`: No.
4190
+ */
4191
+ isAddedBySelf?: boolean;
4192
+ }
4193
+
3628
4194
  interface PresenceMsg {
3629
4195
  type: OnPresenceMsgType;
3630
4196
  to: string;
@@ -3652,6 +4218,7 @@ export declare namespace EasemobChat {
3652
4218
  groupReadCount?: { [key: string]: number };
3653
4219
  ackContent?: string;
3654
4220
  chatType: 'singleChat' | 'groupChat';
4221
+ isChatThread?: boolean;
3655
4222
  }
3656
4223
  interface ReadParameters {
3657
4224
  type: 'read';
@@ -3665,6 +4232,7 @@ export declare namespace EasemobChat {
3665
4232
  id: string;
3666
4233
  ackContent?: string;
3667
4234
  chatType: 'singleChat' | 'groupChat';
4235
+ isChatThread?: boolean;
3668
4236
  }
3669
4237
 
3670
4238
  interface DeliveryParameters {
@@ -3683,6 +4251,7 @@ export declare namespace EasemobChat {
3683
4251
  type: 'delivery';
3684
4252
  to: string;
3685
4253
  from?: string;
4254
+ isChatThread?: boolean;
3686
4255
  }
3687
4256
 
3688
4257
  interface CreateDeliveryMsgParameters {
@@ -3690,6 +4259,7 @@ export declare namespace EasemobChat {
3690
4259
  type: 'delivery';
3691
4260
  to: string;
3692
4261
  from?: string;
4262
+ isChatThread?: boolean;
3693
4263
  }
3694
4264
 
3695
4265
  interface ChannelMsgSetParameters {
@@ -3703,6 +4273,7 @@ export declare namespace EasemobChat {
3703
4273
  group?: string;
3704
4274
  type: 'channel';
3705
4275
  time: number;
4276
+ isChatThread?: boolean;
3706
4277
  }
3707
4278
  interface ChannelParameters {
3708
4279
  type: 'channel';
@@ -3714,6 +4285,7 @@ export declare namespace EasemobChat {
3714
4285
  chatType: ChatType;
3715
4286
  to: string;
3716
4287
  from?: string;
4288
+ isChatThread?: boolean;
3717
4289
  }
3718
4290
 
3719
4291
  interface TextParameters {
@@ -3746,6 +4318,8 @@ export declare namespace EasemobChat {
3746
4318
  msgConfig?: { allowGroupAck?: boolean; languages?: string[] };
3747
4319
  translations?: TranslationResult;
3748
4320
  time: number;
4321
+ isChatThread?: boolean;
4322
+ reactions?: Reaction;
3749
4323
  }
3750
4324
 
3751
4325
  interface CreateTextMsgParameters {
@@ -3756,6 +4330,7 @@ export declare namespace EasemobChat {
3756
4330
  from?: string;
3757
4331
  ext?: { [key: string]: any };
3758
4332
  msgConfig?: { allowGroupAck?: boolean; languages?: string[] };
4333
+ isChatThread?: boolean;
3759
4334
  }
3760
4335
 
3761
4336
  interface CmdParameters {
@@ -3787,6 +4362,8 @@ export declare namespace EasemobChat {
3787
4362
  ext?: { [key: string]: any };
3788
4363
  msgConfig?: { [key: string]: any };
3789
4364
  time: number;
4365
+ isChatThread?: boolean;
4366
+ reactions?: Reaction;
3790
4367
  }
3791
4368
 
3792
4369
  interface CreateCmdMsgParameters {
@@ -3798,6 +4375,7 @@ export declare namespace EasemobChat {
3798
4375
  roomType?: boolean;
3799
4376
  ext?: { [key: string]: any };
3800
4377
  msgConfig?: { allowGroupAck: boolean };
4378
+ isChatThread?: boolean;
3801
4379
  }
3802
4380
 
3803
4381
  interface CustomParameters {
@@ -3832,6 +4410,8 @@ export declare namespace EasemobChat {
3832
4410
  ext?: { [key: string]: any };
3833
4411
  msgConfig?: { [key: string]: any };
3834
4412
  time: number;
4413
+ isChatThread?: boolean;
4414
+ reactions?: Reaction;
3835
4415
  }
3836
4416
 
3837
4417
  interface CreateCustomMsgParameters {
@@ -3843,6 +4423,7 @@ export declare namespace EasemobChat {
3843
4423
  from?: string;
3844
4424
  ext?: { [key: string]: any };
3845
4425
  msgConfig?: { allowGroupAck: boolean };
4426
+ isChatThread?: boolean;
3846
4427
  }
3847
4428
 
3848
4429
  interface LocationParameters {
@@ -3880,6 +4461,8 @@ export declare namespace EasemobChat {
3880
4461
  ext?: { [key: string]: any };
3881
4462
  time: number;
3882
4463
  msgConfig?: { allowGroupAck: boolean };
4464
+ isChatThread?: boolean;
4465
+ reactions?: Reaction;
3883
4466
  }
3884
4467
 
3885
4468
  interface CreateLocationMsgParameters {
@@ -3893,6 +4476,7 @@ export declare namespace EasemobChat {
3893
4476
  from?: string;
3894
4477
  ext?: { [key: string]: any };
3895
4478
  msgConfig?: { allowGroupAck: boolean };
4479
+ isChatThread?: boolean;
3896
4480
  }
3897
4481
 
3898
4482
  interface FileParameters {
@@ -3933,6 +4517,7 @@ export declare namespace EasemobChat {
3933
4517
  accessToken?: string;
3934
4518
  msgConfig?: { allowGroupAck: boolean };
3935
4519
  time: number;
4520
+ reactions?: Reaction;
3936
4521
  }
3937
4522
 
3938
4523
  interface CreateFileMsgParameters {
@@ -3954,6 +4539,7 @@ export declare namespace EasemobChat {
3954
4539
  filename: string;
3955
4540
  };
3956
4541
  msgConfig?: { allowGroupAck: boolean };
4542
+ isChatThread?: boolean;
3957
4543
  }
3958
4544
 
3959
4545
  interface ImgParameters {
@@ -3995,6 +4581,8 @@ export declare namespace EasemobChat {
3995
4581
  secret?: string;
3996
4582
  thumb?: string;
3997
4583
  thumb_secret?: string;
4584
+ isChatThread?: boolean;
4585
+ reactions?: Reaction;
3998
4586
  }
3999
4587
 
4000
4588
  interface CreateImgMsgParameters {
@@ -4018,6 +4606,7 @@ export declare namespace EasemobChat {
4018
4606
  filename: string;
4019
4607
  };
4020
4608
  msgConfig?: { allowGroupAck: boolean };
4609
+ isChatThread?: boolean;
4021
4610
  }
4022
4611
 
4023
4612
  interface AudioParameters {
@@ -4058,6 +4647,8 @@ export declare namespace EasemobChat {
4058
4647
  group?: string;
4059
4648
  msgConfig?: { [key: string]: any };
4060
4649
  time: number;
4650
+ isChatThread?: boolean;
4651
+ reactions?: Reaction;
4061
4652
  }
4062
4653
 
4063
4654
  interface CreateAudioMsgParameters {
@@ -4084,6 +4675,7 @@ export declare namespace EasemobChat {
4084
4675
  filename: string;
4085
4676
  };
4086
4677
  msgConfig?: { allowGroupAck: boolean };
4678
+ isChatThread?: boolean;
4087
4679
  }
4088
4680
 
4089
4681
  interface VideoParameters {
@@ -4124,6 +4716,8 @@ export declare namespace EasemobChat {
4124
4716
  msgConfig?: { [key: string]: any };
4125
4717
  group?: string;
4126
4718
  time: number;
4719
+ isChatThread?: boolean;
4720
+ reactions?: Reaction;
4127
4721
  }
4128
4722
 
4129
4723
  interface CreateVideoMsgParameters {
@@ -4147,6 +4741,7 @@ export declare namespace EasemobChat {
4147
4741
  filename: string;
4148
4742
  };
4149
4743
  msgConfig?: { allowGroupAck: boolean };
4744
+ isChatThread?: boolean;
4150
4745
  }
4151
4746
 
4152
4747
  interface ReceivedMsgBody {