@rongcloud/engine 4.5.0-alpha.4 → 4.5.3

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.4
3
- * CommitId - aed25bcb04db37260a1cc8910f8992d194ae850c
4
- * Tue Nov 30 2021 16:31:39 GMT+0800 (China Standard Time)
2
+ * RCEngine - v4.5.3
3
+ * CommitId - 53f04162f2b6042fd1f3d893800fcb85ecf4ff9e
4
+ * Thu Dec 09 2021 18:05:37 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)中会带入此值. 根据此值判断是删除还是更新
@@ -510,12 +558,17 @@ interface IUserProfile {
510
558
  name?: string;
511
559
  /**
512
560
  * 用户头像地址
561
+ * @deprecated
513
562
  */
514
563
  portraitUri?: string;
515
564
  /**
516
565
  * user info 中附加信息
517
566
  */
518
567
  extra?: string;
568
+ /**
569
+ * 用户头像地址(向移动端兼容)
570
+ */
571
+ portrait?: string;
519
572
  }
520
573
  /**
521
574
  * 发送消息时的可选项信息
@@ -862,6 +915,18 @@ declare enum ErrorCode {
862
915
  * Disconnect,由服务器返回,比如用户互踢。
863
916
  */
864
917
  RC_DISCONN_EXCEPTION = 31011,
918
+ /**
919
+ * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
920
+ */
921
+ RC_APP_AUTH_NOT_PASS = 31026,
922
+ /**
923
+ * One Time Password 已经被使用过
924
+ */
925
+ RC_OTP_USED = 31027,
926
+ /**
927
+ * token平台验证失败
928
+ */
929
+ RC_PLATFORM_ERROR = 31028,
865
930
  /**
866
931
  * 协议层内部错误。query,上传下载过程中数据错误。
867
932
  */
@@ -1117,7 +1182,15 @@ declare enum ErrorCode {
1117
1182
  /**
1118
1183
  * VoIP 不可用
1119
1184
  */
1120
- VOIP_NOT_AVALIABLE = 18
1185
+ VOIP_NOT_AVALIABLE = 18,
1186
+ /**
1187
+ * 聊天室批量设置kv部分不成功
1188
+ */
1189
+ CHATROOM_KV_STORE_NOT_ALL_SUCCESS = 23428,
1190
+ /**
1191
+ * 聊天室设置批量kv,一次不能超过10个
1192
+ */
1193
+ CHATROOM_KV_STORE_OUT_LIMIT = 23429
1121
1194
  }
1122
1195
 
1123
1196
  /**
@@ -1372,6 +1445,7 @@ declare class DataCodec {
1372
1445
  * 聊天室 KV 存储
1373
1446
  */
1374
1447
  encodeModifyChatRoomKV(chrmId: string, entry: IChrmKVEntry, currentUserId: string): any;
1448
+ encodeModifyChatRoomKVS(chrmId: string, entryOptions: IChrmKVEntries, currentUserId: string): any;
1375
1449
  /**
1376
1450
  * KV 存储拉取
1377
1451
  */
@@ -1615,7 +1689,7 @@ declare abstract class ADataChannel {
1615
1689
  * @param protocol 请求导航数据时使用的网络协议, /ping 与 websocket 需要继续遵循该协议
1616
1690
  * @param apiVersion - apiVersion 需符合 `/\d+(\.\d+){2}/` 规则,对于预发布版本号如 `3.1.0-alpha.1` 需认定为 `3.1.0`
1617
1691
  */
1618
- abstract connect(appkey: string, token: string, host: string[], protocol: 'http' | 'https', apiVersion: string): Promise<ErrorCode>;
1692
+ abstract connect(appkey: string, token: string, host: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
1619
1693
  /**
1620
1694
  * 只发送数据,无需响应
1621
1695
  */
@@ -1782,7 +1856,11 @@ declare class WebSocketChannel extends ADataChannel {
1782
1856
  * @param protocol
1783
1857
  * @param apiVersion - apiVersion 需符合 `/\d+(\.\d+){2}/` 规则
1784
1858
  */
1785
- connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string): Promise<ErrorCode>;
1859
+ connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
1860
+ /**
1861
+ * 发起连接请求
1862
+ */
1863
+ private _connect;
1786
1864
  /**
1787
1865
  * 当前累计心跳超时次数
1788
1866
  */
@@ -1826,7 +1904,13 @@ declare class CometChannel extends ADataChannel {
1826
1904
  * 长轮询心跳
1827
1905
  */
1828
1906
  _startPullSignal(protocol: 'http' | 'https'): Promise<void>;
1829
- connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string): Promise<ErrorCode>;
1907
+ /**
1908
+ * 连接
1909
+ * comet 连接暂时不走 protocolVer=v4 的协议
1910
+ * @returns
1911
+ */
1912
+ connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
1913
+ private _connect;
1830
1914
  private _idCount;
1831
1915
  private _generateMessageId;
1832
1916
  sendCometData(writer: BaseWriter, timeout?: number): Promise<void>;
@@ -2232,6 +2316,7 @@ interface IJoinRTCRoomData extends IRTCUsers {
2232
2316
  key: string;
2233
2317
  value: string;
2234
2318
  }[];
2319
+ kvEntries: IServerRTCRoomEntry[];
2235
2320
  }
2236
2321
 
2237
2322
  /**
@@ -2353,6 +2438,22 @@ interface IChatroomEntry {
2353
2438
  isAutoDelete?: boolean;
2354
2439
  }
2355
2440
 
2441
+ interface IChatroomEntries {
2442
+ /**
2443
+ * entries ,要设置的属性列表
2444
+ * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2445
+ * value 属性对应的值, 最大长度 4096 字符
2446
+ */
2447
+ entries: {
2448
+ key: string;
2449
+ value: string;
2450
+ }[];
2451
+ /**
2452
+ * 用户退出聊天室时是否清除此属性
2453
+ */
2454
+ isAutoDelete?: boolean;
2455
+ }
2456
+
2356
2457
  interface IRemoveChatRoomEntryOption {
2357
2458
  /**
2358
2459
  * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
@@ -2368,6 +2469,23 @@ interface IRemoveChatRoomEntryOption {
2368
2469
  notificationExtra?: string;
2369
2470
  }
2370
2471
 
2472
+ interface IRemoveChatRoomEntriesOption {
2473
+ /**
2474
+ * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2475
+ */
2476
+ entries: {
2477
+ key: string;
2478
+ }[];
2479
+ }
2480
+
2481
+ /**
2482
+ * 聊天室成员进入和退出状态
2483
+ */
2484
+ declare enum ChatroomUserChangeType {
2485
+ QUIT = 0,
2486
+ JOIN = 1
2487
+ }
2488
+
2371
2489
  interface IChatroomEntryListenerData {
2372
2490
  /**
2373
2491
  * 更新的键
@@ -2410,6 +2528,12 @@ interface IChatroomRejoinedSuccessed {
2410
2528
  */
2411
2529
  count: number;
2412
2530
  }
2531
+ interface IChatroomUserChangeInfo {
2532
+ users: {
2533
+ [userId: string]: ChatroomUserChangeType;
2534
+ };
2535
+ chatroomId: string;
2536
+ }
2413
2537
  declare type IChatroomRejoinedInfo = IChatroomRejoinedFailed | IChatroomRejoinedSuccessed;
2414
2538
  /**
2415
2539
  * 聊天室信息
@@ -2423,6 +2547,11 @@ interface IChatroomListenerData {
2423
2547
  * 监听到的聊天室 KV 更新
2424
2548
  */
2425
2549
  updatedEntries?: IChatroomEntryListenerData[];
2550
+ userChange?: IChatroomUserChangeInfo;
2551
+ /**
2552
+ * 聊天室销毁
2553
+ */
2554
+ chatroomDestroyed?: string;
2426
2555
  }
2427
2556
 
2428
2557
  interface IUpdatedConversation {
@@ -2637,6 +2766,22 @@ declare const ConnectResultCode: {
2637
2766
  * 开启`禁止把已在线客户端踢下线`开关后,该错误码标识已有同类型端在线,禁止链接
2638
2767
  */
2639
2768
  HASOHTERSAMECLIENTONLINE: number;
2769
+ /**
2770
+ * 客户端连错环境,引发连接拒绝
2771
+ */
2772
+ IN_OTHER_CLUSTER: number;
2773
+ /**
2774
+ * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
2775
+ */
2776
+ APP_AUTH_NOT_PASS: number;
2777
+ /**
2778
+ * One Time Password 已经被使用过
2779
+ */
2780
+ OTP_USED: number;
2781
+ /**
2782
+ * token平台验证失败
2783
+ */
2784
+ PLATFORM_ERROR: number;
2640
2785
  };
2641
2786
 
2642
2787
  /**
@@ -2724,9 +2869,25 @@ declare enum MessageType {
2724
2869
  */
2725
2870
  GROUP_READ_RECEIPT_REQUEST = "RC:RRMsg",
2726
2871
  /**
2727
- * 消息送达报告,仅单聊
2872
+ * 用户加入聊天室
2873
+ */
2874
+ CHATROOM_JOIN = "RC:ChrmJoinNtf",
2875
+ /**
2876
+ * 用户退出聊天室
2877
+ */
2878
+ CHATROOM_LEFT = "RC:ChrmQuitNtf",
2879
+ /**
2880
+ * 用户加入退出聊天室的集合
2881
+ */
2882
+ CHATROOM_MERGE_CHANGE = "RC:ChrmMemChange",
2883
+ /**
2884
+ * 输入状态消息
2885
+ */
2886
+ TYPING_STATUS = "RC:TypSts",
2887
+ /**
2888
+ * 拦截消息,(当发送的消息的敏感词时,服务会下发一个拦截消息,内容包含被拦截消息信息)
2728
2889
  */
2729
- DELIVERED = "RC:Delivered"
2890
+ INTERCEPT = "RC:InterceptMsg"
2730
2891
  }
2731
2892
 
2732
2893
  /**
@@ -2990,6 +3151,10 @@ interface INaviInfo {
2990
3151
  * 群组回执开关, 1: 打开,0(或者没有): 关闭
2991
3152
  */
2992
3153
  grpRRVer?: number;
3154
+ /**
3155
+ * 防黑产开关, 1: 打开,0:关闭
3156
+ */
3157
+ openAnti?: number;
2993
3158
  }
2994
3159
 
2995
3160
  /**
@@ -3033,1147 +3198,1176 @@ interface ITypingMessage {
3033
3198
  }
3034
3199
 
3035
3200
  /**
3036
- * 消息送达相关接口
3201
+ * 消息被拦截类型
3037
3202
  */
3038
-
3039
- interface IDeliveredUser {
3040
- time: number;
3041
- userId: string;
3042
- }
3043
- interface IGroupMessageDeliverInfo {
3044
- totalCount: number;
3045
- list: IDeliveredUser[];
3046
- }
3047
- interface IMessageDeliver {
3048
- deliverTime: number;
3049
- messageUId: string;
3050
- conversationType: ConversationType;
3051
- targetId: string;
3203
+ declare enum MessageBlockType {
3204
+ /*!
3205
+ 全局敏感词:命中了融云内置的全局敏感词
3206
+ */
3207
+ GLOBAL = 1,
3208
+ /*!
3209
+ 自定义敏感词拦截:命中了客户在融云自定义的敏感词
3210
+ */
3211
+ CUSTOM = 2,
3212
+ /*!
3213
+ 第三方审核拦截:命中了第三方(数美)或模板路由决定不下发的状态
3214
+ */
3215
+ THIRD_PARTY = 3
3052
3216
  }
3053
3217
 
3054
3218
  /**
3055
- * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3219
+ * 被拦截的消息信息
3056
3220
  */
3057
- interface IEngine {
3058
- /**
3059
- * 建立连接
3060
- * @param token
3061
- * @param naviInfo
3062
- */
3063
- connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
3064
- /**
3065
- * 上报版本信息
3066
- * @param version
3067
- */
3068
- reportSDKInfo(version: {
3069
- [name: string]: string;
3070
- }): void;
3071
- /**
3072
- * 连接时间
3073
- */
3074
- getConnectedTime(): number;
3075
- /**
3076
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3077
- * 对于未实现的方法,接口响应 Unsupport 错误码
3078
- * @param method
3079
- * @param args
3080
- */
3081
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3082
- /**
3083
- * 获取历史消息
3084
- * @param conversationType
3085
- * @param targetId
3086
- * @param timestamp
3087
- * @param count
3088
- * @param order
3089
- */
3090
- getHistoryMessage(conversationType: ConversationType, targetId: string,
3091
- /**
3092
- * 拉取时间戳,值为 `0` 表示从当前时间拉取
3093
- */
3094
- timestamp: number,
3221
+ interface IBlockedMessageInfo {
3222
+ blockedMessageUId: string;
3223
+ conversationType: number;
3224
+ targetId: string;
3225
+ blockType: MessageBlockType;
3226
+ }
3227
+
3228
+ interface IConnectResult {
3095
3229
  /**
3096
- * 获取条数, 有效值 `1` - `20`
3230
+ * 连接错误码
3097
3231
  */
3098
- count: number,
3232
+ code: ErrorCode;
3099
3233
  /**
3100
- * @description
3101
- * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
3102
- * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3234
+ * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3103
3235
  */
3104
- order: 0 | 1,
3236
+ userId?: string;
3237
+ }
3238
+ declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
3239
+ declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
3240
+ declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
3241
+ declare type IChatroomListener = (state: IChatroomListenerData) => void;
3242
+ declare type IRTCInnerListener = {
3243
+ message?: IMessageListnenr;
3244
+ status?: IConnectionStatusListener;
3245
+ };
3246
+ declare type IExpansionListener = (data: IExpansionListenerData) => void;
3247
+ declare type ITagListener = () => void;
3248
+ declare type IConversationTagListener = () => void;
3249
+ declare type ItypingStateListener = (data: ITypingMessage[]) => void;
3250
+ declare type IMessageBlockedListener = (data: IBlockedMessageInfo) => void;
3251
+ interface ISendExMsgOptions {
3252
+ channelId: string;
3253
+ conversationType: ConversationType;
3254
+ targetId: string;
3105
3255
  /**
3106
- * 会话的业务标识
3256
+ * 消息 ID
3107
3257
  */
3108
- channelId: string,
3109
- /**
3110
- * 消息类型
3111
- */
3112
- objectName: string): IPromiseResult<{
3113
- list: IReceivedMessage[];
3114
- hasMore: boolean;
3115
- }>;
3258
+ messageUId: string;
3116
3259
  /**
3117
- * 删除历史消息 通过 messageUId
3260
+ * 原始消息是否支持扩展的字段
3118
3261
  */
3119
- deleteRemoteMessage(conversationType: ConversationType, targetId: string,
3262
+ canIncludeExpansion: boolean;
3120
3263
  /**
3121
- * @description
3122
- * message 中 messageUId、setTime、messageDirection 为必须参数
3264
+ * 删除的 keys
3123
3265
  */
3124
- messages: {
3125
- messageUId: string;
3126
- sentTime: number;
3127
- messageDirection: MessageDirection;
3128
- }[],
3266
+ keys?: string[];
3129
3267
  /**
3130
- * 会话的业务标识
3268
+ * 扩展对象
3131
3269
  */
3132
- channelId: string): Promise<ErrorCode>;
3133
- recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3270
+ expansion?: {
3271
+ [key: string]: string;
3272
+ };
3134
3273
  /**
3135
- * 删除历史消息 通过 时间戳
3136
- * @param timestamp 小于等于传入时间戳的消息均删除
3274
+ * 是否删除所有扩展
3137
3275
  */
3138
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3276
+ removeAll?: boolean;
3139
3277
  /**
3140
- * 会话的业务标识
3278
+ * 原始消息的扩展
3141
3279
  */
3142
- channelId: string): Promise<ErrorCode>;
3280
+ originExpansion?: {
3281
+ [key: string]: string;
3282
+ } | null;
3283
+ }
3284
+ interface IWatcher {
3285
+ message?: IMessageListnenr;
3286
+ connectionState?: IConnectionStatusListener;
3287
+ conversationState?: IConversationStateListener;
3288
+ chatroomState?: IChatroomListener;
3289
+ expansion?: IExpansionListener;
3143
3290
  /**
3144
- * 获取会话列表
3145
- * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3291
+ * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
3146
3292
  */
3147
- getConversationList(
3293
+ rtcInnerWatcher?: IRTCInnerListener;
3148
3294
  /**
3149
- * 拉取数量, 有效值 0 - 1000, 默认 300
3295
+ * 标签的增删改监听
3150
3296
  */
3151
- count: number,
3297
+ tag?: ITagListener;
3152
3298
  /**
3153
- * 会话类型
3154
- * @todo 待确认是否生效
3299
+ * 会话中标签状态变更监听
3155
3300
  */
3156
- conversationType?: ConversationType,
3301
+ conversationTagChanged?: IConversationTagListener;
3157
3302
  /**
3158
- * 起始时间
3159
- */
3160
- startTime?: number,
3303
+ * 输入状态变更监听
3304
+ */
3305
+ typingState?: ItypingStateListener;
3161
3306
  /**
3162
- * 获取顺序
3163
- */
3164
- order?: 0 | 1,
3307
+ * 是否拉取完毕添加通知
3308
+ */
3309
+ pullFinished?: ITagListener;
3165
3310
  /**
3166
- * 会话的业务标识
3167
- */
3168
- channelId?: string): IPromiseResult<IReceivedConversation[]>;
3169
- /**
3170
- * 获取指定会话
3171
- */
3172
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3173
- /**
3174
- * 删除会话
3175
- * @description 该删除操作会删除服务器端存储的会话数据
3176
- * @param conversationType
3177
- * @param targetId
3311
+ * 敏感词被拦截监听
3178
3312
  */
3179
- removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3313
+ messageBlocked?: IMessageBlockedListener;
3314
+ }
3315
+ interface IPluginGenerator<API, InitOption> {
3180
3316
  /**
3181
- * 获取所有会话未读数
3182
- * @param channelId 多组织 Id
3183
- * @param conversationTypes
3184
- * @param includeMuted 包含已设置免打扰的会话
3317
+ * 只读插件标识
3185
3318
  */
3186
- getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3319
+ readonly tag: string;
3187
3320
  /**
3188
- * 获取指定会话未读数
3321
+ * 版本号
3189
3322
  */
3190
- getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3323
+ readonly version?: string;
3191
3324
  /**
3192
- * 清除指定会话未读数
3325
+ * 插件名称
3193
3326
  */
3194
- clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3327
+ readonly name?: string;
3195
3328
  /**
3196
- * 获取第一个未读消息
3329
+ * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
3197
3330
  */
3198
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3331
+ verify(runtime: IRuntime): boolean;
3199
3332
  /**
3200
- * 设置/保存指定会话消息草稿
3201
- * @draft 草稿内容
3333
+ * 插件初始化
3334
+ * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
3335
+ * @param runtime 运行时实例,用于标识最终的运行时平台
3336
+ * @param options 初始化参数
3202
3337
  */
3203
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3338
+ setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
3339
+ }
3340
+ interface IAPIContextOption {
3204
3341
  /**
3205
- * 获取指定会话消息草稿
3342
+ * 应用 appkey
3206
3343
  */
3207
- getConversationMessageDraft(conversationType: ConversationType, targetId: string): IPromiseResult<string>;
3344
+ appkey: string;
3208
3345
  /**
3209
- * 清除指定会话消息草稿
3346
+ * IMLib 版本号
3210
3347
  */
3211
- clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3348
+ apiVersion: string;
3212
3349
  /**
3213
- * 从服务端拉取会话状态
3350
+ * 自定义导航地址:
3351
+ * 1. 私有云环境下该值为必填项
3352
+ * 2. 当存在自定义导航地址时,SDK 内部默认地址将无效
3353
+ * 3. 当存在自定义导航地址时,地址 url 中需包含 http/https 协议头,否则视为无效值
3354
+ * 4. 建立 ws/wss 连接前的 ping 接口使用的协议与导航 url 中的协议相同
3355
+ * 5. 建立 websocket 建立连接时将根据 ping 接口使用的 http/https 协议来确定使用 ws/wss 协议
3356
+ * 6. 动态导航使用的协议头将与自定义导航地址相同
3357
+ * 7. 公有云默认使用 https 协议
3214
3358
  */
3215
- pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3359
+ navigators: string[];
3216
3360
  /**
3217
- * 批量设置会话 置顶、免打扰
3218
- */
3219
- batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3220
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3361
+ * (参数已废弃)~~c++ 协议栈数据库地址~~
3362
+ * @deprecated
3363
+ */
3364
+ dbPath?: string;
3221
3365
  /**
3222
- * 断开连接
3366
+ * 小程序的 CMP 代理地址
3223
3367
  */
3224
- disconnect(): void;
3368
+ miniCMPProxy: string[];
3225
3369
  /**
3226
- * 拉取用户级配置数据
3370
+ * 指定默认使用的连接类型
3227
3371
  */
3228
- pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3372
+ connectionType: 'websocket' | 'comet';
3229
3373
  /**
3230
- * 消息注册
3231
- * @description
3232
- * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
3233
- * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
3234
- * @param objectName 消息类型,如:RC:TxtMsg
3235
- * @param isPersited 是否存储
3236
- * @param isCounted 是否技术
3237
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3374
+ * 修改 engine log 打印等级
3238
3375
  */
3239
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
3240
- /**
3241
- * 加入聊天室
3242
- * @param count 拉取消息数量
3243
- */
3244
- joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3376
+ logLevel?: LogLevel;
3245
3377
  /**
3246
- * 加入已存在的聊天室
3247
- * @param count 拉取消息数量
3248
- */
3249
- joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3378
+ * 修改默认的 log 输出函数
3379
+ */
3380
+ logStdout?: (logLevel: LogLevel, content: string) => void;
3250
3381
  /**
3251
- * 退出聊天室
3252
- */
3253
- quitChatroom(chatroomId: string): Promise<ErrorCode>;
3382
+ * (已废弃)私有云标识
3383
+ * @deprecated
3384
+ */
3385
+ isEnterPrise?: boolean;
3254
3386
  /**
3255
- * 获取聊天室信息
3256
- * @param count 获取人数, 范围 0 - 20
3257
- * @param order 排序方式, 1 正序, 2 倒序
3258
- */
3259
- getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
3387
+ * typing状态过期时间
3388
+ */
3389
+ typingExpireTime?: number;
3260
3390
  /**
3261
- * 获取聊天室历史消息
3262
- */
3263
- getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
3264
- list: IReceivedMessage[];
3265
- hasMore: boolean;
3266
- }>;
3391
+ * 是否打开 IndexDB 存储,默认为 true
3392
+ */
3393
+ indexDBSwitch?: boolean;
3267
3394
  /**
3268
- * 设置聊天室属性
3269
- */
3270
- setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3395
+ * 是否校验证书,默认为 true
3396
+ */
3397
+ checkCA?: boolean;
3398
+ }
3399
+ declare class APIContext {
3400
+ private _runtime;
3401
+ private static _context?;
3402
+ static init(runtime: IRuntime, options: IAPIContextOption): APIContext;
3403
+ static destroy(): void;
3404
+ private _token;
3271
3405
  /**
3272
- * 强制设置聊天室属性
3273
- */
3274
- forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3406
+ * 插件队列,用于逐一派发消息与信令
3407
+ */
3408
+ private _pluginContextQueue;
3275
3409
  /**
3276
- * 删除聊天室属性
3277
- */
3278
- removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3410
+ * 插件实例Map,用于重复初始化时返回实例
3411
+ */
3412
+ private _pluginInstanseMap;
3413
+ private readonly _engine;
3279
3414
  /**
3280
- * 强制删除聊天室属性
3281
- */
3282
- forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3415
+ * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
3416
+ */
3417
+ readonly coreVersion: string;
3418
+ readonly appkey: string;
3419
+ readonly apiVersion: string;
3420
+ private readonly _options;
3421
+ private _versionInfo;
3422
+ private _typingInfo;
3283
3423
  /**
3284
- * 获取聊天室 key 对应 value
3285
- */
3286
- getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
3424
+ * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
3425
+ */
3426
+ private _isInternalConnected;
3427
+ constructor(_runtime: IRuntime, options: IAPIContextOption);
3287
3428
  /**
3288
- * 获取聊天室所有 key value
3289
- */
3290
- getAllChatroomEntry(chatroomId: string): IPromiseResult<{
3291
- [key: string]: string;
3292
- }>;
3429
+ * 安装使用插件,并初始化插件实例
3430
+ * @param plugin
3431
+ * @param options
3432
+ */
3433
+ install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
3434
+ private _connectionStatus;
3435
+ private _canRedirectConnect;
3293
3436
  /**
3294
- * 获取上传认证信息
3295
- * @description
3296
- * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
3297
- */
3298
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
3437
+ * 重定向后,递归调用 connect
3438
+ */
3439
+ private _handleRedirect;
3299
3440
  /**
3300
- * 获取文件上传后下载地址
3301
- */
3302
- getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
3303
- downloadUrl: string;
3304
- }>;
3441
+ * 连接状态变更回调
3442
+ * @param message
3443
+ */
3444
+ private _connectionStatusListener;
3445
+ private _messageReceiver;
3305
3446
  /**
3306
- * 创建标签
3307
- * @param tag 标签
3447
+ * 聊天室相关信息监听
3308
3448
  */
3309
- createTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
3449
+ private _chatroomInfoListener;
3310
3450
  /**
3311
- * 删除标签
3312
- * @param tagId 标签id
3451
+ * 会话监听相关
3313
3452
  */
3314
- removeTag(tagId: string): IPromiseResult<IAsyncRes>;
3453
+ private _conversationInfoListener;
3315
3454
  /**
3316
- * 编辑标签
3317
- * @param tag 标签
3455
+ * 消息扩展监听相关
3318
3456
  */
3319
- updateTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
3457
+ private _expansionInfoListener;
3320
3458
  /**
3321
- * 获取标签列表
3459
+ * 标签增删改监听
3322
3460
  */
3323
- getTagList(): IPromiseResult<Array<ITagInfo>>;
3461
+ private _tagListener;
3324
3462
  /**
3325
- * 添加会话到标签(给多个会话增加标签)
3326
- * @param tagId 标签id
3327
- * @param conversations 要添加的会话列表
3463
+ * 会话标签状态监听
3328
3464
  */
3329
- addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
3465
+ private _conversationTagListener;
3466
+ private _typingStatusListener;
3467
+ private _pullFinishedListener;
3468
+ private _MessageBlockedListener;
3330
3469
  /**
3331
- * 删除标签中的会话(从多个会话中批量删除指定标签)
3332
- * @param tagId 标签id
3333
- * @param conversations 要删除的会话列表
3470
+ * rtc 数据变更通知 pluginContext
3334
3471
  */
3335
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
3472
+ private _rtcDataChange;
3336
3473
  /**
3337
- * 删除会话中的标签(从单一会话中批量删除标签)
3338
- * @param conversationType 会话类型
3339
- * @param targetId 会话id
3340
- * @param tagIds 要删除的标签列表
3474
+ * 业务层事件监听器挂载点
3341
3475
  */
3342
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult<IAsyncRes>;
3476
+ private _watcher;
3343
3477
  /**
3344
- * 获取标签下的会话列表
3345
- * @param tagId 标签id
3478
+ * 添加事件监听
3479
+ * @param options
3346
3480
  */
3347
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
3481
+ assignWatcher(watcher: IWatcher): void;
3348
3482
  /**
3349
- * 获取标签下的未读消息数
3350
- * @param tagId 标签id
3351
- * @param containMuted 是否包含免打扰会话
3483
+ * 向内存中添加 typing 信息
3484
+ * 添加 typing 时不触发通知,只有在轮询时间点校验 _typingChangedList 的长度大于 0 时才通知
3352
3485
  */
3353
- getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
3486
+ private _addTypingInfo;
3487
+ private _typingInternalTimer;
3488
+ private _typingExpireTime;
3489
+ private _typingChangedList;
3354
3490
  /**
3355
- * 设置标签中会话置顶
3356
- * @param conversation 会话
3491
+ * 启动定时移除typing
3357
3492
  */
3358
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult<IAsyncRes>;
3493
+ private _startCheckTypingInfo;
3494
+ getConnectedTime(): number;
3495
+ getServerTime(): number;
3496
+ getDeviceId(): string;
3497
+ getCurrentUserId(): string;
3498
+ getConnectionStatus(): ConnectionStatus;
3359
3499
  /**
3360
- * 获取会话里的标签
3361
- * @param config
3500
+ * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
3501
+ * @param token
3502
+ * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
3362
3503
  */
3363
- getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
3504
+ connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
3364
3505
  /**
3365
- * 发送群组消息已读回执
3366
- * 导航下发已读回执开关为 true 时调用
3506
+ * 拉取实时配置 web 端需更新 voipCall 字段
3367
3507
  */
3368
- sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3508
+ private _pullUserSettings;
3509
+ disconnect(): Promise<void>;
3510
+ reconnect(): Promise<IConnectResult>;
3511
+ private _getTokenWithoutNavi;
3369
3512
  /**
3370
- * 获取群组消息已读列表
3513
+ * 获取当前缓存的导航数据
3371
3514
  */
3372
- getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
3515
+ getInfoFromCache(): INaviInfo | null;
3373
3516
  /**
3374
- * 获取服务器时间
3517
+ * 消息注册
3518
+ * @description 消息注册需在应用初始化完成前进行
3519
+ * @param objectName 消息类型,如:RC:TxtMsg
3520
+ * @param isPersited 是否存储
3521
+ * @param isCounted 是否技术
3522
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3375
3523
  */
3376
- getServerTime(): number;
3524
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
3377
3525
  /**
3378
- * 获取设备ID
3526
+ * 发送消息
3527
+ * @param conversationType
3528
+ * @param targetId
3529
+ * @param objectName
3530
+ * @param content
3531
+ * @param options
3379
3532
  */
3380
- getDeviceId(): string;
3381
- /**
3382
- * 设置用户在线状态监听器
3383
- */
3384
- setUserStatusListener(config: {
3385
- userIds: string[];
3386
- }, listener: Function): void;
3387
- /**
3388
- * 设置当前用户在线状态
3389
- */
3390
- setUserStatus(status: number): Promise<ErrorCode>;
3391
- /**
3392
- * 订阅用户在线状态
3393
- */
3394
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3395
- /**
3396
- * 获取用户状态
3397
- */
3398
- getUserStatus(userId: string): IPromiseResult<{
3399
- status: string;
3400
- }>;
3401
- /**
3402
- * 清空所有会话
3403
- */
3404
- clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
3405
- /**
3406
- * 加入黑名单
3407
- */
3408
- addToBlacklist(userId: string): Promise<ErrorCode>;
3409
- /**
3410
- * 将指定用户移除黑名单
3411
- */
3412
- removeFromBlacklist(userId: string): Promise<ErrorCode>;
3413
- /**
3414
- * 获取黑名单列表
3415
- */
3416
- getBlacklist(): IPromiseResult<string[]>;
3417
- /**
3418
- * 获取指定人员在黑名单中的状态
3419
- */
3420
- getBlacklistStatus(userId: string): IPromiseResult<string>;
3421
- /**
3422
- * 向本地插入一条消息,不发送到服务器
3423
- */
3424
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
3425
- /**
3426
- * 删除本地消息
3427
- */
3428
- deleteMessages(timestamps: number[]): Promise<ErrorCode>;
3429
- /**
3430
- * 通过时间戳删除本地消息
3431
- */
3432
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
3433
- /**
3434
- * 清空会话下历史消息
3435
- */
3436
- clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3437
- /**
3438
- * 获取消息
3439
- */
3440
- getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
3441
- /**
3442
- * 设置消息内容
3443
- */
3444
- setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3445
- /**
3446
- * 设置消息搜索字段
3447
- */
3448
- setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3449
- /**
3450
- * 通过关键字搜索会话
3451
- */
3452
- searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3453
- /**
3454
- * 按内容搜索会话内的消息
3455
- */
3456
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
3457
- messages: IReceivedMessage[];
3458
- count: number;
3459
- }>;
3460
- /**
3461
- * 获取会话下所有未读的 @ 消息
3462
- */
3463
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
3533
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
3464
3534
  /**
3465
- * 设置消息发送状态
3535
+ * 发送扩展消息
3536
+ * @param messageUId 消息 Id
3537
+ * @param keys 需要删除的 key
3538
+ * @param expansion 设置的扩展
3466
3539
  */
3467
- setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3540
+ sendExpansionMessage(options: ISendExMsgOptions): Promise<IAsyncRes<ErrorCode>>;
3468
3541
  /**
3469
- * 设置消息接收状态
3470
- */
3471
- setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3542
+ * 发送群组消息已读回执
3543
+ * 导航下发已读回执开关为 true 时调用
3544
+ * @param targetId 群组会话id
3545
+ * @param messageUIds 消息id
3546
+ */
3547
+ sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3472
3548
  /**
3473
- * 删除时间戳前的未读数
3474
- */
3475
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
3549
+ * 获取群组消息已读列表
3550
+ * @param targetId
3551
+ * @param messageUIds
3552
+ */
3553
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
3476
3554
  /**
3477
- * 获取会话免打扰状态
3478
- */
3479
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
3555
+ * 反初始化,清空所有监听及计时器
3556
+ */
3557
+ private _destroy;
3480
3558
  /**
3481
- * 协议栈获取远端历史消息
3482
- */
3483
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
3559
+ * @param conversationType
3560
+ * @param targetId 会话 Id
3561
+ * @param timestamp 拉取时间戳
3562
+ * @param count 拉取条数
3563
+ * @param order 1 正序拉取,0 为倒序拉取
3564
+ * @param channelId
3565
+ * @param objectName
3566
+ */
3567
+ getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
3484
3568
  list: IReceivedMessage[];
3485
3569
  hasMore: boolean;
3486
- }>;
3570
+ }>>;
3487
3571
  /**
3488
- * 获取群组消息送达列表
3572
+ * 获取会话列表
3573
+ * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3489
3574
  */
3490
- getGroupMessageDeliverList(targetId: string, messageUId: string, channelId: string): IPromiseResult<IGroupMessageDeliverInfo>;
3575
+ getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3491
3576
  /**
3492
- * 获取单聊消息送达详情
3577
+ * 获取单一会话数据
3578
+ * @param conversationType
3579
+ * @param targetId
3580
+ * @param channelId
3493
3581
  */
3494
- getPrivateMessageDeliverTime(messageUId: string, channelId: string): IPromiseResult<number>;
3495
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
3496
- quitRTCRoom(roomId: string): Promise<ErrorCode>;
3497
- rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
3498
- getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
3499
- getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
3500
- getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
3501
- setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
3502
- removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
3503
- setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
3504
- name: string;
3505
- content: string;
3506
- }): Promise<ErrorCode>;
3582
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3507
3583
  /**
3508
- * 全量订阅资源修改
3509
- * @param roomId 房间 Id
3510
- * @param message 向前兼容的消息内容
3511
- * @param valueInfo 全量资源数据
3512
- * @param objectName 全量 URI 消息名
3584
+ * 删除会话
3513
3585
  */
3514
- setRTCTotalRes(roomId: string, message: {
3515
- name: string;
3516
- content: string;
3517
- }, valueInfo: string, objectName: string, mcuValInfo: string): Promise<ErrorCode>;
3518
- getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
3519
- removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
3520
- name: string;
3521
- content: string;
3522
- }): Promise<ErrorCode>;
3523
- setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
3524
- getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
3525
- getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
3526
- setRTCState(roomId: string, reportId: string): Promise<ErrorCode>;
3527
- getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
3528
- setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
3529
- }
3530
-
3531
- interface IExpansionMsgContent {
3532
- /**
3533
- * 消息扩展的对象
3534
- */
3535
- put?: {
3536
- [key: string]: string;
3537
- };
3538
- /**
3539
- * 删除的 keys
3540
- */
3541
- del?: string[];
3542
- /**
3543
- * messageUId
3544
- */
3545
- mid: string;
3586
+ removeConversation(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3546
3587
  /**
3547
- * 是否删除所有, 有效值:0、1 . ( 后续如有需要, API Layer 层可使用)
3548
- */
3549
- removeAll?: number;
3550
- }
3551
-
3552
- interface IConnectResult {
3588
+ * 清除会话消息未读数
3589
+ */
3590
+ clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3553
3591
  /**
3554
- * 连接错误码
3592
+ * 获取指定会话消息未读数
3555
3593
  */
3556
- code: ErrorCode;
3594
+ getUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<number>>;
3557
3595
  /**
3558
- * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3596
+ * 获取所有会话未读数
3597
+ * @param channelId 多组织 Id
3598
+ * @param conversationTypes
3599
+ * @param includeMuted 包含已设置免打扰的会话
3559
3600
  */
3560
- userId?: string;
3561
- }
3562
- declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
3563
- declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
3564
- declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
3565
- declare type IChatroomListener = (state: IChatroomListenerData) => void;
3566
- declare type IRTCInnerListener = {
3567
- message?: IMessageListnenr;
3568
- status?: IConnectionStatusListener;
3569
- };
3570
- declare type IExpansionListener = (data: IExpansionListenerData) => void;
3571
- declare type ITagListener = () => void;
3572
- declare type IConversationTagListener = () => void;
3573
- declare type ItypingStateListener = (data: ITypingMessage[]) => void;
3574
- declare type IMessageDeliveredListener = (data: IMessageDeliver[]) => void;
3575
- interface ISendExMsgOptions {
3576
- channelId: string;
3577
- conversationType: ConversationType;
3578
- targetId: string;
3601
+ getTotalUnreadCount(channelId: string, conversationTypes?: ConversationType[], includeMuted?: boolean): Promise<IAsyncRes<number>>;
3579
3602
  /**
3580
- * 消息 ID
3581
- */
3582
- messageUId: string;
3603
+ * 获取第一个未读消息
3604
+ */
3605
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<IReceivedMessage | null>>;
3606
+ setConversationStatus(conversationType: ConversationType, targetId: string, isTop?: boolean, notificationStatus?: 1 | 2, channelId?: string): Promise<ErrorCode>;
3607
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3608
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<IAsyncRes<string>>;
3609
+ clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3610
+ recallMessage(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3583
3611
  /**
3584
- * 原始消息是否支持扩展的字段
3585
- */
3586
- canIncludeExpansion: boolean;
3612
+ * 删除远端消息
3613
+ * @param conversationType
3614
+ * @param targetId
3615
+ * @param list
3616
+ */
3617
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string, list: {
3618
+ messageUId: string;
3619
+ sentTime: number;
3620
+ messageDirection: MessageDirection;
3621
+ }[], channelId?: string): Promise<ErrorCode>;
3587
3622
  /**
3588
- * 删除的 keys
3589
- */
3590
- keys?: string[];
3623
+ * 根据时间戳删除指定时间之前的
3624
+ * @param conversationType
3625
+ * @param targetId
3626
+ * @param timestamp
3627
+ */
3628
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3591
3629
  /**
3592
- * 扩展对象
3593
- */
3594
- expansion?: {
3595
- [key: string]: string;
3596
- };
3630
+ * 加入聊天室,若聊天室不存在则创建聊天室
3631
+ * @param roomId 聊天室房间 Id
3632
+ * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3633
+ */
3634
+ joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3597
3635
  /**
3598
- * 是否删除所有扩展
3599
- */
3600
- removeAll?: boolean;
3636
+ * 加入聊天室,若聊天室不存在则抛出异常
3637
+ * @param roomId 聊天室房间 Id
3638
+ * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3639
+ */
3640
+ joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3601
3641
  /**
3602
- * 原始消息的扩展
3603
- */
3604
- originExpansion?: {
3605
- [key: string]: string;
3606
- } | null;
3607
- }
3608
- interface IWatcher {
3609
- message?: IMessageListnenr;
3610
- connectionState?: IConnectionStatusListener;
3611
- conversationState?: IConversationStateListener;
3612
- chatroomState?: IChatroomListener;
3613
- expansion?: IExpansionListener;
3642
+ * 退出聊天室
3643
+ * @param roomId
3644
+ */
3645
+ quitChatroom(roomId: string): Promise<ErrorCode>;
3614
3646
  /**
3615
- * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
3647
+ * 获取聊天室房间数据
3648
+ * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
3649
+ * @param roomId 聊天室 Id
3650
+ * @param count 获取房间人员列表数量,最大有效值 `20`,最小值未 `0`,默认为 0
3651
+ * @param order 人员排序方式,`1` 为正序,`2` 为倒序,默认为 0
3616
3652
  */
3617
- rtcInnerWatcher?: IRTCInnerListener;
3653
+ getChatroomInfo(roomId: string, count?: number, order?: 0 | 1 | 2): Promise<IAsyncRes<IChatroomInfo>>;
3618
3654
  /**
3619
- * 标签的增删改监听
3655
+ * 在指定聊天室中设置自定义属性
3656
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3657
+ * @param roomId 聊天室房间 id
3658
+ * @param entry 属性信息
3620
3659
  */
3621
- tag?: ITagListener;
3660
+ setChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3661
+ setChatroomEntries(roomId: string, entryOptions: IChatroomEntries): Promise<{
3662
+ code: ErrorCode;
3663
+ data?: any;
3664
+ }>;
3622
3665
  /**
3623
- * 会话中标签状态变更监听
3666
+ * 在指定聊天室中强制增加 / 修改任意聊天室属性
3667
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3668
+ * @param roomId 聊天室房间 id
3669
+ * @param entry 属性信息
3624
3670
  */
3625
- conversationTagChanged?: IConversationTagListener;
3671
+ forceSetChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3626
3672
  /**
3627
- * 输入状态变更监听
3673
+ * 删除聊天室属性
3674
+ * @description 该方法仅限于删除自己设置的聊天室属性
3675
+ * @param roomId 聊天室房间 id
3676
+ * @param entry 要移除的属性信息
3628
3677
  */
3629
- typingState?: ItypingStateListener;
3678
+ removeChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3630
3679
  /**
3631
- * 是否拉取完毕添加通知
3680
+ * 批量删除聊天室属性
3681
+ * @description 该方法仅限于删除自己设置的聊天室属性
3682
+ * @param roomId 聊天室房间 id
3683
+ * @param entry 要移除的属性信息
3632
3684
  */
3633
- pullFinished?: ITagListener;
3685
+ removeChatroomEntries(roomId: string, entryOptions: IRemoveChatRoomEntriesOption): Promise<{
3686
+ code: ErrorCode;
3687
+ data?: any;
3688
+ }>;
3634
3689
  /**
3635
- * 单聊消息送达通知
3690
+ * 强制删除任意聊天室属性
3691
+ * @description 该方法仅限于删除自己设置的聊天室属性
3692
+ * @param roomId 聊天室房间 id
3693
+ * @param entry 要移除的属性信息
3636
3694
  */
3637
- messageDelivered?: IMessageDeliveredListener;
3638
- }
3639
- interface IPluginGenerator<API, InitOption> {
3695
+ forceRemoveChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3640
3696
  /**
3641
- * 只读插件标识
3697
+ * 获取聊天室中的指定属性
3698
+ * @param roomId 聊天室房间 id
3699
+ * @param key 属性键名
3642
3700
  */
3643
- readonly tag: string;
3701
+ getChatroomEntry(roomId: string, key: string): Promise<IAsyncRes<string | null>>;
3644
3702
  /**
3645
- * 版本号
3703
+ * 获取聊天室内的所有属性
3704
+ * @param roomId 聊天室房间 id
3646
3705
  */
3647
- readonly version?: string;
3706
+ getAllChatroomEntries(roomId: string): Promise<IAsyncRes<{
3707
+ [key: string]: string;
3708
+ }>>;
3648
3709
  /**
3649
- * 插件名称
3710
+ * 拉取聊天室内的历史消息
3711
+ * @param roomId
3712
+ * @param count 拉取消息条数, 有效值范围 `1 - 20`
3713
+ * @param order 获取顺序,默认值为 0。
3714
+ * * 0:降序,用于获取早于指定时间戳发送的消息
3715
+ * * 1:升序,用于获取晚于指定时间戳发送的消息
3716
+ * @param timestamp 指定拉取消息用到的时间戳。默认值为 `0`,表示按当前时间拉取
3650
3717
  */
3651
- readonly name?: string;
3718
+ getChatRoomHistoryMessages(roomId: string, count?: number, order?: 0 | 1, timestamp?: number): Promise<IAsyncRes<{
3719
+ list: IReceivedMessage[];
3720
+ hasMore: boolean;
3721
+ }>>;
3652
3722
  /**
3653
- * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
3723
+ * 获取存储服务鉴权信息
3724
+ * @param fileType 文件类型
3725
+ * @param fileName 文件名称
3726
+ * @param httpMethod STC 分段上传时的必填参数,有效值为 PUT | POST
3727
+ * @param queryString STC 分段上传时的查询字符串
3728
+ * @description
3729
+ * `httpMethod` 与 `queryString` 为 STC S3 分段上传时的专属参数,STC 分段上传包含三个过程:
3730
+ * 1. 开始分段前调用,此时 `httpMethod` 值应为 `POST`, `queryString` 值为 `uploads`
3731
+ * 2. 上传请求前调用,此时 `httpMethod` 值应为 `PUT`,`queryString` 值为 `partNumber={partamNumer}&uploadId={uploadId}`
3732
+ * 3. 上传结束前调用,此时 `httpMethod` 值应为 `POST`,`queryString` 值为 `uploadId={uploadId}`
3733
+ * @returns
3654
3734
  */
3655
- verify(runtime: IRuntime): boolean;
3735
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
3736
+ bos: string;
3737
+ qiniu: string;
3738
+ }>;
3656
3739
  /**
3657
- * 插件初始化
3658
- * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
3659
- * @param runtime 运行时实例,用于标识最终的运行时平台
3660
- * @param options 初始化参数
3740
+ * 获取 七牛、百度、阿里云 上传成功可下载的 URL
3741
+ * @param fileType 文件类型
3742
+ * @param fileName 文件名
3743
+ * @param saveName 下载后的存储文件名
3744
+ * @param uploadRes 插件上传返回的结果。降级百度上传后,用户传入返回结果,再把结果里的下载地址返回给用户,保证兼容之前结果获取
3745
+ * @param serverType 使用的存储服务标识
3746
+ */
3747
+ getFileUrl(fileType: FileType, fileName?: string, saveName?: string, uploadRes?: {
3748
+ isBosRes: boolean;
3749
+ downloadUrl: string;
3750
+ }, serverType?: UploadMethod): Promise<{
3751
+ downloadUrl: string;
3752
+ }>;
3753
+ /**
3754
+ * 创建标签
3755
+ * @param tag 标签
3661
3756
  */
3662
- setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
3663
- }
3664
- interface IAPIContextOption {
3757
+ createTag(tag: ITagParam): Promise<IAsyncRes>;
3665
3758
  /**
3666
- * 应用 appkey
3759
+ * 删除标签
3760
+ * @param tagId 标签id
3667
3761
  */
3668
- appkey: string;
3762
+ removeTag(tagId: string): Promise<IAsyncRes>;
3669
3763
  /**
3670
- * IMLib 版本号
3764
+ * 更新标签
3765
+ * @param tag 标签
3671
3766
  */
3672
- apiVersion: string;
3767
+ updateTag(tag: ITagParam): Promise<IAsyncRes>;
3673
3768
  /**
3674
- * 自定义导航地址:
3675
- * 1. 私有云环境下该值为必填项
3676
- * 2. 当存在自定义导航地址时,SDK 内部默认地址将无效
3677
- * 3. 当存在自定义导航地址时,地址 url 中需包含 http/https 协议头,否则视为无效值
3678
- * 4. 建立 ws/wss 连接前的 ping 接口使用的协议与导航 url 中的协议相同
3679
- * 5. 建立 websocket 建立连接时将根据 ping 接口使用的 http/https 协议来确定使用 ws/wss 协议
3680
- * 6. 动态导航使用的协议头将与自定义导航地址相同
3681
- * 7. 公有云默认使用 https 协议
3769
+ * 获取标签列表
3682
3770
  */
3683
- navigators: string[];
3771
+ getTagList(): Promise<IAsyncRes<Array<ITagInfo>>>;
3684
3772
  /**
3685
- * (参数已废弃)~~c++ 协议栈数据库地址~~
3686
- * @deprecated
3687
- */
3688
- dbPath?: string;
3773
+ * 添加会话到标签(给多个会话增加标签)
3774
+ * @param tagId 标签id
3775
+ * @param conversations 要添加的会话列表
3776
+ */
3777
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3689
3778
  /**
3690
- * 小程序的 CMP 代理地址
3779
+ * 删除标签中的会话(从多个会话中批量删除指定标签)
3780
+ * @param tagId 标签id
3781
+ * @param conversations 要删除的会话列表
3691
3782
  */
3692
- miniCMPProxy: string[];
3783
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3693
3784
  /**
3694
- * 指定默认使用的连接类型
3785
+ * 删除会话中的标签(从单一会话中批量删除标签)
3786
+ * @param conversationType 会话类型
3787
+ * @param targetId 会话id
3788
+ * @param tagIds 要删除的标签列表
3695
3789
  */
3696
- connectionType: 'websocket' | 'comet';
3790
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): Promise<IAsyncRes<IAsyncRes>>;
3697
3791
  /**
3698
- * 修改 engine log 打印等级
3792
+ * 获取标签下的会话列表
3793
+ * @param tagId 标签id
3699
3794
  */
3700
- logLevel?: LogLevel;
3795
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): Promise<IAsyncRes<IReceivedConversationByTag[]>>;
3701
3796
  /**
3702
- * 修改默认的 log 输出函数
3797
+ * 获取标签下的未读消息数
3798
+ * @param tagId 标签id
3799
+ * @param containMuted 是否包含免打扰会话
3703
3800
  */
3704
- logStdout?: (logLevel: LogLevel, content: string) => void;
3801
+ getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<IAsyncRes<number>>;
3705
3802
  /**
3706
- * (已废弃)私有云标识
3707
- * @deprecated
3803
+ * 设置标签中会话置顶
3804
+ * @param conversation 会话
3708
3805
  */
3709
- isEnterPrise?: boolean;
3806
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: {
3807
+ isTop: boolean;
3808
+ }): Promise<IAsyncRes<IAsyncRes>>;
3710
3809
  /**
3711
- * typing状态过期时间
3810
+ * 获取会话里的标签
3811
+ * @param conversation
3712
3812
  */
3713
- typingExpireTime?: number;
3813
+ getTagsForConversation(conversation: IConversationOption): Promise<IAsyncRes<IConversationTag[]>>;
3714
3814
  /**
3715
- * 是否打开 IndexDB 存储,默认为 true
3815
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3816
+ * 对于未实现的方法,接口响应 Unsupport 错误码
3817
+ * @param method 方法名
3818
+ * @param args
3716
3819
  */
3717
- indexDBSwitch?: boolean;
3820
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3821
+ /**
3822
+ * 删除所有会话
3823
+ */
3824
+ clearConversations(conversationTypes?: ConversationType[], tag?: string): Promise<ErrorCode>;
3825
+ /**
3826
+ * 设置用户连接状态监听器
3827
+ */
3828
+ setUserStatusListener(config: {
3829
+ userIds: string[];
3830
+ }, listener: Function): void;
3831
+ /**
3832
+ * 添加用户黑名单
3833
+ */
3834
+ addToBlacklist(userId: string): Promise<ErrorCode>;
3835
+ /**
3836
+ * 将指定用户移除黑名单
3837
+ */
3838
+ removeFromBlacklist(userId: string): Promise<ErrorCode>;
3839
+ /**
3840
+ * 获取黑名单列表
3841
+ */
3842
+ getBlacklist(): Promise<IAsyncRes<string[]>>;
3843
+ /**
3844
+ * 获取指定人员在黑名单中的状态
3845
+ */
3846
+ getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
3847
+ /**
3848
+ * 向本地插入一条消息,不发送到服务器
3849
+ */
3850
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3718
3851
  /**
3719
- * 是否校验证书,默认为 true
3720
- */
3721
- checkCA?: boolean;
3722
- }
3723
- declare class APIContext {
3724
- private _runtime;
3725
- private static _context?;
3726
- static init(runtime: IRuntime, options: IAPIContextOption): APIContext;
3727
- static destroy(): void;
3728
- private _token;
3852
+ * 删除本地消息
3853
+ */
3854
+ deleteMessages(timestamp: number[]): Promise<ErrorCode>;
3729
3855
  /**
3730
- * 插件队列,用于逐一派发消息与信令
3731
- */
3732
- private _pluginContextQueue;
3856
+ * 从本地消息数据库中删除某一会话指定时间之前的消息数据
3857
+ */
3858
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId?: string): Promise<ErrorCode>;
3733
3859
  /**
3734
- * 插件实例Map,用于重复初始化时返回实例
3735
- */
3736
- private _pluginInstanseMap;
3737
- private readonly _engine;
3860
+ * 清空会话下历史消息
3861
+ */
3862
+ clearMessages(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3738
3863
  /**
3739
- * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
3740
- */
3741
- readonly coreVersion: string;
3742
- readonly appkey: string;
3743
- readonly apiVersion: string;
3744
- private readonly _options;
3745
- private _versionInfo;
3746
- private _typingInfo;
3864
+ * 获取本地消息
3865
+ */
3866
+ getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
3747
3867
  /**
3748
- * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
3749
- */
3750
- private _isInternalConnected;
3751
- constructor(_runtime: IRuntime, options: IAPIContextOption);
3868
+ * 设置消息内容
3869
+ */
3870
+ setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3752
3871
  /**
3753
- * 安装使用插件,并初始化插件实例
3754
- * @param plugin
3755
- * @param options
3756
- */
3757
- install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
3758
- private _connectionStatus;
3759
- private _canRedirectConnect;
3872
+ * 设置消息搜索字段
3873
+ */
3874
+ setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3760
3875
  /**
3761
- * 重定向后,递归调用 connect
3762
- */
3763
- private _handleRedirect;
3876
+ * 设置消息发送状态
3877
+ */
3878
+ setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3764
3879
  /**
3765
- * 连接状态变更回调
3766
- * @param message
3767
- */
3768
- private _connectionStatusListener;
3769
- private _messageReceiver;
3880
+ * 设置消息接收状态
3881
+ */
3882
+ setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3770
3883
  /**
3771
- * 聊天室相关信息监听
3884
+ * 设置当前用户在线状态
3772
3885
  */
3773
- private _chatroomInfoListener;
3886
+ setUserStatus(status: number): Promise<ErrorCode>;
3774
3887
  /**
3775
- * 会话监听相关
3888
+ * 订阅用户在线状态
3776
3889
  */
3777
- private _conversationInfoListener;
3890
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3778
3891
  /**
3779
- * 消息扩展监听相关
3892
+ * 获取用户在线状态
3780
3893
  */
3781
- private _expansionInfoListener;
3894
+ getUserStatus(userId: string): Promise<IAsyncRes<{
3895
+ status: string;
3896
+ }>>;
3897
+ searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
3898
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
3899
+ messages: IReceivedMessage[];
3900
+ count: number;
3901
+ }>>;
3902
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
3903
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3782
3904
  /**
3783
- * 标签增删改监听
3905
+ * 获取会话免打扰状态
3906
+ */
3907
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<NotificationStatus>>;
3908
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): Promise<IAsyncRes<{
3909
+ list: IReceivedMessage[];
3910
+ hasMore: boolean;
3911
+ }>>;
3912
+ /**
3913
+ * 加入房间
3914
+ * @param roomId
3915
+ * @param mode 房间模式:直播 or 会议
3916
+ * @param mediaType 直播房间模式下的媒体资源类型
3784
3917
  */
3785
- private _tagListener;
3918
+ joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
3919
+ quitRTCRoom(roomId: string): Promise<ErrorCode>;
3920
+ rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
3921
+ getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
3922
+ getRTCUserInfoList(roomId: string): Promise<IAsyncRes<IRTCUsers>>;
3923
+ getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
3924
+ setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
3925
+ removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
3926
+ setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
3927
+ name: string;
3928
+ content: string;
3929
+ }): Promise<ErrorCode>;
3930
+ setRTCTotalRes(roomId: string, message: {
3931
+ name: string;
3932
+ content: string;
3933
+ }, valueInfo: string, objectName: string, mcuValInfo?: string): Promise<ErrorCode>;
3934
+ setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
3935
+ getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): Promise<IAsyncRes<KVString>>;
3936
+ removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
3937
+ name: string;
3938
+ content: string;
3939
+ }): Promise<ErrorCode>;
3940
+ setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
3941
+ getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
3942
+ getRTCToken(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<IRtcTokenData>>;
3943
+ setRTCState(roomId: string, report: string): Promise<ErrorCode>;
3944
+ getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
3786
3945
  /**
3787
- * 会话标签状态监听
3946
+ * 直播观众加房间
3788
3947
  */
3789
- private _conversationTagListener;
3790
- private _typingStatusListener;
3791
- private _pullFinishedListener;
3792
- private _messageDeliveredListerer;
3948
+ joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
3949
+ token: string;
3950
+ kvEntries: IServerRTCRoomEntry[];
3951
+ }>>;
3793
3952
  /**
3794
- * rtc 数据变更通知 pluginContext
3953
+ * 直播观众退出房间
3795
3954
  */
3796
- private _rtcDataChange;
3955
+ quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
3797
3956
  /**
3798
- * 业务层事件监听器挂载点
3957
+ * 直播身份切换
3799
3958
  */
3800
- private _watcher;
3959
+ rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
3801
3960
  /**
3802
- * 添加事件监听
3803
- * @param options
3961
+ * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
3804
3962
  */
3805
- assignWatcher(watcher: IWatcher): void;
3963
+ getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
3964
+ }
3965
+
3966
+ /**
3967
+ * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3968
+ */
3969
+ interface IEngine {
3806
3970
  /**
3807
- * 向内存中添加 typing 信息
3808
- * 添加 typing 时不触发通知,只有在轮询时间点校验 _typingChangedList 的长度大于 0 时才通知
3971
+ * 建立连接
3972
+ * @param token
3973
+ * @param naviInfo
3809
3974
  */
3810
- private _addTypingInfo;
3811
- private _typingInternalTimer;
3812
- private _typingExpireTime;
3813
- private _typingChangedList;
3975
+ connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
3814
3976
  /**
3815
- * 启动定时移除typing
3977
+ * 上报版本信息
3978
+ * @param version
3979
+ */
3980
+ reportSDKInfo(version: {
3981
+ [name: string]: string;
3982
+ }): void;
3983
+ /**
3984
+ * 连接时间
3816
3985
  */
3817
- private _startCheckTypingInfo;
3818
3986
  getConnectedTime(): number;
3819
- getServerTime(): number;
3820
- getDeviceId(): string;
3821
- getCurrentUserId(): string;
3822
- getConnectionStatus(): ConnectionStatus;
3823
3987
  /**
3824
- * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
3825
- * @param token
3826
- * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
3988
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3989
+ * 对于未实现的方法,接口响应 Unsupport 错误码
3990
+ * @param method
3991
+ * @param args
3827
3992
  */
3828
- connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
3993
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3829
3994
  /**
3830
- * 拉取实时配置 web 端需更新 voipCall 字段
3995
+ * 获取历史消息
3996
+ * @param conversationType
3997
+ * @param targetId
3998
+ * @param timestamp
3999
+ * @param count
4000
+ * @param order
3831
4001
  */
3832
- private _pullUserSettings;
3833
- disconnect(): Promise<void>;
3834
- reconnect(): Promise<IConnectResult>;
3835
- private _getTokenWithoutNavi;
4002
+ getHistoryMessage(conversationType: ConversationType, targetId: string,
3836
4003
  /**
3837
- * 获取当前缓存的导航数据
4004
+ * 拉取时间戳,值为 `0` 表示从当前时间拉取
3838
4005
  */
3839
- getInfoFromCache(): INaviInfo | null;
4006
+ timestamp: number,
3840
4007
  /**
3841
- * 消息注册
3842
- * @description 消息注册需在应用初始化完成前进行
3843
- * @param objectName 消息类型,如:RC:TxtMsg
3844
- * @param isPersited 是否存储
3845
- * @param isCounted 是否技术
3846
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4008
+ * 获取条数, 有效值 `1` - `20`
3847
4009
  */
3848
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
4010
+ count: number,
3849
4011
  /**
3850
- * 发送消息
3851
- * @param conversationType
3852
- * @param targetId
3853
- * @param objectName
3854
- * @param content
3855
- * @param options
4012
+ * @description
4013
+ * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
4014
+ * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3856
4015
  */
3857
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
4016
+ order: 0 | 1,
4017
+ /**
4018
+ * 会话的业务标识
4019
+ */
4020
+ channelId: string,
4021
+ /**
4022
+ * 消息类型
4023
+ */
4024
+ objectName: string): IPromiseResult<{
4025
+ list: IReceivedMessage[];
4026
+ hasMore: boolean;
4027
+ }>;
4028
+ /**
4029
+ * 删除历史消息 通过 messageUId
4030
+ */
4031
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string,
4032
+ /**
4033
+ * @description
4034
+ * message 中 messageUId、setTime、messageDirection 为必须参数
4035
+ */
4036
+ messages: {
4037
+ messageUId: string;
4038
+ sentTime: number;
4039
+ messageDirection: MessageDirection;
4040
+ }[],
4041
+ /**
4042
+ * 会话的业务标识
4043
+ */
4044
+ channelId: string): Promise<ErrorCode>;
4045
+ recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3858
4046
  /**
3859
- * 发送扩展消息
3860
- * @param messageUId 消息 Id
3861
- * @param keys 需要删除的 key
3862
- * @param expansion 设置的扩展
4047
+ * 删除历史消息 通过 时间戳
4048
+ * @param timestamp 小于等于传入时间戳的消息均删除
3863
4049
  */
3864
- sendExpansionMessage(options: ISendExMsgOptions): Promise<IAsyncRes<ErrorCode>>;
4050
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3865
4051
  /**
3866
- * 发送群组消息已读回执
3867
- * 导航下发已读回执开关为 true 时调用
3868
- * @param targetId 群组会话id
3869
- * @param messageUIds 消息id
3870
- */
3871
- sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
4052
+ * 会话的业务标识
4053
+ */
4054
+ channelId: string): Promise<ErrorCode>;
3872
4055
  /**
3873
- * 获取群组消息已读列表
3874
- * @param targetId
3875
- * @param messageUIds
4056
+ * 获取会话列表
4057
+ * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3876
4058
  */
3877
- getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
4059
+ getConversationList(
3878
4060
  /**
3879
- * 反初始化,清空所有监听及计时器
4061
+ * 拉取数量, 有效值 0 - 1000, 默认 300
3880
4062
  */
3881
- private _destroy;
4063
+ count: number,
3882
4064
  /**
3883
- * @param conversationType
3884
- * @param targetId 会话 Id
3885
- * @param timestamp 拉取时间戳
3886
- * @param count 拉取条数
3887
- * @param order 1 正序拉取,0 为倒序拉取
3888
- * @param channelId
3889
- * @param objectName
4065
+ * 会话类型
4066
+ * @todo 待确认是否生效
3890
4067
  */
3891
- getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
3892
- list: IReceivedMessage[];
3893
- hasMore: boolean;
3894
- }>>;
4068
+ conversationType?: ConversationType,
3895
4069
  /**
3896
- * 获取会话列表
3897
- * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3898
- */
3899
- getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
4070
+ * 起始时间
4071
+ */
4072
+ startTime?: number,
3900
4073
  /**
3901
- * 获取单一会话数据
3902
- * @param conversationType
3903
- * @param targetId
3904
- * @param channelId
3905
- */
3906
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
4074
+ * 获取顺序
4075
+ */
4076
+ order?: 0 | 1,
3907
4077
  /**
3908
- * 删除会话
3909
- */
3910
- removeConversation(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4078
+ * 会话的业务标识
4079
+ */
4080
+ channelId?: string): IPromiseResult<IReceivedConversation[]>;
3911
4081
  /**
3912
- * 清除会话消息未读数
3913
- */
3914
- clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4082
+ * 获取指定会话
4083
+ */
4084
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3915
4085
  /**
3916
- * 获取指定会话消息未读数
4086
+ * 删除会话
4087
+ * @description 该删除操作会删除服务器端存储的会话数据
4088
+ * @param conversationType
4089
+ * @param targetId
3917
4090
  */
3918
- getUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<number>>;
4091
+ removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3919
4092
  /**
3920
4093
  * 获取所有会话未读数
3921
4094
  * @param channelId 多组织 Id
3922
4095
  * @param conversationTypes
3923
4096
  * @param includeMuted 包含已设置免打扰的会话
3924
4097
  */
3925
- getTotalUnreadCount(channelId: string, conversationTypes?: ConversationType[], includeMuted?: boolean): Promise<IAsyncRes<number>>;
4098
+ getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3926
4099
  /**
3927
- * 获取第一个未读消息
4100
+ * 获取指定会话未读数
3928
4101
  */
3929
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<IReceivedMessage | null>>;
3930
- setConversationStatus(conversationType: ConversationType, targetId: string, isTop?: boolean, notificationStatus?: 1 | 2, channelId?: string): Promise<ErrorCode>;
3931
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3932
- getConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<IAsyncRes<string>>;
3933
- clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3934
- recallMessage(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
4102
+ getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3935
4103
  /**
3936
- * 删除远端消息
3937
- * @param conversationType
3938
- * @param targetId
3939
- * @param list
4104
+ * 清除指定会话未读数
3940
4105
  */
3941
- deleteRemoteMessage(conversationType: ConversationType, targetId: string, list: {
3942
- messageUId: string;
3943
- sentTime: number;
3944
- messageDirection: MessageDirection;
3945
- }[], channelId?: string): Promise<ErrorCode>;
4106
+ clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3946
4107
  /**
3947
- * 根据时间戳删除指定时间之前的
3948
- * @param conversationType
3949
- * @param targetId
3950
- * @param timestamp
4108
+ * 获取第一个未读消息
3951
4109
  */
3952
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4110
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3953
4111
  /**
3954
- * 加入聊天室,若聊天室不存在则创建聊天室
3955
- * @param roomId 聊天室房间 Id
3956
- * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4112
+ * 设置/保存指定会话消息草稿
4113
+ * @draft 草稿内容
3957
4114
  */
3958
- joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4115
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3959
4116
  /**
3960
- * 加入聊天室,若聊天室不存在则抛出异常
3961
- * @param roomId 聊天室房间 Id
3962
- * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4117
+ * 获取指定会话消息草稿
3963
4118
  */
3964
- joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4119
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string): IPromiseResult<string>;
3965
4120
  /**
3966
- * 退出聊天室
3967
- * @param roomId
4121
+ * 清除指定会话消息草稿
3968
4122
  */
3969
- quitChatroom(roomId: string): Promise<ErrorCode>;
4123
+ clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3970
4124
  /**
3971
- * 获取聊天室房间数据
3972
- * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
3973
- * @param roomId 聊天室 Id
3974
- * @param count 获取房间人员列表数量,最大有效值 `20`,最小值未 `0`,默认为 0
3975
- * @param order 人员排序方式,`1` 为正序,`2` 为倒序,默认为 0
4125
+ * 从服务端拉取会话状态
3976
4126
  */
3977
- getChatroomInfo(roomId: string, count?: number, order?: 0 | 1 | 2): Promise<IAsyncRes<IChatroomInfo>>;
4127
+ pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3978
4128
  /**
3979
- * 在指定聊天室中设置自定义属性
3980
- * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3981
- * @param roomId 聊天室房间 id
3982
- * @param entry 属性信息
4129
+ * 批量设置会话 置顶、免打扰
3983
4130
  */
3984
- setChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
4131
+ batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
4132
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3985
4133
  /**
3986
- * 在指定聊天室中强制增加 / 修改任意聊天室属性
3987
- * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3988
- * @param roomId 聊天室房间 id
3989
- * @param entry 属性信息
4134
+ * 断开连接
3990
4135
  */
3991
- forceSetChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
4136
+ disconnect(): void;
3992
4137
  /**
3993
- * 删除聊天室属性
3994
- * @description 该方法仅限于删除自己设置的聊天室属性
3995
- * @param roomId 聊天室房间 id
3996
- * @param entry 要移除的属性信息
4138
+ * 拉取用户级配置数据
3997
4139
  */
3998
- removeChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
4140
+ pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3999
4141
  /**
4000
- * 强制删除任意聊天室属性
4001
- * @description 该方法仅限于删除自己设置的聊天室属性
4002
- * @param roomId 聊天室房间 id
4003
- * @param entry 要移除的属性信息
4142
+ * 消息注册
4143
+ * @description
4144
+ * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
4145
+ * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
4146
+ * @param objectName 消息类型,如:RC:TxtMsg
4147
+ * @param isPersited 是否存储
4148
+ * @param isCounted 是否技术
4149
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4004
4150
  */
4005
- forceRemoveChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
4151
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
4006
4152
  /**
4007
- * 获取聊天室中的指定属性
4008
- * @param roomId 聊天室房间 id
4009
- * @param key 属性键名
4010
- */
4011
- getChatroomEntry(roomId: string, key: string): Promise<IAsyncRes<string | null>>;
4153
+ * 加入聊天室
4154
+ * @param count 拉取消息数量
4155
+ */
4156
+ joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
4012
4157
  /**
4013
- * 获取聊天室内的所有属性
4014
- * @param roomId 聊天室房间 id
4015
- */
4016
- getAllChatroomEntries(roomId: string): Promise<IAsyncRes<{
4017
- [key: string]: string;
4018
- }>>;
4158
+ * 加入已存在的聊天室
4159
+ * @param count 拉取消息数量
4160
+ */
4161
+ joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
4019
4162
  /**
4020
- * 拉取聊天室内的历史消息
4021
- * @param roomId
4022
- * @param count 拉取消息条数, 有效值范围 `1 - 20`
4023
- * @param order 获取顺序,默认值为 0。
4024
- * * 0:降序,用于获取早于指定时间戳发送的消息
4025
- * * 1:升序,用于获取晚于指定时间戳发送的消息
4026
- * @param timestamp 指定拉取消息用到的时间戳。默认值为 `0`,表示按当前时间拉取
4027
- */
4028
- getChatRoomHistoryMessages(roomId: string, count?: number, order?: 0 | 1, timestamp?: number): Promise<IAsyncRes<{
4163
+ * 退出聊天室
4164
+ */
4165
+ quitChatroom(chatroomId: string): Promise<ErrorCode>;
4166
+ /**
4167
+ * 获取聊天室信息
4168
+ * @param count 获取人数, 范围 0 - 20
4169
+ * @param order 排序方式, 1 正序, 2 倒序
4170
+ */
4171
+ getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
4172
+ /**
4173
+ * 获取聊天室历史消息
4174
+ */
4175
+ getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
4029
4176
  list: IReceivedMessage[];
4030
4177
  hasMore: boolean;
4031
- }>>;
4178
+ }>;
4032
4179
  /**
4033
- * 获取存储服务鉴权信息
4034
- * @param fileType 文件类型
4035
- * @param fileName 文件名称
4036
- * @param httpMethod STC 分段上传时的必填参数,有效值为 PUT | POST
4037
- * @param queryString STC 分段上传时的查询字符串
4038
- * @description
4039
- * `httpMethod` 与 `queryString` 为 STC S3 分段上传时的专属参数,STC 分段上传包含三个过程:
4040
- * 1. 开始分段前调用,此时 `httpMethod` 值应为 `POST`, `queryString` 值为 `uploads`
4041
- * 2. 上传请求前调用,此时 `httpMethod` 值应为 `PUT`,`queryString` 值为 `partNumber={partamNumer}&uploadId={uploadId}`
4042
- * 3. 上传结束前调用,此时 `httpMethod` 值应为 `POST`,`queryString` 值为 `uploadId={uploadId}`
4043
- * @returns
4180
+ * 设置聊天室属性
4181
+ */
4182
+ setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4183
+ /**
4184
+ * 批量设置聊天室属性
4044
4185
  */
4045
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
4046
- bos: string;
4047
- qiniu: string;
4186
+ setChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
4187
+ code: ErrorCode;
4188
+ data?: any;
4189
+ }>;
4190
+ /**
4191
+ * 强制设置聊天室属性
4192
+ */
4193
+ forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4194
+ /**
4195
+ * 删除聊天室属性
4196
+ */
4197
+ removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4198
+ /**
4199
+ * 批量删除聊天室属性
4200
+ */
4201
+ removeChatroomEntries(chatroomId: string, entries: IChrmKVEntries): Promise<{
4202
+ code: ErrorCode;
4203
+ data?: any;
4048
4204
  }>;
4049
4205
  /**
4050
- * 获取 七牛、百度、阿里云 上传成功可下载的 URL
4051
- * @param fileType 文件类型
4052
- * @param fileName 文件名
4053
- * @param saveName 下载后的存储文件名
4054
- * @param uploadRes 插件上传返回的结果。降级百度上传后,用户传入返回结果,再把结果里的下载地址返回给用户,保证兼容之前结果获取
4055
- * @param serverType 使用的存储服务标识
4206
+ * 强制删除聊天室属性
4207
+ */
4208
+ forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4209
+ /**
4210
+ * 获取聊天室 key 对应 value
4211
+ */
4212
+ getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
4213
+ /**
4214
+ * 获取聊天室所有 key value
4215
+ */
4216
+ getAllChatroomEntry(chatroomId: string): IPromiseResult<{
4217
+ [key: string]: string;
4218
+ }>;
4219
+ /**
4220
+ * 获取上传认证信息
4221
+ * @description
4222
+ * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
4223
+ */
4224
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
4225
+ /**
4226
+ * 获取文件上传后下载地址
4056
4227
  */
4057
- getFileUrl(fileType: FileType, fileName?: string, saveName?: string, uploadRes?: {
4058
- isBosRes: boolean;
4059
- downloadUrl: string;
4060
- }, serverType?: UploadMethod): Promise<{
4228
+ getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
4061
4229
  downloadUrl: string;
4062
4230
  }>;
4063
4231
  /**
4064
4232
  * 创建标签
4065
4233
  * @param tag 标签
4066
- */
4067
- createTag(tag: ITagParam): Promise<IAsyncRes>;
4234
+ */
4235
+ createTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
4068
4236
  /**
4069
4237
  * 删除标签
4070
4238
  * @param tagId 标签id
4071
- */
4072
- removeTag(tagId: string): Promise<IAsyncRes>;
4239
+ */
4240
+ removeTag(tagId: string): IPromiseResult<IAsyncRes>;
4073
4241
  /**
4074
- * 更新标签
4242
+ * 编辑标签
4075
4243
  * @param tag 标签
4076
- */
4077
- updateTag(tag: ITagParam): Promise<IAsyncRes>;
4244
+ */
4245
+ updateTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
4078
4246
  /**
4079
4247
  * 获取标签列表
4080
4248
  */
4081
- getTagList(): Promise<IAsyncRes<Array<ITagInfo>>>;
4249
+ getTagList(): IPromiseResult<Array<ITagInfo>>;
4082
4250
  /**
4083
4251
  * 添加会话到标签(给多个会话增加标签)
4084
4252
  * @param tagId 标签id
4085
4253
  * @param conversations 要添加的会话列表
4086
4254
  */
4087
- addTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
4255
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
4088
4256
  /**
4089
4257
  * 删除标签中的会话(从多个会话中批量删除指定标签)
4090
4258
  * @param tagId 标签id
4091
4259
  * @param conversations 要删除的会话列表
4092
4260
  */
4093
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
4261
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
4094
4262
  /**
4095
4263
  * 删除会话中的标签(从单一会话中批量删除标签)
4096
4264
  * @param conversationType 会话类型
4097
4265
  * @param targetId 会话id
4098
4266
  * @param tagIds 要删除的标签列表
4099
4267
  */
4100
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): Promise<IAsyncRes<IAsyncRes>>;
4268
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult<IAsyncRes>;
4101
4269
  /**
4102
4270
  * 获取标签下的会话列表
4103
4271
  * @param tagId 标签id
4104
4272
  */
4105
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): Promise<IAsyncRes<IReceivedConversationByTag[]>>;
4273
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
4106
4274
  /**
4107
4275
  * 获取标签下的未读消息数
4108
4276
  * @param tagId 标签id
4109
4277
  * @param containMuted 是否包含免打扰会话
4110
4278
  */
4111
- getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<IAsyncRes<number>>;
4279
+ getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
4112
4280
  /**
4113
4281
  * 设置标签中会话置顶
4114
4282
  * @param conversation 会话
4115
4283
  */
4116
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: {
4117
- isTop: boolean;
4118
- }): Promise<IAsyncRes<IAsyncRes>>;
4284
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult<IAsyncRes>;
4119
4285
  /**
4120
4286
  * 获取会话里的标签
4121
- * @param conversation
4287
+ * @param config
4122
4288
  */
4123
- getTagsForConversation(conversation: IConversationOption): Promise<IAsyncRes<IConversationTag[]>>;
4289
+ getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
4124
4290
  /**
4125
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4126
- * 对于未实现的方法,接口响应 Unsupport 错误码
4127
- * @param method 方法名
4128
- * @param args
4291
+ * 发送群组消息已读回执
4292
+ * 导航下发已读回执开关为 true 时调用
4129
4293
  */
4130
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
4294
+ sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
4131
4295
  /**
4132
- * 删除所有会话
4133
- */
4134
- clearConversations(conversationTypes?: ConversationType[], tag?: string): Promise<ErrorCode>;
4296
+ * 获取群组消息已读列表
4297
+ */
4298
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
4135
4299
  /**
4136
- * 设置用户连接状态监听器
4300
+ * 获取服务器时间
4301
+ */
4302
+ getServerTime(): number;
4303
+ /**
4304
+ * 获取设备ID
4305
+ */
4306
+ getDeviceId(): string;
4307
+ /**
4308
+ * 获取当前 userId
4309
+ */
4310
+ getCurrentUserId(): string;
4311
+ /**
4312
+ * 设置用户在线状态监听器
4137
4313
  */
4138
4314
  setUserStatusListener(config: {
4139
4315
  userIds: string[];
4140
4316
  }, listener: Function): void;
4141
4317
  /**
4142
- * 添加用户黑名单
4318
+ * 设置当前用户在线状态
4319
+ */
4320
+ setUserStatus(status: number): Promise<ErrorCode>;
4321
+ /**
4322
+ * 订阅用户在线状态
4323
+ */
4324
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4325
+ /**
4326
+ * 获取用户状态
4327
+ */
4328
+ getUserStatus(userId: string): IPromiseResult<{
4329
+ status: string;
4330
+ }>;
4331
+ /**
4332
+ * 清空所有会话
4333
+ */
4334
+ clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
4335
+ /**
4336
+ * 加入黑名单
4143
4337
  */
4144
4338
  addToBlacklist(userId: string): Promise<ErrorCode>;
4145
4339
  /**
4146
- * 将指定用户移除黑名单
4340
+ * 将指定用户移除黑名单
4147
4341
  */
4148
4342
  removeFromBlacklist(userId: string): Promise<ErrorCode>;
4149
4343
  /**
4150
- * 获取黑名单列表
4344
+ * 获取黑名单列表
4151
4345
  */
4152
- getBlacklist(): Promise<IAsyncRes<string[]>>;
4346
+ getBlacklist(): IPromiseResult<string[]>;
4153
4347
  /**
4154
- * 获取指定人员在黑名单中的状态
4348
+ * 获取指定人员在黑名单中的状态
4155
4349
  */
4156
- getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
4350
+ getBlacklistStatus(userId: string): IPromiseResult<string>;
4157
4351
  /**
4158
4352
  * 向本地插入一条消息,不发送到服务器
4159
4353
  */
4160
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
4354
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
4161
4355
  /**
4162
4356
  * 删除本地消息
4163
4357
  */
4164
- deleteMessages(timestamp: number[]): Promise<ErrorCode>;
4358
+ deleteMessages(timestamps: number[]): Promise<ErrorCode>;
4165
4359
  /**
4166
- * 从本地消息数据库中删除某一会话指定时间之前的消息数据
4360
+ * 通过时间戳删除本地消息
4167
4361
  */
4168
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId?: string): Promise<ErrorCode>;
4362
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
4169
4363
  /**
4170
4364
  * 清空会话下历史消息
4171
4365
  */
4172
- clearMessages(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4366
+ clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
4173
4367
  /**
4174
- * 获取本地消息
4368
+ * 获取消息
4175
4369
  */
4176
- getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
4370
+ getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
4177
4371
  /**
4178
4372
  * 设置消息内容
4179
4373
  */
@@ -4183,61 +4377,48 @@ declare class APIContext {
4183
4377
  */
4184
4378
  setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
4185
4379
  /**
4186
- * 设置消息发送状态
4380
+ * 通过关键字搜索会话
4187
4381
  */
4188
- setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
4382
+ searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
4189
4383
  /**
4190
- * 设置消息接收状态
4384
+ * 按内容搜索会话内的消息
4191
4385
  */
4192
- setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
4386
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
4387
+ messages: IReceivedMessage[];
4388
+ count: number;
4389
+ }>;
4193
4390
  /**
4194
- * 设置当前用户在线状态
4391
+ * 获取会话下所有未读的 @ 消息
4195
4392
  */
4196
- setUserStatus(status: number): Promise<ErrorCode>;
4393
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
4197
4394
  /**
4198
- * 订阅用户在线状态
4395
+ * 设置消息发送状态
4199
4396
  */
4200
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4397
+ setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
4201
4398
  /**
4202
- * 获取用户在线状态
4399
+ * 设置消息接收状态
4203
4400
  */
4204
- getUserStatus(userId: string): Promise<IAsyncRes<{
4205
- status: string;
4206
- }>>;
4207
- searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
4208
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
4209
- messages: IReceivedMessage[];
4210
- count: number;
4211
- }>>;
4212
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
4213
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4401
+ setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
4402
+ /**
4403
+ * 删除时间戳前的未读数
4404
+ */
4405
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
4214
4406
  /**
4215
4407
  * 获取会话免打扰状态
4216
4408
  */
4217
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<NotificationStatus>>;
4218
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): Promise<IAsyncRes<{
4409
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
4410
+ /**
4411
+ * 协议栈获取远端历史消息
4412
+ */
4413
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
4219
4414
  list: IReceivedMessage[];
4220
4415
  hasMore: boolean;
4221
- }>>;
4222
- /**
4223
- * 获取群组消息送达信息
4224
- */
4225
- getGroupMessageDeliverList(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IGroupMessageDeliverInfo>;
4226
- /**
4227
- * 获取单聊消息送达信息
4228
- */
4229
- getPrivateMessageDeliverTime(messageUId: string, channelId?: string): IPromiseResult<number>;
4230
- /**
4231
- * 加入房间
4232
- * @param roomId
4233
- * @param mode 房间模式:直播 or 会议
4234
- * @param mediaType 直播房间模式下的媒体资源类型
4235
- */
4236
- joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
4416
+ }>;
4417
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4237
4418
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4238
- rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
4239
- getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
4240
- getRTCUserInfoList(roomId: string): Promise<IAsyncRes<IRTCUsers>>;
4419
+ rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4420
+ getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
4421
+ getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
4241
4422
  getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
4242
4423
  setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
4243
4424
  removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
@@ -4245,43 +4426,49 @@ declare class APIContext {
4245
4426
  name: string;
4246
4427
  content: string;
4247
4428
  }): Promise<ErrorCode>;
4429
+ /**
4430
+ * 全量订阅资源修改
4431
+ * @param roomId 房间 Id
4432
+ * @param message 向前兼容的消息内容
4433
+ * @param valueInfo 全量资源数据
4434
+ * @param objectName 全量 URI 消息名
4435
+ */
4248
4436
  setRTCTotalRes(roomId: string, message: {
4249
4437
  name: string;
4250
4438
  content: string;
4251
- }, valueInfo: string, objectName: string, mcuValInfo?: string): Promise<ErrorCode>;
4252
- setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4253
- getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): Promise<IAsyncRes<KVString>>;
4439
+ }, valueInfo: string, objectName: string, mcuValInfo: string): Promise<ErrorCode>;
4440
+ getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
4254
4441
  removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
4255
4442
  name: string;
4256
4443
  content: string;
4257
4444
  }): Promise<ErrorCode>;
4258
4445
  setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
4259
4446
  getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
4260
- getRTCToken(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<IRtcTokenData>>;
4261
- setRTCState(roomId: string, report: string): Promise<ErrorCode>;
4447
+ getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
4448
+ setRTCState(roomId: string, reportId: string): Promise<ErrorCode>;
4262
4449
  getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
4450
+ setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4451
+ }
4452
+
4453
+ interface IExpansionMsgContent {
4263
4454
  /**
4264
- * 直播观众加房间
4265
- */
4266
- joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
4267
- token: string;
4268
- }>>;
4269
- /**
4270
- * 直播观众退出房间
4271
- */
4272
- quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
4455
+ * 消息扩展的对象
4456
+ */
4457
+ put?: {
4458
+ [key: string]: string;
4459
+ };
4273
4460
  /**
4274
- * 直播身份切换
4275
- */
4276
- rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
4461
+ * 删除的 keys
4462
+ */
4463
+ del?: string[];
4277
4464
  /**
4278
- * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
4279
- */
4280
- getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
4465
+ * messageUId
4466
+ */
4467
+ mid: string;
4281
4468
  /**
4282
- * 拉取 RTC 全量 KV
4283
- */
4284
- pullRTCRoomEntry(roomId: string, timestamp: number): Promise<IAsyncRes<IChrmKVPullData>>;
4469
+ * 是否删除所有, 有效值:0、1 . ( 后续如有需要, API Layer 层可使用)
4470
+ */
4471
+ removeAll?: number;
4285
4472
  }
4286
4473
 
4287
4474
  declare class RTCPluginContext extends PluginContext {
@@ -4367,6 +4554,7 @@ declare class RTCPluginContext extends PluginContext {
4367
4554
  */
4368
4555
  joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<{
4369
4556
  token: string;
4557
+ kvEntries: IServerRTCRoomEntry[];
4370
4558
  }>;
4371
4559
  /**
4372
4560
  * 直播观众退出房间
@@ -4376,10 +4564,6 @@ declare class RTCPluginContext extends PluginContext {
4376
4564
  * 直播身份切换
4377
4565
  */
4378
4566
  rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4379
- /**
4380
- * 拉取 RTC 全量 KV
4381
- */
4382
- pullRTCRoomEntry(roomId: string, timestamp: number): IPromiseResult<IChrmKVPullData>;
4383
4567
  }
4384
4568
 
4385
4569
  declare abstract class ANavi {
@@ -4428,7 +4612,6 @@ interface IEngineWatcher {
4428
4612
  */
4429
4613
  onRTCDataChange: (data: IServerRTCRoomEntry[], roomId?: string) => void;
4430
4614
  pullFinished: () => void;
4431
- messageDelivered: (data: IMessageDeliver[]) => void;
4432
4615
  }
4433
4616
  /**
4434
4617
  * 引擎定义
@@ -4680,6 +4863,13 @@ declare abstract class AEngine implements IEngine {
4680
4863
  * 设置聊天室属性
4681
4864
  */
4682
4865
  abstract setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4866
+ /**
4867
+ * 批量设置聊天室属性
4868
+ */
4869
+ abstract setChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
4870
+ code: ErrorCode;
4871
+ data?: any;
4872
+ }>;
4683
4873
  /**
4684
4874
  * 强制设置聊天室属性
4685
4875
  */
@@ -4688,6 +4878,13 @@ declare abstract class AEngine implements IEngine {
4688
4878
  * 删除聊天室属性
4689
4879
  */
4690
4880
  abstract removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4881
+ /**
4882
+ * 批量删除聊天室属性
4883
+ */
4884
+ abstract removeChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
4885
+ code: ErrorCode;
4886
+ data?: any;
4887
+ }>;
4691
4888
  /**
4692
4889
  * 强制删除聊天室属性
4693
4890
  */
@@ -4794,6 +4991,10 @@ declare abstract class AEngine implements IEngine {
4794
4991
  * 获取设备ID
4795
4992
  */
4796
4993
  abstract getDeviceId(): string;
4994
+ /**
4995
+ * 获取当前 userId
4996
+ */
4997
+ abstract getCurrentUserId(): string;
4797
4998
  /**
4798
4999
  * 设置用户在线状态监听器
4799
5000
  */
@@ -4900,14 +5101,6 @@ declare abstract class AEngine implements IEngine {
4900
5101
  list: IReceivedMessage[];
4901
5102
  hasMore: boolean;
4902
5103
  }>;
4903
- /**
4904
- * 获取群组消息送达列表
4905
- */
4906
- abstract getGroupMessageDeliverList(targetId: string, messageUId: string, channelId: string): IPromiseResult<IGroupMessageDeliverInfo>;
4907
- /**
4908
- * 获取单聊消息送达列表
4909
- */
4910
- abstract getPrivateMessageDeliverTime(messageUId: string, channelId: string): IPromiseResult<number>;
4911
5104
  abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
4912
5105
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
4913
5106
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
@@ -4943,12 +5136,12 @@ declare abstract class AEngine implements IEngine {
4943
5136
  abstract getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
4944
5137
  abstract joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
4945
5138
  token: string;
5139
+ kvEntries: IServerRTCRoomEntry[];
4946
5140
  }>>;
4947
5141
  abstract quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
4948
5142
  abstract rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
4949
5143
  abstract getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
4950
5144
  abstract setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4951
- abstract pullRTCRoomEntry(roomId: string, timestamp: number): Promise<IAsyncRes<IChrmKVPullData>>;
4952
5145
  }
4953
5146
 
4954
5147
  declare class AppStorage {
@@ -5110,6 +5303,19 @@ declare class EventEmitter {
5110
5303
  clear(): void;
5111
5304
  }
5112
5305
 
5306
+ declare class VersionManage {
5307
+ static add(name: string, version: string): void;
5308
+ /**
5309
+ * 校验当前 engine 版本是否大于等于所需版本,只校验前三位数字
5310
+ * @param version
5311
+ * @returns
5312
+ */
5313
+ static validEngine(version: string): boolean;
5314
+ static getInfo(): {
5315
+ [key: string]: string;
5316
+ };
5317
+ }
5318
+
5113
5319
  /**
5114
5320
  * 检查参数是否为字符串
5115
5321
  * 只做类型检查,不做长度检查,故当字符串长度为 0,结果依然为 true
@@ -5399,4 +5605,4 @@ declare enum CONNECTION_TYPE {
5399
5605
  */
5400
5606
  declare const version: string;
5401
5607
 
5402
- 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 };
5608
+ 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 };