@rongcloud/engine 4.5.4 → 4.6.0-beem.1

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