@rongcloud/engine 4.5.0-alpha.2 → 4.5.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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCEngine - v4.5.0-alpha.2
3
- * CommitId - 2dbdf34ce94b97b99b64591f1ad1736dd594730a
4
- * Tue Sep 28 2021 11:52:00 GMT+0800 (China Standard Time)
2
+ * RCEngine - v4.5.2
3
+ * CommitId - ba81ca4a531f2c59a5e2f0cecb5e05aab7e03210
4
+ * Thu Nov 25 2021 10:37:04 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  /**
@@ -138,6 +138,42 @@ declare enum OperationType {
138
138
  DISCONNECT = 14,
139
139
  RESERVER2 = 15
140
140
  }
141
+ /**
142
+ * connect 版本号,用于区分 ConnAckMessage 的解析规则
143
+ */
144
+ declare enum ConnAckProtocolVer {
145
+ /**
146
+ * V4 说明:
147
+ * ```
148
+ * 增加 flag 来标识每个位置是否有内容,如果没有 messageId 说明此 APP 没有配置防重放,默认取0
149
+ * status | 4byte
150
+ * flag | 1byte 每一位标识是否有对应值,由低到高
151
+ * userId | 可变长
152
+ * sessionId | 可变长
153
+ * timestamp | 8byte
154
+ * messageId | 4byte
155
+ * onlineClientInfo | 可变长
156
+ * ===
157
+ * flag 描述:
158
+ * | | | | 4 | 3 | 2 | 1 | 0 |
159
+ * | | | | hasOnlineClientInfo | hasMessageId | hasTimeStamp | hasSessionId | hasUserId |
160
+ * ```
161
+ */
162
+ V4 = 4,
163
+ /**
164
+ * V3 说明:
165
+ * ```
166
+ * status | 4byte
167
+ * userId | 可变长
168
+ * sessionId | 可变长
169
+ * timestamp | 8byte
170
+ * descyptionType | 1byte
171
+ * secretKey | 可变长
172
+ * onlineClientInfo | 可变长
173
+ * ```
174
+ */
175
+ V3 = 3
176
+ }
141
177
 
142
178
  /**
143
179
  * @todo 注释补全
@@ -163,6 +199,10 @@ declare class RongStreamReader {
163
199
  private _poolLen;
164
200
  constructor(arr: Uint8Array);
165
201
  check(): boolean;
202
+ /**
203
+ * 读 2 位
204
+ */
205
+ read2Byte(): number;
166
206
  /**
167
207
  * 读 4 位
168
208
  */
@@ -219,8 +259,8 @@ declare class BaseReader {
219
259
  identifier: string;
220
260
  constructor(header: Header);
221
261
  getIdentifier(): string | number;
222
- read(stream: RongStreamReader, length: number): void;
223
- readMessage(stream: RongStreamReader, length?: number): {
262
+ read(stream: RongStreamReader, length: number, protocolVer: ConnAckProtocolVer): void;
263
+ readMessage(stream: RongStreamReader, length?: number, protocolVer?: ConnAckProtocolVer): {
224
264
  stream: RongStreamReader;
225
265
  length: number | undefined;
226
266
  };
@@ -325,6 +365,13 @@ interface IConversationOption {
325
365
  targetId: string;
326
366
  channelId?: string;
327
367
  }
368
+ interface IServerRTCRoomEntry {
369
+ key: string;
370
+ value: string;
371
+ status: number;
372
+ timestamp: number;
373
+ uid: string;
374
+ }
328
375
  interface IChrmKVEntry {
329
376
  key: string;
330
377
  value?: string;
@@ -337,10 +384,18 @@ interface IChrmKVEntry {
337
384
  type?: number;
338
385
  isDeleted?: boolean;
339
386
  }
340
- interface IChrmKVPullData {
341
- kvEntries: IChrmKVEntry[];
342
- isFullUpdate?: boolean;
343
- syncTime?: number;
387
+ interface IChrmKVEntries {
388
+ entries: {
389
+ key: string;
390
+ value?: string;
391
+ }[];
392
+ notificationExtra?: string;
393
+ isOverwrite?: boolean;
394
+ isAutoDelete?: boolean;
395
+ timestamp?: number;
396
+ userId?: string;
397
+ type?: number;
398
+ isDeleted?: boolean;
344
399
  }
345
400
  interface IServerConversationStatus {
346
401
  conversationType: number;
@@ -384,13 +439,6 @@ interface IGetConversationListOption {
384
439
  interface IClearMsgOption {
385
440
  timestamp?: number;
386
441
  }
387
- interface IServerRTCRoomEntry {
388
- key: string;
389
- value: string;
390
- status: number;
391
- timestamp: number;
392
- uid: string;
393
- }
394
442
 
395
443
  /**
396
444
  * 聊天室 kv 存储操作类型. 对方操作, 己方收到消息(RC:chrmKVNotiMsg)中会带入此值. 根据此值判断是删除还是更新
@@ -862,6 +910,18 @@ declare enum ErrorCode {
862
910
  * Disconnect,由服务器返回,比如用户互踢。
863
911
  */
864
912
  RC_DISCONN_EXCEPTION = 31011,
913
+ /**
914
+ * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
915
+ */
916
+ RC_APP_AUTH_NOT_PASS = 31026,
917
+ /**
918
+ * One Time Password 已经被使用过
919
+ */
920
+ RC_OTP_USED = 31027,
921
+ /**
922
+ * token平台验证失败
923
+ */
924
+ RC_PLATFORM_ERROR = 31028,
865
925
  /**
866
926
  * 协议层内部错误。query,上传下载过程中数据错误。
867
927
  */
@@ -1117,7 +1177,15 @@ declare enum ErrorCode {
1117
1177
  /**
1118
1178
  * VoIP 不可用
1119
1179
  */
1120
- VOIP_NOT_AVALIABLE = 18
1180
+ VOIP_NOT_AVALIABLE = 18,
1181
+ /**
1182
+ * 聊天室批量设置kv部分不成功
1183
+ */
1184
+ CHATROOM_KV_STORE_NOT_ALL_SUCCESS = 23428,
1185
+ /**
1186
+ * 聊天室设置批量kv,一次不能超过10个
1187
+ */
1188
+ CHATROOM_KV_STORE_OUT_LIMIT = 23429
1121
1189
  }
1122
1190
 
1123
1191
  /**
@@ -1372,6 +1440,7 @@ declare class DataCodec {
1372
1440
  * 聊天室 KV 存储
1373
1441
  */
1374
1442
  encodeModifyChatRoomKV(chrmId: string, entry: IChrmKVEntry, currentUserId: string): any;
1443
+ encodeModifyChatRoomKVS(chrmId: string, entryOptions: IChrmKVEntries, currentUserId: string): any;
1375
1444
  /**
1376
1445
  * KV 存储拉取
1377
1446
  */
@@ -1615,7 +1684,7 @@ declare abstract class ADataChannel {
1615
1684
  * @param protocol 请求导航数据时使用的网络协议, /ping 与 websocket 需要继续遵循该协议
1616
1685
  * @param apiVersion - apiVersion 需符合 `/\d+(\.\d+){2}/` 规则,对于预发布版本号如 `3.1.0-alpha.1` 需认定为 `3.1.0`
1617
1686
  */
1618
- abstract connect(appkey: string, token: string, host: string[], protocol: 'http' | 'https', apiVersion: string): Promise<ErrorCode>;
1687
+ abstract connect(appkey: string, token: string, host: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
1619
1688
  /**
1620
1689
  * 只发送数据,无需响应
1621
1690
  */
@@ -1782,7 +1851,7 @@ declare class WebSocketChannel extends ADataChannel {
1782
1851
  * @param protocol
1783
1852
  * @param apiVersion - apiVersion 需符合 `/\d+(\.\d+){2}/` 规则
1784
1853
  */
1785
- connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string): Promise<ErrorCode>;
1854
+ connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
1786
1855
  /**
1787
1856
  * 当前累计心跳超时次数
1788
1857
  */
@@ -1826,7 +1895,12 @@ declare class CometChannel extends ADataChannel {
1826
1895
  * 长轮询心跳
1827
1896
  */
1828
1897
  _startPullSignal(protocol: 'http' | 'https'): Promise<void>;
1829
- connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string): Promise<ErrorCode>;
1898
+ /**
1899
+ * 连接
1900
+ * comet 连接暂时不走 protocolVer=v4 的协议
1901
+ * @returns
1902
+ */
1903
+ connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
1830
1904
  private _idCount;
1831
1905
  private _generateMessageId;
1832
1906
  sendCometData(writer: BaseWriter, timeout?: number): Promise<void>;
@@ -2232,6 +2306,7 @@ interface IJoinRTCRoomData extends IRTCUsers {
2232
2306
  key: string;
2233
2307
  value: string;
2234
2308
  }[];
2309
+ kvEntries: IServerRTCRoomEntry[];
2235
2310
  }
2236
2311
 
2237
2312
  /**
@@ -2353,6 +2428,22 @@ interface IChatroomEntry {
2353
2428
  isAutoDelete?: boolean;
2354
2429
  }
2355
2430
 
2431
+ interface IChatroomEntries {
2432
+ /**
2433
+ * entries ,要设置的属性列表
2434
+ * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2435
+ * value 属性对应的值, 最大长度 4096 字符
2436
+ */
2437
+ entries: {
2438
+ key: string;
2439
+ value: string;
2440
+ }[];
2441
+ /**
2442
+ * 用户退出聊天室时是否清除此属性
2443
+ */
2444
+ isAutoDelete?: boolean;
2445
+ }
2446
+
2356
2447
  interface IRemoveChatRoomEntryOption {
2357
2448
  /**
2358
2449
  * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
@@ -2368,6 +2459,23 @@ interface IRemoveChatRoomEntryOption {
2368
2459
  notificationExtra?: string;
2369
2460
  }
2370
2461
 
2462
+ interface IRemoveChatRoomEntriesOption {
2463
+ /**
2464
+ * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2465
+ */
2466
+ entries: {
2467
+ key: string;
2468
+ }[];
2469
+ }
2470
+
2471
+ /**
2472
+ * 聊天室成员进入和退出状态
2473
+ */
2474
+ declare enum ChatroomUserChangeType {
2475
+ QUIT = 0,
2476
+ JOIN = 1
2477
+ }
2478
+
2371
2479
  interface IChatroomEntryListenerData {
2372
2480
  /**
2373
2481
  * 更新的键
@@ -2410,6 +2518,12 @@ interface IChatroomRejoinedSuccessed {
2410
2518
  */
2411
2519
  count: number;
2412
2520
  }
2521
+ interface IChatroomUserChangeInfo {
2522
+ users: {
2523
+ [userId: string]: ChatroomUserChangeType;
2524
+ };
2525
+ chatroomId: string;
2526
+ }
2413
2527
  declare type IChatroomRejoinedInfo = IChatroomRejoinedFailed | IChatroomRejoinedSuccessed;
2414
2528
  /**
2415
2529
  * 聊天室信息
@@ -2423,6 +2537,11 @@ interface IChatroomListenerData {
2423
2537
  * 监听到的聊天室 KV 更新
2424
2538
  */
2425
2539
  updatedEntries?: IChatroomEntryListenerData[];
2540
+ userChange?: IChatroomUserChangeInfo;
2541
+ /**
2542
+ * 聊天室销毁
2543
+ */
2544
+ chatroomDestroyed?: string;
2426
2545
  }
2427
2546
 
2428
2547
  interface IUpdatedConversation {
@@ -2637,6 +2756,22 @@ declare const ConnectResultCode: {
2637
2756
  * 开启`禁止把已在线客户端踢下线`开关后,该错误码标识已有同类型端在线,禁止链接
2638
2757
  */
2639
2758
  HASOHTERSAMECLIENTONLINE: number;
2759
+ /**
2760
+ * 客户端连错环境,引发连接拒绝
2761
+ */
2762
+ IN_OTHER_CLUSTER: number;
2763
+ /**
2764
+ * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
2765
+ */
2766
+ APP_AUTH_NOT_PASS: number;
2767
+ /**
2768
+ * One Time Password 已经被使用过
2769
+ */
2770
+ OTP_USED: number;
2771
+ /**
2772
+ * token平台验证失败
2773
+ */
2774
+ PLATFORM_ERROR: number;
2640
2775
  };
2641
2776
 
2642
2777
  /**
@@ -2724,9 +2859,25 @@ declare enum MessageType {
2724
2859
  */
2725
2860
  GROUP_READ_RECEIPT_REQUEST = "RC:RRMsg",
2726
2861
  /**
2727
- * 消息送达报告,仅单聊
2862
+ * 用户加入聊天室
2863
+ */
2864
+ CHATROOM_JOIN = "RC:ChrmJoinNtf",
2865
+ /**
2866
+ * 用户退出聊天室
2867
+ */
2868
+ CHATROOM_LEFT = "RC:ChrmQuitNtf",
2869
+ /**
2870
+ * 用户加入退出聊天室的集合
2728
2871
  */
2729
- DELIVERED = "RC:Delivered"
2872
+ CHATROOM_MERGE_CHANGE = "RC:ChrmMemChange",
2873
+ /**
2874
+ * 输入状态消息
2875
+ */
2876
+ TYPING_STATUS = "RC:TypSts",
2877
+ /**
2878
+ * 拦截消息,(当发送的消息的敏感词时,服务会下发一个拦截消息,内容包含被拦截消息信息)
2879
+ */
2880
+ INTERCEPT = "RC:InterceptMsg"
2730
2881
  }
2731
2882
 
2732
2883
  /**
@@ -2990,6 +3141,10 @@ interface INaviInfo {
2990
3141
  * 群组回执开关, 1: 打开,0(或者没有): 关闭
2991
3142
  */
2992
3143
  grpRRVer?: number;
3144
+ /**
3145
+ * 防黑产开关, 1: 打开,0:关闭
3146
+ */
3147
+ openAnti?: number;
2993
3148
  }
2994
3149
 
2995
3150
  /**
@@ -3033,1144 +3188,1176 @@ interface ITypingMessage {
3033
3188
  }
3034
3189
 
3035
3190
  /**
3036
- * 消息送达相关接口
3191
+ * 消息被拦截类型
3037
3192
  */
3038
- interface IDeliveredUser {
3039
- time: number;
3040
- userId: string;
3041
- }
3042
- interface IGroupMessageDeliverInfo {
3043
- totalCount: number;
3044
- list: IDeliveredUser[];
3045
- }
3046
- interface IMessageDeliver {
3047
- deliverTime: number;
3048
- messageUId: string;
3193
+ declare enum MessageBlockType {
3194
+ /*!
3195
+ 全局敏感词:命中了融云内置的全局敏感词
3196
+ */
3197
+ GLOBAL = 1,
3198
+ /*!
3199
+ 自定义敏感词拦截:命中了客户在融云自定义的敏感词
3200
+ */
3201
+ CUSTOM = 2,
3202
+ /*!
3203
+ 第三方审核拦截:命中了第三方(数美)或模板路由决定不下发的状态
3204
+ */
3205
+ THIRD_PARTY = 3
3049
3206
  }
3050
3207
 
3051
3208
  /**
3052
- * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3209
+ * 被拦截的消息信息
3053
3210
  */
3054
- interface IEngine {
3055
- /**
3056
- * 建立连接
3057
- * @param token
3058
- * @param naviInfo
3059
- */
3060
- connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
3061
- /**
3062
- * 上报版本信息
3063
- * @param version
3064
- */
3065
- reportSDKInfo(version: {
3066
- [name: string]: string;
3067
- }): void;
3068
- /**
3069
- * 连接时间
3070
- */
3071
- getConnectedTime(): number;
3072
- /**
3073
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3074
- * 对于未实现的方法,接口响应 Unsupport 错误码
3075
- * @param method
3076
- * @param args
3077
- */
3078
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3079
- /**
3080
- * 获取历史消息
3081
- * @param conversationType
3082
- * @param targetId
3083
- * @param timestamp
3084
- * @param count
3085
- * @param order
3086
- */
3087
- getHistoryMessage(conversationType: ConversationType, targetId: string,
3088
- /**
3089
- * 拉取时间戳,值为 `0` 表示从当前时间拉取
3090
- */
3091
- timestamp: number,
3211
+ interface IBlockedMessageInfo {
3212
+ blockedMessageUId: string;
3213
+ conversationType: number;
3214
+ targetId: string;
3215
+ blockType: MessageBlockType;
3216
+ }
3217
+
3218
+ interface IConnectResult {
3092
3219
  /**
3093
- * 获取条数, 有效值 `1` - `20`
3220
+ * 连接错误码
3094
3221
  */
3095
- count: number,
3222
+ code: ErrorCode;
3096
3223
  /**
3097
- * @description
3098
- * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
3099
- * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3224
+ * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3100
3225
  */
3101
- order: 0 | 1,
3226
+ userId?: string;
3227
+ }
3228
+ declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
3229
+ declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
3230
+ declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
3231
+ declare type IChatroomListener = (state: IChatroomListenerData) => void;
3232
+ declare type IRTCInnerListener = {
3233
+ message?: IMessageListnenr;
3234
+ status?: IConnectionStatusListener;
3235
+ };
3236
+ declare type IExpansionListener = (data: IExpansionListenerData) => void;
3237
+ declare type ITagListener = () => void;
3238
+ declare type IConversationTagListener = () => void;
3239
+ declare type ItypingStateListener = (data: ITypingMessage[]) => void;
3240
+ declare type IMessageBlockedListener = (data: IBlockedMessageInfo) => void;
3241
+ interface ISendExMsgOptions {
3242
+ channelId: string;
3243
+ conversationType: ConversationType;
3244
+ targetId: string;
3102
3245
  /**
3103
- * 会话的业务标识
3246
+ * 消息 ID
3104
3247
  */
3105
- channelId: string,
3106
- /**
3107
- * 消息类型
3108
- */
3109
- objectName: string): IPromiseResult<{
3110
- list: IReceivedMessage[];
3111
- hasMore: boolean;
3112
- }>;
3248
+ messageUId: string;
3113
3249
  /**
3114
- * 删除历史消息 通过 messageUId
3250
+ * 原始消息是否支持扩展的字段
3115
3251
  */
3116
- deleteRemoteMessage(conversationType: ConversationType, targetId: string,
3252
+ canIncludeExpansion: boolean;
3117
3253
  /**
3118
- * @description
3119
- * message 中 messageUId、setTime、messageDirection 为必须参数
3254
+ * 删除的 keys
3120
3255
  */
3121
- messages: {
3122
- messageUId: string;
3123
- sentTime: number;
3124
- messageDirection: MessageDirection;
3125
- }[],
3256
+ keys?: string[];
3126
3257
  /**
3127
- * 会话的业务标识
3258
+ * 扩展对象
3128
3259
  */
3129
- channelId: string): Promise<ErrorCode>;
3130
- recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3260
+ expansion?: {
3261
+ [key: string]: string;
3262
+ };
3131
3263
  /**
3132
- * 删除历史消息 通过 时间戳
3133
- * @param timestamp 小于等于传入时间戳的消息均删除
3264
+ * 是否删除所有扩展
3134
3265
  */
3135
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3266
+ removeAll?: boolean;
3136
3267
  /**
3137
- * 会话的业务标识
3268
+ * 原始消息的扩展
3138
3269
  */
3139
- channelId: string): Promise<ErrorCode>;
3270
+ originExpansion?: {
3271
+ [key: string]: string;
3272
+ } | null;
3273
+ }
3274
+ interface IWatcher {
3275
+ message?: IMessageListnenr;
3276
+ connectionState?: IConnectionStatusListener;
3277
+ conversationState?: IConversationStateListener;
3278
+ chatroomState?: IChatroomListener;
3279
+ expansion?: IExpansionListener;
3140
3280
  /**
3141
- * 获取会话列表
3142
- * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3281
+ * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
3143
3282
  */
3144
- getConversationList(
3283
+ rtcInnerWatcher?: IRTCInnerListener;
3145
3284
  /**
3146
- * 拉取数量, 有效值 0 - 1000, 默认 300
3285
+ * 标签的增删改监听
3147
3286
  */
3148
- count: number,
3287
+ tag?: ITagListener;
3149
3288
  /**
3150
- * 会话类型
3151
- * @todo 待确认是否生效
3289
+ * 会话中标签状态变更监听
3152
3290
  */
3153
- conversationType?: ConversationType,
3154
- /**
3155
- * 起始时间
3156
- */
3157
- startTime?: number,
3291
+ conversationTagChanged?: IConversationTagListener;
3158
3292
  /**
3159
- * 获取顺序
3160
- */
3161
- order?: 0 | 1,
3293
+ * 输入状态变更监听
3294
+ */
3295
+ typingState?: ItypingStateListener;
3162
3296
  /**
3163
- * 会话的业务标识
3164
- */
3165
- channelId?: string): IPromiseResult<IReceivedConversation[]>;
3297
+ * 是否拉取完毕添加通知
3298
+ */
3299
+ pullFinished?: ITagListener;
3166
3300
  /**
3167
- * 获取指定会话
3168
- */
3169
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3301
+ * 敏感词被拦截监听
3302
+ */
3303
+ messageBlocked?: IMessageBlockedListener;
3304
+ }
3305
+ interface IPluginGenerator<API, InitOption> {
3170
3306
  /**
3171
- * 删除会话
3172
- * @description 该删除操作会删除服务器端存储的会话数据
3173
- * @param conversationType
3174
- * @param targetId
3307
+ * 只读插件标识
3175
3308
  */
3176
- removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3309
+ readonly tag: string;
3177
3310
  /**
3178
- * 获取所有会话未读数
3179
- * @param channelId 多组织 Id
3180
- * @param conversationTypes
3181
- * @param includeMuted 包含已设置免打扰的会话
3311
+ * 版本号
3182
3312
  */
3183
- getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3313
+ readonly version?: string;
3184
3314
  /**
3185
- * 获取指定会话未读数
3315
+ * 插件名称
3186
3316
  */
3187
- getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3317
+ readonly name?: string;
3188
3318
  /**
3189
- * 清除指定会话未读数
3319
+ * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
3190
3320
  */
3191
- clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3321
+ verify(runtime: IRuntime): boolean;
3192
3322
  /**
3193
- * 获取第一个未读消息
3323
+ * 插件初始化
3324
+ * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
3325
+ * @param runtime 运行时实例,用于标识最终的运行时平台
3326
+ * @param options 初始化参数
3194
3327
  */
3195
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3328
+ setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
3329
+ }
3330
+ interface IAPIContextOption {
3196
3331
  /**
3197
- * 设置/保存指定会话消息草稿
3198
- * @draft 草稿内容
3332
+ * 应用 appkey
3199
3333
  */
3200
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3334
+ appkey: string;
3201
3335
  /**
3202
- * 获取指定会话消息草稿
3336
+ * IMLib 版本号
3203
3337
  */
3204
- getConversationMessageDraft(conversationType: ConversationType, targetId: string): IPromiseResult<string>;
3338
+ apiVersion: string;
3205
3339
  /**
3206
- * 清除指定会话消息草稿
3340
+ * 自定义导航地址:
3341
+ * 1. 私有云环境下该值为必填项
3342
+ * 2. 当存在自定义导航地址时,SDK 内部默认地址将无效
3343
+ * 3. 当存在自定义导航地址时,地址 url 中需包含 http/https 协议头,否则视为无效值
3344
+ * 4. 建立 ws/wss 连接前的 ping 接口使用的协议与导航 url 中的协议相同
3345
+ * 5. 建立 websocket 建立连接时将根据 ping 接口使用的 http/https 协议来确定使用 ws/wss 协议
3346
+ * 6. 动态导航使用的协议头将与自定义导航地址相同
3347
+ * 7. 公有云默认使用 https 协议
3207
3348
  */
3208
- clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3349
+ navigators: string[];
3209
3350
  /**
3210
- * 从服务端拉取会话状态
3211
- */
3212
- pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3351
+ * (参数已废弃)~~c++ 协议栈数据库地址~~
3352
+ * @deprecated
3353
+ */
3354
+ dbPath?: string;
3213
3355
  /**
3214
- * 批量设置会话 置顶、免打扰
3356
+ * 小程序的 CMP 代理地址
3215
3357
  */
3216
- batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3217
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3358
+ miniCMPProxy: string[];
3218
3359
  /**
3219
- * 断开连接
3360
+ * 指定默认使用的连接类型
3220
3361
  */
3221
- disconnect(): void;
3362
+ connectionType: 'websocket' | 'comet';
3222
3363
  /**
3223
- * 拉取用户级配置数据
3364
+ * 修改 engine log 打印等级
3224
3365
  */
3225
- pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3366
+ logLevel?: LogLevel;
3226
3367
  /**
3227
- * 消息注册
3228
- * @description
3229
- * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
3230
- * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
3231
- * @param objectName 消息类型,如:RC:TxtMsg
3232
- * @param isPersited 是否存储
3233
- * @param isCounted 是否技术
3234
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3368
+ * 修改默认的 log 输出函数
3235
3369
  */
3236
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
3237
- /**
3238
- * 加入聊天室
3239
- * @param count 拉取消息数量
3240
- */
3241
- joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3242
- /**
3243
- * 加入已存在的聊天室
3244
- * @param count 拉取消息数量
3245
- */
3246
- joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3370
+ logStdout?: (logLevel: LogLevel, content: string) => void;
3247
3371
  /**
3248
- * 退出聊天室
3249
- */
3250
- quitChatroom(chatroomId: string): Promise<ErrorCode>;
3372
+ * (已废弃)私有云标识
3373
+ * @deprecated
3374
+ */
3375
+ isEnterPrise?: boolean;
3251
3376
  /**
3252
- * 获取聊天室信息
3253
- * @param count 获取人数, 范围 0 - 20
3254
- * @param order 排序方式, 1 正序, 2 倒序
3255
- */
3256
- getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
3377
+ * typing状态过期时间
3378
+ */
3379
+ typingExpireTime?: number;
3257
3380
  /**
3258
- * 获取聊天室历史消息
3259
- */
3260
- getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
3261
- list: IReceivedMessage[];
3262
- hasMore: boolean;
3263
- }>;
3381
+ * 是否打开 IndexDB 存储,默认为 true
3382
+ */
3383
+ indexDBSwitch?: boolean;
3264
3384
  /**
3265
- * 设置聊天室属性
3266
- */
3267
- setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3385
+ * 是否校验证书,默认为 true
3386
+ */
3387
+ checkCA?: boolean;
3388
+ }
3389
+ declare class APIContext {
3390
+ private _runtime;
3391
+ private static _context?;
3392
+ static init(runtime: IRuntime, options: IAPIContextOption): APIContext;
3393
+ static destroy(): void;
3394
+ private _token;
3268
3395
  /**
3269
- * 强制设置聊天室属性
3270
- */
3271
- forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3396
+ * 插件队列,用于逐一派发消息与信令
3397
+ */
3398
+ private _pluginContextQueue;
3272
3399
  /**
3273
- * 删除聊天室属性
3274
- */
3275
- removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3400
+ * 插件实例Map,用于重复初始化时返回实例
3401
+ */
3402
+ private _pluginInstanseMap;
3403
+ private readonly _engine;
3276
3404
  /**
3277
- * 强制删除聊天室属性
3278
- */
3279
- forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3405
+ * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
3406
+ */
3407
+ readonly coreVersion: string;
3408
+ readonly appkey: string;
3409
+ readonly apiVersion: string;
3410
+ private readonly _options;
3411
+ private _versionInfo;
3412
+ private _typingInfo;
3280
3413
  /**
3281
- * 获取聊天室 key 对应 value
3282
- */
3283
- getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
3414
+ * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
3415
+ */
3416
+ private _isInternalConnected;
3417
+ constructor(_runtime: IRuntime, options: IAPIContextOption);
3284
3418
  /**
3285
- * 获取聊天室所有 key value
3286
- */
3287
- getAllChatroomEntry(chatroomId: string): IPromiseResult<{
3288
- [key: string]: string;
3289
- }>;
3419
+ * 安装使用插件,并初始化插件实例
3420
+ * @param plugin
3421
+ * @param options
3422
+ */
3423
+ install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
3424
+ private _connectionStatus;
3425
+ private _canRedirectConnect;
3290
3426
  /**
3291
- * 获取上传认证信息
3292
- * @description
3293
- * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
3294
- */
3295
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
3427
+ * 重定向后,递归调用 connect
3428
+ */
3429
+ private _handleRedirect;
3296
3430
  /**
3297
- * 获取文件上传后下载地址
3298
- */
3299
- getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
3300
- downloadUrl: string;
3301
- }>;
3431
+ * 连接状态变更回调
3432
+ * @param message
3433
+ */
3434
+ private _connectionStatusListener;
3435
+ private _messageReceiver;
3302
3436
  /**
3303
- * 创建标签
3304
- * @param tag 标签
3437
+ * 聊天室相关信息监听
3305
3438
  */
3306
- createTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
3439
+ private _chatroomInfoListener;
3307
3440
  /**
3308
- * 删除标签
3309
- * @param tagId 标签id
3441
+ * 会话监听相关
3310
3442
  */
3311
- removeTag(tagId: string): IPromiseResult<IAsyncRes>;
3443
+ private _conversationInfoListener;
3312
3444
  /**
3313
- * 编辑标签
3314
- * @param tag 标签
3445
+ * 消息扩展监听相关
3315
3446
  */
3316
- updateTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
3447
+ private _expansionInfoListener;
3317
3448
  /**
3318
- * 获取标签列表
3449
+ * 标签增删改监听
3319
3450
  */
3320
- getTagList(): IPromiseResult<Array<ITagInfo>>;
3451
+ private _tagListener;
3321
3452
  /**
3322
- * 添加会话到标签(给多个会话增加标签)
3323
- * @param tagId 标签id
3324
- * @param conversations 要添加的会话列表
3453
+ * 会话标签状态监听
3325
3454
  */
3326
- addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
3455
+ private _conversationTagListener;
3456
+ private _typingStatusListener;
3457
+ private _pullFinishedListener;
3458
+ private _MessageBlockedListener;
3327
3459
  /**
3328
- * 删除标签中的会话(从多个会话中批量删除指定标签)
3329
- * @param tagId 标签id
3330
- * @param conversations 要删除的会话列表
3460
+ * rtc 数据变更通知 pluginContext
3331
3461
  */
3332
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
3462
+ private _rtcDataChange;
3333
3463
  /**
3334
- * 删除会话中的标签(从单一会话中批量删除标签)
3335
- * @param conversationType 会话类型
3336
- * @param targetId 会话id
3337
- * @param tagIds 要删除的标签列表
3464
+ * 业务层事件监听器挂载点
3338
3465
  */
3339
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult<IAsyncRes>;
3466
+ private _watcher;
3340
3467
  /**
3341
- * 获取标签下的会话列表
3342
- * @param tagId 标签id
3468
+ * 添加事件监听
3469
+ * @param options
3343
3470
  */
3344
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
3471
+ assignWatcher(watcher: IWatcher): void;
3345
3472
  /**
3346
- * 获取标签下的未读消息数
3347
- * @param tagId 标签id
3348
- * @param containMuted 是否包含免打扰会话
3473
+ * 向内存中添加 typing 信息
3474
+ * 添加 typing 时不触发通知,只有在轮询时间点校验 _typingChangedList 的长度大于 0 时才通知
3349
3475
  */
3350
- getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
3476
+ private _addTypingInfo;
3477
+ private _typingInternalTimer;
3478
+ private _typingExpireTime;
3479
+ private _typingChangedList;
3351
3480
  /**
3352
- * 设置标签中会话置顶
3353
- * @param conversation 会话
3481
+ * 启动定时移除typing
3354
3482
  */
3355
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult<IAsyncRes>;
3483
+ private _startCheckTypingInfo;
3484
+ getConnectedTime(): number;
3485
+ getServerTime(): number;
3486
+ getDeviceId(): string;
3487
+ getCurrentUserId(): string;
3488
+ getConnectionStatus(): ConnectionStatus;
3356
3489
  /**
3357
- * 获取会话里的标签
3358
- * @param config
3490
+ * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
3491
+ * @param token
3492
+ * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
3359
3493
  */
3360
- getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
3494
+ connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
3361
3495
  /**
3362
- * 发送群组消息已读回执
3363
- * 导航下发已读回执开关为 true 时调用
3496
+ * 拉取实时配置 web 端需更新 voipCall 字段
3364
3497
  */
3365
- sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3498
+ private _pullUserSettings;
3499
+ disconnect(): Promise<void>;
3500
+ reconnect(): Promise<IConnectResult>;
3501
+ private _getTokenWithoutNavi;
3366
3502
  /**
3367
- * 获取群组消息已读列表
3503
+ * 获取当前缓存的导航数据
3368
3504
  */
3369
- getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
3505
+ getInfoFromCache(): INaviInfo | null;
3370
3506
  /**
3371
- * 获取服务器时间
3507
+ * 消息注册
3508
+ * @description 消息注册需在应用初始化完成前进行
3509
+ * @param objectName 消息类型,如:RC:TxtMsg
3510
+ * @param isPersited 是否存储
3511
+ * @param isCounted 是否技术
3512
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3372
3513
  */
3373
- getServerTime(): number;
3514
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
3374
3515
  /**
3375
- * 获取设备ID
3516
+ * 发送消息
3517
+ * @param conversationType
3518
+ * @param targetId
3519
+ * @param objectName
3520
+ * @param content
3521
+ * @param options
3376
3522
  */
3377
- getDeviceId(): string;
3378
- /**
3379
- * 设置用户在线状态监听器
3380
- */
3381
- setUserStatusListener(config: {
3382
- userIds: string[];
3383
- }, listener: Function): void;
3384
- /**
3385
- * 设置当前用户在线状态
3386
- */
3387
- setUserStatus(status: number): Promise<ErrorCode>;
3388
- /**
3389
- * 订阅用户在线状态
3390
- */
3391
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3392
- /**
3393
- * 获取用户状态
3394
- */
3395
- getUserStatus(userId: string): IPromiseResult<{
3396
- status: string;
3397
- }>;
3398
- /**
3399
- * 清空所有会话
3400
- */
3401
- clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
3402
- /**
3403
- * 加入黑名单
3404
- */
3405
- addToBlacklist(userId: string): Promise<ErrorCode>;
3406
- /**
3407
- * 将指定用户移除黑名单
3408
- */
3409
- removeFromBlacklist(userId: string): Promise<ErrorCode>;
3410
- /**
3411
- * 获取黑名单列表
3412
- */
3413
- getBlacklist(): IPromiseResult<string[]>;
3414
- /**
3415
- * 获取指定人员在黑名单中的状态
3416
- */
3417
- getBlacklistStatus(userId: string): IPromiseResult<string>;
3418
- /**
3419
- * 向本地插入一条消息,不发送到服务器
3420
- */
3421
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
3422
- /**
3423
- * 删除本地消息
3424
- */
3425
- deleteMessages(timestamps: number[]): Promise<ErrorCode>;
3426
- /**
3427
- * 通过时间戳删除本地消息
3428
- */
3429
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
3430
- /**
3431
- * 清空会话下历史消息
3432
- */
3433
- clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3434
- /**
3435
- * 获取消息
3436
- */
3437
- getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
3438
- /**
3439
- * 设置消息内容
3440
- */
3441
- setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3442
- /**
3443
- * 设置消息搜索字段
3444
- */
3445
- setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3446
- /**
3447
- * 通过关键字搜索会话
3448
- */
3449
- searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3450
- /**
3451
- * 按内容搜索会话内的消息
3452
- */
3453
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
3454
- messages: IReceivedMessage[];
3455
- count: number;
3456
- }>;
3457
- /**
3458
- * 获取会话下所有未读的 @ 消息
3459
- */
3460
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
3523
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
3461
3524
  /**
3462
- * 设置消息发送状态
3525
+ * 发送扩展消息
3526
+ * @param messageUId 消息 Id
3527
+ * @param keys 需要删除的 key
3528
+ * @param expansion 设置的扩展
3463
3529
  */
3464
- setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3530
+ sendExpansionMessage(options: ISendExMsgOptions): Promise<IAsyncRes<ErrorCode>>;
3465
3531
  /**
3466
- * 设置消息接收状态
3467
- */
3468
- setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3532
+ * 发送群组消息已读回执
3533
+ * 导航下发已读回执开关为 true 时调用
3534
+ * @param targetId 群组会话id
3535
+ * @param messageUIds 消息id
3536
+ */
3537
+ sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3469
3538
  /**
3470
- * 删除时间戳前的未读数
3471
- */
3472
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
3539
+ * 获取群组消息已读列表
3540
+ * @param targetId
3541
+ * @param messageUIds
3542
+ */
3543
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
3473
3544
  /**
3474
- * 获取会话免打扰状态
3475
- */
3476
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
3545
+ * 反初始化,清空所有监听及计时器
3546
+ */
3547
+ private _destroy;
3477
3548
  /**
3478
- * 协议栈获取远端历史消息
3479
- */
3480
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
3549
+ * @param conversationType
3550
+ * @param targetId 会话 Id
3551
+ * @param timestamp 拉取时间戳
3552
+ * @param count 拉取条数
3553
+ * @param order 1 正序拉取,0 为倒序拉取
3554
+ * @param channelId
3555
+ * @param objectName
3556
+ */
3557
+ getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
3481
3558
  list: IReceivedMessage[];
3482
3559
  hasMore: boolean;
3483
- }>;
3560
+ }>>;
3484
3561
  /**
3485
- * 获取群组消息送达列表
3562
+ * 获取会话列表
3563
+ * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3486
3564
  */
3487
- getGroupMessageDeliverList(targetId: string, messageUId: string, channelId: string): IPromiseResult<IGroupMessageDeliverInfo>;
3565
+ getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3488
3566
  /**
3489
- * 获取单聊消息送达详情
3567
+ * 获取单一会话数据
3568
+ * @param conversationType
3569
+ * @param targetId
3570
+ * @param channelId
3490
3571
  */
3491
- getPrivateMessageDeliverTime(messageUId: string, channelId: string): IPromiseResult<IDeliveredUser | null>;
3492
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
3493
- quitRTCRoom(roomId: string): Promise<ErrorCode>;
3494
- rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
3495
- getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
3496
- getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
3497
- getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
3498
- setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
3499
- removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
3500
- setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
3501
- name: string;
3502
- content: string;
3503
- }): Promise<ErrorCode>;
3572
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3504
3573
  /**
3505
- * 全量订阅资源修改
3506
- * @param roomId 房间 Id
3507
- * @param message 向前兼容的消息内容
3508
- * @param valueInfo 全量资源数据
3509
- * @param objectName 全量 URI 消息名
3574
+ * 删除会话
3510
3575
  */
3511
- setRTCTotalRes(roomId: string, message: {
3512
- name: string;
3513
- content: string;
3514
- }, valueInfo: string, objectName: string, mcuValInfo: string): Promise<ErrorCode>;
3515
- getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
3516
- removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
3517
- name: string;
3518
- content: string;
3519
- }): Promise<ErrorCode>;
3520
- setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
3521
- getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
3522
- getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
3523
- setRTCState(roomId: string, reportId: string): Promise<ErrorCode>;
3524
- getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
3525
- setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
3526
- }
3527
-
3528
- interface IExpansionMsgContent {
3529
- /**
3530
- * 消息扩展的对象
3531
- */
3532
- put?: {
3533
- [key: string]: string;
3534
- };
3535
- /**
3536
- * 删除的 keys
3537
- */
3538
- del?: string[];
3539
- /**
3540
- * messageUId
3541
- */
3542
- mid: string;
3576
+ removeConversation(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3543
3577
  /**
3544
- * 是否删除所有, 有效值:0、1 . ( 后续如有需要, API Layer 层可使用)
3545
- */
3546
- removeAll?: number;
3547
- }
3548
-
3549
- interface IConnectResult {
3578
+ * 清除会话消息未读数
3579
+ */
3580
+ clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3550
3581
  /**
3551
- * 连接错误码
3582
+ * 获取指定会话消息未读数
3552
3583
  */
3553
- code: ErrorCode;
3584
+ getUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<number>>;
3554
3585
  /**
3555
- * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3586
+ * 获取所有会话未读数
3587
+ * @param channelId 多组织 Id
3588
+ * @param conversationTypes
3589
+ * @param includeMuted 包含已设置免打扰的会话
3556
3590
  */
3557
- userId?: string;
3558
- }
3559
- declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
3560
- declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
3561
- declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
3562
- declare type IChatroomListener = (state: IChatroomListenerData) => void;
3563
- declare type IRTCInnerListener = {
3564
- message?: IMessageListnenr;
3565
- status?: IConnectionStatusListener;
3566
- };
3567
- declare type IExpansionListener = (data: IExpansionListenerData) => void;
3568
- declare type ITagListener = () => void;
3569
- declare type IConversationTagListener = () => void;
3570
- declare type ItypingStateListener = (data: ITypingMessage[]) => void;
3571
- declare type IMessageDeliveredListener = (data: IMessageDeliver[]) => void;
3572
- interface ISendExMsgOptions {
3573
- channelId: string;
3574
- conversationType: ConversationType;
3575
- targetId: string;
3591
+ getTotalUnreadCount(channelId: string, conversationTypes?: ConversationType[], includeMuted?: boolean): Promise<IAsyncRes<number>>;
3576
3592
  /**
3577
- * 消息 ID
3578
- */
3579
- messageUId: string;
3593
+ * 获取第一个未读消息
3594
+ */
3595
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<IReceivedMessage | null>>;
3596
+ setConversationStatus(conversationType: ConversationType, targetId: string, isTop?: boolean, notificationStatus?: 1 | 2, channelId?: string): Promise<ErrorCode>;
3597
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3598
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<IAsyncRes<string>>;
3599
+ clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3600
+ recallMessage(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3580
3601
  /**
3581
- * 原始消息是否支持扩展的字段
3582
- */
3583
- canIncludeExpansion: boolean;
3602
+ * 删除远端消息
3603
+ * @param conversationType
3604
+ * @param targetId
3605
+ * @param list
3606
+ */
3607
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string, list: {
3608
+ messageUId: string;
3609
+ sentTime: number;
3610
+ messageDirection: MessageDirection;
3611
+ }[], channelId?: string): Promise<ErrorCode>;
3584
3612
  /**
3585
- * 删除的 keys
3586
- */
3587
- keys?: string[];
3613
+ * 根据时间戳删除指定时间之前的
3614
+ * @param conversationType
3615
+ * @param targetId
3616
+ * @param timestamp
3617
+ */
3618
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3588
3619
  /**
3589
- * 扩展对象
3590
- */
3591
- expansion?: {
3592
- [key: string]: string;
3593
- };
3620
+ * 加入聊天室,若聊天室不存在则创建聊天室
3621
+ * @param roomId 聊天室房间 Id
3622
+ * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3623
+ */
3624
+ joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3594
3625
  /**
3595
- * 是否删除所有扩展
3596
- */
3597
- removeAll?: boolean;
3626
+ * 加入聊天室,若聊天室不存在则抛出异常
3627
+ * @param roomId 聊天室房间 Id
3628
+ * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3629
+ */
3630
+ joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3598
3631
  /**
3599
- * 原始消息的扩展
3600
- */
3601
- originExpansion?: {
3602
- [key: string]: string;
3603
- } | null;
3604
- }
3605
- interface IWatcher {
3606
- message?: IMessageListnenr;
3607
- connectionState?: IConnectionStatusListener;
3608
- conversationState?: IConversationStateListener;
3609
- chatroomState?: IChatroomListener;
3610
- expansion?: IExpansionListener;
3632
+ * 退出聊天室
3633
+ * @param roomId
3634
+ */
3635
+ quitChatroom(roomId: string): Promise<ErrorCode>;
3611
3636
  /**
3612
- * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
3637
+ * 获取聊天室房间数据
3638
+ * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
3639
+ * @param roomId 聊天室 Id
3640
+ * @param count 获取房间人员列表数量,最大有效值 `20`,最小值未 `0`,默认为 0
3641
+ * @param order 人员排序方式,`1` 为正序,`2` 为倒序,默认为 0
3613
3642
  */
3614
- rtcInnerWatcher?: IRTCInnerListener;
3643
+ getChatroomInfo(roomId: string, count?: number, order?: 0 | 1 | 2): Promise<IAsyncRes<IChatroomInfo>>;
3615
3644
  /**
3616
- * 标签的增删改监听
3645
+ * 在指定聊天室中设置自定义属性
3646
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3647
+ * @param roomId 聊天室房间 id
3648
+ * @param entry 属性信息
3617
3649
  */
3618
- tag?: ITagListener;
3650
+ setChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3651
+ setChatroomEntries(roomId: string, entryOptions: IChatroomEntries): Promise<{
3652
+ code: ErrorCode;
3653
+ data?: any;
3654
+ }>;
3619
3655
  /**
3620
- * 会话中标签状态变更监听
3656
+ * 在指定聊天室中强制增加 / 修改任意聊天室属性
3657
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3658
+ * @param roomId 聊天室房间 id
3659
+ * @param entry 属性信息
3621
3660
  */
3622
- conversationTagChanged?: IConversationTagListener;
3661
+ forceSetChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3623
3662
  /**
3624
- * 输入状态变更监听
3663
+ * 删除聊天室属性
3664
+ * @description 该方法仅限于删除自己设置的聊天室属性
3665
+ * @param roomId 聊天室房间 id
3666
+ * @param entry 要移除的属性信息
3625
3667
  */
3626
- typingState?: ItypingStateListener;
3668
+ removeChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3627
3669
  /**
3628
- * 是否拉取完毕添加通知
3670
+ * 批量删除聊天室属性
3671
+ * @description 该方法仅限于删除自己设置的聊天室属性
3672
+ * @param roomId 聊天室房间 id
3673
+ * @param entry 要移除的属性信息
3629
3674
  */
3630
- pullFinished?: ITagListener;
3675
+ removeChatroomEntries(roomId: string, entryOptions: IRemoveChatRoomEntriesOption): Promise<{
3676
+ code: ErrorCode;
3677
+ data?: any;
3678
+ }>;
3631
3679
  /**
3632
- * 单聊消息送达通知
3680
+ * 强制删除任意聊天室属性
3681
+ * @description 该方法仅限于删除自己设置的聊天室属性
3682
+ * @param roomId 聊天室房间 id
3683
+ * @param entry 要移除的属性信息
3633
3684
  */
3634
- messageDelivered?: IMessageDeliveredListener;
3635
- }
3636
- interface IPluginGenerator<API, InitOption> {
3685
+ forceRemoveChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3637
3686
  /**
3638
- * 只读插件标识
3687
+ * 获取聊天室中的指定属性
3688
+ * @param roomId 聊天室房间 id
3689
+ * @param key 属性键名
3639
3690
  */
3640
- readonly tag: string;
3691
+ getChatroomEntry(roomId: string, key: string): Promise<IAsyncRes<string | null>>;
3641
3692
  /**
3642
- * 版本号
3693
+ * 获取聊天室内的所有属性
3694
+ * @param roomId 聊天室房间 id
3643
3695
  */
3644
- readonly version?: string;
3696
+ getAllChatroomEntries(roomId: string): Promise<IAsyncRes<{
3697
+ [key: string]: string;
3698
+ }>>;
3645
3699
  /**
3646
- * 插件名称
3700
+ * 拉取聊天室内的历史消息
3701
+ * @param roomId
3702
+ * @param count 拉取消息条数, 有效值范围 `1 - 20`
3703
+ * @param order 获取顺序,默认值为 0。
3704
+ * * 0:降序,用于获取早于指定时间戳发送的消息
3705
+ * * 1:升序,用于获取晚于指定时间戳发送的消息
3706
+ * @param timestamp 指定拉取消息用到的时间戳。默认值为 `0`,表示按当前时间拉取
3647
3707
  */
3648
- readonly name?: string;
3708
+ getChatRoomHistoryMessages(roomId: string, count?: number, order?: 0 | 1, timestamp?: number): Promise<IAsyncRes<{
3709
+ list: IReceivedMessage[];
3710
+ hasMore: boolean;
3711
+ }>>;
3649
3712
  /**
3650
- * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
3713
+ * 获取存储服务鉴权信息
3714
+ * @param fileType 文件类型
3715
+ * @param fileName 文件名称
3716
+ * @param httpMethod STC 分段上传时的必填参数,有效值为 PUT | POST
3717
+ * @param queryString STC 分段上传时的查询字符串
3718
+ * @description
3719
+ * `httpMethod` 与 `queryString` 为 STC S3 分段上传时的专属参数,STC 分段上传包含三个过程:
3720
+ * 1. 开始分段前调用,此时 `httpMethod` 值应为 `POST`, `queryString` 值为 `uploads`
3721
+ * 2. 上传请求前调用,此时 `httpMethod` 值应为 `PUT`,`queryString` 值为 `partNumber={partamNumer}&uploadId={uploadId}`
3722
+ * 3. 上传结束前调用,此时 `httpMethod` 值应为 `POST`,`queryString` 值为 `uploadId={uploadId}`
3723
+ * @returns
3651
3724
  */
3652
- verify(runtime: IRuntime): boolean;
3725
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
3726
+ bos: string;
3727
+ qiniu: string;
3728
+ }>;
3653
3729
  /**
3654
- * 插件初始化
3655
- * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
3656
- * @param runtime 运行时实例,用于标识最终的运行时平台
3657
- * @param options 初始化参数
3730
+ * 获取 七牛、百度、阿里云 上传成功可下载的 URL
3731
+ * @param fileType 文件类型
3732
+ * @param fileName 文件名
3733
+ * @param saveName 下载后的存储文件名
3734
+ * @param uploadRes 插件上传返回的结果。降级百度上传后,用户传入返回结果,再把结果里的下载地址返回给用户,保证兼容之前结果获取
3735
+ * @param serverType 使用的存储服务标识
3736
+ */
3737
+ getFileUrl(fileType: FileType, fileName?: string, saveName?: string, uploadRes?: {
3738
+ isBosRes: boolean;
3739
+ downloadUrl: string;
3740
+ }, serverType?: UploadMethod): Promise<{
3741
+ downloadUrl: string;
3742
+ }>;
3743
+ /**
3744
+ * 创建标签
3745
+ * @param tag 标签
3658
3746
  */
3659
- setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
3660
- }
3661
- interface IAPIContextOption {
3747
+ createTag(tag: ITagParam): Promise<IAsyncRes>;
3662
3748
  /**
3663
- * 应用 appkey
3749
+ * 删除标签
3750
+ * @param tagId 标签id
3664
3751
  */
3665
- appkey: string;
3752
+ removeTag(tagId: string): Promise<IAsyncRes>;
3666
3753
  /**
3667
- * IMLib 版本号
3754
+ * 更新标签
3755
+ * @param tag 标签
3668
3756
  */
3669
- apiVersion: string;
3757
+ updateTag(tag: ITagParam): Promise<IAsyncRes>;
3670
3758
  /**
3671
- * 自定义导航地址:
3672
- * 1. 私有云环境下该值为必填项
3673
- * 2. 当存在自定义导航地址时,SDK 内部默认地址将无效
3674
- * 3. 当存在自定义导航地址时,地址 url 中需包含 http/https 协议头,否则视为无效值
3675
- * 4. 建立 ws/wss 连接前的 ping 接口使用的协议与导航 url 中的协议相同
3676
- * 5. 建立 websocket 建立连接时将根据 ping 接口使用的 http/https 协议来确定使用 ws/wss 协议
3677
- * 6. 动态导航使用的协议头将与自定义导航地址相同
3678
- * 7. 公有云默认使用 https 协议
3759
+ * 获取标签列表
3679
3760
  */
3680
- navigators: string[];
3761
+ getTagList(): Promise<IAsyncRes<Array<ITagInfo>>>;
3681
3762
  /**
3682
- * (参数已废弃)~~c++ 协议栈数据库地址~~
3683
- * @deprecated
3684
- */
3685
- dbPath?: string;
3763
+ * 添加会话到标签(给多个会话增加标签)
3764
+ * @param tagId 标签id
3765
+ * @param conversations 要添加的会话列表
3766
+ */
3767
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3686
3768
  /**
3687
- * 小程序的 CMP 代理地址
3769
+ * 删除标签中的会话(从多个会话中批量删除指定标签)
3770
+ * @param tagId 标签id
3771
+ * @param conversations 要删除的会话列表
3688
3772
  */
3689
- miniCMPProxy: string[];
3773
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3690
3774
  /**
3691
- * 指定默认使用的连接类型
3775
+ * 删除会话中的标签(从单一会话中批量删除标签)
3776
+ * @param conversationType 会话类型
3777
+ * @param targetId 会话id
3778
+ * @param tagIds 要删除的标签列表
3692
3779
  */
3693
- connectionType: 'websocket' | 'comet';
3780
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): Promise<IAsyncRes<IAsyncRes>>;
3694
3781
  /**
3695
- * 修改 engine log 打印等级
3782
+ * 获取标签下的会话列表
3783
+ * @param tagId 标签id
3696
3784
  */
3697
- logLevel?: LogLevel;
3785
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): Promise<IAsyncRes<IReceivedConversationByTag[]>>;
3698
3786
  /**
3699
- * 修改默认的 log 输出函数
3787
+ * 获取标签下的未读消息数
3788
+ * @param tagId 标签id
3789
+ * @param containMuted 是否包含免打扰会话
3700
3790
  */
3701
- logStdout?: (logLevel: LogLevel, content: string) => void;
3791
+ getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<IAsyncRes<number>>;
3702
3792
  /**
3703
- * (已废弃)私有云标识
3704
- * @deprecated
3793
+ * 设置标签中会话置顶
3794
+ * @param conversation 会话
3705
3795
  */
3706
- isEnterPrise?: boolean;
3796
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: {
3797
+ isTop: boolean;
3798
+ }): Promise<IAsyncRes<IAsyncRes>>;
3707
3799
  /**
3708
- * typing状态过期时间
3800
+ * 获取会话里的标签
3801
+ * @param conversation
3709
3802
  */
3710
- typingExpireTime?: number;
3803
+ getTagsForConversation(conversation: IConversationOption): Promise<IAsyncRes<IConversationTag[]>>;
3711
3804
  /**
3712
- * 是否打开 IndexDB 存储,默认为 true
3805
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3806
+ * 对于未实现的方法,接口响应 Unsupport 错误码
3807
+ * @param method 方法名
3808
+ * @param args
3713
3809
  */
3714
- indexDBSwitch?: boolean;
3810
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3811
+ /**
3812
+ * 删除所有会话
3813
+ */
3814
+ clearConversations(conversationTypes?: ConversationType[], tag?: string): Promise<ErrorCode>;
3815
+ /**
3816
+ * 设置用户连接状态监听器
3817
+ */
3818
+ setUserStatusListener(config: {
3819
+ userIds: string[];
3820
+ }, listener: Function): void;
3821
+ /**
3822
+ * 添加用户黑名单
3823
+ */
3824
+ addToBlacklist(userId: string): Promise<ErrorCode>;
3825
+ /**
3826
+ * 将指定用户移除黑名单
3827
+ */
3828
+ removeFromBlacklist(userId: string): Promise<ErrorCode>;
3829
+ /**
3830
+ * 获取黑名单列表
3831
+ */
3832
+ getBlacklist(): Promise<IAsyncRes<string[]>>;
3833
+ /**
3834
+ * 获取指定人员在黑名单中的状态
3835
+ */
3836
+ getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
3837
+ /**
3838
+ * 向本地插入一条消息,不发送到服务器
3839
+ */
3840
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3715
3841
  /**
3716
- * 是否校验证书,默认为 true
3717
- */
3718
- checkCA?: boolean;
3719
- }
3720
- declare class APIContext {
3721
- private _runtime;
3722
- private static _context?;
3723
- static init(runtime: IRuntime, options: IAPIContextOption): APIContext;
3724
- static destroy(): void;
3725
- private _token;
3842
+ * 删除本地消息
3843
+ */
3844
+ deleteMessages(timestamp: number[]): Promise<ErrorCode>;
3726
3845
  /**
3727
- * 插件队列,用于逐一派发消息与信令
3728
- */
3729
- private _pluginContextQueue;
3846
+ * 从本地消息数据库中删除某一会话指定时间之前的消息数据
3847
+ */
3848
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId?: string): Promise<ErrorCode>;
3730
3849
  /**
3731
- * 插件实例Map,用于重复初始化时返回实例
3732
- */
3733
- private _pluginInstanseMap;
3734
- private readonly _engine;
3850
+ * 清空会话下历史消息
3851
+ */
3852
+ clearMessages(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3735
3853
  /**
3736
- * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
3737
- */
3738
- readonly coreVersion: string;
3739
- readonly appkey: string;
3740
- readonly apiVersion: string;
3741
- private readonly _options;
3742
- private _versionInfo;
3743
- private _typingInfo;
3854
+ * 获取本地消息
3855
+ */
3856
+ getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
3744
3857
  /**
3745
- * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
3746
- */
3747
- private _isInternalConnected;
3748
- constructor(_runtime: IRuntime, options: IAPIContextOption);
3858
+ * 设置消息内容
3859
+ */
3860
+ setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3749
3861
  /**
3750
- * 安装使用插件,并初始化插件实例
3751
- * @param plugin
3752
- * @param options
3753
- */
3754
- install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
3755
- private _connectionStatus;
3756
- private _canRedirectConnect;
3862
+ * 设置消息搜索字段
3863
+ */
3864
+ setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3757
3865
  /**
3758
- * 重定向后,递归调用 connect
3759
- */
3760
- private _handleRedirect;
3866
+ * 设置消息发送状态
3867
+ */
3868
+ setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3761
3869
  /**
3762
- * 连接状态变更回调
3763
- * @param message
3764
- */
3765
- private _connectionStatusListener;
3766
- private _messageReceiver;
3870
+ * 设置消息接收状态
3871
+ */
3872
+ setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3767
3873
  /**
3768
- * 聊天室相关信息监听
3874
+ * 设置当前用户在线状态
3769
3875
  */
3770
- private _chatroomInfoListener;
3876
+ setUserStatus(status: number): Promise<ErrorCode>;
3771
3877
  /**
3772
- * 会话监听相关
3878
+ * 订阅用户在线状态
3773
3879
  */
3774
- private _conversationInfoListener;
3880
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3775
3881
  /**
3776
- * 消息扩展监听相关
3882
+ * 获取用户在线状态
3777
3883
  */
3778
- private _expansionInfoListener;
3884
+ getUserStatus(userId: string): Promise<IAsyncRes<{
3885
+ status: string;
3886
+ }>>;
3887
+ searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
3888
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
3889
+ messages: IReceivedMessage[];
3890
+ count: number;
3891
+ }>>;
3892
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
3893
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3779
3894
  /**
3780
- * 标签增删改监听
3895
+ * 获取会话免打扰状态
3896
+ */
3897
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<NotificationStatus>>;
3898
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): Promise<IAsyncRes<{
3899
+ list: IReceivedMessage[];
3900
+ hasMore: boolean;
3901
+ }>>;
3902
+ /**
3903
+ * 加入房间
3904
+ * @param roomId
3905
+ * @param mode 房间模式:直播 or 会议
3906
+ * @param mediaType 直播房间模式下的媒体资源类型
3781
3907
  */
3782
- private _tagListener;
3908
+ joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
3909
+ quitRTCRoom(roomId: string): Promise<ErrorCode>;
3910
+ rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
3911
+ getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
3912
+ getRTCUserInfoList(roomId: string): Promise<IAsyncRes<IRTCUsers>>;
3913
+ getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
3914
+ setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
3915
+ removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
3916
+ setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
3917
+ name: string;
3918
+ content: string;
3919
+ }): Promise<ErrorCode>;
3920
+ setRTCTotalRes(roomId: string, message: {
3921
+ name: string;
3922
+ content: string;
3923
+ }, valueInfo: string, objectName: string, mcuValInfo?: string): Promise<ErrorCode>;
3924
+ setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
3925
+ getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): Promise<IAsyncRes<KVString>>;
3926
+ removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
3927
+ name: string;
3928
+ content: string;
3929
+ }): Promise<ErrorCode>;
3930
+ setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
3931
+ getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
3932
+ getRTCToken(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<IRtcTokenData>>;
3933
+ setRTCState(roomId: string, report: string): Promise<ErrorCode>;
3934
+ getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
3783
3935
  /**
3784
- * 会话标签状态监听
3936
+ * 直播观众加房间
3785
3937
  */
3786
- private _conversationTagListener;
3787
- private _typingStatusListener;
3788
- private _pullFinishedListener;
3789
- private _messageDeliveredListerer;
3938
+ joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
3939
+ token: string;
3940
+ kvEntries: IServerRTCRoomEntry[];
3941
+ }>>;
3790
3942
  /**
3791
- * rtc 数据变更通知 pluginContext
3943
+ * 直播观众退出房间
3792
3944
  */
3793
- private _rtcDataChange;
3945
+ quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
3794
3946
  /**
3795
- * 业务层事件监听器挂载点
3947
+ * 直播身份切换
3796
3948
  */
3797
- private _watcher;
3949
+ rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
3798
3950
  /**
3799
- * 添加事件监听
3800
- * @param options
3951
+ * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
3801
3952
  */
3802
- assignWatcher(watcher: IWatcher): void;
3953
+ getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
3954
+ }
3955
+
3956
+ /**
3957
+ * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3958
+ */
3959
+ interface IEngine {
3803
3960
  /**
3804
- * 向内存中添加 typing 信息
3805
- * 添加 typing 时不触发通知,只有在轮询时间点校验 _typingChangedList 的长度大于 0 时才通知
3961
+ * 建立连接
3962
+ * @param token
3963
+ * @param naviInfo
3806
3964
  */
3807
- private _addTypingInfo;
3808
- private _typingInternalTimer;
3809
- private _typingExpireTime;
3810
- private _typingChangedList;
3965
+ connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
3811
3966
  /**
3812
- * 启动定时移除typing
3967
+ * 上报版本信息
3968
+ * @param version
3969
+ */
3970
+ reportSDKInfo(version: {
3971
+ [name: string]: string;
3972
+ }): void;
3973
+ /**
3974
+ * 连接时间
3813
3975
  */
3814
- private _startCheckTypingInfo;
3815
3976
  getConnectedTime(): number;
3816
- getServerTime(): number;
3817
- getDeviceId(): string;
3818
- getCurrentUserId(): string;
3819
- getConnectionStatus(): ConnectionStatus;
3820
3977
  /**
3821
- * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
3822
- * @param token
3823
- * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
3978
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3979
+ * 对于未实现的方法,接口响应 Unsupport 错误码
3980
+ * @param method
3981
+ * @param args
3824
3982
  */
3825
- connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
3983
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3826
3984
  /**
3827
- * 拉取实时配置 web 端需更新 voipCall 字段
3985
+ * 获取历史消息
3986
+ * @param conversationType
3987
+ * @param targetId
3988
+ * @param timestamp
3989
+ * @param count
3990
+ * @param order
3828
3991
  */
3829
- private _pullUserSettings;
3830
- disconnect(): Promise<void>;
3831
- reconnect(): Promise<IConnectResult>;
3832
- private _getTokenWithoutNavi;
3992
+ getHistoryMessage(conversationType: ConversationType, targetId: string,
3833
3993
  /**
3834
- * 获取当前缓存的导航数据
3994
+ * 拉取时间戳,值为 `0` 表示从当前时间拉取
3835
3995
  */
3836
- getInfoFromCache(): INaviInfo | null;
3996
+ timestamp: number,
3837
3997
  /**
3838
- * 消息注册
3839
- * @description 消息注册需在应用初始化完成前进行
3840
- * @param objectName 消息类型,如:RC:TxtMsg
3841
- * @param isPersited 是否存储
3842
- * @param isCounted 是否技术
3843
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3998
+ * 获取条数, 有效值 `1` - `20`
3844
3999
  */
3845
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
4000
+ count: number,
3846
4001
  /**
3847
- * 发送消息
3848
- * @param conversationType
3849
- * @param targetId
3850
- * @param objectName
3851
- * @param content
3852
- * @param options
4002
+ * @description
4003
+ * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
4004
+ * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3853
4005
  */
3854
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
4006
+ order: 0 | 1,
4007
+ /**
4008
+ * 会话的业务标识
4009
+ */
4010
+ channelId: string,
4011
+ /**
4012
+ * 消息类型
4013
+ */
4014
+ objectName: string): IPromiseResult<{
4015
+ list: IReceivedMessage[];
4016
+ hasMore: boolean;
4017
+ }>;
4018
+ /**
4019
+ * 删除历史消息 通过 messageUId
4020
+ */
4021
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string,
4022
+ /**
4023
+ * @description
4024
+ * message 中 messageUId、setTime、messageDirection 为必须参数
4025
+ */
4026
+ messages: {
4027
+ messageUId: string;
4028
+ sentTime: number;
4029
+ messageDirection: MessageDirection;
4030
+ }[],
4031
+ /**
4032
+ * 会话的业务标识
4033
+ */
4034
+ channelId: string): Promise<ErrorCode>;
4035
+ recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3855
4036
  /**
3856
- * 发送扩展消息
3857
- * @param messageUId 消息 Id
3858
- * @param keys 需要删除的 key
3859
- * @param expansion 设置的扩展
4037
+ * 删除历史消息 通过 时间戳
4038
+ * @param timestamp 小于等于传入时间戳的消息均删除
3860
4039
  */
3861
- sendExpansionMessage(options: ISendExMsgOptions): Promise<IAsyncRes<ErrorCode>>;
4040
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3862
4041
  /**
3863
- * 发送群组消息已读回执
3864
- * 导航下发已读回执开关为 true 时调用
3865
- * @param targetId 群组会话id
3866
- * @param messageUIds 消息id
3867
- */
3868
- sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
4042
+ * 会话的业务标识
4043
+ */
4044
+ channelId: string): Promise<ErrorCode>;
3869
4045
  /**
3870
- * 获取群组消息已读列表
3871
- * @param targetId
3872
- * @param messageUIds
4046
+ * 获取会话列表
4047
+ * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3873
4048
  */
3874
- getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
4049
+ getConversationList(
3875
4050
  /**
3876
- * 反初始化,清空所有监听及计时器
4051
+ * 拉取数量, 有效值 0 - 1000, 默认 300
3877
4052
  */
3878
- private _destroy;
4053
+ count: number,
3879
4054
  /**
3880
- * @param conversationType
3881
- * @param targetId 会话 Id
3882
- * @param timestamp 拉取时间戳
3883
- * @param count 拉取条数
3884
- * @param order 1 正序拉取,0 为倒序拉取
3885
- * @param channelId
3886
- * @param objectName
4055
+ * 会话类型
4056
+ * @todo 待确认是否生效
3887
4057
  */
3888
- getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
3889
- list: IReceivedMessage[];
3890
- hasMore: boolean;
3891
- }>>;
4058
+ conversationType?: ConversationType,
3892
4059
  /**
3893
- * 获取会话列表
3894
- * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3895
- */
3896
- getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
4060
+ * 起始时间
4061
+ */
4062
+ startTime?: number,
3897
4063
  /**
3898
- * 获取单一会话数据
3899
- * @param conversationType
3900
- * @param targetId
3901
- * @param channelId
3902
- */
3903
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
4064
+ * 获取顺序
4065
+ */
4066
+ order?: 0 | 1,
3904
4067
  /**
3905
- * 删除会话
3906
- */
3907
- removeConversation(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4068
+ * 会话的业务标识
4069
+ */
4070
+ channelId?: string): IPromiseResult<IReceivedConversation[]>;
3908
4071
  /**
3909
- * 清除会话消息未读数
3910
- */
3911
- clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4072
+ * 获取指定会话
4073
+ */
4074
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3912
4075
  /**
3913
- * 获取指定会话消息未读数
4076
+ * 删除会话
4077
+ * @description 该删除操作会删除服务器端存储的会话数据
4078
+ * @param conversationType
4079
+ * @param targetId
3914
4080
  */
3915
- getUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<number>>;
4081
+ removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3916
4082
  /**
3917
4083
  * 获取所有会话未读数
3918
4084
  * @param channelId 多组织 Id
3919
4085
  * @param conversationTypes
3920
4086
  * @param includeMuted 包含已设置免打扰的会话
3921
4087
  */
3922
- getTotalUnreadCount(channelId: string, conversationTypes?: ConversationType[], includeMuted?: boolean): Promise<IAsyncRes<number>>;
4088
+ getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3923
4089
  /**
3924
- * 获取第一个未读消息
4090
+ * 获取指定会话未读数
3925
4091
  */
3926
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<IReceivedMessage | null>>;
3927
- setConversationStatus(conversationType: ConversationType, targetId: string, isTop?: boolean, notificationStatus?: 1 | 2, channelId?: string): Promise<ErrorCode>;
3928
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3929
- getConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<IAsyncRes<string>>;
3930
- clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3931
- recallMessage(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
4092
+ getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3932
4093
  /**
3933
- * 删除远端消息
3934
- * @param conversationType
3935
- * @param targetId
3936
- * @param list
4094
+ * 清除指定会话未读数
3937
4095
  */
3938
- deleteRemoteMessage(conversationType: ConversationType, targetId: string, list: {
3939
- messageUId: string;
3940
- sentTime: number;
3941
- messageDirection: MessageDirection;
3942
- }[], channelId?: string): Promise<ErrorCode>;
4096
+ clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3943
4097
  /**
3944
- * 根据时间戳删除指定时间之前的
3945
- * @param conversationType
3946
- * @param targetId
3947
- * @param timestamp
4098
+ * 获取第一个未读消息
3948
4099
  */
3949
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4100
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3950
4101
  /**
3951
- * 加入聊天室,若聊天室不存在则创建聊天室
3952
- * @param roomId 聊天室房间 Id
3953
- * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4102
+ * 设置/保存指定会话消息草稿
4103
+ * @draft 草稿内容
3954
4104
  */
3955
- joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4105
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3956
4106
  /**
3957
- * 加入聊天室,若聊天室不存在则抛出异常
3958
- * @param roomId 聊天室房间 Id
3959
- * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4107
+ * 获取指定会话消息草稿
3960
4108
  */
3961
- joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4109
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string): IPromiseResult<string>;
3962
4110
  /**
3963
- * 退出聊天室
3964
- * @param roomId
4111
+ * 清除指定会话消息草稿
3965
4112
  */
3966
- quitChatroom(roomId: string): Promise<ErrorCode>;
4113
+ clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3967
4114
  /**
3968
- * 获取聊天室房间数据
3969
- * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
3970
- * @param roomId 聊天室 Id
3971
- * @param count 获取房间人员列表数量,最大有效值 `20`,最小值未 `0`,默认为 0
3972
- * @param order 人员排序方式,`1` 为正序,`2` 为倒序,默认为 0
4115
+ * 从服务端拉取会话状态
3973
4116
  */
3974
- getChatroomInfo(roomId: string, count?: number, order?: 0 | 1 | 2): Promise<IAsyncRes<IChatroomInfo>>;
4117
+ pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3975
4118
  /**
3976
- * 在指定聊天室中设置自定义属性
3977
- * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3978
- * @param roomId 聊天室房间 id
3979
- * @param entry 属性信息
4119
+ * 批量设置会话 置顶、免打扰
3980
4120
  */
3981
- setChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
4121
+ batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
4122
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3982
4123
  /**
3983
- * 在指定聊天室中强制增加 / 修改任意聊天室属性
3984
- * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3985
- * @param roomId 聊天室房间 id
3986
- * @param entry 属性信息
4124
+ * 断开连接
3987
4125
  */
3988
- forceSetChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
4126
+ disconnect(): void;
3989
4127
  /**
3990
- * 删除聊天室属性
3991
- * @description 该方法仅限于删除自己设置的聊天室属性
3992
- * @param roomId 聊天室房间 id
3993
- * @param entry 要移除的属性信息
4128
+ * 拉取用户级配置数据
3994
4129
  */
3995
- removeChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
4130
+ pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3996
4131
  /**
3997
- * 强制删除任意聊天室属性
3998
- * @description 该方法仅限于删除自己设置的聊天室属性
3999
- * @param roomId 聊天室房间 id
4000
- * @param entry 要移除的属性信息
4132
+ * 消息注册
4133
+ * @description
4134
+ * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
4135
+ * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
4136
+ * @param objectName 消息类型,如:RC:TxtMsg
4137
+ * @param isPersited 是否存储
4138
+ * @param isCounted 是否技术
4139
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4001
4140
  */
4002
- forceRemoveChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
4141
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
4003
4142
  /**
4004
- * 获取聊天室中的指定属性
4005
- * @param roomId 聊天室房间 id
4006
- * @param key 属性键名
4007
- */
4008
- getChatroomEntry(roomId: string, key: string): Promise<IAsyncRes<string | null>>;
4143
+ * 加入聊天室
4144
+ * @param count 拉取消息数量
4145
+ */
4146
+ joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
4009
4147
  /**
4010
- * 获取聊天室内的所有属性
4011
- * @param roomId 聊天室房间 id
4012
- */
4013
- getAllChatroomEntries(roomId: string): Promise<IAsyncRes<{
4014
- [key: string]: string;
4015
- }>>;
4148
+ * 加入已存在的聊天室
4149
+ * @param count 拉取消息数量
4150
+ */
4151
+ joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
4016
4152
  /**
4017
- * 拉取聊天室内的历史消息
4018
- * @param roomId
4019
- * @param count 拉取消息条数, 有效值范围 `1 - 20`
4020
- * @param order 获取顺序,默认值为 0。
4021
- * * 0:降序,用于获取早于指定时间戳发送的消息
4022
- * * 1:升序,用于获取晚于指定时间戳发送的消息
4023
- * @param timestamp 指定拉取消息用到的时间戳。默认值为 `0`,表示按当前时间拉取
4024
- */
4025
- getChatRoomHistoryMessages(roomId: string, count?: number, order?: 0 | 1, timestamp?: number): Promise<IAsyncRes<{
4153
+ * 退出聊天室
4154
+ */
4155
+ quitChatroom(chatroomId: string): Promise<ErrorCode>;
4156
+ /**
4157
+ * 获取聊天室信息
4158
+ * @param count 获取人数, 范围 0 - 20
4159
+ * @param order 排序方式, 1 正序, 2 倒序
4160
+ */
4161
+ getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
4162
+ /**
4163
+ * 获取聊天室历史消息
4164
+ */
4165
+ getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
4026
4166
  list: IReceivedMessage[];
4027
4167
  hasMore: boolean;
4028
- }>>;
4168
+ }>;
4029
4169
  /**
4030
- * 获取存储服务鉴权信息
4031
- * @param fileType 文件类型
4032
- * @param fileName 文件名称
4033
- * @param httpMethod STC 分段上传时的必填参数,有效值为 PUT | POST
4034
- * @param queryString STC 分段上传时的查询字符串
4035
- * @description
4036
- * `httpMethod` 与 `queryString` 为 STC S3 分段上传时的专属参数,STC 分段上传包含三个过程:
4037
- * 1. 开始分段前调用,此时 `httpMethod` 值应为 `POST`, `queryString` 值为 `uploads`
4038
- * 2. 上传请求前调用,此时 `httpMethod` 值应为 `PUT`,`queryString` 值为 `partNumber={partamNumer}&uploadId={uploadId}`
4039
- * 3. 上传结束前调用,此时 `httpMethod` 值应为 `POST`,`queryString` 值为 `uploadId={uploadId}`
4040
- * @returns
4170
+ * 设置聊天室属性
4171
+ */
4172
+ setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4173
+ /**
4174
+ * 批量设置聊天室属性
4041
4175
  */
4042
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
4043
- bos: string;
4044
- qiniu: string;
4176
+ setChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
4177
+ code: ErrorCode;
4178
+ data?: any;
4179
+ }>;
4180
+ /**
4181
+ * 强制设置聊天室属性
4182
+ */
4183
+ forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4184
+ /**
4185
+ * 删除聊天室属性
4186
+ */
4187
+ removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4188
+ /**
4189
+ * 批量删除聊天室属性
4190
+ */
4191
+ removeChatroomEntries(chatroomId: string, entries: IChrmKVEntries): Promise<{
4192
+ code: ErrorCode;
4193
+ data?: any;
4045
4194
  }>;
4046
4195
  /**
4047
- * 获取 七牛、百度、阿里云 上传成功可下载的 URL
4048
- * @param fileType 文件类型
4049
- * @param fileName 文件名
4050
- * @param saveName 下载后的存储文件名
4051
- * @param uploadRes 插件上传返回的结果。降级百度上传后,用户传入返回结果,再把结果里的下载地址返回给用户,保证兼容之前结果获取
4052
- * @param serverType 使用的存储服务标识
4196
+ * 强制删除聊天室属性
4197
+ */
4198
+ forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4199
+ /**
4200
+ * 获取聊天室 key 对应 value
4201
+ */
4202
+ getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
4203
+ /**
4204
+ * 获取聊天室所有 key value
4205
+ */
4206
+ getAllChatroomEntry(chatroomId: string): IPromiseResult<{
4207
+ [key: string]: string;
4208
+ }>;
4209
+ /**
4210
+ * 获取上传认证信息
4211
+ * @description
4212
+ * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
4213
+ */
4214
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
4215
+ /**
4216
+ * 获取文件上传后下载地址
4053
4217
  */
4054
- getFileUrl(fileType: FileType, fileName?: string, saveName?: string, uploadRes?: {
4055
- isBosRes: boolean;
4056
- downloadUrl: string;
4057
- }, serverType?: UploadMethod): Promise<{
4218
+ getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
4058
4219
  downloadUrl: string;
4059
4220
  }>;
4060
4221
  /**
4061
4222
  * 创建标签
4062
4223
  * @param tag 标签
4063
- */
4064
- createTag(tag: ITagParam): Promise<IAsyncRes>;
4224
+ */
4225
+ createTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
4065
4226
  /**
4066
4227
  * 删除标签
4067
4228
  * @param tagId 标签id
4068
- */
4069
- removeTag(tagId: string): Promise<IAsyncRes>;
4229
+ */
4230
+ removeTag(tagId: string): IPromiseResult<IAsyncRes>;
4070
4231
  /**
4071
- * 更新标签
4232
+ * 编辑标签
4072
4233
  * @param tag 标签
4073
- */
4074
- updateTag(tag: ITagParam): Promise<IAsyncRes>;
4234
+ */
4235
+ updateTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
4075
4236
  /**
4076
4237
  * 获取标签列表
4077
4238
  */
4078
- getTagList(): Promise<IAsyncRes<Array<ITagInfo>>>;
4239
+ getTagList(): IPromiseResult<Array<ITagInfo>>;
4079
4240
  /**
4080
4241
  * 添加会话到标签(给多个会话增加标签)
4081
4242
  * @param tagId 标签id
4082
4243
  * @param conversations 要添加的会话列表
4083
4244
  */
4084
- addTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
4245
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
4085
4246
  /**
4086
4247
  * 删除标签中的会话(从多个会话中批量删除指定标签)
4087
4248
  * @param tagId 标签id
4088
4249
  * @param conversations 要删除的会话列表
4089
4250
  */
4090
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
4251
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
4091
4252
  /**
4092
4253
  * 删除会话中的标签(从单一会话中批量删除标签)
4093
4254
  * @param conversationType 会话类型
4094
4255
  * @param targetId 会话id
4095
4256
  * @param tagIds 要删除的标签列表
4096
4257
  */
4097
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): Promise<IAsyncRes<IAsyncRes>>;
4258
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult<IAsyncRes>;
4098
4259
  /**
4099
4260
  * 获取标签下的会话列表
4100
4261
  * @param tagId 标签id
4101
4262
  */
4102
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): Promise<IAsyncRes<IReceivedConversationByTag[]>>;
4263
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
4103
4264
  /**
4104
4265
  * 获取标签下的未读消息数
4105
4266
  * @param tagId 标签id
4106
4267
  * @param containMuted 是否包含免打扰会话
4107
4268
  */
4108
- getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<IAsyncRes<number>>;
4269
+ getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
4109
4270
  /**
4110
4271
  * 设置标签中会话置顶
4111
4272
  * @param conversation 会话
4112
4273
  */
4113
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: {
4114
- isTop: boolean;
4115
- }): Promise<IAsyncRes<IAsyncRes>>;
4274
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult<IAsyncRes>;
4116
4275
  /**
4117
4276
  * 获取会话里的标签
4118
- * @param conversation
4277
+ * @param config
4119
4278
  */
4120
- getTagsForConversation(conversation: IConversationOption): Promise<IAsyncRes<IConversationTag[]>>;
4279
+ getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
4121
4280
  /**
4122
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4123
- * 对于未实现的方法,接口响应 Unsupport 错误码
4124
- * @param method 方法名
4125
- * @param args
4281
+ * 发送群组消息已读回执
4282
+ * 导航下发已读回执开关为 true 时调用
4126
4283
  */
4127
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
4284
+ sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
4128
4285
  /**
4129
- * 删除所有会话
4130
- */
4131
- clearConversations(conversationTypes?: ConversationType[], tag?: string): Promise<ErrorCode>;
4286
+ * 获取群组消息已读列表
4287
+ */
4288
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
4132
4289
  /**
4133
- * 设置用户连接状态监听器
4290
+ * 获取服务器时间
4291
+ */
4292
+ getServerTime(): number;
4293
+ /**
4294
+ * 获取设备ID
4295
+ */
4296
+ getDeviceId(): string;
4297
+ /**
4298
+ * 获取当前 userId
4299
+ */
4300
+ getCurrentUserId(): string;
4301
+ /**
4302
+ * 设置用户在线状态监听器
4134
4303
  */
4135
4304
  setUserStatusListener(config: {
4136
4305
  userIds: string[];
4137
4306
  }, listener: Function): void;
4138
4307
  /**
4139
- * 添加用户黑名单
4308
+ * 设置当前用户在线状态
4309
+ */
4310
+ setUserStatus(status: number): Promise<ErrorCode>;
4311
+ /**
4312
+ * 订阅用户在线状态
4313
+ */
4314
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4315
+ /**
4316
+ * 获取用户状态
4317
+ */
4318
+ getUserStatus(userId: string): IPromiseResult<{
4319
+ status: string;
4320
+ }>;
4321
+ /**
4322
+ * 清空所有会话
4323
+ */
4324
+ clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
4325
+ /**
4326
+ * 加入黑名单
4140
4327
  */
4141
4328
  addToBlacklist(userId: string): Promise<ErrorCode>;
4142
4329
  /**
4143
- * 将指定用户移除黑名单
4330
+ * 将指定用户移除黑名单
4144
4331
  */
4145
4332
  removeFromBlacklist(userId: string): Promise<ErrorCode>;
4146
4333
  /**
4147
- * 获取黑名单列表
4334
+ * 获取黑名单列表
4148
4335
  */
4149
- getBlacklist(): Promise<IAsyncRes<string[]>>;
4336
+ getBlacklist(): IPromiseResult<string[]>;
4150
4337
  /**
4151
- * 获取指定人员在黑名单中的状态
4338
+ * 获取指定人员在黑名单中的状态
4152
4339
  */
4153
- getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
4340
+ getBlacklistStatus(userId: string): IPromiseResult<string>;
4154
4341
  /**
4155
4342
  * 向本地插入一条消息,不发送到服务器
4156
4343
  */
4157
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
4344
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
4158
4345
  /**
4159
4346
  * 删除本地消息
4160
4347
  */
4161
- deleteMessages(timestamp: number[]): Promise<ErrorCode>;
4348
+ deleteMessages(timestamps: number[]): Promise<ErrorCode>;
4162
4349
  /**
4163
- * 从本地消息数据库中删除某一会话指定时间之前的消息数据
4350
+ * 通过时间戳删除本地消息
4164
4351
  */
4165
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId?: string): Promise<ErrorCode>;
4352
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
4166
4353
  /**
4167
4354
  * 清空会话下历史消息
4168
4355
  */
4169
- clearMessages(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4356
+ clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
4170
4357
  /**
4171
- * 获取本地消息
4358
+ * 获取消息
4172
4359
  */
4173
- getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
4360
+ getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
4174
4361
  /**
4175
4362
  * 设置消息内容
4176
4363
  */
@@ -4180,61 +4367,48 @@ declare class APIContext {
4180
4367
  */
4181
4368
  setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
4182
4369
  /**
4183
- * 设置消息发送状态
4370
+ * 通过关键字搜索会话
4184
4371
  */
4185
- setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
4372
+ searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
4186
4373
  /**
4187
- * 设置消息接收状态
4374
+ * 按内容搜索会话内的消息
4188
4375
  */
4189
- setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
4376
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
4377
+ messages: IReceivedMessage[];
4378
+ count: number;
4379
+ }>;
4190
4380
  /**
4191
- * 设置当前用户在线状态
4381
+ * 获取会话下所有未读的 @ 消息
4192
4382
  */
4193
- setUserStatus(status: number): Promise<ErrorCode>;
4383
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
4194
4384
  /**
4195
- * 订阅用户在线状态
4385
+ * 设置消息发送状态
4196
4386
  */
4197
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4387
+ setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
4198
4388
  /**
4199
- * 获取用户在线状态
4389
+ * 设置消息接收状态
4200
4390
  */
4201
- getUserStatus(userId: string): Promise<IAsyncRes<{
4202
- status: string;
4203
- }>>;
4204
- searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
4205
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
4206
- messages: IReceivedMessage[];
4207
- count: number;
4208
- }>>;
4209
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
4210
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4391
+ setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
4392
+ /**
4393
+ * 删除时间戳前的未读数
4394
+ */
4395
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
4211
4396
  /**
4212
4397
  * 获取会话免打扰状态
4213
4398
  */
4214
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<NotificationStatus>>;
4215
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): Promise<IAsyncRes<{
4399
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
4400
+ /**
4401
+ * 协议栈获取远端历史消息
4402
+ */
4403
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
4216
4404
  list: IReceivedMessage[];
4217
4405
  hasMore: boolean;
4218
- }>>;
4219
- /**
4220
- * 获取群组消息送达信息
4221
- */
4222
- getGroupMessageDeliverList(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IGroupMessageDeliverInfo>;
4223
- /**
4224
- * 获取单聊消息送达信息
4225
- */
4226
- getPrivateMessageDeliverTime(messageUId: string, channelId?: string): IPromiseResult<IDeliveredUser | null>;
4227
- /**
4228
- * 加入房间
4229
- * @param roomId
4230
- * @param mode 房间模式:直播 or 会议
4231
- * @param mediaType 直播房间模式下的媒体资源类型
4232
- */
4233
- joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
4406
+ }>;
4407
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4234
4408
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4235
- rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
4236
- getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
4237
- getRTCUserInfoList(roomId: string): Promise<IAsyncRes<IRTCUsers>>;
4409
+ rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4410
+ getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
4411
+ getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
4238
4412
  getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
4239
4413
  setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
4240
4414
  removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
@@ -4242,43 +4416,49 @@ declare class APIContext {
4242
4416
  name: string;
4243
4417
  content: string;
4244
4418
  }): Promise<ErrorCode>;
4419
+ /**
4420
+ * 全量订阅资源修改
4421
+ * @param roomId 房间 Id
4422
+ * @param message 向前兼容的消息内容
4423
+ * @param valueInfo 全量资源数据
4424
+ * @param objectName 全量 URI 消息名
4425
+ */
4245
4426
  setRTCTotalRes(roomId: string, message: {
4246
4427
  name: string;
4247
4428
  content: string;
4248
- }, valueInfo: string, objectName: string, mcuValInfo?: string): Promise<ErrorCode>;
4249
- setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4250
- getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): Promise<IAsyncRes<KVString>>;
4429
+ }, valueInfo: string, objectName: string, mcuValInfo: string): Promise<ErrorCode>;
4430
+ getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
4251
4431
  removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
4252
4432
  name: string;
4253
4433
  content: string;
4254
4434
  }): Promise<ErrorCode>;
4255
4435
  setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
4256
4436
  getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
4257
- getRTCToken(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<IRtcTokenData>>;
4258
- setRTCState(roomId: string, report: string): Promise<ErrorCode>;
4437
+ getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
4438
+ setRTCState(roomId: string, reportId: string): Promise<ErrorCode>;
4259
4439
  getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
4440
+ setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4441
+ }
4442
+
4443
+ interface IExpansionMsgContent {
4260
4444
  /**
4261
- * 直播观众加房间
4262
- */
4263
- joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
4264
- token: string;
4265
- }>>;
4266
- /**
4267
- * 直播观众退出房间
4268
- */
4269
- quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
4445
+ * 消息扩展的对象
4446
+ */
4447
+ put?: {
4448
+ [key: string]: string;
4449
+ };
4270
4450
  /**
4271
- * 直播身份切换
4272
- */
4273
- rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
4451
+ * 删除的 keys
4452
+ */
4453
+ del?: string[];
4274
4454
  /**
4275
- * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
4276
- */
4277
- getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
4455
+ * messageUId
4456
+ */
4457
+ mid: string;
4278
4458
  /**
4279
- * 拉取 RTC 全量 KV
4280
- */
4281
- pullRTCRoomEntry(roomId: string, timestamp: number): Promise<IAsyncRes<IChrmKVPullData>>;
4459
+ * 是否删除所有, 有效值:0、1 . ( 后续如有需要, API Layer 层可使用)
4460
+ */
4461
+ removeAll?: number;
4282
4462
  }
4283
4463
 
4284
4464
  declare class RTCPluginContext extends PluginContext {
@@ -4364,6 +4544,7 @@ declare class RTCPluginContext extends PluginContext {
4364
4544
  */
4365
4545
  joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<{
4366
4546
  token: string;
4547
+ kvEntries: IServerRTCRoomEntry[];
4367
4548
  }>;
4368
4549
  /**
4369
4550
  * 直播观众退出房间
@@ -4373,10 +4554,6 @@ declare class RTCPluginContext extends PluginContext {
4373
4554
  * 直播身份切换
4374
4555
  */
4375
4556
  rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4376
- /**
4377
- * 拉取 RTC 全量 KV
4378
- */
4379
- pullRTCRoomEntry(roomId: string, timestamp: number): IPromiseResult<IChrmKVPullData>;
4380
4557
  }
4381
4558
 
4382
4559
  declare abstract class ANavi {
@@ -4425,7 +4602,6 @@ interface IEngineWatcher {
4425
4602
  */
4426
4603
  onRTCDataChange: (data: IServerRTCRoomEntry[], roomId?: string) => void;
4427
4604
  pullFinished: () => void;
4428
- messageDelivered: (data: IMessageDeliver[]) => void;
4429
4605
  }
4430
4606
  /**
4431
4607
  * 引擎定义
@@ -4677,6 +4853,13 @@ declare abstract class AEngine implements IEngine {
4677
4853
  * 设置聊天室属性
4678
4854
  */
4679
4855
  abstract setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4856
+ /**
4857
+ * 批量设置聊天室属性
4858
+ */
4859
+ abstract setChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
4860
+ code: ErrorCode;
4861
+ data?: any;
4862
+ }>;
4680
4863
  /**
4681
4864
  * 强制设置聊天室属性
4682
4865
  */
@@ -4685,6 +4868,13 @@ declare abstract class AEngine implements IEngine {
4685
4868
  * 删除聊天室属性
4686
4869
  */
4687
4870
  abstract removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4871
+ /**
4872
+ * 批量删除聊天室属性
4873
+ */
4874
+ abstract removeChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
4875
+ code: ErrorCode;
4876
+ data?: any;
4877
+ }>;
4688
4878
  /**
4689
4879
  * 强制删除聊天室属性
4690
4880
  */
@@ -4791,6 +4981,10 @@ declare abstract class AEngine implements IEngine {
4791
4981
  * 获取设备ID
4792
4982
  */
4793
4983
  abstract getDeviceId(): string;
4984
+ /**
4985
+ * 获取当前 userId
4986
+ */
4987
+ abstract getCurrentUserId(): string;
4794
4988
  /**
4795
4989
  * 设置用户在线状态监听器
4796
4990
  */
@@ -4897,14 +5091,6 @@ declare abstract class AEngine implements IEngine {
4897
5091
  list: IReceivedMessage[];
4898
5092
  hasMore: boolean;
4899
5093
  }>;
4900
- /**
4901
- * 获取群组消息送达列表
4902
- */
4903
- abstract getGroupMessageDeliverList(targetId: string, messageUId: string, channelId: string): IPromiseResult<IGroupMessageDeliverInfo>;
4904
- /**
4905
- * 获取单聊消息送达列表
4906
- */
4907
- abstract getPrivateMessageDeliverTime(messageUId: string, channelId: string): IPromiseResult<IDeliveredUser | null>;
4908
5094
  abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
4909
5095
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
4910
5096
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
@@ -4940,12 +5126,12 @@ declare abstract class AEngine implements IEngine {
4940
5126
  abstract getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
4941
5127
  abstract joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
4942
5128
  token: string;
5129
+ kvEntries: IServerRTCRoomEntry[];
4943
5130
  }>>;
4944
5131
  abstract quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
4945
5132
  abstract rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
4946
5133
  abstract getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
4947
5134
  abstract setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4948
- abstract pullRTCRoomEntry(roomId: string, timestamp: number): Promise<IAsyncRes<IChrmKVPullData>>;
4949
5135
  }
4950
5136
 
4951
5137
  declare class AppStorage {
@@ -5107,6 +5293,19 @@ declare class EventEmitter {
5107
5293
  clear(): void;
5108
5294
  }
5109
5295
 
5296
+ declare class VersionManage {
5297
+ static add(name: string, version: string): void;
5298
+ /**
5299
+ * 校验当前 engine 版本是否大于等于所需版本,只校验前三位数字
5300
+ * @param version
5301
+ * @returns
5302
+ */
5303
+ static validEngine(version: string): boolean;
5304
+ static getInfo(): {
5305
+ [key: string]: string;
5306
+ };
5307
+ }
5308
+
5110
5309
  /**
5111
5310
  * 检查参数是否为字符串
5112
5311
  * 只做类型检查,不做长度检查,故当字符串长度为 0,结果依然为 true
@@ -5396,4 +5595,4 @@ declare enum CONNECTION_TYPE {
5396
5595
  */
5397
5596
  declare const version: string;
5398
5597
 
5399
- export { AEngine, ANavi, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAsyncRes, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IDeliveredUser, IEngine, IEngineWatcher, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGroupMessageDeliverInfo, IInsertMsgOptions, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_COMET_PULLMSG_TIMEOUT, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageDeliver, IMessageDeliveredListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntryOption, IRequest, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NotificationStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, TagChangeType, UploadMethod, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, cloneByJSON, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };
5598
+ export { AEngine, ANavi, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType as ChatroomMemberChangeType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAsyncRes, IBlockedMessageInfo, IChatroomEntries, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IEngine, IEngineWatcher, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IInsertMsgOptions, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_COMET_PULLMSG_TIMEOUT, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageBlockedListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntriesOption, IRemoveChatRoomEntryOption, IRequest, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NotificationStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, TagChangeType, UploadMethod, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, cloneByJSON, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };