@rongcloud/engine 4.4.10 → 4.5.0-alpha.4

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.4.10
3
- * CommitId - 14053676af3c75f4975149af39a5b25a298490f2
4
- * Thu Oct 14 2021 11:23:11 GMT+0800 (China Standard Time)
2
+ * RCEngine - v4.5.0-alpha.4
3
+ * CommitId - aed25bcb04db37260a1cc8910f8992d194ae850c
4
+ * Tue Nov 30 2021 16:31:39 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  /**
@@ -337,6 +337,11 @@ interface IChrmKVEntry {
337
337
  type?: number;
338
338
  isDeleted?: boolean;
339
339
  }
340
+ interface IChrmKVPullData {
341
+ kvEntries: IChrmKVEntry[];
342
+ isFullUpdate?: boolean;
343
+ syncTime?: number;
344
+ }
340
345
  interface IServerConversationStatus {
341
346
  conversationType: number;
342
347
  targetId: string;
@@ -1171,6 +1176,23 @@ declare enum RTCIdentityChangeType {
1171
1176
  AnchorToViewer = 1,
1172
1177
  ViewerToAnchor = 2
1173
1178
  }
1179
+ /**
1180
+ * RTC 房间加入类型
1181
+ */
1182
+ declare enum RTCJoinType {
1183
+ /**
1184
+ * 踢前一个设备
1185
+ */
1186
+ KICK = 0,
1187
+ /**
1188
+ * 当前加入拒绝
1189
+ */
1190
+ REFUSE = 1,
1191
+ /**
1192
+ * 两个设备共存
1193
+ */
1194
+ COEXIST = 2
1195
+ }
1174
1196
 
1175
1197
  declare enum MessageDirection {
1176
1198
  /**
@@ -1264,7 +1286,14 @@ declare class DataCodec {
1264
1286
  * 格式化 RTC 用户加入房间后通知拉取的数据(房间内主播全量列表、房间全量资源)
1265
1287
  */
1266
1288
  private _formatRTCRoomKVList;
1289
+ /**
1290
+ * 格式化观众加房间后返回数据
1291
+ */
1267
1292
  private _formatRTCAuidenceJoinRoomData;
1293
+ /**
1294
+ * 格式化加入 RTC 房间的用户信息
1295
+ */
1296
+ private _formatRTCJoinedUserInfo;
1268
1297
  /**
1269
1298
  * ===== 以下为通用数据 序列化为 PB 数据 =====
1270
1299
  * Engine Index 调用处理数据
@@ -1393,7 +1422,7 @@ declare class DataCodec {
1393
1422
  /**
1394
1423
  * 加入 RTC 房间
1395
1424
  */
1396
- encodeJoinRTCRoom(mode: RTCMode, broadcastType?: number): any[];
1425
+ encodeJoinRTCRoom(mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): any[];
1397
1426
  /**
1398
1427
  * 退出 RTC 房间
1399
1428
  */
@@ -1452,6 +1481,10 @@ declare class DataCodec {
1452
1481
  * RTC 直播观众拉取房间内 KV
1453
1482
  */
1454
1483
  encodePullRTCRoomKV(roomId: string, timestamp: number): any;
1484
+ /**
1485
+ * RTC 查询在房间内用户的信息
1486
+ */
1487
+ encodeQueryUserJoinedInfo(userId: string): any;
1455
1488
  }
1456
1489
 
1457
1490
  /**
@@ -2424,6 +2457,24 @@ interface IUpdatedConversation {
2424
2457
  tags?: IUpdatedConversation[];
2425
2458
  }
2426
2459
 
2460
+ /**
2461
+ * 加入 RTC 房间的用户信息
2462
+ */
2463
+ interface IRTCJoinedInfo {
2464
+ /**
2465
+ * 设备 ID
2466
+ */
2467
+ deviceId: string;
2468
+ /**
2469
+ * RTC 房间 ID
2470
+ */
2471
+ roomId: string;
2472
+ /**
2473
+ * 加入的时间戳
2474
+ */
2475
+ joinTime: number;
2476
+ }
2477
+
2427
2478
  declare class PluginContext {
2428
2479
  protected readonly _context: APIContext;
2429
2480
  constructor(_context: APIContext);
@@ -2493,6 +2544,10 @@ declare class PluginContext {
2493
2544
  * 获取服务时间
2494
2545
  */
2495
2546
  getServerTime(): number;
2547
+ /**
2548
+ * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
2549
+ */
2550
+ getRTCJoinedUserInfo(userId: string): IPromiseResult<IRTCJoinedInfo[]>;
2496
2551
  }
2497
2552
 
2498
2553
  declare enum ReceivedStatus {
@@ -2667,7 +2722,11 @@ declare enum MessageType {
2667
2722
  /**
2668
2723
  * 接受群已读回执更新消息(导航开关grpRRVer为1时使用)
2669
2724
  */
2670
- GROUP_READ_RECEIPT_REQUEST = "RC:RRMsg"
2725
+ GROUP_READ_RECEIPT_REQUEST = "RC:RRMsg",
2726
+ /**
2727
+ * 消息送达报告,仅单聊
2728
+ */
2729
+ DELIVERED = "RC:Delivered"
2671
2730
  }
2672
2731
 
2673
2732
  /**
@@ -2973,1111 +3032,1148 @@ interface ITypingMessage {
2973
3032
  list: Array<ITypingUser>;
2974
3033
  }
2975
3034
 
2976
- interface IConnectResult {
3035
+ /**
3036
+ * 消息送达相关接口
3037
+ */
3038
+
3039
+ interface IDeliveredUser {
3040
+ time: number;
3041
+ userId: string;
3042
+ }
3043
+ interface IGroupMessageDeliverInfo {
3044
+ totalCount: number;
3045
+ list: IDeliveredUser[];
3046
+ }
3047
+ interface IMessageDeliver {
3048
+ deliverTime: number;
3049
+ messageUId: string;
3050
+ conversationType: ConversationType;
3051
+ targetId: string;
3052
+ }
3053
+
3054
+ /**
3055
+ * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3056
+ */
3057
+ interface IEngine {
2977
3058
  /**
2978
- * 连接错误码
3059
+ * 建立连接
3060
+ * @param token
3061
+ * @param naviInfo
2979
3062
  */
2980
- code: ErrorCode;
3063
+ connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
2981
3064
  /**
2982
- * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3065
+ * 上报版本信息
3066
+ * @param version
2983
3067
  */
2984
- userId?: string;
2985
- }
2986
- declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
2987
- declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
2988
- declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
2989
- declare type IChatroomListener = (state: IChatroomListenerData) => void;
2990
- declare type IRTCInnerListener = {
2991
- message?: IMessageListnenr;
2992
- status?: IConnectionStatusListener;
2993
- };
2994
- declare type IExpansionListener = (data: IExpansionListenerData) => void;
2995
- declare type ITagListener = () => void;
2996
- declare type IConversationTagListener = () => void;
2997
- declare type ItypingStateListener = (data: ITypingMessage[]) => void;
2998
- interface ISendExMsgOptions {
2999
- channelId: string;
3000
- conversationType: ConversationType;
3001
- targetId: string;
3068
+ reportSDKInfo(version: {
3069
+ [name: string]: string;
3070
+ }): void;
3002
3071
  /**
3003
- * 消息 ID
3072
+ * 连接时间
3073
+ */
3074
+ getConnectedTime(): number;
3075
+ /**
3076
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3077
+ * 对于未实现的方法,接口响应 Unsupport 错误码
3078
+ * @param method
3079
+ * @param args
3080
+ */
3081
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3082
+ /**
3083
+ * 获取历史消息
3084
+ * @param conversationType
3085
+ * @param targetId
3086
+ * @param timestamp
3087
+ * @param count
3088
+ * @param order
3089
+ */
3090
+ getHistoryMessage(conversationType: ConversationType, targetId: string,
3091
+ /**
3092
+ * 拉取时间戳,值为 `0` 表示从当前时间拉取
3093
+ */
3094
+ timestamp: number,
3095
+ /**
3096
+ * 获取条数, 有效值 `1` - `20`
3097
+ */
3098
+ count: number,
3099
+ /**
3100
+ * @description
3101
+ * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
3102
+ * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3103
+ */
3104
+ order: 0 | 1,
3105
+ /**
3106
+ * 会话的业务标识
3004
3107
  */
3005
- messageUId: string;
3108
+ channelId: string,
3006
3109
  /**
3007
- * 原始消息是否支持扩展的字段
3110
+ * 消息类型
3111
+ */
3112
+ objectName: string): IPromiseResult<{
3113
+ list: IReceivedMessage[];
3114
+ hasMore: boolean;
3115
+ }>;
3116
+ /**
3117
+ * 删除历史消息 通过 messageUId
3008
3118
  */
3009
- canIncludeExpansion: boolean;
3119
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string,
3010
3120
  /**
3011
- * 删除的 keys
3121
+ * @description
3122
+ * message 中 messageUId、setTime、messageDirection 为必须参数
3012
3123
  */
3013
- keys?: string[];
3124
+ messages: {
3125
+ messageUId: string;
3126
+ sentTime: number;
3127
+ messageDirection: MessageDirection;
3128
+ }[],
3014
3129
  /**
3015
- * 扩展对象
3130
+ * 会话的业务标识
3016
3131
  */
3017
- expansion?: {
3018
- [key: string]: string;
3019
- };
3132
+ channelId: string): Promise<ErrorCode>;
3133
+ recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3020
3134
  /**
3021
- * 是否删除所有扩展
3135
+ * 删除历史消息 通过 时间戳
3136
+ * @param timestamp 小于等于传入时间戳的消息均删除
3022
3137
  */
3023
- removeAll?: boolean;
3138
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3024
3139
  /**
3025
- * 原始消息的扩展
3140
+ * 会话的业务标识
3026
3141
  */
3027
- originExpansion?: {
3028
- [key: string]: string;
3029
- } | null;
3030
- }
3031
- interface IWatcher {
3032
- message?: IMessageListnenr;
3033
- connectionState?: IConnectionStatusListener;
3034
- conversationState?: IConversationStateListener;
3035
- chatroomState?: IChatroomListener;
3036
- expansion?: IExpansionListener;
3142
+ channelId: string): Promise<ErrorCode>;
3037
3143
  /**
3038
- * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
3144
+ * 获取会话列表
3145
+ * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3039
3146
  */
3040
- rtcInnerWatcher?: IRTCInnerListener;
3147
+ getConversationList(
3041
3148
  /**
3042
- * 标签的增删改监听
3149
+ * 拉取数量, 有效值 0 - 1000, 默认 300
3043
3150
  */
3044
- tag?: ITagListener;
3151
+ count: number,
3045
3152
  /**
3046
- * 会话中标签状态变更监听
3153
+ * 会话类型
3154
+ * @todo 待确认是否生效
3047
3155
  */
3048
- conversationTagChanged?: IConversationTagListener;
3156
+ conversationType?: ConversationType,
3049
3157
  /**
3050
- * 输入状态变更监听
3158
+ * 起始时间
3159
+ */
3160
+ startTime?: number,
3161
+ /**
3162
+ * 获取顺序
3163
+ */
3164
+ order?: 0 | 1,
3165
+ /**
3166
+ * 会话的业务标识
3167
+ */
3168
+ channelId?: string): IPromiseResult<IReceivedConversation[]>;
3169
+ /**
3170
+ * 获取指定会话
3171
+ */
3172
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3173
+ /**
3174
+ * 删除会话
3175
+ * @description 该删除操作会删除服务器端存储的会话数据
3176
+ * @param conversationType
3177
+ * @param targetId
3051
3178
  */
3052
- typingState?: ItypingStateListener;
3179
+ removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3053
3180
  /**
3054
- * 是否拉取完毕添加通知
3181
+ * 获取所有会话未读数
3182
+ * @param channelId 多组织 Id
3183
+ * @param conversationTypes
3184
+ * @param includeMuted 包含已设置免打扰的会话
3055
3185
  */
3056
- pullFinished?: ITagListener;
3057
- }
3058
- interface IPluginGenerator<API, InitOption> {
3186
+ getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3059
3187
  /**
3060
- * 只读插件标识
3188
+ * 获取指定会话未读数
3061
3189
  */
3062
- readonly tag: string;
3190
+ getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3063
3191
  /**
3064
- * 版本号
3192
+ * 清除指定会话未读数
3065
3193
  */
3066
- readonly version?: string;
3194
+ clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3067
3195
  /**
3068
- * 插件名称
3196
+ * 获取第一个未读消息
3069
3197
  */
3070
- readonly name?: string;
3198
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3071
3199
  /**
3072
- * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
3200
+ * 设置/保存指定会话消息草稿
3201
+ * @draft 草稿内容
3073
3202
  */
3074
- verify(runtime: IRuntime): boolean;
3203
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3075
3204
  /**
3076
- * 插件初始化
3077
- * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
3078
- * @param runtime 运行时实例,用于标识最终的运行时平台
3079
- * @param options 初始化参数
3205
+ * 获取指定会话消息草稿
3080
3206
  */
3081
- setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
3082
- }
3083
- interface IAPIContextOption {
3207
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string): IPromiseResult<string>;
3084
3208
  /**
3085
- * 应用 appkey
3209
+ * 清除指定会话消息草稿
3086
3210
  */
3087
- appkey: string;
3211
+ clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3088
3212
  /**
3089
- * IMLib 版本号
3213
+ * 从服务端拉取会话状态
3090
3214
  */
3091
- apiVersion: string;
3215
+ pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3092
3216
  /**
3093
- * 自定义导航地址:
3094
- * 1. 私有云环境下该值为必填项
3095
- * 2. 当存在自定义导航地址时,SDK 内部默认地址将无效
3096
- * 3. 当存在自定义导航地址时,地址 url 中需包含 http/https 协议头,否则视为无效值
3097
- * 4. 建立 ws/wss 连接前的 ping 接口使用的协议与导航 url 中的协议相同
3098
- * 5. 建立 websocket 建立连接时将根据 ping 接口使用的 http/https 协议来确定使用 ws/wss 协议
3099
- * 6. 动态导航使用的协议头将与自定义导航地址相同
3100
- * 7. 公有云默认使用 https 协议
3217
+ * 批量设置会话 置顶、免打扰
3101
3218
  */
3102
- navigators: string[];
3219
+ batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3220
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3103
3221
  /**
3104
- * (参数已废弃)~~c++ 协议栈数据库地址~~
3105
- * @deprecated
3106
- */
3107
- dbPath?: string;
3108
- /**
3109
- * 小程序的 CMP 代理地址
3110
- */
3111
- miniCMPProxy: string[];
3112
- /**
3113
- * 指定默认使用的连接类型
3114
- */
3115
- connectionType: 'websocket' | 'comet';
3116
- /**
3117
- * 修改 engine log 打印等级
3118
- */
3119
- logLevel?: LogLevel;
3120
- /**
3121
- * 修改默认的 log 输出函数
3222
+ * 断开连接
3122
3223
  */
3123
- logStdout?: (logLevel: LogLevel, content: string) => void;
3224
+ disconnect(): void;
3124
3225
  /**
3125
- * (已废弃)私有云标识
3126
- * @deprecated
3226
+ * 拉取用户级配置数据
3127
3227
  */
3128
- isEnterPrise?: boolean;
3228
+ pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3129
3229
  /**
3130
- * typing状态过期时间
3230
+ * 消息注册
3231
+ * @description
3232
+ * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
3233
+ * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
3234
+ * @param objectName 消息类型,如:RC:TxtMsg
3235
+ * @param isPersited 是否存储
3236
+ * @param isCounted 是否技术
3237
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3131
3238
  */
3132
- typingExpireTime?: number;
3239
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
3133
3240
  /**
3134
- * 是否打开 IndexDB 存储,默认为 true
3135
- */
3136
- indexDBSwitch?: boolean;
3241
+ * 加入聊天室
3242
+ * @param count 拉取消息数量
3243
+ */
3244
+ joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3137
3245
  /**
3138
- * 是否校验证书,默认为 true
3139
- */
3140
- checkCA?: boolean;
3141
- }
3142
- declare class APIContext {
3143
- private _runtime;
3144
- private static _context?;
3145
- static init(runtime: IRuntime, options: IAPIContextOption): APIContext;
3146
- static destroy(): void;
3147
- private _token;
3246
+ * 加入已存在的聊天室
3247
+ * @param count 拉取消息数量
3248
+ */
3249
+ joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3148
3250
  /**
3149
- * 插件队列,用于逐一派发消息与信令
3150
- */
3151
- private _pluginContextQueue;
3251
+ * 退出聊天室
3252
+ */
3253
+ quitChatroom(chatroomId: string): Promise<ErrorCode>;
3152
3254
  /**
3153
- * 插件实例Map,用于重复初始化时返回实例
3154
- */
3155
- private _pluginInstanseMap;
3156
- private readonly _engine;
3255
+ * 获取聊天室信息
3256
+ * @param count 获取人数, 范围 0 - 20
3257
+ * @param order 排序方式, 1 正序, 2 倒序
3258
+ */
3259
+ getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
3157
3260
  /**
3158
- * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
3159
- */
3160
- readonly coreVersion: string;
3161
- readonly appkey: string;
3162
- readonly apiVersion: string;
3163
- private readonly _options;
3164
- private _versionInfo;
3165
- private _typingInfo;
3261
+ * 获取聊天室历史消息
3262
+ */
3263
+ getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
3264
+ list: IReceivedMessage[];
3265
+ hasMore: boolean;
3266
+ }>;
3166
3267
  /**
3167
- * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
3168
- */
3169
- private _isInternalConnected;
3170
- constructor(_runtime: IRuntime, options: IAPIContextOption);
3268
+ * 设置聊天室属性
3269
+ */
3270
+ setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3171
3271
  /**
3172
- * 安装使用插件,并初始化插件实例
3173
- * @param plugin
3174
- * @param options
3175
- */
3176
- install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
3177
- private _connectionStatus;
3178
- private _canRedirectConnect;
3272
+ * 强制设置聊天室属性
3273
+ */
3274
+ forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3179
3275
  /**
3180
- * 重定向后,递归调用 connect
3181
- */
3182
- private _handleRedirect;
3276
+ * 删除聊天室属性
3277
+ */
3278
+ removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3183
3279
  /**
3184
- * 连接状态变更回调
3185
- * @param message
3186
- */
3187
- private _connectionStatusListener;
3188
- private _messageReceiver;
3280
+ * 强制删除聊天室属性
3281
+ */
3282
+ forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3189
3283
  /**
3190
- * 聊天室相关信息监听
3284
+ * 获取聊天室 key 对应 value
3191
3285
  */
3192
- private _chatroomInfoListener;
3286
+ getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
3193
3287
  /**
3194
- * 会话监听相关
3288
+ * 获取聊天室所有 key value
3195
3289
  */
3196
- private _conversationInfoListener;
3290
+ getAllChatroomEntry(chatroomId: string): IPromiseResult<{
3291
+ [key: string]: string;
3292
+ }>;
3197
3293
  /**
3198
- * 消息扩展监听相关
3294
+ * 获取上传认证信息
3295
+ * @description
3296
+ * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
3199
3297
  */
3200
- private _expansionInfoListener;
3298
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
3201
3299
  /**
3202
- * 标签增删改监听
3203
- */
3204
- private _tagListener;
3300
+ * 获取文件上传后下载地址
3301
+ */
3302
+ getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
3303
+ downloadUrl: string;
3304
+ }>;
3205
3305
  /**
3206
- * 会话标签状态监听
3207
- */
3208
- private _conversationTagListener;
3209
- private _typingStatusListener;
3210
- private _pullFinishedLister;
3306
+ * 创建标签
3307
+ * @param tag 标签
3308
+ */
3309
+ createTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
3211
3310
  /**
3212
- * rtc 数据变更通知 pluginContext
3213
- */
3214
- private _rtcDataChange;
3311
+ * 删除标签
3312
+ * @param tagId 标签id
3313
+ */
3314
+ removeTag(tagId: string): IPromiseResult<IAsyncRes>;
3215
3315
  /**
3216
- * 业务层事件监听器挂载点
3217
- */
3218
- private _watcher;
3316
+ * 编辑标签
3317
+ * @param tag 标签
3318
+ */
3319
+ updateTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
3219
3320
  /**
3220
- * 添加事件监听
3221
- * @param options
3321
+ * 获取标签列表
3222
3322
  */
3223
- assignWatcher(watcher: IWatcher): void;
3323
+ getTagList(): IPromiseResult<Array<ITagInfo>>;
3224
3324
  /**
3225
- * 向内存中添加 typing 信息
3226
- * 添加 typing 时不触发通知,只有在轮询时间点校验 _typingChangedList 的长度大于 0 时才通知
3325
+ * 添加会话到标签(给多个会话增加标签)
3326
+ * @param tagId 标签id
3327
+ * @param conversations 要添加的会话列表
3227
3328
  */
3228
- private _addTypingInfo;
3229
- private _typingInternalTimer;
3230
- private _typingExpireTime;
3231
- private _typingChangedList;
3329
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
3232
3330
  /**
3233
- * 启动定时移除typing
3331
+ * 删除标签中的会话(从多个会话中批量删除指定标签)
3332
+ * @param tagId 标签id
3333
+ * @param conversations 要删除的会话列表
3234
3334
  */
3235
- private _startCheckTypingInfo;
3236
- getConnectedTime(): number;
3237
- getServerTime(): number;
3238
- getDeviceId(): string;
3239
- getCurrentUserId(): string;
3240
- getConnectionStatus(): ConnectionStatus;
3335
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
3241
3336
  /**
3242
- * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
3243
- * @param token
3244
- * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
3337
+ * 删除会话中的标签(从单一会话中批量删除标签)
3338
+ * @param conversationType 会话类型
3339
+ * @param targetId 会话id
3340
+ * @param tagIds 要删除的标签列表
3245
3341
  */
3246
- connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
3342
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult<IAsyncRes>;
3247
3343
  /**
3248
- * 拉取实时配置 web 端需更新 voipCall 字段
3344
+ * 获取标签下的会话列表
3345
+ * @param tagId 标签id
3249
3346
  */
3250
- private _pullUserSettings;
3251
- disconnect(): Promise<void>;
3252
- reconnect(): Promise<IConnectResult>;
3253
- private _getTokenWithoutNavi;
3347
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
3254
3348
  /**
3255
- * 获取当前缓存的导航数据
3349
+ * 获取标签下的未读消息数
3350
+ * @param tagId 标签id
3351
+ * @param containMuted 是否包含免打扰会话
3256
3352
  */
3257
- getInfoFromCache(): INaviInfo | null;
3353
+ getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
3258
3354
  /**
3259
- * 消息注册
3260
- * @description 消息注册需在应用初始化完成前进行
3261
- * @param objectName 消息类型,如:RC:TxtMsg
3262
- * @param isPersited 是否存储
3263
- * @param isCounted 是否技术
3264
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3355
+ * 设置标签中会话置顶
3356
+ * @param conversation 会话
3265
3357
  */
3266
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
3358
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult<IAsyncRes>;
3267
3359
  /**
3268
- * 发送消息
3269
- * @param conversationType
3270
- * @param targetId
3271
- * @param objectName
3272
- * @param content
3273
- * @param options
3360
+ * 获取会话里的标签
3361
+ * @param config
3274
3362
  */
3275
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
3276
- /**
3277
- * 发送扩展消息
3278
- * @param messageUId 消息 Id
3279
- * @param keys 需要删除的 key
3280
- * @param expansion 设置的扩展
3281
- */
3282
- sendExpansionMessage(options: ISendExMsgOptions): Promise<IAsyncRes<ErrorCode>>;
3363
+ getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
3283
3364
  /**
3284
3365
  * 发送群组消息已读回执
3285
3366
  * 导航下发已读回执开关为 true 时调用
3286
- * @param targetId 群组会话id
3287
- * @param messageUIds 消息id
3288
3367
  */
3289
3368
  sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3290
3369
  /**
3291
3370
  * 获取群组消息已读列表
3292
- * @param targetId
3293
- * @param messageUIds
3294
3371
  */
3295
- getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
3372
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
3296
3373
  /**
3297
- * 反初始化,清空所有监听及计时器
3374
+ * 获取服务器时间
3298
3375
  */
3299
- private _destroy;
3376
+ getServerTime(): number;
3300
3377
  /**
3301
- * @param conversationType
3302
- * @param targetId 会话 Id
3303
- * @param timestamp 拉取时间戳
3304
- * @param count 拉取条数
3305
- * @param order 1 正序拉取,0 为倒序拉取
3306
- * @param channelId
3307
- * @param objectName
3378
+ * 获取设备ID
3308
3379
  */
3309
- getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
3380
+ getDeviceId(): string;
3381
+ /**
3382
+ * 设置用户在线状态监听器
3383
+ */
3384
+ setUserStatusListener(config: {
3385
+ userIds: string[];
3386
+ }, listener: Function): void;
3387
+ /**
3388
+ * 设置当前用户在线状态
3389
+ */
3390
+ setUserStatus(status: number): Promise<ErrorCode>;
3391
+ /**
3392
+ * 订阅用户在线状态
3393
+ */
3394
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3395
+ /**
3396
+ * 获取用户状态
3397
+ */
3398
+ getUserStatus(userId: string): IPromiseResult<{
3399
+ status: string;
3400
+ }>;
3401
+ /**
3402
+ * 清空所有会话
3403
+ */
3404
+ clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
3405
+ /**
3406
+ * 加入黑名单
3407
+ */
3408
+ addToBlacklist(userId: string): Promise<ErrorCode>;
3409
+ /**
3410
+ * 将指定用户移除黑名单
3411
+ */
3412
+ removeFromBlacklist(userId: string): Promise<ErrorCode>;
3413
+ /**
3414
+ * 获取黑名单列表
3415
+ */
3416
+ getBlacklist(): IPromiseResult<string[]>;
3417
+ /**
3418
+ * 获取指定人员在黑名单中的状态
3419
+ */
3420
+ getBlacklistStatus(userId: string): IPromiseResult<string>;
3421
+ /**
3422
+ * 向本地插入一条消息,不发送到服务器
3423
+ */
3424
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
3425
+ /**
3426
+ * 删除本地消息
3427
+ */
3428
+ deleteMessages(timestamps: number[]): Promise<ErrorCode>;
3429
+ /**
3430
+ * 通过时间戳删除本地消息
3431
+ */
3432
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
3433
+ /**
3434
+ * 清空会话下历史消息
3435
+ */
3436
+ clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3437
+ /**
3438
+ * 获取消息
3439
+ */
3440
+ getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
3441
+ /**
3442
+ * 设置消息内容
3443
+ */
3444
+ setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3445
+ /**
3446
+ * 设置消息搜索字段
3447
+ */
3448
+ setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3449
+ /**
3450
+ * 通过关键字搜索会话
3451
+ */
3452
+ searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3453
+ /**
3454
+ * 按内容搜索会话内的消息
3455
+ */
3456
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
3457
+ messages: IReceivedMessage[];
3458
+ count: number;
3459
+ }>;
3460
+ /**
3461
+ * 获取会话下所有未读的 @ 消息
3462
+ */
3463
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
3464
+ /**
3465
+ * 设置消息发送状态
3466
+ */
3467
+ setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3468
+ /**
3469
+ * 设置消息接收状态
3470
+ */
3471
+ setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3472
+ /**
3473
+ * 删除时间戳前的未读数
3474
+ */
3475
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
3476
+ /**
3477
+ * 获取会话免打扰状态
3478
+ */
3479
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
3480
+ /**
3481
+ * 协议栈获取远端历史消息
3482
+ */
3483
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
3310
3484
  list: IReceivedMessage[];
3311
3485
  hasMore: boolean;
3312
- }>>;
3313
- /**
3314
- * 获取会话列表
3315
- * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3316
- */
3317
- getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3486
+ }>;
3318
3487
  /**
3319
- * 获取单一会话数据
3320
- * @param conversationType
3321
- * @param targetId
3322
- * @param channelId
3488
+ * 获取群组消息送达列表
3323
3489
  */
3324
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3490
+ getGroupMessageDeliverList(targetId: string, messageUId: string, channelId: string): IPromiseResult<IGroupMessageDeliverInfo>;
3325
3491
  /**
3326
- * 删除会话
3492
+ * 获取单聊消息送达详情
3327
3493
  */
3328
- removeConversation(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3494
+ getPrivateMessageDeliverTime(messageUId: string, channelId: string): IPromiseResult<number>;
3495
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
3496
+ quitRTCRoom(roomId: string): Promise<ErrorCode>;
3497
+ rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
3498
+ getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
3499
+ getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
3500
+ getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
3501
+ setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
3502
+ removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
3503
+ setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
3504
+ name: string;
3505
+ content: string;
3506
+ }): Promise<ErrorCode>;
3329
3507
  /**
3330
- * 清除会话消息未读数
3508
+ * 全量订阅资源修改
3509
+ * @param roomId 房间 Id
3510
+ * @param message 向前兼容的消息内容
3511
+ * @param valueInfo 全量资源数据
3512
+ * @param objectName 全量 URI 消息名
3331
3513
  */
3332
- clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3514
+ setRTCTotalRes(roomId: string, message: {
3515
+ name: string;
3516
+ content: string;
3517
+ }, valueInfo: string, objectName: string, mcuValInfo: string): Promise<ErrorCode>;
3518
+ getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
3519
+ removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
3520
+ name: string;
3521
+ content: string;
3522
+ }): Promise<ErrorCode>;
3523
+ setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
3524
+ getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
3525
+ getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
3526
+ setRTCState(roomId: string, reportId: string): Promise<ErrorCode>;
3527
+ getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
3528
+ setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
3529
+ }
3530
+
3531
+ interface IExpansionMsgContent {
3333
3532
  /**
3334
- * 获取指定会话消息未读数
3335
- */
3336
- getUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<number>>;
3533
+ * 消息扩展的对象
3534
+ */
3535
+ put?: {
3536
+ [key: string]: string;
3537
+ };
3337
3538
  /**
3338
- * 获取所有会话未读数
3339
- * @param channelId 多组织 Id
3340
- * @param conversationTypes
3341
- * @param includeMuted 包含已设置免打扰的会话
3342
- */
3343
- getTotalUnreadCount(channelId: string, conversationTypes?: ConversationType[], includeMuted?: boolean): Promise<IAsyncRes<number>>;
3539
+ * 删除的 keys
3540
+ */
3541
+ del?: string[];
3344
3542
  /**
3345
- * 获取第一个未读消息
3346
- */
3347
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<IReceivedMessage | null>>;
3348
- setConversationStatus(conversationType: ConversationType, targetId: string, isTop?: boolean, notificationStatus?: 1 | 2, channelId?: string): Promise<ErrorCode>;
3349
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3350
- getConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<IAsyncRes<string>>;
3351
- clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3352
- recallMessage(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3543
+ * messageUId
3544
+ */
3545
+ mid: string;
3353
3546
  /**
3354
- * 删除远端消息
3355
- * @param conversationType
3356
- * @param targetId
3357
- * @param list
3358
- */
3359
- deleteRemoteMessage(conversationType: ConversationType, targetId: string, list: {
3360
- messageUId: string;
3361
- sentTime: number;
3362
- messageDirection: MessageDirection;
3363
- }[], channelId?: string): Promise<ErrorCode>;
3547
+ * 是否删除所有, 有效值:0、1 . ( 后续如有需要, API Layer 层可使用)
3548
+ */
3549
+ removeAll?: number;
3550
+ }
3551
+
3552
+ interface IConnectResult {
3364
3553
  /**
3365
- * 根据时间戳删除指定时间之前的
3366
- * @param conversationType
3367
- * @param targetId
3368
- * @param timestamp
3554
+ * 连接错误码
3369
3555
  */
3370
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3556
+ code: ErrorCode;
3371
3557
  /**
3372
- * 加入聊天室,若聊天室不存在则创建聊天室
3373
- * @param roomId 聊天室房间 Id
3374
- * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3558
+ * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3375
3559
  */
3376
- joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3560
+ userId?: string;
3561
+ }
3562
+ declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
3563
+ declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
3564
+ declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
3565
+ declare type IChatroomListener = (state: IChatroomListenerData) => void;
3566
+ declare type IRTCInnerListener = {
3567
+ message?: IMessageListnenr;
3568
+ status?: IConnectionStatusListener;
3569
+ };
3570
+ declare type IExpansionListener = (data: IExpansionListenerData) => void;
3571
+ declare type ITagListener = () => void;
3572
+ declare type IConversationTagListener = () => void;
3573
+ declare type ItypingStateListener = (data: ITypingMessage[]) => void;
3574
+ declare type IMessageDeliveredListener = (data: IMessageDeliver[]) => void;
3575
+ interface ISendExMsgOptions {
3576
+ channelId: string;
3577
+ conversationType: ConversationType;
3578
+ targetId: string;
3377
3579
  /**
3378
- * 加入聊天室,若聊天室不存在则抛出异常
3379
- * @param roomId 聊天室房间 Id
3380
- * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3381
- */
3382
- joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3580
+ * 消息 ID
3581
+ */
3582
+ messageUId: string;
3383
3583
  /**
3384
- * 退出聊天室
3385
- * @param roomId
3386
- */
3387
- quitChatroom(roomId: string): Promise<ErrorCode>;
3584
+ * 原始消息是否支持扩展的字段
3585
+ */
3586
+ canIncludeExpansion: boolean;
3388
3587
  /**
3389
- * 获取聊天室房间数据
3390
- * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
3391
- * @param roomId 聊天室 Id
3392
- * @param count 获取房间人员列表数量,最大有效值 `20`,最小值未 `0`,默认为 0
3393
- * @param order 人员排序方式,`1` 为正序,`2` 为倒序,默认为 0
3394
- */
3395
- getChatroomInfo(roomId: string, count?: number, order?: 0 | 1 | 2): Promise<IAsyncRes<IChatroomInfo>>;
3588
+ * 删除的 keys
3589
+ */
3590
+ keys?: string[];
3396
3591
  /**
3397
- * 在指定聊天室中设置自定义属性
3398
- * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3399
- * @param roomId 聊天室房间 id
3400
- * @param entry 属性信息
3401
- */
3402
- setChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3592
+ * 扩展对象
3593
+ */
3594
+ expansion?: {
3595
+ [key: string]: string;
3596
+ };
3403
3597
  /**
3404
- * 在指定聊天室中强制增加 / 修改任意聊天室属性
3405
- * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3406
- * @param roomId 聊天室房间 id
3407
- * @param entry 属性信息
3408
- */
3409
- forceSetChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3598
+ * 是否删除所有扩展
3599
+ */
3600
+ removeAll?: boolean;
3410
3601
  /**
3411
- * 删除聊天室属性
3412
- * @description 该方法仅限于删除自己设置的聊天室属性
3413
- * @param roomId 聊天室房间 id
3414
- * @param entry 要移除的属性信息
3415
- */
3416
- removeChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3602
+ * 原始消息的扩展
3603
+ */
3604
+ originExpansion?: {
3605
+ [key: string]: string;
3606
+ } | null;
3607
+ }
3608
+ interface IWatcher {
3609
+ message?: IMessageListnenr;
3610
+ connectionState?: IConnectionStatusListener;
3611
+ conversationState?: IConversationStateListener;
3612
+ chatroomState?: IChatroomListener;
3613
+ expansion?: IExpansionListener;
3417
3614
  /**
3418
- * 强制删除任意聊天室属性
3419
- * @description 该方法仅限于删除自己设置的聊天室属性
3420
- * @param roomId 聊天室房间 id
3421
- * @param entry 要移除的属性信息
3615
+ * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
3422
3616
  */
3423
- forceRemoveChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3617
+ rtcInnerWatcher?: IRTCInnerListener;
3424
3618
  /**
3425
- * 获取聊天室中的指定属性
3426
- * @param roomId 聊天室房间 id
3427
- * @param key 属性键名
3619
+ * 标签的增删改监听
3428
3620
  */
3429
- getChatroomEntry(roomId: string, key: string): Promise<IAsyncRes<string | null>>;
3621
+ tag?: ITagListener;
3430
3622
  /**
3431
- * 获取聊天室内的所有属性
3432
- * @param roomId 聊天室房间 id
3623
+ * 会话中标签状态变更监听
3433
3624
  */
3434
- getAllChatroomEntries(roomId: string): Promise<IAsyncRes<{
3435
- [key: string]: string;
3436
- }>>;
3625
+ conversationTagChanged?: IConversationTagListener;
3437
3626
  /**
3438
- * 拉取聊天室内的历史消息
3439
- * @param roomId
3440
- * @param count 拉取消息条数, 有效值范围 `1 - 20`
3441
- * @param order 获取顺序,默认值为 0。
3442
- * * 0:降序,用于获取早于指定时间戳发送的消息
3443
- * * 1:升序,用于获取晚于指定时间戳发送的消息
3444
- * @param timestamp 指定拉取消息用到的时间戳。默认值为 `0`,表示按当前时间拉取
3627
+ * 输入状态变更监听
3445
3628
  */
3446
- getChatRoomHistoryMessages(roomId: string, count?: number, order?: 0 | 1, timestamp?: number): Promise<IAsyncRes<{
3447
- list: IReceivedMessage[];
3448
- hasMore: boolean;
3449
- }>>;
3629
+ typingState?: ItypingStateListener;
3450
3630
  /**
3451
- * 获取存储服务鉴权信息
3452
- * @param fileType 文件类型
3453
- * @param fileName 文件名称
3454
- * @param httpMethod STC 分段上传时的必填参数,有效值为 PUT | POST
3455
- * @param queryString STC 分段上传时的查询字符串
3456
- * @description
3457
- * `httpMethod` 与 `queryString` 为 STC S3 分段上传时的专属参数,STC 分段上传包含三个过程:
3458
- * 1. 开始分段前调用,此时 `httpMethod` 值应为 `POST`, `queryString` 值为 `uploads`
3459
- * 2. 上传请求前调用,此时 `httpMethod` 值应为 `PUT`,`queryString` 值为 `partNumber={partamNumer}&uploadId={uploadId}`
3460
- * 3. 上传结束前调用,此时 `httpMethod` 值应为 `POST`,`queryString` 值为 `uploadId={uploadId}`
3461
- * @returns
3631
+ * 是否拉取完毕添加通知
3462
3632
  */
3463
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
3464
- bos: string;
3465
- qiniu: string;
3466
- }>;
3467
- /**
3468
- * 获取 七牛、百度、阿里云 上传成功可下载的 URL
3469
- * @param fileType 文件类型
3470
- * @param fileName 文件名
3471
- * @param saveName 下载后的存储文件名
3472
- * @param uploadRes 插件上传返回的结果。降级百度上传后,用户传入返回结果,再把结果里的下载地址返回给用户,保证兼容之前结果获取
3473
- * @param serverType 使用的存储服务标识
3474
- */
3475
- getFileUrl(fileType: FileType, fileName?: string, saveName?: string, uploadRes?: {
3476
- isBosRes: boolean;
3477
- downloadUrl: string;
3478
- }, serverType?: UploadMethod): Promise<{
3479
- downloadUrl: string;
3480
- }>;
3633
+ pullFinished?: ITagListener;
3481
3634
  /**
3482
- * 创建标签
3483
- * @param tag 标签
3635
+ * 单聊消息送达通知
3484
3636
  */
3485
- createTag(tag: ITagParam): Promise<IAsyncRes>;
3637
+ messageDelivered?: IMessageDeliveredListener;
3638
+ }
3639
+ interface IPluginGenerator<API, InitOption> {
3486
3640
  /**
3487
- * 删除标签
3488
- * @param tagId 标签id
3641
+ * 只读插件标识
3489
3642
  */
3490
- removeTag(tagId: string): Promise<IAsyncRes>;
3643
+ readonly tag: string;
3491
3644
  /**
3492
- * 更新标签
3493
- * @param tag 标签
3645
+ * 版本号
3494
3646
  */
3495
- updateTag(tag: ITagParam): Promise<IAsyncRes>;
3647
+ readonly version?: string;
3496
3648
  /**
3497
- * 获取标签列表
3649
+ * 插件名称
3498
3650
  */
3499
- getTagList(): Promise<IAsyncRes<Array<ITagInfo>>>;
3651
+ readonly name?: string;
3500
3652
  /**
3501
- * 添加会话到标签(给多个会话增加标签)
3502
- * @param tagId 标签id
3503
- * @param conversations 要添加的会话列表
3653
+ * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
3504
3654
  */
3505
- addTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3655
+ verify(runtime: IRuntime): boolean;
3506
3656
  /**
3507
- * 删除标签中的会话(从多个会话中批量删除指定标签)
3508
- * @param tagId 标签id
3509
- * @param conversations 要删除的会话列表
3657
+ * 插件初始化
3658
+ * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
3659
+ * @param runtime 运行时实例,用于标识最终的运行时平台
3660
+ * @param options 初始化参数
3510
3661
  */
3511
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3662
+ setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
3663
+ }
3664
+ interface IAPIContextOption {
3512
3665
  /**
3513
- * 删除会话中的标签(从单一会话中批量删除标签)
3514
- * @param conversationType 会话类型
3515
- * @param targetId 会话id
3516
- * @param tagIds 要删除的标签列表
3666
+ * 应用 appkey
3517
3667
  */
3518
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): Promise<IAsyncRes<IAsyncRes>>;
3668
+ appkey: string;
3519
3669
  /**
3520
- * 获取标签下的会话列表
3521
- * @param tagId 标签id
3670
+ * IMLib 版本号
3522
3671
  */
3523
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): Promise<IAsyncRes<IReceivedConversationByTag[]>>;
3672
+ apiVersion: string;
3524
3673
  /**
3525
- * 获取标签下的未读消息数
3526
- * @param tagId 标签id
3527
- * @param containMuted 是否包含免打扰会话
3674
+ * 自定义导航地址:
3675
+ * 1. 私有云环境下该值为必填项
3676
+ * 2. 当存在自定义导航地址时,SDK 内部默认地址将无效
3677
+ * 3. 当存在自定义导航地址时,地址 url 中需包含 http/https 协议头,否则视为无效值
3678
+ * 4. 建立 ws/wss 连接前的 ping 接口使用的协议与导航 url 中的协议相同
3679
+ * 5. 建立 websocket 建立连接时将根据 ping 接口使用的 http/https 协议来确定使用 ws/wss 协议
3680
+ * 6. 动态导航使用的协议头将与自定义导航地址相同
3681
+ * 7. 公有云默认使用 https 协议
3528
3682
  */
3529
- getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<IAsyncRes<number>>;
3683
+ navigators: string[];
3530
3684
  /**
3531
- * 设置标签中会话置顶
3532
- * @param conversation 会话
3533
- */
3534
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: {
3535
- isTop: boolean;
3536
- }): Promise<IAsyncRes<IAsyncRes>>;
3685
+ * (参数已废弃)~~c++ 协议栈数据库地址~~
3686
+ * @deprecated
3687
+ */
3688
+ dbPath?: string;
3537
3689
  /**
3538
- * 获取会话里的标签
3539
- * @param conversation
3690
+ * 小程序的 CMP 代理地址
3540
3691
  */
3541
- getTagsForConversation(conversation: IConversationOption): Promise<IAsyncRes<IConversationTag[]>>;
3692
+ miniCMPProxy: string[];
3542
3693
  /**
3543
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3544
- * 对于未实现的方法,接口响应 Unsupport 错误码
3545
- * @param method 方法名
3546
- * @param args
3694
+ * 指定默认使用的连接类型
3547
3695
  */
3548
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3696
+ connectionType: 'websocket' | 'comet';
3549
3697
  /**
3550
- * 删除所有会话
3551
- */
3552
- clearConversations(conversationTypes?: ConversationType[], tag?: string): Promise<ErrorCode>;
3698
+ * 修改 engine log 打印等级
3699
+ */
3700
+ logLevel?: LogLevel;
3553
3701
  /**
3554
- * 设置用户连接状态监听器
3555
- */
3556
- setUserStatusListener(config: {
3557
- userIds: string[];
3558
- }, listener: Function): void;
3702
+ * 修改默认的 log 输出函数
3703
+ */
3704
+ logStdout?: (logLevel: LogLevel, content: string) => void;
3559
3705
  /**
3560
- * 添加用户黑名单
3561
- */
3562
- addToBlacklist(userId: string): Promise<ErrorCode>;
3706
+ * (已废弃)私有云标识
3707
+ * @deprecated
3708
+ */
3709
+ isEnterPrise?: boolean;
3563
3710
  /**
3564
- * 将指定用户移除黑名单
3565
- */
3566
- removeFromBlacklist(userId: string): Promise<ErrorCode>;
3711
+ * typing状态过期时间
3712
+ */
3713
+ typingExpireTime?: number;
3567
3714
  /**
3568
- * 获取黑名单列表
3569
- */
3570
- getBlacklist(): Promise<IAsyncRes<string[]>>;
3715
+ * 是否打开 IndexDB 存储,默认为 true
3716
+ */
3717
+ indexDBSwitch?: boolean;
3571
3718
  /**
3572
- * 获取指定人员在黑名单中的状态
3573
- */
3574
- getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
3719
+ * 是否校验证书,默认为 true
3720
+ */
3721
+ checkCA?: boolean;
3722
+ }
3723
+ declare class APIContext {
3724
+ private _runtime;
3725
+ private static _context?;
3726
+ static init(runtime: IRuntime, options: IAPIContextOption): APIContext;
3727
+ static destroy(): void;
3728
+ private _token;
3575
3729
  /**
3576
- * 向本地插入一条消息,不发送到服务器
3577
- */
3578
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3730
+ * 插件队列,用于逐一派发消息与信令
3731
+ */
3732
+ private _pluginContextQueue;
3579
3733
  /**
3580
- * 删除本地消息
3581
- */
3582
- deleteMessages(timestamp: number[]): Promise<ErrorCode>;
3734
+ * 插件实例Map,用于重复初始化时返回实例
3735
+ */
3736
+ private _pluginInstanseMap;
3737
+ private readonly _engine;
3583
3738
  /**
3584
- * 从本地消息数据库中删除某一会话指定时间之前的消息数据
3585
- */
3586
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId?: string): Promise<ErrorCode>;
3739
+ * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
3740
+ */
3741
+ readonly coreVersion: string;
3742
+ readonly appkey: string;
3743
+ readonly apiVersion: string;
3744
+ private readonly _options;
3745
+ private _versionInfo;
3746
+ private _typingInfo;
3587
3747
  /**
3588
- * 清空会话下历史消息
3589
- */
3590
- clearMessages(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3748
+ * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
3749
+ */
3750
+ private _isInternalConnected;
3751
+ constructor(_runtime: IRuntime, options: IAPIContextOption);
3591
3752
  /**
3592
- * 获取本地消息
3593
- */
3594
- getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
3753
+ * 安装使用插件,并初始化插件实例
3754
+ * @param plugin
3755
+ * @param options
3756
+ */
3757
+ install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
3758
+ private _connectionStatus;
3759
+ private _canRedirectConnect;
3595
3760
  /**
3596
- * 设置消息内容
3597
- */
3598
- setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3761
+ * 重定向后,递归调用 connect
3762
+ */
3763
+ private _handleRedirect;
3599
3764
  /**
3600
- * 设置消息搜索字段
3601
- */
3602
- setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3765
+ * 连接状态变更回调
3766
+ * @param message
3767
+ */
3768
+ private _connectionStatusListener;
3769
+ private _messageReceiver;
3603
3770
  /**
3604
- * 设置消息发送状态
3771
+ * 聊天室相关信息监听
3605
3772
  */
3606
- setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3773
+ private _chatroomInfoListener;
3607
3774
  /**
3608
- * 设置消息接收状态
3775
+ * 会话监听相关
3609
3776
  */
3610
- setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3777
+ private _conversationInfoListener;
3611
3778
  /**
3612
- * 设置当前用户在线状态
3779
+ * 消息扩展监听相关
3613
3780
  */
3614
- setUserStatus(status: number): Promise<ErrorCode>;
3781
+ private _expansionInfoListener;
3615
3782
  /**
3616
- * 订阅用户在线状态
3617
- */
3618
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3783
+ * 标签增删改监听
3784
+ */
3785
+ private _tagListener;
3619
3786
  /**
3620
- * 获取用户在线状态
3621
- */
3622
- getUserStatus(userId: string): Promise<IAsyncRes<{
3623
- status: string;
3624
- }>>;
3625
- searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
3626
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
3627
- messages: IReceivedMessage[];
3628
- count: number;
3629
- }>>;
3630
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
3631
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3787
+ * 会话标签状态监听
3788
+ */
3789
+ private _conversationTagListener;
3790
+ private _typingStatusListener;
3791
+ private _pullFinishedListener;
3792
+ private _messageDeliveredListerer;
3632
3793
  /**
3633
- * 获取会话免打扰状态
3634
- */
3635
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<NotificationStatus>>;
3636
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): Promise<IAsyncRes<{
3637
- list: IReceivedMessage[];
3638
- hasMore: boolean;
3639
- }>>;
3794
+ * rtc 数据变更通知 pluginContext
3795
+ */
3796
+ private _rtcDataChange;
3640
3797
  /**
3641
- * 加入房间
3642
- * @param roomId
3643
- * @param mode 房间模式:直播 or 会议
3644
- * @param mediaType 直播房间模式下的媒体资源类型
3798
+ * 业务层事件监听器挂载点
3645
3799
  */
3646
- joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
3647
- quitRTCRoom(roomId: string): Promise<ErrorCode>;
3648
- rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
3649
- getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
3650
- getRTCUserInfoList(roomId: string): Promise<IAsyncRes<IRTCUsers>>;
3651
- getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
3652
- setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
3653
- removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
3654
- setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
3655
- name: string;
3656
- content: string;
3657
- }): Promise<ErrorCode>;
3658
- setRTCTotalRes(roomId: string, message: {
3659
- name: string;
3660
- content: string;
3661
- }, valueInfo: string, objectName: string, mcuValInfo?: string): Promise<ErrorCode>;
3662
- setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
3663
- getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): Promise<IAsyncRes<KVString>>;
3664
- removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
3665
- name: string;
3666
- content: string;
3667
- }): Promise<ErrorCode>;
3668
- setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
3669
- getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
3670
- getRTCToken(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<IRtcTokenData>>;
3671
- setRTCState(roomId: string, report: string): Promise<ErrorCode>;
3672
- getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
3800
+ private _watcher;
3673
3801
  /**
3674
- * 直播观众加房间
3802
+ * 添加事件监听
3803
+ * @param options
3675
3804
  */
3676
- joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
3677
- token: string;
3678
- kvEntries: IServerRTCRoomEntry[];
3679
- }>>;
3805
+ assignWatcher(watcher: IWatcher): void;
3680
3806
  /**
3681
- * 直播观众退出房间
3807
+ * 向内存中添加 typing 信息
3808
+ * 添加 typing 时不触发通知,只有在轮询时间点校验 _typingChangedList 的长度大于 0 时才通知
3682
3809
  */
3683
- quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
3810
+ private _addTypingInfo;
3811
+ private _typingInternalTimer;
3812
+ private _typingExpireTime;
3813
+ private _typingChangedList;
3684
3814
  /**
3685
- * 直播身份切换
3815
+ * 启动定时移除typing
3686
3816
  */
3687
- rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
3688
- }
3689
-
3690
- /**
3691
- * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3692
- */
3693
- interface IEngine {
3817
+ private _startCheckTypingInfo;
3818
+ getConnectedTime(): number;
3819
+ getServerTime(): number;
3820
+ getDeviceId(): string;
3821
+ getCurrentUserId(): string;
3822
+ getConnectionStatus(): ConnectionStatus;
3694
3823
  /**
3695
- * 建立连接
3824
+ * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
3696
3825
  * @param token
3697
- * @param naviInfo
3826
+ * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
3698
3827
  */
3699
- connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
3828
+ connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
3700
3829
  /**
3701
- * 上报版本信息
3702
- * @param version
3830
+ * 拉取实时配置 web 端需更新 voipCall 字段
3703
3831
  */
3704
- reportSDKInfo(version: {
3705
- [name: string]: string;
3706
- }): void;
3832
+ private _pullUserSettings;
3833
+ disconnect(): Promise<void>;
3834
+ reconnect(): Promise<IConnectResult>;
3835
+ private _getTokenWithoutNavi;
3707
3836
  /**
3708
- * 连接时间
3837
+ * 获取当前缓存的导航数据
3709
3838
  */
3710
- getConnectedTime(): number;
3839
+ getInfoFromCache(): INaviInfo | null;
3711
3840
  /**
3712
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3713
- * 对于未实现的方法,接口响应 Unsupport 错误码
3714
- * @param method
3715
- * @param args
3841
+ * 消息注册
3842
+ * @description 消息注册需在应用初始化完成前进行
3843
+ * @param objectName 消息类型,如:RC:TxtMsg
3844
+ * @param isPersited 是否存储
3845
+ * @param isCounted 是否技术
3846
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3716
3847
  */
3717
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3848
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
3718
3849
  /**
3719
- * 获取历史消息
3850
+ * 发送消息
3720
3851
  * @param conversationType
3721
3852
  * @param targetId
3722
- * @param timestamp
3723
- * @param count
3724
- * @param order
3853
+ * @param objectName
3854
+ * @param content
3855
+ * @param options
3725
3856
  */
3726
- getHistoryMessage(conversationType: ConversationType, targetId: string,
3857
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
3727
3858
  /**
3728
- * 拉取时间戳,值为 `0` 表示从当前时间拉取
3859
+ * 发送扩展消息
3860
+ * @param messageUId 消息 Id
3861
+ * @param keys 需要删除的 key
3862
+ * @param expansion 设置的扩展
3863
+ */
3864
+ sendExpansionMessage(options: ISendExMsgOptions): Promise<IAsyncRes<ErrorCode>>;
3865
+ /**
3866
+ * 发送群组消息已读回执
3867
+ * 导航下发已读回执开关为 true 时调用
3868
+ * @param targetId 群组会话id
3869
+ * @param messageUIds 消息id
3729
3870
  */
3730
- timestamp: number,
3871
+ sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3731
3872
  /**
3732
- * 获取条数, 有效值 `1` - `20`
3873
+ * 获取群组消息已读列表
3874
+ * @param targetId
3875
+ * @param messageUIds
3733
3876
  */
3734
- count: number,
3877
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
3735
3878
  /**
3736
- * @description
3737
- * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
3738
- * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3879
+ * 反初始化,清空所有监听及计时器
3739
3880
  */
3740
- order: 0 | 1,
3741
- /**
3742
- * 会话的业务标识
3743
- */
3744
- channelId: string,
3881
+ private _destroy;
3745
3882
  /**
3746
- * 消息类型
3883
+ * @param conversationType
3884
+ * @param targetId 会话 Id
3885
+ * @param timestamp 拉取时间戳
3886
+ * @param count 拉取条数
3887
+ * @param order 1 正序拉取,0 为倒序拉取
3888
+ * @param channelId
3889
+ * @param objectName
3747
3890
  */
3748
- objectName: string): IPromiseResult<{
3891
+ getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
3749
3892
  list: IReceivedMessage[];
3750
3893
  hasMore: boolean;
3751
- }>;
3752
- /**
3753
- * 删除历史消息 通过 messageUId
3754
- */
3755
- deleteRemoteMessage(conversationType: ConversationType, targetId: string,
3756
- /**
3757
- * @description
3758
- * message 中 messageUId、setTime、messageDirection 为必须参数
3759
- */
3760
- messages: {
3761
- messageUId: string;
3762
- sentTime: number;
3763
- messageDirection: MessageDirection;
3764
- }[],
3765
- /**
3766
- * 会话的业务标识
3767
- */
3768
- channelId: string): Promise<ErrorCode>;
3769
- recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3770
- /**
3771
- * 删除历史消息 通过 时间戳
3772
- * @param timestamp 小于等于传入时间戳的消息均删除
3773
- */
3774
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3775
- /**
3776
- * 会话的业务标识
3777
- */
3778
- channelId: string): Promise<ErrorCode>;
3894
+ }>>;
3779
3895
  /**
3780
3896
  * 获取会话列表
3781
3897
  * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3782
3898
  */
3783
- getConversationList(
3899
+ getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3784
3900
  /**
3785
- * 拉取数量, 有效值 0 - 1000, 默认 300
3901
+ * 获取单一会话数据
3902
+ * @param conversationType
3903
+ * @param targetId
3904
+ * @param channelId
3786
3905
  */
3787
- count: number,
3906
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3788
3907
  /**
3789
- * 会话类型
3790
- * @todo 待确认是否生效
3908
+ * 删除会话
3791
3909
  */
3792
- conversationType?: ConversationType,
3793
- /**
3794
- * 起始时间
3795
- */
3796
- startTime?: number,
3797
- /**
3798
- * 获取顺序
3799
- */
3800
- order?: 0 | 1,
3801
- /**
3802
- * 会话的业务标识
3803
- */
3804
- channelId?: string): IPromiseResult<IReceivedConversation[]>;
3910
+ removeConversation(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3805
3911
  /**
3806
- * 获取指定会话
3807
- */
3808
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3912
+ * 清除会话消息未读数
3913
+ */
3914
+ clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3809
3915
  /**
3810
- * 删除会话
3811
- * @description 该删除操作会删除服务器端存储的会话数据
3812
- * @param conversationType
3813
- * @param targetId
3916
+ * 获取指定会话消息未读数
3814
3917
  */
3815
- removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3918
+ getUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<number>>;
3816
3919
  /**
3817
3920
  * 获取所有会话未读数
3818
3921
  * @param channelId 多组织 Id
3819
3922
  * @param conversationTypes
3820
3923
  * @param includeMuted 包含已设置免打扰的会话
3821
3924
  */
3822
- getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3925
+ getTotalUnreadCount(channelId: string, conversationTypes?: ConversationType[], includeMuted?: boolean): Promise<IAsyncRes<number>>;
3823
3926
  /**
3824
- * 获取指定会话未读数
3927
+ * 获取第一个未读消息
3825
3928
  */
3826
- getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3929
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<IReceivedMessage | null>>;
3930
+ setConversationStatus(conversationType: ConversationType, targetId: string, isTop?: boolean, notificationStatus?: 1 | 2, channelId?: string): Promise<ErrorCode>;
3931
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3932
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<IAsyncRes<string>>;
3933
+ clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3934
+ recallMessage(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
3827
3935
  /**
3828
- * 清除指定会话未读数
3936
+ * 删除远端消息
3937
+ * @param conversationType
3938
+ * @param targetId
3939
+ * @param list
3829
3940
  */
3830
- clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3941
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string, list: {
3942
+ messageUId: string;
3943
+ sentTime: number;
3944
+ messageDirection: MessageDirection;
3945
+ }[], channelId?: string): Promise<ErrorCode>;
3831
3946
  /**
3832
- * 获取第一个未读消息
3947
+ * 根据时间戳删除指定时间之前的
3948
+ * @param conversationType
3949
+ * @param targetId
3950
+ * @param timestamp
3833
3951
  */
3834
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3952
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
3835
3953
  /**
3836
- * 设置/保存指定会话消息草稿
3837
- * @draft 草稿内容
3954
+ * 加入聊天室,若聊天室不存在则创建聊天室
3955
+ * @param roomId 聊天室房间 Id
3956
+ * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3838
3957
  */
3839
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string): Promise<ErrorCode>;
3958
+ joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3840
3959
  /**
3841
- * 获取指定会话消息草稿
3960
+ * 加入聊天室,若聊天室不存在则抛出异常
3961
+ * @param roomId 聊天室房间 Id
3962
+ * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
3842
3963
  */
3843
- getConversationMessageDraft(conversationType: ConversationType, targetId: string): IPromiseResult<string>;
3964
+ joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
3844
3965
  /**
3845
- * 清除指定会话消息草稿
3966
+ * 退出聊天室
3967
+ * @param roomId
3846
3968
  */
3847
- clearConversationMessageDraft(conversationType: ConversationType, targetId: string): Promise<ErrorCode>;
3969
+ quitChatroom(roomId: string): Promise<ErrorCode>;
3848
3970
  /**
3849
- * 从服务端拉取会话状态
3971
+ * 获取聊天室房间数据
3972
+ * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
3973
+ * @param roomId 聊天室 Id
3974
+ * @param count 获取房间人员列表数量,最大有效值 `20`,最小值未 `0`,默认为 0
3975
+ * @param order 人员排序方式,`1` 为正序,`2` 为倒序,默认为 0
3850
3976
  */
3851
- pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3977
+ getChatroomInfo(roomId: string, count?: number, order?: 0 | 1 | 2): Promise<IAsyncRes<IChatroomInfo>>;
3852
3978
  /**
3853
- * 批量设置会话 置顶、免打扰
3979
+ * 在指定聊天室中设置自定义属性
3980
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3981
+ * @param roomId 聊天室房间 id
3982
+ * @param entry 属性信息
3854
3983
  */
3855
- batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3856
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3984
+ setChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3857
3985
  /**
3858
- * 断开连接
3986
+ * 在指定聊天室中强制增加 / 修改任意聊天室属性
3987
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
3988
+ * @param roomId 聊天室房间 id
3989
+ * @param entry 属性信息
3859
3990
  */
3860
- disconnect(): void;
3991
+ forceSetChatroomEntry(roomId: string, entry: IChatroomEntry): Promise<ErrorCode>;
3861
3992
  /**
3862
- * 拉取用户级配置数据
3993
+ * 删除聊天室属性
3994
+ * @description 该方法仅限于删除自己设置的聊天室属性
3995
+ * @param roomId 聊天室房间 id
3996
+ * @param entry 要移除的属性信息
3863
3997
  */
3864
- pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3998
+ removeChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3865
3999
  /**
3866
- * 消息注册
3867
- * @description
3868
- * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
3869
- * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
3870
- * @param objectName 消息类型,如:RC:TxtMsg
3871
- * @param isPersited 是否存储
3872
- * @param isCounted 是否技术
3873
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4000
+ * 强制删除任意聊天室属性
4001
+ * @description 该方法仅限于删除自己设置的聊天室属性
4002
+ * @param roomId 聊天室房间 id
4003
+ * @param entry 要移除的属性信息
3874
4004
  */
3875
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
3876
- /**
3877
- * 加入聊天室
3878
- * @param count 拉取消息数量
3879
- */
3880
- joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3881
- /**
3882
- * 加入已存在的聊天室
3883
- * @param count 拉取消息数量
3884
- */
3885
- joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
4005
+ forceRemoveChatroomEntry(roomId: string, entry: IRemoveChatRoomEntryOption): Promise<ErrorCode>;
3886
4006
  /**
3887
- * 退出聊天室
3888
- */
3889
- quitChatroom(chatroomId: string): Promise<ErrorCode>;
4007
+ * 获取聊天室中的指定属性
4008
+ * @param roomId 聊天室房间 id
4009
+ * @param key 属性键名
4010
+ */
4011
+ getChatroomEntry(roomId: string, key: string): Promise<IAsyncRes<string | null>>;
3890
4012
  /**
3891
- * 获取聊天室信息
3892
- * @param count 获取人数, 范围 0 - 20
3893
- * @param order 排序方式, 1 正序, 2 倒序
3894
- */
3895
- getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
4013
+ * 获取聊天室内的所有属性
4014
+ * @param roomId 聊天室房间 id
4015
+ */
4016
+ getAllChatroomEntries(roomId: string): Promise<IAsyncRes<{
4017
+ [key: string]: string;
4018
+ }>>;
3896
4019
  /**
3897
- * 获取聊天室历史消息
3898
- */
3899
- getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
4020
+ * 拉取聊天室内的历史消息
4021
+ * @param roomId
4022
+ * @param count 拉取消息条数, 有效值范围 `1 - 20`
4023
+ * @param order 获取顺序,默认值为 0。
4024
+ * * 0:降序,用于获取早于指定时间戳发送的消息
4025
+ * * 1:升序,用于获取晚于指定时间戳发送的消息
4026
+ * @param timestamp 指定拉取消息用到的时间戳。默认值为 `0`,表示按当前时间拉取
4027
+ */
4028
+ getChatRoomHistoryMessages(roomId: string, count?: number, order?: 0 | 1, timestamp?: number): Promise<IAsyncRes<{
3900
4029
  list: IReceivedMessage[];
3901
4030
  hasMore: boolean;
3902
- }>;
3903
- /**
3904
- * 设置聊天室属性
3905
- */
3906
- setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3907
- /**
3908
- * 强制设置聊天室属性
3909
- */
3910
- forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3911
- /**
3912
- * 删除聊天室属性
3913
- */
3914
- removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3915
- /**
3916
- * 强制删除聊天室属性
3917
- */
3918
- forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3919
- /**
3920
- * 获取聊天室 key 对应 value
3921
- */
3922
- getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
3923
- /**
3924
- * 获取聊天室所有 key value
3925
- */
3926
- getAllChatroomEntry(chatroomId: string): IPromiseResult<{
3927
- [key: string]: string;
3928
- }>;
4031
+ }>>;
3929
4032
  /**
3930
- * 获取上传认证信息
4033
+ * 获取存储服务鉴权信息
4034
+ * @param fileType 文件类型
4035
+ * @param fileName 文件名称
4036
+ * @param httpMethod STC 分段上传时的必填参数,有效值为 PUT | POST
4037
+ * @param queryString STC 分段上传时的查询字符串
3931
4038
  * @description
3932
- * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
3933
- */
3934
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
4039
+ * `httpMethod` `queryString` 为 STC S3 分段上传时的专属参数,STC 分段上传包含三个过程:
4040
+ * 1. 开始分段前调用,此时 `httpMethod` 值应为 `POST`, `queryString` 值为 `uploads`
4041
+ * 2. 上传请求前调用,此时 `httpMethod` 值应为 `PUT`,`queryString` 值为 `partNumber={partamNumer}&uploadId={uploadId}`
4042
+ * 3. 上传结束前调用,此时 `httpMethod` 值应为 `POST`,`queryString` 值为 `uploadId={uploadId}`
4043
+ * @returns
4044
+ */
4045
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
4046
+ bos: string;
4047
+ qiniu: string;
4048
+ }>;
3935
4049
  /**
3936
- * 获取文件上传后下载地址
4050
+ * 获取 七牛、百度、阿里云 上传成功可下载的 URL
4051
+ * @param fileType 文件类型
4052
+ * @param fileName 文件名
4053
+ * @param saveName 下载后的存储文件名
4054
+ * @param uploadRes 插件上传返回的结果。降级百度上传后,用户传入返回结果,再把结果里的下载地址返回给用户,保证兼容之前结果获取
4055
+ * @param serverType 使用的存储服务标识
3937
4056
  */
3938
- getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
4057
+ getFileUrl(fileType: FileType, fileName?: string, saveName?: string, uploadRes?: {
4058
+ isBosRes: boolean;
4059
+ downloadUrl: string;
4060
+ }, serverType?: UploadMethod): Promise<{
3939
4061
  downloadUrl: string;
3940
4062
  }>;
3941
4063
  /**
3942
4064
  * 创建标签
3943
4065
  * @param tag 标签
3944
- */
3945
- createTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
4066
+ */
4067
+ createTag(tag: ITagParam): Promise<IAsyncRes>;
3946
4068
  /**
3947
4069
  * 删除标签
3948
4070
  * @param tagId 标签id
3949
- */
3950
- removeTag(tagId: string): IPromiseResult<IAsyncRes>;
4071
+ */
4072
+ removeTag(tagId: string): Promise<IAsyncRes>;
3951
4073
  /**
3952
- * 编辑标签
4074
+ * 更新标签
3953
4075
  * @param tag 标签
3954
- */
3955
- updateTag(tag: ITagParam): IPromiseResult<IAsyncRes>;
4076
+ */
4077
+ updateTag(tag: ITagParam): Promise<IAsyncRes>;
3956
4078
  /**
3957
4079
  * 获取标签列表
3958
4080
  */
3959
- getTagList(): IPromiseResult<Array<ITagInfo>>;
4081
+ getTagList(): Promise<IAsyncRes<Array<ITagInfo>>>;
3960
4082
  /**
3961
4083
  * 添加会话到标签(给多个会话增加标签)
3962
4084
  * @param tagId 标签id
3963
4085
  * @param conversations 要添加的会话列表
3964
4086
  */
3965
- addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
4087
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3966
4088
  /**
3967
4089
  * 删除标签中的会话(从多个会话中批量删除指定标签)
3968
4090
  * @param tagId 标签id
3969
4091
  * @param conversations 要删除的会话列表
3970
4092
  */
3971
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult<IAsyncRes>;
4093
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): Promise<IAsyncRes<IAsyncRes>>;
3972
4094
  /**
3973
4095
  * 删除会话中的标签(从单一会话中批量删除标签)
3974
4096
  * @param conversationType 会话类型
3975
4097
  * @param targetId 会话id
3976
4098
  * @param tagIds 要删除的标签列表
3977
4099
  */
3978
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult<IAsyncRes>;
4100
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): Promise<IAsyncRes<IAsyncRes>>;
3979
4101
  /**
3980
4102
  * 获取标签下的会话列表
3981
4103
  * @param tagId 标签id
3982
4104
  */
3983
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
4105
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): Promise<IAsyncRes<IReceivedConversationByTag[]>>;
3984
4106
  /**
3985
4107
  * 获取标签下的未读消息数
3986
4108
  * @param tagId 标签id
3987
4109
  * @param containMuted 是否包含免打扰会话
3988
4110
  */
3989
- getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
4111
+ getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<IAsyncRes<number>>;
3990
4112
  /**
3991
4113
  * 设置标签中会话置顶
3992
4114
  * @param conversation 会话
3993
4115
  */
3994
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult<IAsyncRes>;
4116
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: {
4117
+ isTop: boolean;
4118
+ }): Promise<IAsyncRes<IAsyncRes>>;
3995
4119
  /**
3996
4120
  * 获取会话里的标签
3997
- * @param config
3998
- */
3999
- getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
4000
- /**
4001
- * 发送群组消息已读回执
4002
- * 导航下发已读回执开关为 true 时调用
4003
- */
4004
- sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
4005
- /**
4006
- * 获取群组消息已读列表
4007
- */
4008
- getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
4009
- /**
4010
- * 获取服务器时间
4121
+ * @param conversation
4011
4122
  */
4012
- getServerTime(): number;
4123
+ getTagsForConversation(conversation: IConversationOption): Promise<IAsyncRes<IConversationTag[]>>;
4013
4124
  /**
4014
- * 获取设备ID
4125
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4126
+ * 对于未实现的方法,接口响应 Unsupport 错误码
4127
+ * @param method 方法名
4128
+ * @param args
4015
4129
  */
4016
- getDeviceId(): string;
4130
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
4017
4131
  /**
4018
- * 获取当前 userId
4019
- */
4020
- getCurrentUserId(): string;
4132
+ * 删除所有会话
4133
+ */
4134
+ clearConversations(conversationTypes?: ConversationType[], tag?: string): Promise<ErrorCode>;
4021
4135
  /**
4022
- * 设置用户在线状态监听器
4136
+ * 设置用户连接状态监听器
4023
4137
  */
4024
4138
  setUserStatusListener(config: {
4025
4139
  userIds: string[];
4026
4140
  }, listener: Function): void;
4027
4141
  /**
4028
- * 设置当前用户在线状态
4029
- */
4030
- setUserStatus(status: number): Promise<ErrorCode>;
4031
- /**
4032
- * 订阅用户在线状态
4033
- */
4034
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4035
- /**
4036
- * 获取用户状态
4037
- */
4038
- getUserStatus(userId: string): IPromiseResult<{
4039
- status: string;
4040
- }>;
4041
- /**
4042
- * 清空所有会话
4043
- */
4044
- clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
4045
- /**
4046
- * 加入黑名单
4142
+ * 添加用户黑名单
4047
4143
  */
4048
4144
  addToBlacklist(userId: string): Promise<ErrorCode>;
4049
4145
  /**
4050
- * 将指定用户移除黑名单
4146
+ * 将指定用户移除黑名单
4051
4147
  */
4052
4148
  removeFromBlacklist(userId: string): Promise<ErrorCode>;
4053
4149
  /**
4054
- * 获取黑名单列表
4150
+ * 获取黑名单列表
4055
4151
  */
4056
- getBlacklist(): IPromiseResult<string[]>;
4152
+ getBlacklist(): Promise<IAsyncRes<string[]>>;
4057
4153
  /**
4058
- * 获取指定人员在黑名单中的状态
4154
+ * 获取指定人员在黑名单中的状态
4059
4155
  */
4060
- getBlacklistStatus(userId: string): IPromiseResult<string>;
4156
+ getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
4061
4157
  /**
4062
4158
  * 向本地插入一条消息,不发送到服务器
4063
4159
  */
4064
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
4160
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): Promise<IAsyncRes<IReceivedMessage>>;
4065
4161
  /**
4066
4162
  * 删除本地消息
4067
4163
  */
4068
- deleteMessages(timestamps: number[]): Promise<ErrorCode>;
4164
+ deleteMessages(timestamp: number[]): Promise<ErrorCode>;
4069
4165
  /**
4070
- * 通过时间戳删除本地消息
4166
+ * 从本地消息数据库中删除某一会话指定时间之前的消息数据
4071
4167
  */
4072
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
4168
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId?: string): Promise<ErrorCode>;
4073
4169
  /**
4074
4170
  * 清空会话下历史消息
4075
4171
  */
4076
- clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
4172
+ clearMessages(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
4077
4173
  /**
4078
- * 获取消息
4174
+ * 获取本地消息
4079
4175
  */
4080
- getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
4176
+ getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
4081
4177
  /**
4082
4178
  * 设置消息内容
4083
4179
  */
@@ -4086,49 +4182,62 @@ interface IEngine {
4086
4182
  * 设置消息搜索字段
4087
4183
  */
4088
4184
  setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
4089
- /**
4090
- * 通过关键字搜索会话
4091
- */
4092
- searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
4093
- /**
4094
- * 按内容搜索会话内的消息
4095
- */
4096
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
4097
- messages: IReceivedMessage[];
4098
- count: number;
4099
- }>;
4100
- /**
4101
- * 获取会话下所有未读的 @ 消息
4102
- */
4103
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
4104
4185
  /**
4105
4186
  * 设置消息发送状态
4106
4187
  */
4107
4188
  setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
4108
4189
  /**
4109
- * 设置消息接收状态
4190
+ * 设置消息接收状态
4110
4191
  */
4111
4192
  setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
4112
4193
  /**
4113
- * 删除时间戳前的未读数
4194
+ * 设置当前用户在线状态
4114
4195
  */
4115
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
4196
+ setUserStatus(status: number): Promise<ErrorCode>;
4116
4197
  /**
4117
- * 获取会话免打扰状态
4198
+ * 订阅用户在线状态
4118
4199
  */
4119
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
4200
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4120
4201
  /**
4121
- * 协议栈获取远端历史消息
4202
+ * 获取用户在线状态
4122
4203
  */
4123
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
4204
+ getUserStatus(userId: string): Promise<IAsyncRes<{
4205
+ status: string;
4206
+ }>>;
4207
+ searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
4208
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
4209
+ messages: IReceivedMessage[];
4210
+ count: number;
4211
+ }>>;
4212
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
4213
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4214
+ /**
4215
+ * 获取会话免打扰状态
4216
+ */
4217
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId?: string): Promise<IAsyncRes<NotificationStatus>>;
4218
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): Promise<IAsyncRes<{
4124
4219
  list: IReceivedMessage[];
4125
4220
  hasMore: boolean;
4126
- }>;
4127
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4221
+ }>>;
4222
+ /**
4223
+ * 获取群组消息送达信息
4224
+ */
4225
+ getGroupMessageDeliverList(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IGroupMessageDeliverInfo>;
4226
+ /**
4227
+ * 获取单聊消息送达信息
4228
+ */
4229
+ getPrivateMessageDeliverTime(messageUId: string, channelId?: string): IPromiseResult<number>;
4230
+ /**
4231
+ * 加入房间
4232
+ * @param roomId
4233
+ * @param mode 房间模式:直播 or 会议
4234
+ * @param mediaType 直播房间模式下的媒体资源类型
4235
+ */
4236
+ joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
4128
4237
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4129
- rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4130
- getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
4131
- getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
4238
+ rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
4239
+ getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
4240
+ getRTCUserInfoList(roomId: string): Promise<IAsyncRes<IRTCUsers>>;
4132
4241
  getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
4133
4242
  setRTCUserInfo(roomId: string, key: string, value: string): Promise<ErrorCode>;
4134
4243
  removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
@@ -4136,49 +4245,43 @@ interface IEngine {
4136
4245
  name: string;
4137
4246
  content: string;
4138
4247
  }): Promise<ErrorCode>;
4139
- /**
4140
- * 全量订阅资源修改
4141
- * @param roomId 房间 Id
4142
- * @param message 向前兼容的消息内容
4143
- * @param valueInfo 全量资源数据
4144
- * @param objectName 全量 URI 消息名
4145
- */
4146
4248
  setRTCTotalRes(roomId: string, message: {
4147
4249
  name: string;
4148
4250
  content: string;
4149
- }, valueInfo: string, objectName: string, mcuValInfo: string): Promise<ErrorCode>;
4150
- getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
4251
+ }, valueInfo: string, objectName: string, mcuValInfo?: string): Promise<ErrorCode>;
4252
+ setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4253
+ getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): Promise<IAsyncRes<KVString>>;
4151
4254
  removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
4152
4255
  name: string;
4153
4256
  content: string;
4154
4257
  }): Promise<ErrorCode>;
4155
4258
  setRTCOutData(roomId: string, rtcData: unknown, type: number, message: unknown): Promise<ErrorCode>;
4156
4259
  getRTCOutData(roomId: string, userIds: string[]): IPromiseResult<unknown>;
4157
- getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
4158
- setRTCState(roomId: string, reportId: string): Promise<ErrorCode>;
4260
+ getRTCToken(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<IRtcTokenData>>;
4261
+ setRTCState(roomId: string, report: string): Promise<ErrorCode>;
4159
4262
  getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
4160
- setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4161
- }
4162
-
4163
- interface IExpansionMsgContent {
4164
4263
  /**
4165
- * 消息扩展的对象
4166
- */
4167
- put?: {
4168
- [key: string]: string;
4169
- };
4264
+ * 直播观众加房间
4265
+ */
4266
+ joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
4267
+ token: string;
4268
+ }>>;
4170
4269
  /**
4171
- * 删除的 keys
4172
- */
4173
- del?: string[];
4270
+ * 直播观众退出房间
4271
+ */
4272
+ quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
4174
4273
  /**
4175
- * messageUId
4176
- */
4177
- mid: string;
4274
+ * 直播身份切换
4275
+ */
4276
+ rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
4178
4277
  /**
4179
- * 是否删除所有, 有效值:0、1 . ( 后续如有需要, API Layer 层可使用)
4180
- */
4181
- removeAll?: number;
4278
+ * 获取加入 RTC 房间的用户信息(当前仅能查自己的)
4279
+ */
4280
+ getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
4281
+ /**
4282
+ * 拉取 RTC 全量 KV
4283
+ */
4284
+ pullRTCRoomEntry(roomId: string, timestamp: number): Promise<IAsyncRes<IChrmKVPullData>>;
4182
4285
  }
4183
4286
 
4184
4287
  declare class RTCPluginContext extends PluginContext {
@@ -4193,7 +4296,7 @@ declare class RTCPluginContext extends PluginContext {
4193
4296
  * @param mode 房间模式:直播 or 会议
4194
4297
  * @param broadcastType
4195
4298
  */
4196
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4299
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
4197
4300
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4198
4301
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4199
4302
  getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -4264,7 +4367,6 @@ declare class RTCPluginContext extends PluginContext {
4264
4367
  */
4265
4368
  joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<{
4266
4369
  token: string;
4267
- kvEntries: IServerRTCRoomEntry[];
4268
4370
  }>;
4269
4371
  /**
4270
4372
  * 直播观众退出房间
@@ -4274,6 +4376,10 @@ declare class RTCPluginContext extends PluginContext {
4274
4376
  * 直播身份切换
4275
4377
  */
4276
4378
  rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4379
+ /**
4380
+ * 拉取 RTC 全量 KV
4381
+ */
4382
+ pullRTCRoomEntry(roomId: string, timestamp: number): IPromiseResult<IChrmKVPullData>;
4277
4383
  }
4278
4384
 
4279
4385
  declare abstract class ANavi {
@@ -4322,6 +4428,7 @@ interface IEngineWatcher {
4322
4428
  */
4323
4429
  onRTCDataChange: (data: IServerRTCRoomEntry[], roomId?: string) => void;
4324
4430
  pullFinished: () => void;
4431
+ messageDelivered: (data: IMessageDeliver[]) => void;
4325
4432
  }
4326
4433
  /**
4327
4434
  * 引擎定义
@@ -4687,10 +4794,6 @@ declare abstract class AEngine implements IEngine {
4687
4794
  * 获取设备ID
4688
4795
  */
4689
4796
  abstract getDeviceId(): string;
4690
- /**
4691
- * 获取当前 userId
4692
- */
4693
- abstract getCurrentUserId(): string;
4694
4797
  /**
4695
4798
  * 设置用户在线状态监听器
4696
4799
  */
@@ -4797,7 +4900,15 @@ declare abstract class AEngine implements IEngine {
4797
4900
  list: IReceivedMessage[];
4798
4901
  hasMore: boolean;
4799
4902
  }>;
4800
- abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
4903
+ /**
4904
+ * 获取群组消息送达列表
4905
+ */
4906
+ abstract getGroupMessageDeliverList(targetId: string, messageUId: string, channelId: string): IPromiseResult<IGroupMessageDeliverInfo>;
4907
+ /**
4908
+ * 获取单聊消息送达列表
4909
+ */
4910
+ abstract getPrivateMessageDeliverTime(messageUId: string, channelId: string): IPromiseResult<number>;
4911
+ abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
4801
4912
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
4802
4913
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4803
4914
  abstract getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -4832,11 +4943,12 @@ declare abstract class AEngine implements IEngine {
4832
4943
  abstract getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
4833
4944
  abstract joinLivingRoomAsAudience(roomId: string, mode: RTCMode, broadcastType?: number): Promise<IAsyncRes<{
4834
4945
  token: string;
4835
- kvEntries: IServerRTCRoomEntry[];
4836
4946
  }>>;
4837
4947
  abstract quitLivingRoomAsAudience(roomId: string): Promise<ErrorCode>;
4838
4948
  abstract rtcIdentityChange(roomId: string, changeType: RTCIdentityChangeType, broadcastType?: number): Promise<IAsyncRes<IJoinRTCRoomData>>;
4949
+ abstract getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
4839
4950
  abstract setRTCCDNUris(roomId: string, objectName: string, CDNUris: string): Promise<ErrorCode>;
4951
+ abstract pullRTCRoomEntry(roomId: string, timestamp: number): Promise<IAsyncRes<IChrmKVPullData>>;
4840
4952
  }
4841
4953
 
4842
4954
  declare class AppStorage {
@@ -5287,4 +5399,4 @@ declare enum CONNECTION_TYPE {
5287
5399
  */
5288
5400
  declare const version: string;
5289
5401
 
5290
- export { AEngine, ANavi, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAsyncRes, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, 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, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntryOption, IRequest, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NotificationStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RTCApiType, RTCIdentityChangeType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, TagChangeType, UploadMethod, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, cloneByJSON, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };
5402
+ export { AEngine, ANavi, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAsyncRes, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IDeliveredUser, IEngine, IEngineWatcher, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGroupMessageDeliverInfo, IInsertMsgOptions, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_COMET_PULLMSG_TIMEOUT, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageDeliver, IMessageDeliveredListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntryOption, IRequest, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NotificationStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, TagChangeType, UploadMethod, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, cloneByJSON, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };