@rongcloud/engine 4.5.5 → 4.6.0-beem.11

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.5
3
- * CommitId - 995181d9e191b32bf0910367a205e604999e026a
4
- * Wed Jan 26 2022 11:32:58 GMT+0800 (China Standard Time)
2
+ * RCEngine - v4.6.0-beem.11
3
+ * CommitId - dc5878afdcc5cfd598d431d47b48c4af5528ebfe
4
+ * Tue Jun 28 2022 10:49:18 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  /**
@@ -908,13 +908,17 @@ declare enum ErrorCode {
908
908
  */
909
909
  RC_CONN_USER_BLOCKED = 31009,
910
910
  /**
911
- * Disconnect,由服务器返回,比如用户互踢。
911
+ * Disconnect,该用户其他设备登录,本端被踢下线;
912
912
  */
913
913
  RC_DISCONN_KICK = 31010,
914
914
  /**
915
- * Disconnect,由服务器返回,比如用户互踢。
915
+ * Disconnect,连接被服务端主动关闭;
916
916
  */
917
917
  RC_DISCONN_EXCEPTION = 31011,
918
+ /**
919
+ * 开启禁止把已在线客户端踢下线开关后,该错误码标识已有同类型端在线,禁止链接;
920
+ */
921
+ RC_DISCONN_SAME_CLIENT_ON_LINE = 31023,
918
922
  /**
919
923
  * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
920
924
  */
@@ -1204,7 +1208,19 @@ declare enum RTCMode {
1204
1208
  /**
1205
1209
  * 直播模式
1206
1210
  */
1207
- LIVE = 2
1211
+ LIVE = 2,
1212
+ /**
1213
+ * sip呼叫
1214
+ */
1215
+ SIP = 4,
1216
+ /**
1217
+ * 呼叫模式.包括单呼和群呼
1218
+ */
1219
+ CALL = 5,
1220
+ /**
1221
+ * 会议
1222
+ */
1223
+ MEETING = 6
1208
1224
  }
1209
1225
  /**
1210
1226
  * 直播类型
@@ -1617,6 +1633,10 @@ declare enum ConnectionStatus {
1617
1633
  * appkey 不正确
1618
1634
  */
1619
1635
  APPKEY_IS_FAKE = 20,
1636
+ /**
1637
+ * 其他端登录,本端禁止连接和重连
1638
+ */
1639
+ FORBID_RECONNECT_BY_OTHER_SAME_CLIENT = 31023,
1620
1640
  /**
1621
1641
  * 互踢次数过多(`count > 5`),此时可能出现:在其它他设备登陆有 reconnect 逻辑
1622
1642
  */
@@ -2321,6 +2341,7 @@ interface IJoinRTCRoomData extends IRTCUsers {
2321
2341
  value: string;
2322
2342
  }[];
2323
2343
  kvEntries: IServerRTCRoomEntry[];
2344
+ offlineKickTime: number;
2324
2345
  }
2325
2346
 
2326
2347
  /**
@@ -2638,6 +2659,7 @@ declare class PluginContext {
2638
2659
  * 目前仅通知:主播加入、退出房间的人员列表变更,发布、取消发布资源列表变更
2639
2660
  */
2640
2661
  onrtcdatachange?(data: IServerRTCRoomEntry[], roomdId?: string): void;
2662
+ onCallInfo?(data: string): void;
2641
2663
  /**
2642
2664
  * 获取 `@rongcloud/engine` 包版本
2643
2665
  */
@@ -2681,6 +2703,10 @@ declare class PluginContext {
2681
2703
  * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
2682
2704
  */
2683
2705
  getRTCJoinedUserInfo(userId: string): IPromiseResult<IRTCJoinedInfo[]>;
2706
+ setCallInfo(targetId: string, key: string, value: string): IPromiseResult<{
2707
+ key: string;
2708
+ value: string;
2709
+ }>;
2684
2710
  }
2685
2711
 
2686
2712
  declare enum ReceivedStatus {
@@ -2873,8 +2899,13 @@ declare enum MessageType {
2873
2899
  */
2874
2900
  GROUP_READ_RECEIPT_REQUEST = "RC:RRMsg",
2875
2901
  /**
2876
- * 用户加入聊天室
2902
+ * 消息送达报告,仅单聊
2903
+ */
2904
+ DELIVERED = "RC:Delivered",
2905
+ /**
2906
+ * 消息送达状态报告,仅群聊
2877
2907
  */
2908
+ DELIVERED_MSG = "RC:DRMsg",
2878
2909
  CHATROOM_JOIN = "RC:ChrmJoinNtf",
2879
2910
  /**
2880
2911
  * 用户退出聊天室
@@ -3220,1172 +3251,1256 @@ interface ITypingMessage {
3220
3251
  }
3221
3252
 
3222
3253
  /**
3223
- * 被拦截的消息信息
3254
+ * 消息送达相关接口
3224
3255
  */
3225
- interface IBlockedMessageInfo {
3226
- blockedMessageUId: string;
3227
- conversationType: number;
3256
+
3257
+ interface IDeliveredUser {
3258
+ time: number;
3259
+ userId: string;
3260
+ }
3261
+ interface IGroupMessageDeliverInfo {
3262
+ totalCount: number;
3263
+ list: IDeliveredUser[];
3264
+ }
3265
+ interface IMessageDeliver {
3266
+ deliverTime: number;
3267
+ messageUId: string;
3268
+ conversationType: ConversationType;
3228
3269
  targetId: string;
3229
- channelId: string;
3230
- blockType: MessageBlockType;
3270
+ }
3271
+ interface IGroupMessageDeliveredStatusInfo {
3272
+ MessageUId: string;
3273
+ deliveryCount: number;
3274
+ }
3275
+ interface IGroupMessageDeliverStatus {
3276
+ totalCount: number;
3277
+ list: IGroupMessageDeliveredStatusInfo[];
3231
3278
  }
3232
3279
 
3233
- interface IConnectResult {
3280
+ /**
3281
+ * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3282
+ */
3283
+ interface IEngine {
3234
3284
  /**
3235
- * 连接错误码
3285
+ * 建立连接
3286
+ * @param token
3287
+ * @param naviInfo
3288
+ * @param reconnectKickEnable
3236
3289
  */
3237
- code: ErrorCode;
3290
+ connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
3238
3291
  /**
3239
- * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3292
+ * 获取导航信息
3293
+ * @param uris
3294
+ * @param appkey
3295
+ * @param token
3296
+ * @param checkCA
3240
3297
  */
3241
- userId?: string;
3242
- }
3243
- declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
3244
- declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
3245
- declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
3246
- declare type IChatroomListener = (state: IChatroomListenerData) => void;
3247
- declare type IRTCInnerListener = {
3248
- message?: IMessageListnenr;
3249
- status?: IConnectionStatusListener;
3250
- };
3251
- declare type IExpansionListener = (data: IExpansionListenerData) => void;
3252
- declare type ITagListener = () => void;
3253
- declare type IConversationTagListener = () => void;
3254
- declare type ItypingStateListener = (data: ITypingMessage[]) => void;
3255
- declare type IMessageBlockedListener = (data: IBlockedMessageInfo) => void;
3256
- interface ISendExMsgOptions {
3257
- channelId: string;
3258
- conversationType: ConversationType;
3259
- targetId: string;
3298
+ getNaviInfo(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
3260
3299
  /**
3261
- * 消息 ID
3300
+ * 从缓存获取navi
3301
+ */
3302
+ getNaviInfoFromCache(): INaviInfo | null;
3303
+ /**
3304
+ * 上报版本信息
3305
+ * @param version
3306
+ */
3307
+ reportSDKInfo(version: {
3308
+ [name: string]: string;
3309
+ }): void;
3310
+ /**
3311
+ * 连接时间
3312
+ */
3313
+ getConnectedTime(): number;
3314
+ /**
3315
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3316
+ * 对于未实现的方法,接口响应 Unsupport 错误码
3317
+ * @param method
3318
+ * @param args
3319
+ */
3320
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3321
+ /**
3322
+ * 获取历史消息
3323
+ * @param conversationType
3324
+ * @param targetId
3325
+ * @param timestamp
3326
+ * @param count
3327
+ * @param order
3328
+ */
3329
+ getHistoryMessage(conversationType: ConversationType, targetId: string,
3330
+ /**
3331
+ * 拉取时间戳,值为 `0` 表示从当前时间拉取
3332
+ */
3333
+ timestamp: number,
3334
+ /**
3335
+ * 获取条数, 有效值 `1` - `20`
3336
+ */
3337
+ count: number,
3338
+ /**
3339
+ * @description
3340
+ * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
3341
+ * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3342
+ */
3343
+ order: 0 | 1,
3344
+ /**
3345
+ * 会话的业务标识
3262
3346
  */
3263
- messageUId: string;
3347
+ channelId: string,
3264
3348
  /**
3265
- * 原始消息是否支持扩展的字段
3349
+ * 消息类型
3350
+ */
3351
+ objectName: string): IPromiseResult<{
3352
+ list: IReceivedMessage[];
3353
+ hasMore: boolean;
3354
+ }>;
3355
+ /**
3356
+ * 删除历史消息 通过 messageUId
3266
3357
  */
3267
- canIncludeExpansion: boolean;
3358
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string,
3268
3359
  /**
3269
- * 删除的 keys
3360
+ * @description
3361
+ * message 中 messageUId、setTime、messageDirection 为必须参数
3270
3362
  */
3271
- keys?: string[];
3363
+ messages: {
3364
+ messageUId: string;
3365
+ sentTime: number;
3366
+ messageDirection: MessageDirection;
3367
+ }[],
3272
3368
  /**
3273
- * 扩展对象
3369
+ * 会话的业务标识
3274
3370
  */
3275
- expansion?: {
3276
- [key: string]: string;
3277
- };
3371
+ channelId: string): Promise<ErrorCode>;
3372
+ recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3278
3373
  /**
3279
- * 是否删除所有扩展
3374
+ * 删除历史消息 通过 时间戳
3375
+ * @param timestamp 小于等于传入时间戳的消息均删除
3280
3376
  */
3281
- removeAll?: boolean;
3377
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3282
3378
  /**
3283
- * 原始消息的扩展
3379
+ * 会话的业务标识
3284
3380
  */
3285
- originExpansion?: {
3286
- [key: string]: string;
3287
- } | null;
3288
- }
3289
- interface IWatcher {
3290
- message?: IMessageListnenr;
3291
- connectionState?: IConnectionStatusListener;
3292
- conversationState?: IConversationStateListener;
3293
- chatroomState?: IChatroomListener;
3294
- expansion?: IExpansionListener;
3381
+ channelId: string): Promise<ErrorCode>;
3295
3382
  /**
3296
- * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
3383
+ * 获取会话列表
3384
+ * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3297
3385
  */
3298
- rtcInnerWatcher?: IRTCInnerListener;
3386
+ getConversationList(
3299
3387
  /**
3300
- * 标签的增删改监听
3388
+ * 拉取数量, 有效值 0 - 1000, 默认 300
3301
3389
  */
3302
- tag?: ITagListener;
3390
+ count: number,
3303
3391
  /**
3304
- * 会话中标签状态变更监听
3392
+ * 会话类型
3393
+ * @todo 待确认是否生效
3305
3394
  */
3306
- conversationTagChanged?: IConversationTagListener;
3395
+ conversationType?: ConversationType,
3307
3396
  /**
3308
- * 输入状态变更监听
3309
- */
3310
- typingState?: ItypingStateListener;
3397
+ * 起始时间
3398
+ */
3399
+ startTime?: number,
3311
3400
  /**
3312
- * 是否拉取完毕添加通知
3313
- */
3314
- pullFinished?: ITagListener;
3401
+ * 获取顺序
3402
+ */
3403
+ order?: 0 | 1,
3315
3404
  /**
3316
- * 敏感词被拦截监听
3317
- */
3318
- messageBlocked?: IMessageBlockedListener;
3319
- }
3320
- interface IPluginGenerator<API, InitOption> {
3405
+ * 会话的业务标识
3406
+ */
3407
+ channelId?: string): IPromiseResult<IReceivedConversation[]>;
3321
3408
  /**
3322
- * 只读插件标识
3323
- */
3324
- readonly tag: string;
3409
+ * 获取指定会话
3410
+ */
3411
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3325
3412
  /**
3326
- * 版本号
3413
+ * 删除会话
3414
+ * @description 该删除操作会删除服务器端存储的会话数据
3415
+ * @param conversationType
3416
+ * @param targetId
3327
3417
  */
3328
- readonly version?: string;
3418
+ removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3329
3419
  /**
3330
- * 插件名称
3420
+ * 获取所有会话未读数
3421
+ * @param channelId 多组织 Id
3422
+ * @param conversationTypes
3423
+ * @param includeMuted 包含已设置免打扰的会话
3331
3424
  */
3332
- readonly name?: string;
3425
+ getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3333
3426
  /**
3334
- * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
3427
+ * 获取指定会话未读数
3335
3428
  */
3336
- verify(runtime: IRuntime): boolean;
3429
+ getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3337
3430
  /**
3338
- * 插件初始化
3339
- * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
3340
- * @param runtime 运行时实例,用于标识最终的运行时平台
3341
- * @param options 初始化参数
3431
+ * 清除指定会话未读数
3342
3432
  */
3343
- setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
3344
- }
3345
- interface IAPIContextOption {
3433
+ clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3346
3434
  /**
3347
- * 应用 appkey
3435
+ * 获取第一个未读消息
3348
3436
  */
3349
- appkey: string;
3437
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3350
3438
  /**
3351
- * IMLib 版本号
3439
+ * 设置/保存指定会话消息草稿
3440
+ * @draft 草稿内容
3352
3441
  */
3353
- apiVersion: string;
3442
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3354
3443
  /**
3355
- * 自定义导航地址:
3356
- * 1. 私有云环境下该值为必填项
3357
- * 2. 当存在自定义导航地址时,SDK 内部默认地址将无效
3358
- * 3. 当存在自定义导航地址时,地址 url 中需包含 http/https 协议头,否则视为无效值
3359
- * 4. 建立 ws/wss 连接前的 ping 接口使用的协议与导航 url 中的协议相同
3360
- * 5. 建立 websocket 建立连接时将根据 ping 接口使用的 http/https 协议来确定使用 ws/wss 协议
3361
- * 6. 动态导航使用的协议头将与自定义导航地址相同
3362
- * 7. 公有云默认使用 https 协议
3444
+ * 获取指定会话消息草稿
3363
3445
  */
3364
- navigators: string[];
3365
- /**
3366
- * (参数已废弃)~~c++ 协议栈数据库地址~~
3367
- * @deprecated
3368
- */
3369
- dbPath?: string;
3446
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string): IPromiseResult<string>;
3370
3447
  /**
3371
- * 小程序的 CMP 代理地址
3448
+ * 清除指定会话消息草稿
3372
3449
  */
3373
- miniCMPProxy: string[];
3450
+ clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3374
3451
  /**
3375
- * 指定默认使用的连接类型
3452
+ * 从服务端拉取会话状态
3376
3453
  */
3377
- connectionType: 'websocket' | 'comet';
3454
+ pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3378
3455
  /**
3379
- * 修改 engine log 打印等级
3456
+ * 批量设置会话 置顶、免打扰
3380
3457
  */
3381
- logLevel?: LogLevel;
3458
+ batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3459
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3382
3460
  /**
3383
- * 修改默认的 log 输出函数
3461
+ * 断开连接
3384
3462
  */
3385
- logStdout?: (logLevel: LogLevel, content: string) => void;
3463
+ disconnect(): void;
3386
3464
  /**
3387
- * (已废弃)私有云标识
3388
- * @deprecated
3465
+ * 拉取用户级配置数据
3389
3466
  */
3390
- isEnterPrise?: boolean;
3467
+ pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3391
3468
  /**
3392
- * typing状态过期时间
3469
+ * 消息注册
3470
+ * @description
3471
+ * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
3472
+ * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
3473
+ * @param objectName 消息类型,如:RC:TxtMsg
3474
+ * @param isPersited 是否存储
3475
+ * @param isCounted 是否技术
3476
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3393
3477
  */
3394
- typingExpireTime?: number;
3478
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
3395
3479
  /**
3396
- * 是否打开 IndexDB 存储,默认为 true
3397
- */
3398
- indexDBSwitch?: boolean;
3480
+ * 加入聊天室
3481
+ * @param count 拉取消息数量
3482
+ */
3483
+ joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3399
3484
  /**
3400
- * 是否校验证书,默认为 true
3401
- */
3402
- checkCA?: boolean;
3403
- }
3404
- declare class APIContext {
3405
- private _runtime;
3406
- private static _context?;
3407
- static init(runtime: IRuntime, options: IAPIContextOption): APIContext;
3408
- static destroy(): void;
3409
- private _token;
3485
+ * 加入已存在的聊天室
3486
+ * @param count 拉取消息数量
3487
+ */
3488
+ joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3410
3489
  /**
3411
- * 插件队列,用于逐一派发消息与信令
3412
- */
3413
- private _pluginContextQueue;
3490
+ * 退出聊天室
3491
+ */
3492
+ quitChatroom(chatroomId: string): Promise<ErrorCode>;
3414
3493
  /**
3415
- * 插件实例Map,用于重复初始化时返回实例
3416
- */
3417
- private _pluginInstanseMap;
3418
- private readonly _engine;
3494
+ * 获取聊天室信息
3495
+ * @param count 获取人数, 范围 0 - 20
3496
+ * @param order 排序方式, 1 正序, 2 倒序
3497
+ */
3498
+ getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
3419
3499
  /**
3420
- * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
3421
- */
3422
- readonly coreVersion: string;
3423
- readonly appkey: string;
3424
- readonly apiVersion: string;
3425
- private readonly _options;
3426
- private _versionInfo;
3427
- private _typingInfo;
3500
+ * 获取聊天室历史消息
3501
+ */
3502
+ getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
3503
+ list: IReceivedMessage[];
3504
+ hasMore: boolean;
3505
+ }>;
3428
3506
  /**
3429
- * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
3430
- */
3431
- private _isInternalConnected;
3432
- constructor(_runtime: IRuntime, options: IAPIContextOption);
3507
+ * 设置聊天室属性
3508
+ */
3509
+ setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3433
3510
  /**
3434
- * 安装使用插件,并初始化插件实例
3435
- * @param plugin
3436
- * @param options
3511
+ * 批量设置聊天室属性
3437
3512
  */
3438
- install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
3439
- private _connectionStatus;
3440
- private _canRedirectConnect;
3513
+ setChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
3514
+ code: ErrorCode;
3515
+ data?: any;
3516
+ }>;
3441
3517
  /**
3442
- * 重定向后,递归调用 connect
3443
- */
3444
- private _handleRedirect;
3518
+ * 强制设置聊天室属性
3519
+ */
3520
+ forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3445
3521
  /**
3446
- * 连接状态变更回调
3447
- * @param message
3522
+ * 删除聊天室属性
3523
+ */
3524
+ removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3525
+ /**
3526
+ * 批量删除聊天室属性
3448
3527
  */
3449
- private _connectionStatusListener;
3450
- private _messageReceiver;
3528
+ removeChatroomEntries(chatroomId: string, entries: IChrmKVEntries): Promise<{
3529
+ code: ErrorCode;
3530
+ data?: any;
3531
+ }>;
3451
3532
  /**
3452
- * 聊天室相关信息监听
3533
+ * 强制删除聊天室属性
3453
3534
  */
3454
- private _chatroomInfoListener;
3535
+ forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3455
3536
  /**
3456
- * 会话监听相关
3537
+ * 获取聊天室 key 对应 value
3457
3538
  */
3458
- private _conversationInfoListener;
3539
+ getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
3459
3540
  /**
3460
- * 消息扩展监听相关
3541
+ * 获取聊天室所有 key value
3461
3542
  */
3462
- private _expansionInfoListener;
3543
+ getAllChatroomEntry(chatroomId: string): IPromiseResult<{
3544
+ [key: string]: string;
3545
+ }>;
3463
3546
  /**
3464
- * 标签增删改监听
3465
- */
3466
- private _tagListener;
3547
+ * 获取上传认证信息
3548
+ * @description
3549
+ * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
3550
+ */
3551
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
3467
3552
  /**
3468
- * 会话标签状态监听
3469
- */
3470
- private _conversationTagListener;
3471
- private _typingStatusListener;
3472
- private _pullFinishedListener;
3473
- private _MessageBlockedListener;
3553
+ * 获取文件上传后下载地址
3554
+ */
3555
+ getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
3556
+ downloadUrl: string;
3557
+ }>;
3474
3558
  /**
3475
- * rtc 数据变更通知 pluginContext
3476
- */
3477
- private _rtcDataChange;
3559
+ * 创建标签
3560
+ * @param tag 标签
3561
+ */
3562
+ createTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
3478
3563
  /**
3479
- * 业务层事件监听器挂载点
3480
- */
3481
- private _watcher;
3564
+ * 删除标签
3565
+ * @param tagId 标签id
3566
+ */
3567
+ removeTag(tagId: string): IPromiseResult<IAsyncRes>;
3482
3568
  /**
3483
- * 添加事件监听
3484
- * @param options
3485
- */
3486
- assignWatcher(watcher: IWatcher): void;
3569
+ * 编辑标签
3570
+ * @param tag 标签
3571
+ */
3572
+ updateTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
3487
3573
  /**
3488
- * 向内存中添加 typing 信息
3489
- * 添加 typing 时不触发通知,只有在轮询时间点校验 _typingChangedList 的长度大于 0 时才通知
3574
+ * 获取标签列表
3490
3575
  */
3491
- private _addTypingInfo;
3492
- private _typingInternalTimer;
3493
- private _typingExpireTime;
3494
- private _typingChangedList;
3576
+ getTagList(): IPromiseResult<Array<ITagInfo>>;
3495
3577
  /**
3496
- * 启动定时移除typing
3578
+ * 添加会话到标签(给多个会话增加标签)
3579
+ * @param tagId 标签id
3580
+ * @param conversations 要添加的会话列表
3497
3581
  */
3498
- private _startCheckTypingInfo;
3499
- getConnectedTime(): number;
3500
- getServerTime(): number;
3501
- getDeviceId(): string;
3502
- getCurrentUserId(): string;
3503
- getConnectionStatus(): ConnectionStatus;
3582
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
3504
3583
  /**
3505
- * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
3506
- * @param token
3507
- * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
3508
- * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
3509
- * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
3510
- 由于 SDK 有断线重连功能,存在下面情况。
3511
- 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
3512
- 用户此时又在 B 设备登录,B 设备连接成功。
3513
- A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
3514
- 这个字段就是为这种情况加的。
3515
- 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
3584
+ * 删除标签中的会话(从多个会话中批量删除指定标签)
3585
+ * @param tagId 标签id
3586
+ * @param conversations 要删除的会话列表
3516
3587
  */
3517
- connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
3588
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
3518
3589
  /**
3519
- * 拉取实时配置 web 端需更新 voipCall 字段
3590
+ * 删除会话中的标签(从单一会话中批量删除标签)
3591
+ * @param conversationType 会话类型
3592
+ * @param targetId 会话id
3593
+ * @param tagIds 要删除的标签列表
3520
3594
  */
3521
- private _pullUserSettings;
3522
- disconnect(): Promise<void>;
3523
- reconnect(reconnectKickEnable?: boolean): Promise<IConnectResult>;
3524
- private _getTokenWithoutNavi;
3595
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult<IAsyncRes>;
3525
3596
  /**
3526
- * 获取当前缓存的导航数据
3597
+ * 获取标签下的会话列表
3598
+ * @param tagId 标签id
3527
3599
  */
3528
- getInfoFromCache(): INaviInfo | null;
3600
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
3529
3601
  /**
3530
- * 消息注册
3531
- * @description 消息注册需在应用初始化完成前进行
3532
- * @param objectName 消息类型,如:RC:TxtMsg
3533
- * @param isPersited 是否存储
3534
- * @param isCounted 是否技术
3535
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3602
+ * 获取标签下的未读消息数
3603
+ * @param tagId 标签id
3604
+ * @param containMuted 是否包含免打扰会话
3536
3605
  */
3537
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
3606
+ getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
3538
3607
  /**
3539
- * 发送消息
3540
- * @param conversationType
3541
- * @param targetId
3542
- * @param objectName
3543
- * @param content
3544
- * @param options
3608
+ * 设置标签中会话置顶
3609
+ * @param conversation 会话
3545
3610
  */
3546
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
3611
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult<IAsyncRes>;
3547
3612
  /**
3548
- * 发送扩展消息
3549
- * @param messageUId 消息 Id
3550
- * @param keys 需要删除的 key
3551
- * @param expansion 设置的扩展
3552
- */
3553
- sendExpansionMessage(options: ISendExMsgOptions): Promise<IAsyncRes<ErrorCode>>;
3613
+ * 获取会话里的标签
3614
+ * @param config
3615
+ */
3616
+ getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
3554
3617
  /**
3555
3618
  * 发送群组消息已读回执
3556
3619
  * 导航下发已读回执开关为 true 时调用
3557
- * @param targetId 群组会话id
3558
- * @param messageUIds 消息id
3559
3620
  */
3560
3621
  sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3561
3622
  /**
3562
3623
  * 获取群组消息已读列表
3563
- * @param targetId
3564
- * @param messageUIds
3565
3624
  */
3566
- getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
3625
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
3567
3626
  /**
3568
- * 反初始化,清空所有监听及计时器
3627
+ * 获取服务器时间
3569
3628
  */
3570
- private _destroy;
3629
+ getServerTime(): number;
3571
3630
  /**
3572
- * @param conversationType
3573
- * @param targetId 会话 Id
3574
- * @param timestamp 拉取时间戳
3575
- * @param count 拉取条数
3576
- * @param order 1 正序拉取,0 为倒序拉取
3577
- * @param channelId
3578
- * @param objectName
3631
+ * 获取设备ID
3579
3632
  */
3580
- getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
3581
- list: IReceivedMessage[];
3582
- hasMore: boolean;
3583
- }>>;
3633
+ getDeviceId(): string;
3584
3634
  /**
3585
- * 获取会话列表
3586
- * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3635
+ * 获取当前 userId
3587
3636
  */
3588
- getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3637
+ getCurrentUserId(): string;
3638
+ getConversationListWithAllChannel(): IPromiseResult<IReceivedConversation[]>;
3639
+ getConversationListWithAllChannelByPage(index: number, limit: number): IPromiseResult<IReceivedConversation[]>;
3589
3640
  /**
3590
- * 获取单一会话数据
3591
- * @param conversationType
3592
- * @param targetId
3593
- * @param channelId
3594
- */
3595
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3641
+ * 设置用户在线状态监听器
3642
+ */
3643
+ setUserStatusListener(config: {
3644
+ userIds: string[];
3645
+ }, listener: Function): void;
3596
3646
  /**
3597
- * 删除会话
3598
- */
3599
- removeConversation(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3647
+ * 设置当前用户在线状态
3648
+ */
3649
+ setUserStatus(status: number): Promise<ErrorCode>;
3600
3650
  /**
3601
- * 清除会话消息未读数
3602
- */
3603
- clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3651
+ * 订阅用户在线状态
3652
+ */
3653
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3604
3654
  /**
3605
- * 清除全部会话消息未读数
3606
- */
3607
- clearAllUnreadCount(): Promise<ErrorCode>;
3655
+ * 获取用户状态
3656
+ */
3657
+ getUserStatus(userId: string): IPromiseResult<{
3658
+ status: string;
3659
+ }>;
3608
3660
  /**
3609
- * 获取指定会话消息未读数
3610
- */
3611
- getUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<number>>;
3661
+ * 清空所有会话
3662
+ */
3663
+ clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
3612
3664
  /**
3613
- * 获取所有会话未读数
3614
- * @param channelId 多组织 Id
3615
- * @param conversationTypes
3616
- * @param includeMuted 包含已设置免打扰的会话
3617
- */
3618
- getTotalUnreadCount(channelId: string, conversationTypes?: ConversationType[], includeMuted?: boolean): Promise<IAsyncRes<number>>;
3665
+ * 加入黑名单
3666
+ */
3667
+ addToBlacklist(userId: string): Promise<ErrorCode>;
3619
3668
  /**
3620
- * 获取第一个未读消息
3621
- */
3622
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<IReceivedMessage | null>>;
3623
- setConversationStatus(conversationType: ConversationType, targetId: string, isTop?: boolean, notificationStatus?: 1 | 2, channelId?: string): Promise<ErrorCode>;
3624
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3625
- getConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<IAsyncRes<string>>;
3626
- clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3627
- recallMessage(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3669
+ * 将指定用户移除黑名单
3670
+ */
3671
+ removeFromBlacklist(userId: string): Promise<ErrorCode>;
3628
3672
  /**
3629
- * 删除远端消息
3630
- * @param conversationType
3631
- * @param targetId
3632
- * @param list
3633
- */
3634
- deleteRemoteMessage(conversationType: ConversationType, targetId: string, list: {
3635
- messageUId: string;
3636
- sentTime: number;
3637
- messageDirection: MessageDirection;
3638
- }[], channelId?: string): Promise<ErrorCode>;
3673
+ * 获取黑名单列表
3674
+ */
3675
+ getBlacklist(): IPromiseResult<string[]>;
3639
3676
  /**
3640
- * 根据时间戳删除指定时间之前的
3641
- * @param conversationType
3642
- * @param targetId
3643
- * @param timestamp
3644
- */
3645
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3677
+ * 获取指定人员在黑名单中的状态
3678
+ */
3679
+ getBlacklistStatus(userId: string): IPromiseResult<string>;
3646
3680
  /**
3647
- * 加入聊天室,若聊天室不存在则创建聊天室
3648
- * @param roomId 聊天室房间 Id
3649
- * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3650
- */
3651
- joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3681
+ * 向本地插入一条消息,不发送到服务器
3682
+ */
3683
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
3652
3684
  /**
3653
- * 加入聊天室,若聊天室不存在则抛出异常
3654
- * @param roomId 聊天室房间 Id
3655
- * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3656
- */
3657
- joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3685
+ * 删除本地消息
3686
+ */
3687
+ deleteMessages(timestamps: number[]): Promise<ErrorCode>;
3658
3688
  /**
3659
- * 退出聊天室
3660
- * @param roomId
3689
+ * 通过时间戳删除本地消息
3690
+ */
3691
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
3692
+ /**
3693
+ * 清空会话下历史消息
3694
+ */
3695
+ clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3696
+ /**
3697
+ * 获取消息
3698
+ */
3699
+ getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
3700
+ /**
3701
+ * 设置消息内容
3702
+ */
3703
+ setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3704
+ /**
3705
+ * 设置消息搜索字段
3706
+ */
3707
+ setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3708
+ /**
3709
+ * 通过关键字与 channelId 搜索所有会话
3661
3710
  */
3662
- quitChatroom(roomId: string): Promise<ErrorCode>;
3711
+ searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3663
3712
  /**
3664
- * 获取聊天室房间数据
3665
- * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
3666
- * @param roomId 聊天室 Id
3667
- * @param count 获取房间人员列表数量,最大有效值 `20`,最小值未 `0`,默认为 0
3668
- * @param order 人员排序方式,`1` 为正序,`2` 为倒序,默认为 0
3713
+ * 通过关键字搜索所有会话
3669
3714
  */
3670
- getChatroomInfo(roomId: string, count?: number, order?: 0 | 1 | 2): Promise<IAsyncRes<IChatroomInfo>>;
3715
+ searchConversationByContentWithAllChannel(keyword: string, customMessageTypes: string[], conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3671
3716
  /**
3672
- * 在指定聊天室中设置自定义属性
3673
- * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3674
- * @param roomId 聊天室房间 id
3675
- * @param entry 属性信息
3717
+ * 按内容搜索指定会话内的消息
3676
3718
  */
3677
- setChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3678
- setChatroomEntries(roomId: string, entryOptions: IChatroomEntries): Promise<{
3679
- code: ErrorCode;
3680
- data?: any;
3719
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
3720
+ messages: IReceivedMessage[];
3721
+ count: number;
3681
3722
  }>;
3682
3723
  /**
3683
- * 在指定聊天室中强制增加 / 修改任意聊天室属性
3684
- * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3685
- * @param roomId 聊天室房间 id
3686
- * @param entry 属性信息
3724
+ * 按内容搜索指定会话(不区分 channelId)的消息
3687
3725
  */
3688
- forceSetChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3726
+ searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): IPromiseResult<{
3727
+ messages: IReceivedMessage[];
3728
+ count: number;
3729
+ }>;
3689
3730
  /**
3690
- * 删除聊天室属性
3691
- * @description 该方法仅限于删除自己设置的聊天室属性
3692
- * @param roomId 聊天室房间 id
3693
- * @param entry 要移除的属性信息
3731
+ * 按内容搜索时间范围内指定会话(不区分 channelId)的消息
3694
3732
  */
3695
- removeChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3733
+ searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): IPromiseResult<{
3734
+ messages: IReceivedMessage[];
3735
+ }>;
3696
3736
  /**
3697
- * 批量删除聊天室属性
3698
- * @description 该方法仅限于删除自己设置的聊天室属性
3699
- * @param roomId 聊天室房间 id
3700
- * @param entry 要移除的属性信息
3701
- */
3702
- removeChatroomEntries(roomId: string, entryOptions: IRemoveChatRoomEntriesOption): Promise<{
3703
- code: ErrorCode;
3704
- data?: any;
3737
+ * 获取会话下所有未读的 @ 消息
3738
+ */
3739
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
3740
+ /**
3741
+ * 设置消息发送状态
3742
+ */
3743
+ setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3744
+ /**
3745
+ * 设置消息接收状态
3746
+ */
3747
+ setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3748
+ /**
3749
+ * 删除时间戳前的未读数
3750
+ */
3751
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
3752
+ /**
3753
+ * 获取会话免打扰状态
3754
+ */
3755
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
3756
+ /**
3757
+ * 协议栈获取远端历史消息
3758
+ */
3759
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
3760
+ list: IReceivedMessage[];
3761
+ hasMore: boolean;
3705
3762
  }>;
3706
3763
  /**
3707
- * 强制删除任意聊天室属性
3708
- * @description 该方法仅限于删除自己设置的聊天室属性
3709
- * @param roomId 聊天室房间 id
3710
- * @param entry 要移除的属性信息
3764
+ * 获取群组消息送达列表
3711
3765
  */
3712
- forceRemoveChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3766
+ getGroupMessageDeliverList(targetId: string, messageUId: string, channelId: string): IPromiseResult<IGroupMessageDeliverInfo>;
3713
3767
  /**
3714
- * 获取聊天室中的指定属性
3715
- * @param roomId 聊天室房间 id
3716
- * @param key 属性键名
3768
+ * 获取单聊消息送达详情
3717
3769
  */
3718
- getChatroomEntry(roomId: string, key: string): Promise<IAsyncRes<string | null>>;
3770
+ getPrivateMessageDeliverTime(messageUId: string, channelId: string): IPromiseResult<number>;
3771
+ setCallInfo(targetId: string, key: string, value: string): IPromiseResult<{
3772
+ key: string;
3773
+ value: string;
3774
+ }>;
3775
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
3776
+ quitRTCRoom(roomId: string): Promise<ErrorCode>;
3777
+ rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
3778
+ getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
3779
+ getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
3780
+ getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
3781
+ setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
3782
+ removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
3783
+ setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
3784
+ name: string;
3785
+ content: string;
3786
+ }): Promise<ErrorCode>;
3719
3787
  /**
3720
- * 获取聊天室内的所有属性
3721
- * @param roomId 聊天室房间 id
3788
+ * 全量订阅资源修改
3789
+ * @param roomId 房间 Id
3790
+ * @param message 向前兼容的消息内容
3791
+ * @param valueInfo 全量资源数据
3792
+ * @param objectName 全量 URI 消息名
3722
3793
  */
3723
- getAllChatroomEntries(roomId: string): Promise<IAsyncRes<{
3794
+ setRTCTotalRes(roomId: string, message: {
3795
+ name: string;
3796
+ content: string;
3797
+ }, valueInfo: string, objectName: string, mcuValInfo: string): Promise<ErrorCode>;
3798
+ getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
3799
+ removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
3800
+ name: string;
3801
+ content: string;
3802
+ }): Promise<ErrorCode>;
3803
+ setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
3804
+ getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
3805
+ getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
3806
+ setRTCState(roomId: string, reportId: string): Promise<ErrorCode>;
3807
+ getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
3808
+ setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
3809
+ }
3810
+
3811
+ interface IExpansionMsgContent {
3812
+ /**
3813
+ * 消息扩展的对象
3814
+ */
3815
+ put?: {
3724
3816
  [key: string]: string;
3725
- }>>;
3817
+ };
3726
3818
  /**
3727
- * 拉取聊天室内的历史消息
3728
- * @param roomId
3729
- * @param count 拉取消息条数, 有效值范围 `1 - 20`
3730
- * @param order 获取顺序,默认值为 0。
3731
- * * 0:降序,用于获取早于指定时间戳发送的消息
3732
- * * 1:升序,用于获取晚于指定时间戳发送的消息
3733
- * @param timestamp 指定拉取消息用到的时间戳。默认值为 `0`,表示按当前时间拉取
3819
+ * 删除的 keys
3820
+ */
3821
+ del?: string[];
3822
+ /**
3823
+ * messageUId
3824
+ */
3825
+ mid: string;
3826
+ /**
3827
+ * 是否删除所有, 有效值:0、1 . ( 后续如有需要, API Layer 层可使用)
3828
+ */
3829
+ removeAll?: number;
3830
+ }
3831
+
3832
+ /**
3833
+ * 被拦截的消息信息
3834
+ */
3835
+ interface IBlockedMessageInfo {
3836
+ blockedMessageUId: string;
3837
+ conversationType: number;
3838
+ targetId: string;
3839
+ channelId: string;
3840
+ blockType: MessageBlockType;
3841
+ }
3842
+
3843
+ interface IConnectResult {
3844
+ /**
3845
+ * 连接错误码
3734
3846
  */
3735
- getChatRoomHistoryMessages(roomId: string, count?: number, order?: 0 | 1, timestamp?: number): Promise<IAsyncRes<{
3736
- list: IReceivedMessage[];
3737
- hasMore: boolean;
3738
- }>>;
3847
+ code: ErrorCode;
3739
3848
  /**
3740
- * 获取存储服务鉴权信息
3741
- * @param fileType 文件类型
3742
- * @param fileName 文件名称
3743
- * @param httpMethod STC 分段上传时的必填参数,有效值为 PUT | POST
3744
- * @param queryString STC 分段上传时的查询字符串
3745
- * @description
3746
- * `httpMethod` 与 `queryString` 为 STC S3 分段上传时的专属参数,STC 分段上传包含三个过程:
3747
- * 1. 开始分段前调用,此时 `httpMethod` 值应为 `POST`, `queryString` 值为 `uploads`
3748
- * 2. 上传请求前调用,此时 `httpMethod` 值应为 `PUT`,`queryString` 值为 `partNumber={partamNumer}&uploadId={uploadId}`
3749
- * 3. 上传结束前调用,此时 `httpMethod` 值应为 `POST`,`queryString` 值为 `uploadId={uploadId}`
3750
- * @returns
3849
+ * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3751
3850
  */
3752
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
3753
- bos: string;
3754
- qiniu: string;
3755
- }>;
3851
+ userId?: string;
3852
+ }
3853
+ declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
3854
+ declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
3855
+ declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
3856
+ declare type IChatroomListener = (state: IChatroomListenerData) => void;
3857
+ declare type IRTCInnerListener = {
3858
+ message?: IMessageListnenr;
3859
+ status?: IConnectionStatusListener;
3860
+ };
3861
+ declare type IExpansionListener = (data: IExpansionListenerData) => void;
3862
+ declare type ITagListener = () => void;
3863
+ declare type IConversationTagListener = () => void;
3864
+ declare type ItypingStateListener = (data: ITypingMessage[]) => void;
3865
+ declare type IMessageDeliveredListener = (data: IMessageDeliver[]) => void;
3866
+ declare type IGroupMessageDeliveredStatusListener = (data: IGroupMessageDeliverStatus) => void;
3867
+ declare type IMessageBlockedListener = (data: IBlockedMessageInfo) => void;
3868
+ interface ISendExMsgOptions {
3869
+ channelId: string;
3870
+ conversationType: ConversationType;
3871
+ targetId: string;
3872
+ /**
3873
+ * 消息 ID
3874
+ */
3875
+ messageUId: string;
3876
+ /**
3877
+ * 原始消息是否支持扩展的字段
3878
+ */
3879
+ canIncludeExpansion: boolean;
3880
+ /**
3881
+ * 删除的 keys
3882
+ */
3883
+ keys?: string[];
3884
+ /**
3885
+ * 扩展对象
3886
+ */
3887
+ expansion?: {
3888
+ [key: string]: string;
3889
+ };
3756
3890
  /**
3757
- * 获取 七牛、百度、阿里云 上传成功可下载的 URL
3758
- * @param fileType 文件类型
3759
- * @param fileName 文件名
3760
- * @param saveName 下载后的存储文件名
3761
- * @param uploadRes 插件上传返回的结果。降级百度上传后,用户传入返回结果,再把结果里的下载地址返回给用户,保证兼容之前结果获取
3762
- * @param serverType 使用的存储服务标识
3891
+ * 是否删除所有扩展
3763
3892
  */
3764
- getFileUrl(fileType: FileType, fileName?: string, saveName?: string, uploadRes?: {
3765
- isBosRes: boolean;
3766
- downloadUrl: string;
3767
- }, serverType?: UploadMethod): Promise<{
3768
- downloadUrl: string;
3769
- }>;
3893
+ removeAll?: boolean;
3770
3894
  /**
3771
- * 创建标签
3772
- * @param tag 标签
3773
- */
3774
- createTag(tag: ITagParam): Promise<IAsyncRes>;
3895
+ * 原始消息的扩展
3896
+ */
3897
+ originExpansion?: {
3898
+ [key: string]: string;
3899
+ } | null;
3900
+ }
3901
+ interface IWatcher {
3902
+ message?: IMessageListnenr;
3903
+ connectionState?: IConnectionStatusListener;
3904
+ conversationState?: IConversationStateListener;
3905
+ chatroomState?: IChatroomListener;
3906
+ expansion?: IExpansionListener;
3775
3907
  /**
3776
- * 删除标签
3777
- * @param tagId 标签id
3908
+ * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
3778
3909
  */
3779
- removeTag(tagId: string): Promise<IAsyncRes>;
3910
+ rtcInnerWatcher?: IRTCInnerListener;
3780
3911
  /**
3781
- * 更新标签
3782
- * @param tag 标签
3912
+ * 标签的增删改监听
3783
3913
  */
3784
- updateTag(tag: ITagParam): Promise<IAsyncRes>;
3914
+ tag?: ITagListener;
3785
3915
  /**
3786
- * 获取标签列表
3916
+ * 会话中标签状态变更监听
3787
3917
  */
3788
- getTagList(): Promise<IAsyncRes<Array<ITagInfo>>>;
3918
+ conversationTagChanged?: IConversationTagListener;
3789
3919
  /**
3790
- * 添加会话到标签(给多个会话增加标签)
3791
- * @param tagId 标签id
3792
- * @param conversations 要添加的会话列表
3920
+ * 输入状态变更监听
3793
3921
  */
3794
- addTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3922
+ typingState?: ItypingStateListener;
3795
3923
  /**
3796
- * 删除标签中的会话(从多个会话中批量删除指定标签)
3797
- * @param tagId 标签id
3798
- * @param conversations 要删除的会话列表
3924
+ * 是否拉取完毕添加通知
3799
3925
  */
3800
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3926
+ pullFinished?: ITagListener;
3801
3927
  /**
3802
- * 删除会话中的标签(从单一会话中批量删除标签)
3803
- * @param conversationType 会话类型
3804
- * @param targetId 会话id
3805
- * @param tagIds 要删除的标签列表
3928
+ * 单聊消息送达通知
3806
3929
  */
3807
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): Promise<IAsyncRes<IAsyncRes>>;
3930
+ messageDelivered?: IMessageDeliveredListener;
3808
3931
  /**
3809
- * 获取标签下的会话列表
3810
- * @param tagId 标签id
3932
+ * 群聊消息送达状态通知
3811
3933
  */
3812
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): Promise<IAsyncRes<IReceivedConversationByTag[]>>;
3934
+ groupMessageDeliveredStatus?: IGroupMessageDeliveredStatusListener;
3935
+ messageBlocked?: IMessageBlockedListener;
3936
+ }
3937
+ interface IPluginGenerator<API, InitOption> {
3813
3938
  /**
3814
- * 获取标签下的未读消息数
3815
- * @param tagId 标签id
3816
- * @param containMuted 是否包含免打扰会话
3939
+ * 只读插件标识
3817
3940
  */
3818
- getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<IAsyncRes<number>>;
3941
+ readonly tag: string;
3819
3942
  /**
3820
- * 设置标签中会话置顶
3821
- * @param conversation 会话
3943
+ * 版本号
3822
3944
  */
3823
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: {
3824
- isTop: boolean;
3825
- }): Promise<IAsyncRes<IAsyncRes>>;
3945
+ readonly version?: string;
3826
3946
  /**
3827
- * 获取会话里的标签
3828
- * @param conversation
3947
+ * 插件名称
3829
3948
  */
3830
- getTagsForConversation(conversation: IConversationOption): Promise<IAsyncRes<IConversationTag[]>>;
3949
+ readonly name?: string;
3831
3950
  /**
3832
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3833
- * 对于未实现的方法,接口响应 Unsupport 错误码
3834
- * @param method 方法名
3835
- * @param args
3951
+ * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
3836
3952
  */
3837
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3838
- /**
3839
- * 删除所有会话
3840
- */
3841
- clearConversations(conversationTypes?: ConversationType[], tag?: string): Promise<ErrorCode>;
3842
- /**
3843
- * 设置用户连接状态监听器
3844
- */
3845
- setUserStatusListener(config: {
3846
- userIds: string[];
3847
- }, listener: Function): void;
3848
- /**
3849
- * 添加用户黑名单
3850
- */
3851
- addToBlacklist(userId: string): Promise<ErrorCode>;
3852
- /**
3853
- * 将指定用户移除黑名单
3854
- */
3855
- removeFromBlacklist(userId: string): Promise<ErrorCode>;
3856
- /**
3857
- * 获取黑名单列表
3858
- */
3859
- getBlacklist(): Promise<IAsyncRes<string[]>>;
3860
- /**
3861
- * 获取指定人员在黑名单中的状态
3862
- */
3863
- getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
3864
- /**
3865
- * 向本地插入一条消息,不发送到服务器
3866
- */
3867
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3868
- /**
3869
- * 删除本地消息
3870
- */
3871
- deleteMessages(timestamp: number[]): Promise<ErrorCode>;
3872
- /**
3873
- * 从本地消息数据库中删除某一会话指定时间之前的消息数据
3874
- */
3875
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId?: string): Promise<ErrorCode>;
3876
- /**
3877
- * 清空会话下历史消息
3878
- */
3879
- clearMessages(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3880
- /**
3881
- * 获取本地消息
3882
- */
3883
- getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
3953
+ verify(runtime: IRuntime): boolean;
3884
3954
  /**
3885
- * 设置消息内容
3886
- */
3887
- setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3955
+ * 插件初始化
3956
+ * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
3957
+ * @param runtime 运行时实例,用于标识最终的运行时平台
3958
+ * @param options 初始化参数
3959
+ */
3960
+ setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
3961
+ }
3962
+ interface IAPIContextOption {
3888
3963
  /**
3889
- * 设置消息搜索字段
3890
- */
3891
- setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3964
+ * 应用 appkey
3965
+ */
3966
+ appkey: string;
3892
3967
  /**
3893
- * 设置消息发送状态
3894
- */
3895
- setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3968
+ * IMLib 版本号
3969
+ */
3970
+ apiVersion: string;
3896
3971
  /**
3897
- * 设置消息接收状态
3898
- */
3899
- setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3972
+ * 自定义导航地址:
3973
+ * 1. 私有云环境下该值为必填项
3974
+ * 2. 当存在自定义导航地址时,SDK 内部默认地址将无效
3975
+ * 3. 当存在自定义导航地址时,地址 url 中需包含 http/https 协议头,否则视为无效值
3976
+ * 4. 建立 ws/wss 连接前的 ping 接口使用的协议与导航 url 中的协议相同
3977
+ * 5. 建立 websocket 建立连接时将根据 ping 接口使用的 http/https 协议来确定使用 ws/wss 协议
3978
+ * 6. 动态导航使用的协议头将与自定义导航地址相同
3979
+ * 7. 公有云默认使用 https 协议
3980
+ */
3981
+ navigators: string[];
3900
3982
  /**
3901
- * 设置当前用户在线状态
3983
+ * (参数已废弃)~~c++ 协议栈数据库地址~~
3984
+ * @deprecated
3902
3985
  */
3903
- setUserStatus(status: number): Promise<ErrorCode>;
3986
+ dbPath?: string;
3904
3987
  /**
3905
- * 订阅用户在线状态
3906
- */
3907
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3988
+ * 小程序的 CMP 代理地址
3989
+ */
3990
+ miniCMPProxy: string[];
3908
3991
  /**
3909
- * 获取用户在线状态
3910
- */
3911
- getUserStatus(userId: string): Promise<IAsyncRes<{
3912
- status: string;
3913
- }>>;
3914
- searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
3915
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
3916
- messages: IReceivedMessage[];
3917
- count: number;
3918
- }>>;
3919
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
3920
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3992
+ * 指定默认使用的连接类型
3993
+ */
3994
+ connectionType: 'websocket' | 'comet';
3921
3995
  /**
3922
- * 获取会话免打扰状态
3923
- */
3924
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<NotificationStatus>>;
3925
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): Promise<IAsyncRes<{
3926
- list: IReceivedMessage[];
3927
- hasMore: boolean;
3928
- }>>;
3996
+ * 修改 engine log 打印等级
3997
+ */
3998
+ logLevel?: LogLevel;
3929
3999
  /**
3930
- * 加入房间
3931
- * @param roomId
3932
- * @param mode 房间模式:直播 or 会议
3933
- * @param mediaType 直播房间模式下的媒体资源类型
4000
+ * 修改默认的 log 输出函数
3934
4001
  */
3935
- joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
3936
- quitRTCRoom(roomId: string): Promise<ErrorCode>;
3937
- rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
3938
- getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
3939
- getRTCUserInfoList(roomId: string): Promise<IAsyncRes<IRTCUsers>>;
3940
- getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
3941
- setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
3942
- removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
3943
- setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
3944
- name: string;
3945
- content: string;
3946
- }): Promise<ErrorCode>;
3947
- setRTCTotalRes(roomId: string, message: {
3948
- name: string;
3949
- content: string;
3950
- }, valueInfo: string, objectName: string, mcuValInfo?: string): Promise<ErrorCode>;
3951
- setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
3952
- getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): Promise<IAsyncRes<KVString>>;
3953
- removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
3954
- name: string;
3955
- content: string;
3956
- }): Promise<ErrorCode>;
3957
- setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
3958
- getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
3959
- getRTCToken(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<IRtcTokenData>>;
3960
- setRTCState(roomId: string, report: string): Promise<ErrorCode>;
3961
- getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
4002
+ logStdout?: (logLevel: LogLevel, content: string) => void;
3962
4003
  /**
3963
- * 直播观众加房间
4004
+ * (已废弃)私有云标识
4005
+ * @deprecated
3964
4006
  */
3965
- joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
3966
- token: string;
3967
- kvEntries: IServerRTCRoomEntry[];
3968
- }>>;
4007
+ isEnterPrise?: boolean;
3969
4008
  /**
3970
- * 直播观众退出房间
4009
+ * typing状态过期时间
3971
4010
  */
3972
- quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
4011
+ typingExpireTime?: number;
3973
4012
  /**
3974
- * 直播身份切换
4013
+ * 是否打开 IndexDB 存储,默认为 true
3975
4014
  */
3976
- rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
4015
+ indexDBSwitch?: boolean;
3977
4016
  /**
3978
- * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
4017
+ * 是否校验证书,默认为 true
3979
4018
  */
3980
- getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
4019
+ checkCA?: boolean;
3981
4020
  }
3982
-
3983
- /**
3984
- * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3985
- */
3986
- interface IEngine {
4021
+ declare class APIContext {
4022
+ private _runtime;
4023
+ private static _context?;
4024
+ static init(runtime: IRuntime, options: IAPIContextOption): APIContext;
4025
+ static destroy(): void;
4026
+ private _token;
3987
4027
  /**
3988
- * 建立连接
3989
- * @param token
3990
- * @param naviInfo
3991
- * @param reconnectKickEnable
4028
+ * 插件队列,用于逐一派发消息与信令
3992
4029
  */
3993
- connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
4030
+ private _pluginContextQueue;
3994
4031
  /**
3995
- * 上报版本信息
3996
- * @param version
4032
+ * 插件实例Map,用于重复初始化时返回实例
3997
4033
  */
3998
- reportSDKInfo(version: {
3999
- [name: string]: string;
4000
- }): void;
4034
+ private _pluginInstanseMap;
4035
+ private readonly _engine;
4001
4036
  /**
4002
- * 连接时间
4037
+ * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
4003
4038
  */
4004
- getConnectedTime(): number;
4039
+ readonly coreVersion: string;
4040
+ readonly appkey: string;
4041
+ readonly apiVersion: string;
4042
+ private readonly _options;
4043
+ private _versionInfo;
4044
+ private _typingInfo;
4005
4045
  /**
4006
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4007
- * 对于未实现的方法,接口响应 Unsupport 错误码
4008
- * @param method
4009
- * @param args
4046
+ * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
4010
4047
  */
4011
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
4048
+ private _isInternalConnected;
4049
+ constructor(_runtime: IRuntime, options: IAPIContextOption);
4012
4050
  /**
4013
- * 获取历史消息
4014
- * @param conversationType
4015
- * @param targetId
4016
- * @param timestamp
4017
- * @param count
4018
- * @param order
4051
+ * 安装使用插件,并初始化插件实例
4052
+ * @param plugin
4053
+ * @param options
4019
4054
  */
4020
- getHistoryMessage(conversationType: ConversationType, targetId: string,
4055
+ install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
4056
+ private _connectionStatus;
4057
+ private _canRedirectConnect;
4021
4058
  /**
4022
- * 拉取时间戳,值为 `0` 表示从当前时间拉取
4059
+ * 重定向后,递归调用 connect
4023
4060
  */
4024
- timestamp: number,
4061
+ private _handleRedirect;
4025
4062
  /**
4026
- * 获取条数, 有效值 `1` - `20`
4063
+ * 连接状态变更回调
4064
+ * @param message
4027
4065
  */
4028
- count: number,
4066
+ private _connectionStatusListener;
4067
+ private _messageReceiver;
4029
4068
  /**
4030
- * @description
4031
- * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
4032
- * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
4033
- */
4034
- order: 0 | 1,
4069
+ * 聊天室相关信息监听
4070
+ */
4071
+ private _chatroomInfoListener;
4035
4072
  /**
4036
- * 会话的业务标识
4073
+ * 会话监听相关
4037
4074
  */
4038
- channelId: string,
4075
+ private _conversationInfoListener;
4039
4076
  /**
4040
- * 消息类型
4077
+ * 消息扩展监听相关
4078
+ */
4079
+ private _expansionInfoListener;
4080
+ /**
4081
+ * 标签增删改监听
4041
4082
  */
4042
- objectName: string): IPromiseResult<{
4043
- list: IReceivedMessage[];
4044
- hasMore: boolean;
4045
- }>;
4083
+ private _tagListener;
4046
4084
  /**
4047
- * 删除历史消息 通过 messageUId
4048
- */
4049
- deleteRemoteMessage(conversationType: ConversationType, targetId: string,
4085
+ * 会话标签状态监听
4086
+ */
4087
+ private _conversationTagListener;
4088
+ private _typingStatusListener;
4089
+ private _pullFinishedListener;
4090
+ private _messageDeliveredListerer;
4091
+ private _groupMessageDeliveredStatusListerer;
4092
+ private _MessageBlockedListener;
4093
+ private _callInfoListener;
4050
4094
  /**
4051
- * @description
4052
- * message 中 messageUId、setTime、messageDirection 为必须参数
4053
- */
4054
- messages: {
4055
- messageUId: string;
4056
- sentTime: number;
4057
- messageDirection: MessageDirection;
4058
- }[],
4095
+ * rtc 数据变更通知 pluginContext
4096
+ */
4097
+ private _rtcDataChange;
4059
4098
  /**
4060
- * 会话的业务标识
4061
- */
4062
- channelId: string): Promise<ErrorCode>;
4063
- recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
4099
+ * 业务层事件监听器挂载点
4100
+ */
4101
+ private _watcher;
4064
4102
  /**
4065
- * 删除历史消息 通过 时间戳
4066
- * @param timestamp 小于等于传入时间戳的消息均删除
4067
- */
4068
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
4103
+ * 添加事件监听
4104
+ * @param options
4105
+ */
4106
+ assignWatcher(watcher: IWatcher): void;
4069
4107
  /**
4070
- * 会话的业务标识
4071
- */
4072
- channelId: string): Promise<ErrorCode>;
4108
+ * 向内存中添加 typing 信息
4109
+ * 添加 typing 时不触发通知,只有在轮询时间点校验 _typingChangedList 的长度大于 0 时才通知
4110
+ */
4111
+ private _addTypingInfo;
4112
+ private _typingInternalTimer;
4113
+ private _typingExpireTime;
4114
+ private _typingChangedList;
4073
4115
  /**
4074
- * 获取会话列表
4075
- * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
4116
+ * 启动定时移除typing
4076
4117
  */
4077
- getConversationList(
4118
+ private _startCheckTypingInfo;
4119
+ getConnectedTime(): number;
4120
+ getServerTime(): number;
4121
+ getDeviceId(): string;
4122
+ getCurrentUserId(): string;
4123
+ getConnectionStatus(): ConnectionStatus;
4078
4124
  /**
4079
- * 拉取数量, 有效值 0 - 1000, 默认 300
4125
+ * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
4126
+ * @param token
4127
+ * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
4128
+ * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
4129
+ * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
4130
+ 由于 SDK 有断线重连功能,存在下面情况。
4131
+ 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
4132
+ 用户此时又在 B 设备登录,B 设备连接成功。
4133
+ A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
4134
+ 这个字段就是为这种情况加的。
4135
+ 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
4080
4136
  */
4081
- count: number,
4137
+ connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
4082
4138
  /**
4083
- * 会话类型
4084
- * @todo 待确认是否生效
4139
+ * 拉取实时配置 web 端需更新 voipCall 字段
4085
4140
  */
4086
- conversationType?: ConversationType,
4141
+ private _pullUserSettings;
4142
+ disconnect(): Promise<void>;
4143
+ reconnect(reconnectKickEnable?: boolean): Promise<IConnectResult>;
4144
+ private _getTokenWithoutNavi;
4087
4145
  /**
4088
- * 起始时间
4089
- */
4090
- startTime?: number,
4146
+ * 获取当前缓存的导航数据
4147
+ */
4148
+ getInfoFromCache(): INaviInfo | null;
4091
4149
  /**
4092
- * 获取顺序
4093
- */
4094
- order?: 0 | 1,
4150
+ * 消息注册
4151
+ * @description 消息注册需在应用初始化完成前进行
4152
+ * @param objectName 消息类型,如:RC:TxtMsg
4153
+ * @param isPersited 是否存储
4154
+ * @param isCounted 是否技术
4155
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4156
+ */
4157
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
4095
4158
  /**
4096
- * 会话的业务标识
4097
- */
4098
- channelId?: string): IPromiseResult<IReceivedConversation[]>;
4159
+ * 发送消息
4160
+ * @param conversationType
4161
+ * @param targetId
4162
+ * @param objectName
4163
+ * @param content
4164
+ * @param options
4165
+ */
4166
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
4099
4167
  /**
4100
- * 获取指定会话
4168
+ * 发送扩展消息
4169
+ * @param messageUId 消息 Id
4170
+ * @param keys 需要删除的 key
4171
+ * @param expansion 设置的扩展
4101
4172
  */
4102
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
4173
+ sendExpansionMessage(options: ISendExMsgOptions): Promise<IAsyncRes<ErrorCode>>;
4103
4174
  /**
4104
- * 删除会话
4105
- * @description 该删除操作会删除服务器端存储的会话数据
4106
- * @param conversationType
4175
+ * 发送群组消息已读回执
4176
+ * 导航下发已读回执开关为 true 时调用
4177
+ * @param targetId 群组会话id
4178
+ * @param messageUIds 消息id
4179
+ */
4180
+ sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
4181
+ /**
4182
+ * 获取群组消息已读列表
4107
4183
  * @param targetId
4184
+ * @param messageUIds
4108
4185
  */
4109
- removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
4186
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
4110
4187
  /**
4111
- * 获取所有会话未读数
4112
- * @param channelId 多组织 Id
4113
- * @param conversationTypes
4114
- * @param includeMuted 包含已设置免打扰的会话
4188
+ * 反初始化,清空所有监听及计时器
4189
+ */
4190
+ private _destroy;
4191
+ /**
4192
+ * @param conversationType
4193
+ * @param targetId 会话 Id
4194
+ * @param timestamp 拉取时间戳
4195
+ * @param count 拉取条数
4196
+ * @param order 1 正序拉取,0 为倒序拉取
4197
+ * @param channelId
4198
+ * @param objectName
4199
+ */
4200
+ getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
4201
+ list: IReceivedMessage[];
4202
+ hasMore: boolean;
4203
+ }>>;
4204
+ /**
4205
+ * 获取会话列表
4206
+ * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
4207
+ */
4208
+ getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
4209
+ /**
4210
+ * 获取单一会话数据
4211
+ * @param conversationType
4212
+ * @param targetId
4213
+ * @param channelId
4115
4214
  */
4116
- getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
4215
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
4117
4216
  /**
4118
- * 获取指定会话未读数
4217
+ * 删除会话
4119
4218
  */
4120
- getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
4219
+ removeConversation(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4121
4220
  /**
4122
- * 清除指定会话未读数
4221
+ * 清除会话消息未读数
4123
4222
  */
4124
- clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
4223
+ clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4125
4224
  /**
4126
- * 获取第一个未读消息
4225
+ * 清除全部会话消息未读数
4127
4226
  */
4128
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
4227
+ clearAllUnreadCount(): Promise<ErrorCode>;
4129
4228
  /**
4130
- * 设置/保存指定会话消息草稿
4131
- * @draft 草稿内容
4229
+ * 获取指定会话消息未读数
4132
4230
  */
4133
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
4231
+ getUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<number>>;
4134
4232
  /**
4135
- * 获取指定会话消息草稿
4233
+ * 获取所有会话未读数
4234
+ * @param channelId 多组织 Id
4235
+ * @param conversationTypes
4236
+ * @param includeMuted 包含已设置免打扰的会话
4136
4237
  */
4137
- getConversationMessageDraft(conversationType: ConversationType, targetId: string): IPromiseResult<string>;
4238
+ getTotalUnreadCount(channelId: string, conversationTypes?: ConversationType[], includeMuted?: boolean): Promise<IAsyncRes<number>>;
4138
4239
  /**
4139
- * 清除指定会话消息草稿
4240
+ * 获取第一个未读消息
4140
4241
  */
4242
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<IReceivedMessage | null>>;
4243
+ setConversationStatus(conversationType: ConversationType, targetId: string, isTop?: boolean, notificationStatus?: 1 | 2, channelId?: string): Promise<ErrorCode>;
4244
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
4245
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<IAsyncRes<string>>;
4141
4246
  clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
4247
+ recallMessage(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
4142
4248
  /**
4143
- * 从服务端拉取会话状态
4144
- */
4145
- pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
4146
- /**
4147
- * 批量设置会话 置顶、免打扰
4249
+ * 删除远端消息
4250
+ * @param conversationType
4251
+ * @param targetId
4252
+ * @param list
4148
4253
  */
4149
- batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
4150
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
4254
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string, list: {
4255
+ messageUId: string;
4256
+ sentTime: number;
4257
+ messageDirection: MessageDirection;
4258
+ }[], channelId?: string): Promise<ErrorCode>;
4151
4259
  /**
4152
- * 断开连接
4260
+ * 根据时间戳删除指定时间之前的
4261
+ * @param conversationType
4262
+ * @param targetId
4263
+ * @param timestamp
4153
4264
  */
4154
- disconnect(): void;
4265
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4155
4266
  /**
4156
- * 拉取用户级配置数据
4267
+ * 加入聊天室,若聊天室不存在则创建聊天室
4268
+ * @param roomId 聊天室房间 Id
4269
+ * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4157
4270
  */
4158
- pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
4271
+ joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4159
4272
  /**
4160
- * 消息注册
4161
- * @description
4162
- * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
4163
- * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
4164
- * @param objectName 消息类型,如:RC:TxtMsg
4165
- * @param isPersited 是否存储
4166
- * @param isCounted 是否技术
4167
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4273
+ * 加入聊天室,若聊天室不存在则抛出异常
4274
+ * @param roomId 聊天室房间 Id
4275
+ * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4168
4276
  */
4169
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
4170
- /**
4171
- * 加入聊天室
4172
- * @param count 拉取消息数量
4173
- */
4174
- joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
4175
- /**
4176
- * 加入已存在的聊天室
4177
- * @param count 拉取消息数量
4178
- */
4179
- joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
4277
+ joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4180
4278
  /**
4181
4279
  * 退出聊天室
4182
- */
4183
- quitChatroom(chatroomId: string): Promise<ErrorCode>;
4184
- /**
4185
- * 获取聊天室信息
4186
- * @param count 获取人数, 范围 0 - 20
4187
- * @param order 排序方式, 1 正序, 2 倒序
4188
- */
4189
- getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
4190
- /**
4191
- * 获取聊天室历史消息
4192
- */
4193
- getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
4194
- list: IReceivedMessage[];
4195
- hasMore: boolean;
4196
- }>;
4280
+ * @param roomId
4281
+ */
4282
+ quitChatroom(roomId: string): Promise<ErrorCode>;
4197
4283
  /**
4198
- * 设置聊天室属性
4199
- */
4200
- setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4284
+ * 获取聊天室房间数据
4285
+ * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
4286
+ * @param roomId 聊天室 Id
4287
+ * @param count 获取房间人员列表数量,最大有效值 `20`,最小值未 `0`,默认为 0
4288
+ * @param order 人员排序方式,`1` 为正序,`2` 为倒序,默认为 0
4289
+ */
4290
+ getChatroomInfo(roomId: string, count?: number, order?: 0 | 1 | 2): Promise<IAsyncRes<IChatroomInfo>>;
4201
4291
  /**
4202
- * 批量设置聊天室属性
4292
+ * 在指定聊天室中设置自定义属性
4293
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
4294
+ * @param roomId 聊天室房间 id
4295
+ * @param entry 属性信息
4203
4296
  */
4204
- setChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
4297
+ setChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
4298
+ setChatroomEntries(roomId: string, entryOptions: IChatroomEntries): Promise<{
4205
4299
  code: ErrorCode;
4206
4300
  data?: any;
4207
4301
  }>;
4208
4302
  /**
4209
- * 强制设置聊天室属性
4210
- */
4211
- forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4303
+ * 在指定聊天室中强制增加 / 修改任意聊天室属性
4304
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
4305
+ * @param roomId 聊天室房间 id
4306
+ * @param entry 属性信息
4307
+ */
4308
+ forceSetChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
4212
4309
  /**
4213
4310
  * 删除聊天室属性
4214
- */
4215
- removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4311
+ * @description 该方法仅限于删除自己设置的聊天室属性
4312
+ * @param roomId 聊天室房间 id
4313
+ * @param entry 要移除的属性信息
4314
+ */
4315
+ removeChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
4216
4316
  /**
4217
4317
  * 批量删除聊天室属性
4318
+ * @description 该方法仅限于删除自己设置的聊天室属性
4319
+ * @param roomId 聊天室房间 id
4320
+ * @param entry 要移除的属性信息
4218
4321
  */
4219
- removeChatroomEntries(chatroomId: string, entries: IChrmKVEntries): Promise<{
4322
+ removeChatroomEntries(roomId: string, entryOptions: IRemoveChatRoomEntriesOption): Promise<{
4220
4323
  code: ErrorCode;
4221
4324
  data?: any;
4222
4325
  }>;
4223
4326
  /**
4224
- * 强制删除聊天室属性
4225
- */
4226
- forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
4327
+ * 强制删除任意聊天室属性
4328
+ * @description 该方法仅限于删除自己设置的聊天室属性
4329
+ * @param roomId 聊天室房间 id
4330
+ * @param entry 要移除的属性信息
4331
+ */
4332
+ forceRemoveChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
4227
4333
  /**
4228
- * 获取聊天室 key 对应 value
4229
- */
4230
- getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
4334
+ * 获取聊天室中的指定属性
4335
+ * @param roomId 聊天室房间 id
4336
+ * @param key 属性键名
4337
+ */
4338
+ getChatroomEntry(roomId: string, key: string): Promise<IAsyncRes<string | null>>;
4231
4339
  /**
4232
- * 获取聊天室所有 key value
4233
- */
4234
- getAllChatroomEntry(chatroomId: string): IPromiseResult<{
4340
+ * 获取聊天室内的所有属性
4341
+ * @param roomId 聊天室房间 id
4342
+ */
4343
+ getAllChatroomEntries(roomId: string): Promise<IAsyncRes<{
4235
4344
  [key: string]: string;
4236
- }>;
4345
+ }>>;
4237
4346
  /**
4238
- * 获取上传认证信息
4347
+ * 拉取聊天室内的历史消息
4348
+ * @param roomId
4349
+ * @param count 拉取消息条数, 有效值范围 `1 - 20`
4350
+ * @param order 获取顺序,默认值为 0。
4351
+ * * 0:降序,用于获取早于指定时间戳发送的消息
4352
+ * * 1:升序,用于获取晚于指定时间戳发送的消息
4353
+ * @param timestamp 指定拉取消息用到的时间戳。默认值为 `0`,表示按当前时间拉取
4354
+ */
4355
+ getChatRoomHistoryMessages(roomId: string, count?: number, order?: 0 | 1, timestamp?: number): Promise<IAsyncRes<{
4356
+ list: IReceivedMessage[];
4357
+ hasMore: boolean;
4358
+ }>>;
4359
+ /**
4360
+ * 获取存储服务鉴权信息
4361
+ * @param fileType 文件类型
4362
+ * @param fileName 文件名称
4363
+ * @param httpMethod STC 分段上传时的必填参数,有效值为 PUT | POST
4364
+ * @param queryString STC 分段上传时的查询字符串
4239
4365
  * @description
4240
- * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
4241
- */
4242
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
4366
+ * `httpMethod` `queryString` 为 STC S3 分段上传时的专属参数,STC 分段上传包含三个过程:
4367
+ * 1. 开始分段前调用,此时 `httpMethod` 值应为 `POST`, `queryString` 值为 `uploads`
4368
+ * 2. 上传请求前调用,此时 `httpMethod` 值应为 `PUT`,`queryString` 值为 `partNumber={partamNumer}&uploadId={uploadId}`
4369
+ * 3. 上传结束前调用,此时 `httpMethod` 值应为 `POST`,`queryString` 值为 `uploadId={uploadId}`
4370
+ * @returns
4371
+ */
4372
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
4373
+ bos: string;
4374
+ qiniu: string;
4375
+ }>;
4243
4376
  /**
4244
- * 获取文件上传后下载地址
4377
+ * 获取 七牛、百度、阿里云 上传成功可下载的 URL
4378
+ * @param fileType 文件类型
4379
+ * @param fileName 文件名
4380
+ * @param saveName 下载后的存储文件名
4381
+ * @param uploadRes 插件上传返回的结果。降级百度上传后,用户传入返回结果,再把结果里的下载地址返回给用户,保证兼容之前结果获取
4382
+ * @param serverType 使用的存储服务标识
4245
4383
  */
4246
- getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
4384
+ getFileUrl(fileType: FileType, fileName?: string, saveName?: string, uploadRes?: {
4385
+ isBosRes: boolean;
4386
+ downloadUrl: string;
4387
+ }, serverType?: UploadMethod): Promise<{
4247
4388
  downloadUrl: string;
4248
4389
  }>;
4249
4390
  /**
4250
4391
  * 创建标签
4251
4392
  * @param tag 标签
4252
- */
4253
- createTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
4393
+ */
4394
+ createTag(tag: ITagParam): Promise<IAsyncRes>;
4254
4395
  /**
4255
4396
  * 删除标签
4256
4397
  * @param tagId 标签id
4257
- */
4258
- removeTag(tagId: string): IPromiseResult<IAsyncRes>;
4398
+ */
4399
+ removeTag(tagId: string): Promise<IAsyncRes>;
4259
4400
  /**
4260
- * 编辑标签
4401
+ * 更新标签
4261
4402
  * @param tag 标签
4262
- */
4263
- updateTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
4403
+ */
4404
+ updateTag(tag: ITagParam): Promise<IAsyncRes>;
4264
4405
  /**
4265
4406
  * 获取标签列表
4266
4407
  */
4267
- getTagList(): IPromiseResult<Array<ITagInfo>>;
4408
+ getTagList(): Promise<IAsyncRes<Array<ITagInfo>>>;
4268
4409
  /**
4269
4410
  * 添加会话到标签(给多个会话增加标签)
4270
4411
  * @param tagId 标签id
4271
4412
  * @param conversations 要添加的会话列表
4272
4413
  */
4273
- addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
4414
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
4274
4415
  /**
4275
4416
  * 删除标签中的会话(从多个会话中批量删除指定标签)
4276
4417
  * @param tagId 标签id
4277
4418
  * @param conversations 要删除的会话列表
4278
4419
  */
4279
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
4420
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
4280
4421
  /**
4281
4422
  * 删除会话中的标签(从单一会话中批量删除标签)
4282
4423
  * @param conversationType 会话类型
4283
4424
  * @param targetId 会话id
4284
4425
  * @param tagIds 要删除的标签列表
4285
4426
  */
4286
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult<IAsyncRes>;
4427
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): Promise<IAsyncRes<IAsyncRes>>;
4287
4428
  /**
4288
4429
  * 获取标签下的会话列表
4289
- * @param tagId 标签id
4290
- */
4291
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
4292
- /**
4293
- * 获取标签下的未读消息数
4294
- * @param tagId 标签id
4295
- * @param containMuted 是否包含免打扰会话
4296
- */
4297
- getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
4298
- /**
4299
- * 设置标签中会话置顶
4300
- * @param conversation 会话
4301
- */
4302
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult<IAsyncRes>;
4303
- /**
4304
- * 获取会话里的标签
4305
- * @param config
4306
- */
4307
- getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
4308
- /**
4309
- * 发送群组消息已读回执
4310
- * 导航下发已读回执开关为 true 时调用
4430
+ * @param tagId 标签id
4311
4431
  */
4312
- sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
4432
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): Promise<IAsyncRes<IReceivedConversationByTag[]>>;
4313
4433
  /**
4314
- * 获取群组消息已读列表
4434
+ * 获取标签下的未读消息数
4435
+ * @param tagId 标签id
4436
+ * @param containMuted 是否包含免打扰会话
4315
4437
  */
4316
- getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
4438
+ getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<IAsyncRes<number>>;
4317
4439
  /**
4318
- * 获取服务器时间
4440
+ * 设置标签中会话置顶
4441
+ * @param conversation 会话
4319
4442
  */
4320
- getServerTime(): number;
4443
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: {
4444
+ isTop: boolean;
4445
+ }): Promise<IAsyncRes<IAsyncRes>>;
4321
4446
  /**
4322
- * 获取设备ID
4447
+ * 获取会话里的标签
4448
+ * @param conversation
4323
4449
  */
4324
- getDeviceId(): string;
4450
+ getTagsForConversation(conversation: IConversationOption): Promise<IAsyncRes<IConversationTag[]>>;
4325
4451
  /**
4326
- * 获取当前 userId
4452
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4453
+ * 对于未实现的方法,接口响应 Unsupport 错误码
4454
+ * @param method 方法名
4455
+ * @param args
4327
4456
  */
4328
- getCurrentUserId(): string;
4457
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
4329
4458
  /**
4330
- * 设置用户在线状态监听器
4459
+ * 删除所有会话
4460
+ */
4461
+ clearConversations(conversationTypes?: ConversationType[], tag?: string): Promise<ErrorCode>;
4462
+ /**
4463
+ * 设置用户连接状态监听器
4331
4464
  */
4332
4465
  setUserStatusListener(config: {
4333
4466
  userIds: string[];
4334
4467
  }, listener: Function): void;
4335
4468
  /**
4336
- * 设置当前用户在线状态
4337
- */
4338
- setUserStatus(status: number): Promise<ErrorCode>;
4339
- /**
4340
- * 订阅用户在线状态
4341
- */
4342
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4343
- /**
4344
- * 获取用户状态
4345
- */
4346
- getUserStatus(userId: string): IPromiseResult<{
4347
- status: string;
4348
- }>;
4349
- /**
4350
- * 清空所有会话
4351
- */
4352
- clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
4353
- /**
4354
- * 加入黑名单
4469
+ * 添加用户黑名单
4355
4470
  */
4356
4471
  addToBlacklist(userId: string): Promise<ErrorCode>;
4357
4472
  /**
4358
- * 将指定用户移除黑名单
4473
+ * 将指定用户移除黑名单
4359
4474
  */
4360
4475
  removeFromBlacklist(userId: string): Promise<ErrorCode>;
4361
4476
  /**
4362
- * 获取黑名单列表
4477
+ * 获取黑名单列表
4363
4478
  */
4364
- getBlacklist(): IPromiseResult<string[]>;
4479
+ getBlacklist(): Promise<IAsyncRes<string[]>>;
4365
4480
  /**
4366
- * 获取指定人员在黑名单中的状态
4481
+ * 获取指定人员在黑名单中的状态
4367
4482
  */
4368
- getBlacklistStatus(userId: string): IPromiseResult<string>;
4483
+ getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
4369
4484
  /**
4370
4485
  * 向本地插入一条消息,不发送到服务器
4371
4486
  */
4372
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
4487
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
4373
4488
  /**
4374
4489
  * 删除本地消息
4375
4490
  */
4376
- deleteMessages(timestamps: number[]): Promise<ErrorCode>;
4491
+ deleteMessages(timestamp: number[]): Promise<ErrorCode>;
4377
4492
  /**
4378
- * 通过时间戳删除本地消息
4493
+ * 从本地消息数据库中删除某一会话指定时间之前的消息数据
4379
4494
  */
4380
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
4495
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId?: string): Promise<ErrorCode>;
4381
4496
  /**
4382
4497
  * 清空会话下历史消息
4383
4498
  */
4384
- clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
4499
+ clearMessages(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4385
4500
  /**
4386
- * 获取消息
4501
+ * 获取本地消息
4387
4502
  */
4388
- getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
4503
+ getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
4389
4504
  /**
4390
4505
  * 设置消息内容
4391
4506
  */
@@ -4394,49 +4509,76 @@ interface IEngine {
4394
4509
  * 设置消息搜索字段
4395
4510
  */
4396
4511
  setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
4397
- /**
4398
- * 通过关键字搜索会话
4399
- */
4400
- searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
4401
- /**
4402
- * 按内容搜索会话内的消息
4403
- */
4404
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
4405
- messages: IReceivedMessage[];
4406
- count: number;
4407
- }>;
4408
- /**
4409
- * 获取会话下所有未读的 @ 消息
4410
- */
4411
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
4412
4512
  /**
4413
4513
  * 设置消息发送状态
4414
4514
  */
4415
4515
  setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
4416
4516
  /**
4417
- * 设置消息接收状态
4517
+ * 设置消息接收状态
4418
4518
  */
4419
4519
  setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
4420
4520
  /**
4421
- * 删除时间戳前的未读数
4521
+ * 设置当前用户在线状态
4422
4522
  */
4423
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
4523
+ setUserStatus(status: number): Promise<ErrorCode>;
4424
4524
  /**
4425
- * 获取会话免打扰状态
4525
+ * 订阅用户在线状态
4426
4526
  */
4427
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
4527
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4428
4528
  /**
4429
- * 协议栈获取远端历史消息
4529
+ * 获取用户在线状态
4430
4530
  */
4431
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
4531
+ getUserStatus(userId: string): Promise<IAsyncRes<{
4532
+ status: string;
4533
+ }>>;
4534
+ searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
4535
+ searchConversationByContentWithAllChannel(keyword: string, customMessageTypes?: string[], conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
4536
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
4537
+ messages: IReceivedMessage[];
4538
+ count: number;
4539
+ }>>;
4540
+ searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): Promise<IAsyncRes<{
4541
+ messages: IReceivedMessage[];
4542
+ count: number;
4543
+ }>>;
4544
+ searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): Promise<IAsyncRes<{
4545
+ messages: IReceivedMessage[];
4546
+ }>>;
4547
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
4548
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4549
+ /**
4550
+ * 获取会话免打扰状态
4551
+ */
4552
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<NotificationStatus>>;
4553
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): Promise<IAsyncRes<{
4432
4554
  list: IReceivedMessage[];
4433
4555
  hasMore: boolean;
4556
+ }>>;
4557
+ /**
4558
+ * 获取群组消息送达信息
4559
+ */
4560
+ getGroupMessageDeliverList(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IGroupMessageDeliverInfo>;
4561
+ /**
4562
+ * 获取单聊消息送达信息
4563
+ */
4564
+ getPrivateMessageDeliverTime(messageUId: string, channelId?: string): IPromiseResult<number>;
4565
+ setCallInfo(targetId: string, key: string, value: string): IPromiseResult<{
4566
+ key: string;
4567
+ value: string;
4434
4568
  }>;
4435
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4569
+ getConversationListWithAllChannel(): Promise<IAsyncRes<IReceivedConversation[]>>;
4570
+ getConversationListWithAllChannelByPage(index: number, limit: number): Promise<IAsyncRes<IReceivedConversation[]>>;
4571
+ /**
4572
+ * 加入房间
4573
+ * @param roomId
4574
+ * @param mode 房间模式:直播 or 会议
4575
+ * @param mediaType 直播房间模式下的媒体资源类型
4576
+ */
4577
+ joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
4436
4578
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4437
- rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4438
- getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
4439
- getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
4579
+ rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
4580
+ getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
4581
+ getRTCUserInfoList(roomId: string): Promise<IAsyncRes<IRTCUsers>>;
4440
4582
  getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
4441
4583
  setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
4442
4584
  removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
@@ -4444,49 +4586,40 @@ interface IEngine {
4444
4586
  name: string;
4445
4587
  content: string;
4446
4588
  }): Promise<ErrorCode>;
4447
- /**
4448
- * 全量订阅资源修改
4449
- * @param roomId 房间 Id
4450
- * @param message 向前兼容的消息内容
4451
- * @param valueInfo 全量资源数据
4452
- * @param objectName 全量 URI 消息名
4453
- */
4454
4589
  setRTCTotalRes(roomId: string, message: {
4455
4590
  name: string;
4456
4591
  content: string;
4457
- }, valueInfo: string, objectName: string, mcuValInfo: string): Promise<ErrorCode>;
4458
- getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
4592
+ }, valueInfo: string, objectName: string, mcuValInfo?: string): Promise<ErrorCode>;
4593
+ setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4594
+ getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): Promise<IAsyncRes<KVString>>;
4459
4595
  removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
4460
4596
  name: string;
4461
4597
  content: string;
4462
4598
  }): Promise<ErrorCode>;
4463
4599
  setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
4464
4600
  getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
4465
- getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
4466
- setRTCState(roomId: string, reportId: string): Promise<ErrorCode>;
4601
+ getRTCToken(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<IRtcTokenData>>;
4602
+ setRTCState(roomId: string, report: string): Promise<ErrorCode>;
4467
4603
  getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
4468
- setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4469
- }
4470
-
4471
- interface IExpansionMsgContent {
4472
4604
  /**
4473
- * 消息扩展的对象
4474
- */
4475
- put?: {
4476
- [key: string]: string;
4477
- };
4605
+ * 直播观众加房间
4606
+ */
4607
+ joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
4608
+ token: string;
4609
+ kvEntries: IServerRTCRoomEntry[];
4610
+ }>>;
4478
4611
  /**
4479
- * 删除的 keys
4480
- */
4481
- del?: string[];
4612
+ * 直播观众退出房间
4613
+ */
4614
+ quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
4482
4615
  /**
4483
- * messageUId
4484
- */
4485
- mid: string;
4616
+ * 直播身份切换
4617
+ */
4618
+ rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
4486
4619
  /**
4487
- * 是否删除所有, 有效值:0、1 . ( 后续如有需要, API Layer 层可使用)
4488
- */
4489
- removeAll?: number;
4620
+ * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
4621
+ */
4622
+ getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
4490
4623
  }
4491
4624
 
4492
4625
  declare class RTCPluginContext extends PluginContext {
@@ -4584,34 +4717,6 @@ declare class RTCPluginContext extends PluginContext {
4584
4717
  rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4585
4718
  }
4586
4719
 
4587
- declare abstract class ANavi {
4588
- protected readonly _runtime: IRuntime;
4589
- protected readonly _options: IAPIContextOption;
4590
- protected readonly _apiVersion: string;
4591
- protected readonly _appkey: string;
4592
- protected _naviInfo: INaviInfo | null;
4593
- constructor(_runtime: IRuntime, _options: IAPIContextOption);
4594
- /**
4595
- * @param uris
4596
- * @param appkey
4597
- * @param token
4598
- */
4599
- protected abstract _reqNavi(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
4600
- /**
4601
- * 获取导航数据
4602
- * @param token
4603
- * @param dynamicUris token 携带的动态导航地址
4604
- * @param force 是否强制重新获取并清空缓存数据
4605
- */
4606
- getInfo(token: string, dynamicUris: string[], force: boolean, checkCA?: boolean): Promise<INaviInfo | null>;
4607
- protected setNaviInfo2Cache(token: string, naviInfo: INaviInfo): void;
4608
- getInfoFromCache(token: string): INaviInfo | null;
4609
- /**
4610
- * 清空导航数据:内存数据、缓存数据
4611
- */
4612
- private _clear;
4613
- }
4614
-
4615
4720
  interface IEngineWatcher {
4616
4721
  /**
4617
4722
  * @param message 消息
@@ -4630,6 +4735,9 @@ interface IEngineWatcher {
4630
4735
  */
4631
4736
  onRTCDataChange: (data: IServerRTCRoomEntry[], roomId?: string) => void;
4632
4737
  pullFinished: () => void;
4738
+ messageDelivered: (data: IMessageDeliver[]) => void;
4739
+ groupMessageDeliveredStatus: (data: IGroupMessageDeliverStatus) => void;
4740
+ callInfo: (data: string) => void;
4633
4741
  }
4634
4742
  /**
4635
4743
  * 引擎定义
@@ -4638,23 +4746,37 @@ declare abstract class AEngine implements IEngine {
4638
4746
  readonly runtime: IRuntime;
4639
4747
  protected readonly _watcher: IEngineWatcher;
4640
4748
  protected readonly _options: IAPIContextOption;
4641
- /**
4642
- * 当前用户 Id
4643
- */
4644
- currentUserId: string;
4645
4749
  /**
4646
4750
  * 连接时间
4647
4751
  */
4648
4752
  abstract getConnectedTime(): number;
4649
- readonly navi: ANavi;
4650
4753
  protected readonly _appkey: string;
4651
4754
  protected readonly _apiVer: string;
4755
+ protected readonly _apiVersion: string;
4652
4756
  /**
4653
4757
  * 引擎初始化
4654
4758
  * @param _appkey
4655
4759
  */
4656
4760
  constructor(runtime: IRuntime, _watcher: IEngineWatcher, _options: IAPIContextOption);
4657
- protected abstract _createNavi(): ANavi;
4761
+ /**
4762
+ * @param uris
4763
+ * @param appkey
4764
+ * @param token
4765
+ */
4766
+ abstract getNaviInfo(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
4767
+ /**
4768
+ * 获取导航数据
4769
+ * @param token
4770
+ * @param dynamicUris token 携带的动态导航地址
4771
+ * @param force 是否强制重新获取并清空缓存数据
4772
+ */
4773
+ getInfo(token: string, dynamicUris: string[], force: boolean, checkCA?: boolean): Promise<INaviInfo | null>;
4774
+ protected setNaviInfo2Cache(token: string, naviInfo: INaviInfo): void;
4775
+ abstract getNaviInfoFromCache(): INaviInfo | null;
4776
+ /**
4777
+ * 清空导航数据:内存数据、缓存数据
4778
+ */
4779
+ private _clear;
4658
4780
  /**
4659
4781
  * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4660
4782
  * 对于未实现的方法,接口响应 Unsupport 错误码
@@ -5018,6 +5140,8 @@ declare abstract class AEngine implements IEngine {
5018
5140
  * 获取当前 userId
5019
5141
  */
5020
5142
  abstract getCurrentUserId(): string;
5143
+ abstract getConversationListWithAllChannel(): IPromiseResult<IReceivedConversation[]>;
5144
+ abstract getConversationListWithAllChannelByPage(index: number, limit: number): IPromiseResult<IReceivedConversation[]>;
5021
5145
  /**
5022
5146
  * 设置用户在线状态监听器
5023
5147
  */
@@ -5090,6 +5214,10 @@ declare abstract class AEngine implements IEngine {
5090
5214
  * 通过关键字搜索会话
5091
5215
  */
5092
5216
  abstract searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
5217
+ /**
5218
+ * 通过关键字搜索所有会话
5219
+ */
5220
+ abstract searchConversationByContentWithAllChannel(keyword: string, customMessageTypes: string[], conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
5093
5221
  /**
5094
5222
  * 按内容搜索会话内的消息
5095
5223
  */
@@ -5097,6 +5225,19 @@ declare abstract class AEngine implements IEngine {
5097
5225
  messages: IReceivedMessage[];
5098
5226
  count: number;
5099
5227
  }>;
5228
+ /**
5229
+ * 按内容搜索指定会话(不区分 channelId)的消息
5230
+ */
5231
+ abstract searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): IPromiseResult<{
5232
+ messages: IReceivedMessage[];
5233
+ count: number;
5234
+ }>;
5235
+ /**
5236
+ * 按内容搜索时间范围内指定会话(不区分 channelId)的消息
5237
+ */
5238
+ abstract searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): IPromiseResult<{
5239
+ messages: IReceivedMessage[];
5240
+ }>;
5100
5241
  /**
5101
5242
  * 获取会话下所有未读的 @ 消息
5102
5243
  */
@@ -5124,6 +5265,18 @@ declare abstract class AEngine implements IEngine {
5124
5265
  list: IReceivedMessage[];
5125
5266
  hasMore: boolean;
5126
5267
  }>;
5268
+ /**
5269
+ * 获取群组消息送达列表
5270
+ */
5271
+ abstract getGroupMessageDeliverList(targetId: string, messageUId: string, channelId: string): IPromiseResult<IGroupMessageDeliverInfo>;
5272
+ /**
5273
+ * 获取单聊消息送达列表
5274
+ */
5275
+ abstract getPrivateMessageDeliverTime(messageUId: string, channelId: string): IPromiseResult<number>;
5276
+ abstract setCallInfo(targetId: string, key: string, value: string): IPromiseResult<{
5277
+ key: string;
5278
+ value: string;
5279
+ }>;
5127
5280
  abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
5128
5281
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
5129
5282
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
@@ -5628,4 +5781,4 @@ declare enum CONNECTION_TYPE {
5628
5781
  */
5629
5782
  declare const version: string;
5630
5783
 
5631
- 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, MessageBlockType, 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 };
5784
+ export { AEngine, 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, IDeliveredUser, IEngine, IEngineWatcher, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGroupMessageDeliverInfo, IGroupMessageDeliverStatus, IGroupMessageDeliveredStatusListener, IInsertMsgOptions, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_COMET_PULLMSG_TIMEOUT, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageBlockedListener, IMessageDeliver, IMessageDeliveredListener, 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, MessageBlockType, 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 };