@rongcloud/imlib-next 5.0.0-alpha.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.
@@ -0,0 +1,1000 @@
1
+ import { LogLevel, MessageDirection, IReadReceiptInfo, IPushConfig, IPluginGenerator, ConnectionStatus, IEventListener, NotificationStatus, IConversationOption, IReceivedConversation, ConversationType, IChatroomInfo, IUserProfile, IMessageReaderResponse, IAsyncRes, IReceivedMessage, ITagParam, ITagInfo, IConversationTag, IReceivedConversationByTag } from '@rongcloud/engine';
2
+ export { ConnectionStatus, ConversationType, IChatroomListenerData, IConversationOption, IDeletedExpansion, IExpansionListenerData, IPluginGenerator, IUpdatedExpansion, LogLevel, MessageDirection, NotificationStatus, ReceivedStatus, UploadMethod } from '@rongcloud/engine';
3
+
4
+ declare type IInitOption = {
5
+ /**
6
+ * 应用 appkey 标识
7
+ */
8
+ appkey: string;
9
+ /**
10
+ * 修改 engine log 打印等级
11
+ */
12
+ logLevel?: LogLevel;
13
+ /**
14
+ * 修改默认的 log 输出函数
15
+ */
16
+ logStdout?: (logLevel: LogLevel, content: string) => void;
17
+ /**
18
+ * 自定义导航地址,公有云用户不推荐修改
19
+ */
20
+ navigators?: string[];
21
+ /**
22
+ * 连接方式,默认使用 'websocket'
23
+ */
24
+ connectType?: 'websocket' | 'comet';
25
+ /**
26
+ * 小程序平台专属配置
27
+ */
28
+ customCMP?: string[];
29
+ /**
30
+ * 是否打开 IndexDB 存储, 默认为 true
31
+ */
32
+ indexDBSwitch?: boolean;
33
+ /**
34
+ * 是否校验证书,默认为 true
35
+ */
36
+ checkCA?: boolean;
37
+ };
38
+ /**
39
+ * 用户收到的消息结构
40
+ */
41
+ interface IAReceivedMessage {
42
+ /**
43
+ * 消息类型
44
+ * @example RC:TxtMsg
45
+ */
46
+ messageType: string;
47
+ /**
48
+ * 消息内容
49
+ */
50
+ content: Object;
51
+ /**
52
+ * 消息发送者的用户 id
53
+ */
54
+ senderUserId: string;
55
+ /**
56
+ * 会话 id
57
+ */
58
+ targetId: string;
59
+ /**
60
+ * 会话的业务标识
61
+ */
62
+ channelId: string;
63
+ /**
64
+ * 会话类型
65
+ * * 1: 单聊
66
+ * * 3: 群聊
67
+ * * 4: 聊天室
68
+ * * 5: 客服会话
69
+ * * 6: 系统消息
70
+ * * 7: 默认关注的公众号
71
+ * * 8: 手动关注的公众号
72
+ * * 9: RTCLib 房间
73
+ */
74
+ type: number;
75
+ /**
76
+ * 消息在服务器端的发送时间
77
+ */
78
+ sentTime: number;
79
+ /**
80
+ * 消息接收时间,该时间通过消息的 `sentTime` 值在本地进行计算得出,不推荐使用
81
+ * @description 当 isOffLineMessage 为 true 时,该值无效
82
+ */
83
+ receivedTime: number;
84
+ /**
85
+ * 服务端存储的消息 Id
86
+ */
87
+ messageUId: string;
88
+ /**
89
+ * 消息方向
90
+ * * 1: 发送
91
+ * * 2: 接收
92
+ */
93
+ messageDirection: MessageDirection;
94
+ /**
95
+ * 是否存储
96
+ * @default true
97
+ */
98
+ isPersited: boolean;
99
+ /**
100
+ * 是否计数
101
+ * @default true
102
+ */
103
+ isCounted: boolean;
104
+ /**
105
+ * 是否为离线消息
106
+ */
107
+ isOffLineMessage: boolean;
108
+ /**
109
+ * 是否为 @ 消息
110
+ */
111
+ isMentioned?: boolean;
112
+ /**
113
+ * 消息是否静默
114
+ * @description 静默消息不会发送 Push 信息和本地通知提醒
115
+ */
116
+ disableNotification?: boolean;
117
+ /**
118
+ * 是否是状态消息
119
+ */
120
+ isStatusMessage?: boolean;
121
+ /**
122
+ * 是否支持消息扩展
123
+ */
124
+ canIncludeExpansion: boolean;
125
+ /**
126
+ * 消息扩展
127
+ */
128
+ expansion?: {
129
+ [key: string]: any;
130
+ } | null;
131
+ /**
132
+ * 消息接收状态
133
+ */
134
+ receivedStatus: number;
135
+ /**
136
+ * 消息已读回执信息,导航配置grpRRVer=1时群组类型消息内存在, 其他情况为undefined
137
+ */
138
+ readReceiptInfo?: IReadReceiptInfo;
139
+ /**
140
+ * 推送扩展
141
+ */
142
+ pushConfig?: IPushConfig;
143
+ }
144
+ declare type ISetChatroomEntryOption = {
145
+ key: string;
146
+ value: string;
147
+ isAutoDelete?: boolean;
148
+ isSendNotification?: boolean;
149
+ notificationExtra?: string;
150
+ };
151
+ declare type ISetChatroomEntriesOption = {
152
+ entries: {
153
+ key: string;
154
+ value: string;
155
+ }[];
156
+ isAutoDelete?: boolean;
157
+ notificationExtra?: string;
158
+ };
159
+ declare type IRemoveChatroomEntryOption = {
160
+ key: string;
161
+ isSendNotification?: boolean;
162
+ notificationExtra?: string;
163
+ };
164
+ declare type IRemoveChatroomEntriesOption = {
165
+ entries: string[];
166
+ notificationExtra?: string;
167
+ };
168
+ declare type GetHistoryMessageOption = {
169
+ /**
170
+ * 获取此时间之前的消息,0 为从当前时间拉取
171
+ */
172
+ timestamp?: number;
173
+ /**
174
+ * 获取消息的数量,范围: 1-20
175
+ */
176
+ count?: number;
177
+ /**
178
+ * 获取消息的排列顺序
179
+ * * 0: 升序
180
+ * * 1: 降序
181
+ */
182
+ order?: 0 | 1;
183
+ };
184
+ declare type GetHistoryMessageResult = {
185
+ list: IAReceivedMessage[];
186
+ hasMore: boolean;
187
+ };
188
+
189
+ /**
190
+ * 初始化
191
+ * @param initOption
192
+ */
193
+ declare const init: (initOption: IInitOption) => void;
194
+ /**
195
+ * 装载 plugin 插件,并返回相应的插件实例,需在调用 `connect` 方法之前使用
196
+ * @param plugins
197
+ */
198
+ declare function installPlugin<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
199
+ /**
200
+ * 建立 IM 连接
201
+ */
202
+ declare function connect(token: string): Promise<{
203
+ id: string;
204
+ }>;
205
+ /**
206
+ * 断开当前用户的连接
207
+ * @description 调用后将不再接收消息,不可发送消息,不可获取历史消息,不可获取会话列表
208
+ */
209
+ declare function disconnect(): Promise<void>;
210
+ /**
211
+ * 获取 IM 连接状态
212
+ */
213
+ declare function getConnectionStatus(): ConnectionStatus;
214
+ /**
215
+ * 当前服务器时间
216
+ * 校准时间,可能存在误差
217
+ */
218
+ declare function getServerTime(): number;
219
+ /**
220
+ * 获取 IM 连接用户的 id
221
+ */
222
+ declare function getCurrentUserId(): string;
223
+ /**
224
+ * 绑定事件
225
+ */
226
+ declare function addEvent(eventType: string, listener: IEventListener, target?: any): void;
227
+ declare function onceEvent(eventType: string, listener: IEventListener, target?: any): void;
228
+ /**
229
+ * 移除事件
230
+ */
231
+ declare function removeEvent(eventType: string, listener: IEventListener, target?: any): void;
232
+ /**
233
+ * 移除同一类型下的所有事件
234
+ */
235
+ declare function removeAllEvents(eventType: string): void;
236
+ /**
237
+ * 清理所有事件
238
+ */
239
+ declare function clearEvents(): void;
240
+
241
+ interface IConversationUpdateItem {
242
+ time: number;
243
+ val: any;
244
+ }
245
+ declare type MentionedInfo = {
246
+ /**
247
+ * `@ 类型,其中 1 为 @ 所有人,2 为 @ 部分人`
248
+ */
249
+ type?: 1 | 2;
250
+ /**
251
+ * 被 @ 的用户 Id 列表,仅在 `type` 为 `2` 时有效
252
+ */
253
+ userIdList?: Array<string>;
254
+ };
255
+ interface IReceivedUpdateConversation {
256
+ updatedItems: {
257
+ [key: string]: IConversationUpdateItem;
258
+ };
259
+ type: number;
260
+ targetId: string;
261
+ latestMessage?: IAReceivedMessage;
262
+ unreadMessageCount?: number;
263
+ hasMentioned?: boolean;
264
+ mentionedInfo?: MentionedInfo;
265
+ lastUnreadTime?: number;
266
+ notificationStatus?: NotificationStatus;
267
+ isTop?: boolean;
268
+ }
269
+ /**
270
+ * 用户收到的会话结构
271
+ */
272
+ interface IAReceivedConversation {
273
+ /**
274
+ * 会话类型
275
+ * * 1: 单聊
276
+ * * 3: 群聊
277
+ * * 4: 聊天室
278
+ * * 5: 客服会话
279
+ * * 6: 系统消息
280
+ * * 7: 默认关注的公众号
281
+ * * 8: 手动关注的公众号
282
+ * * 9: RTCLib 房间
283
+ */
284
+ type: number;
285
+ /**
286
+ * 会话 id
287
+ */
288
+ targetId: string;
289
+ /**
290
+ * 会话中的最后一条消息
291
+ */
292
+ latestMessage: IAReceivedMessage | null;
293
+ /**
294
+ * 当前会话的未读消息数
295
+ */
296
+ unreadMessageCount?: number;
297
+ /**
298
+ * 是否包含 @ 自己的消息
299
+ * @description 仅在 `conversationType` 为 `ConversationType.GROUP` 时有效
300
+ */
301
+ hasMentioned?: boolean;
302
+ /**
303
+ * 消息中的 @ 数据
304
+ * @description 仅在 `conversationType` 为 `ConversationType.GROUP` 时有效
305
+ */
306
+ mentionedInfo?: MentionedInfo;
307
+ /**
308
+ * 会话中消息的最后未读时间
309
+ */
310
+ lastUnreadTime?: number;
311
+ /**
312
+ * 会话免打扰状态
313
+ * * 1: 开启免打扰
314
+ * * 2: 关闭免打扰
315
+ */
316
+ notificationStatus?: NotificationStatus;
317
+ /**
318
+ * 会话是否置顶
319
+ */
320
+ isTop?: boolean;
321
+ }
322
+ interface ISendMessageOptions {
323
+ /**
324
+ * 是否是状态消息,一般为无需注册的自定义消息
325
+ * @description
326
+ * 1. 状态消息只有 pub,没有 ack 应答
327
+ * 2. 状态消息默认不存储,不计数,`isPersited` 与 `isCounted` 配置将失效
328
+ */
329
+ isStatusMessage?: boolean;
330
+ /**
331
+ * 是否发送静默消息
332
+ * @description
333
+ * 当值为 `true` 时,服务器将不会发送 Push 信息,移动端也不会弹出本地通知提醒
334
+ */
335
+ disableNotification?: boolean;
336
+ /**
337
+ * Push 信息
338
+ */
339
+ pushContent?: string;
340
+ /**
341
+ * Push 通知携带的附加信息
342
+ */
343
+ pushData?: string;
344
+ /**
345
+ * 是否为 @ 消息,只当 conversationType 值为 `ConversationType.GROUP` 时有效
346
+ */
347
+ isMentioned?: boolean;
348
+ /**
349
+ * `@` 消息类型
350
+ * @description `1: @ 所有人 2: @ 指定用户`
351
+ */
352
+ mentionedType?: 1 | 2;
353
+ /**
354
+ * 被 @ 的用户 Id 列表,当 `mentionedType` 值为 `1` 时,该值可为空
355
+ */
356
+ mentionedUserIdList?: string[];
357
+ /**
358
+ * 用于发送群定向消息,只当 conversationType 值为 `ConversationType.GROUP` 时有效
359
+ */
360
+ directionalUserIdList?: string[];
361
+ /**
362
+ * 当对方为 iOS 设备且未在线时,其将收到 Voip Push. 此配置对 Android 无影响
363
+ */
364
+ isVoipPush?: boolean;
365
+ /**
366
+ * 消息是否支持拓展内容
367
+ */
368
+ canIncludeExpansion?: boolean;
369
+ /**
370
+ * 消息拓展内容数据
371
+ */
372
+ expansion?: {
373
+ [key: string]: string;
374
+ };
375
+ /**
376
+ * 黑/白名单
377
+ * @todo 功能未知,需确认
378
+ */
379
+ isFilerWhiteBlacklist?: boolean;
380
+ /**
381
+ * 移动端推送配置
382
+ */
383
+ pushConfig?: IPushConfig;
384
+ }
385
+ interface ISendMessageBody {
386
+ /**
387
+ * 消息类型,即消息结构的 ObjectName,某个版本抛弃
388
+ */
389
+ messageType: string;
390
+ /**
391
+ * 消息内容,某个版本抛弃
392
+ */
393
+ content?: any;
394
+ /**
395
+ * 是否存储
396
+ * @description 只在发送未注册过的自定义消息时有效,否则使用注册时的配置
397
+ */
398
+ isPersited?: boolean;
399
+ /**
400
+ * 是否计数
401
+ * @description 只在发送未注册过的自定义消息时有效,否则使用注册时的配置
402
+ */
403
+ isCounted?: boolean;
404
+ }
405
+
406
+ /**
407
+ * 获取会话列表
408
+ * @param options
409
+ */
410
+ declare function getConversationList(options: {
411
+ /**
412
+ * 会话数量
413
+ */
414
+ count?: number;
415
+ /**
416
+ * 获取起始时间
417
+ * 默认值: 0
418
+ * order 为 0 startTime 默认值为当前时间
419
+ * order 为 1 startTime 默认值为所有会话中最早的消息时间
420
+ */
421
+ startTime?: number;
422
+ /**
423
+ * 默认值: 0
424
+ * 0 获取 startTime 之前的
425
+ * 1 获取 startTime 之后的
426
+ */
427
+ order?: 0 | 1;
428
+ /**
429
+ * 强制从服务器拉取
430
+ */
431
+ force?: false;
432
+ }, channelId?: string): Promise<{
433
+ code: number;
434
+ data: IAReceivedConversation[];
435
+ }>;
436
+ /**
437
+ * 获取指定会话实例,通过实例可实现向指定会话收发消息等功能
438
+ * @description 通过该方法获取的会话可能并不存在于当前的会话列表中,此处只作为功能性封装语法糖
439
+ * @param options
440
+ */
441
+ declare function getConversation(options: IConversationOption): Promise<{
442
+ code: number;
443
+ data: IReceivedConversation | null | undefined;
444
+ }>;
445
+ /**
446
+ * 移除指定的会话实例
447
+ */
448
+ declare function removeConversation(options: IConversationOption): Promise<void>;
449
+ /**
450
+ * 获取会话文本草稿
451
+ * @params conversationType 会话乐行
452
+ * @params targetId 目标 ID
453
+ */
454
+ declare function getTextMessageDraft(options: IConversationOption): Promise<{
455
+ code: number;
456
+ data: string;
457
+ }>;
458
+ /**
459
+ * 设置会话文本草稿
460
+ * @params conversationType 会话乐行
461
+ * @params targetId 目标 ID
462
+ * @params draft 草稿内容
463
+ */
464
+ declare function saveTextMessageDraft(options: IConversationOption, draft: string): Promise<void>;
465
+ /**
466
+ * 删除会话文本草稿
467
+ * @params conversationType 会话乐行
468
+ * @params targetId 目标 ID
469
+ */
470
+ declare function clearTextMessageDraft(options: IConversationOption): Promise<void>;
471
+ /**
472
+ * 获取当前所有会话的消息未读数
473
+ * @description
474
+ * 1. 清除浏览器缓存会导致会话未读数不准确
475
+ * 2. 会话消息未读数存储在 WebStorage 中, 若浏览器不支持或禁用 WebStorage,未读消息数将不会保存,浏览器页面刷新未读消息数将不会存在
476
+ * 3. 其他端删除会话可能会导致会话未读数不准确
477
+ * @param includeMuted 是否包含免打扰会话
478
+ * @param conversationTypes 要获取未读数的会话类型,若为空,则默认获取单聊、群聊及系统消息未读数
479
+ */
480
+ declare function getTotalUnreadCount(includeMuted?: boolean, conversationTypes?: ConversationType[]): Promise<{
481
+ code: number;
482
+ data: number;
483
+ }>;
484
+ /**
485
+ * 获取单个会话的未读数
486
+ *
487
+ */
488
+ declare function getUnreadCount(options: IConversationOption): Promise<{
489
+ code: number;
490
+ data: number;
491
+ }>;
492
+ /**
493
+ * 清除会话未读数
494
+ * 原:clearUnreadCount
495
+ */
496
+ declare function clearMessagesUnreadStatus(options: IConversationOption): Promise<{
497
+ code: number;
498
+ }>;
499
+ /**
500
+ * 设置会话免打扰
501
+ * 原: setConversationStatus,免打扰和置顶一体的
502
+ * 是否免打扰
503
+ * * 1: 开启免打扰
504
+ * * 2: 关闭免打扰
505
+ */
506
+ declare function setConversationNotificationStatus(conversation: IConversationOption, notificationStatus: NotificationStatus): Promise<void>;
507
+ /**
508
+ * 获取免打扰状态
509
+ * getConversationNotificationStatus
510
+ */
511
+ declare function getConversationNotificationStatus(conversation: IConversationOption): Promise<{
512
+ code: number;
513
+ data: NotificationStatus | undefined;
514
+ }>;
515
+ /**
516
+ * 获取免打扰状态列表
517
+ * getBlockedConversationList
518
+ */
519
+ declare function getBlockedConversationList(conversationTypeList: ConversationType[]): Promise<IAReceivedConversation[]>;
520
+ /**
521
+ * 设置会话是否置顶
522
+ */
523
+ declare function setConversationToTop(conversation: IConversationOption, isTop?: boolean): Promise<void>;
524
+ /**
525
+ * 获取置顶会话
526
+ */
527
+ declare function getTopConversationList(conversationTypeList: ConversationType[]): Promise<IAReceivedConversation[]>;
528
+
529
+ /**
530
+ * 加入聊天室
531
+ */
532
+ declare function joinChatRoom(targetId: string, options: {
533
+ /**
534
+ * 拉取消息数
535
+ */
536
+ count: number;
537
+ }): Promise<void>;
538
+ /**
539
+ * 加入已存在的聊天室
540
+ */
541
+ declare function joinExistChatRoom(targetId: string, options: {
542
+ /**
543
+ * 拉取消息数
544
+ */
545
+ count: number;
546
+ }): Promise<void>;
547
+ /**
548
+ * 退出聊天室
549
+ */
550
+ declare function quitChatRoom(targetId: string): Promise<void>;
551
+ /**
552
+ * 获取聊天室房间数据
553
+ * @description count 或 order 有一个为 0 时,只返回成员总数,不返回成员列表信息
554
+ */
555
+ declare function getChatRoomInfo(targetId: string, options: {
556
+ /**
557
+ * 获取聊天室的人数,传值范围:0-20,默认为 0
558
+ */
559
+ count?: number;
560
+ /**
561
+ * 聊天室的人员排序,默认为 0
562
+ * * 1: 升序
563
+ * * 2: 降序
564
+ */
565
+ order?: 0 | 1 | 2;
566
+ }): Promise<IChatroomInfo>;
567
+ /**
568
+ * 设置聊天室自定义属性
569
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
570
+ */
571
+ declare function setChatRoomEntry(targetId: string, options: ISetChatroomEntryOption): Promise<void>;
572
+ /**
573
+ * 批量设置聊天室自定义属性
574
+ * @param options ISetChatroomEntryOption数组
575
+ */
576
+ declare function setChatRoomEntries(targetId: string, options: ISetChatroomEntriesOption): Promise<void>;
577
+ /**
578
+ * 强制 增加/修改 任意聊天室属性
579
+ * @description 仅聊天室中不存在此属性或属性设置者为己方时可设置成功
580
+ */
581
+ declare function forceSetChatRoomEntry(targetId: string, options: ISetChatroomEntryOption): Promise<void>;
582
+ /**
583
+ * 删除聊天室属性
584
+ * @description 仅限于删除自己设置的聊天室属性
585
+ * @param key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
586
+ * @param isSendNotification? 删除成功后是否发送通知消息
587
+ * @param notificationExtra? RC:chrmKVNotiMsg 通知消息中携带的附加信息
588
+ */
589
+ declare function removeChatRoomEntry(targetId: string, options: IRemoveChatroomEntryOption): Promise<void>;
590
+ /**
591
+ * 批量删除聊天室属性
592
+ * @description 仅限于删除自己设置的聊天室属性
593
+ * @param entries[] 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
594
+ * @param notificationExtra? RC:chrmKVNotiMsg 通知消息中携带的附加信息
595
+ */
596
+ declare function removeChatRoomEntries(targetId: string, options: IRemoveChatroomEntriesOption): Promise<void>;
597
+ /**
598
+ * 强制删除聊天室内的任意属性
599
+ * @description
600
+ */
601
+ declare function forceRemoveChatRoomEntry(targetId: string, options: IRemoveChatroomEntryOption): Promise<void>;
602
+ /**
603
+ * 获取聊天室的指定属性
604
+ */
605
+ declare function getChatRoomEntry(targetId: string,
606
+ /**
607
+ * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
608
+ */
609
+ key: string): Promise<{
610
+ code: number;
611
+ data: string | number | boolean;
612
+ }>;
613
+ /**
614
+ * 获取聊天室的所有属性
615
+ */
616
+ declare function getAllChatRoomEntries(targetId: string): Promise<{
617
+ code: number;
618
+ data: {
619
+ [key: string]: string | number | boolean;
620
+ };
621
+ }>;
622
+ /**
623
+ * 获取聊天室的历史消息
624
+ */
625
+ declare function getChatroomHistoryMessages(targetId: string, options: GetHistoryMessageOption): Promise<{
626
+ code: number;
627
+ data: GetHistoryMessageResult;
628
+ }>;
629
+
630
+ /**
631
+ * 发送消息
632
+ * @param options
633
+ */
634
+ declare function sendMessage(conversation: IConversationOption, message: ISendMessageBody, options?: ISendMessageOptions): Promise<IAReceivedMessage>;
635
+ declare function sendTextMessage(conversation: IConversationOption, text: string, options?: ISendMessageOptions): Promise<IAReceivedMessage>;
636
+ declare function sendFileMessage(conversation: IConversationOption, file: Blob, onProgress?: Function, options?: ISendMessageOptions): Promise<unknown>;
637
+ declare function sendImageMessage(conversation: IConversationOption, image: Blob, onProgress?: Function, options?: ISendMessageOptions): Promise<unknown>;
638
+ declare function sendHQVoiceMessage(conversation: IConversationOption, audio: Blob, onProgress?: Function, options?: ISendMessageOptions): Promise<unknown>;
639
+ declare function sendSightMessage(conversation: IConversationOption, messageBody: {
640
+ video: Blob;
641
+ duration: number;
642
+ thumbnail: string;
643
+ name: string;
644
+ }, onProgress?: Function, options?: ISendMessageOptions): Promise<unknown>;
645
+ declare function sendCombineMessage(conversation: IConversationOption, messageBody: {
646
+ file: Blob;
647
+ nameList: string[];
648
+ summaryList: string;
649
+ conversationType: ConversationType;
650
+ }, onProgress?: Function, options?: ISendMessageOptions): Promise<unknown>;
651
+ /**
652
+ * 获取历史消息
653
+ * web端与getRemoteHistoryMessages相同
654
+ */
655
+ declare function getHistoryMessages(conversation: IConversationOption, options: GetHistoryMessageOption): Promise<{
656
+ code: number;
657
+ data: GetHistoryMessageResult;
658
+ }>;
659
+ /**
660
+ * 获取远程历史消息
661
+ */
662
+ declare function getRemoteHistoryMessages(conversation: IConversationOption, options: GetHistoryMessageOption): Promise<{
663
+ code: number;
664
+ data: GetHistoryMessageResult;
665
+ }>;
666
+ /**
667
+ * 发送单聊已读回执
668
+ */
669
+ declare function sendReadReceiptMessage(targetId: string, messageUId: string, lastMessageSendTime: number): Promise<IAReceivedMessage>;
670
+ /**
671
+ * 发送群已读回执
672
+ * @param messageUIds 消息UID列表
673
+ */
674
+ declare function sendReadReceiptRequest(targetId: string, messageUIds: string[]): Promise<void>;
675
+ /**
676
+ * 发送阅读回执响应
677
+ */
678
+ declare function sendReadReceiptResponse(targetId: string, messageUIds: string[]): Promise<IAReceivedMessage>;
679
+ /**
680
+ * 多端同步阅读状态
681
+ * @param conversation
682
+ * @param timestamp
683
+ */
684
+ declare function sendSyncReadStatusMessage(conversation: IConversationOption, lastMessageSendTime: number): Promise<IAReceivedMessage>;
685
+ /**
686
+ * 撤回消息
687
+ * @param options
688
+ */
689
+ declare function recallMessage(conversation: IConversationOption, options: {
690
+ /**
691
+ * 消息的唯一id,客户端依赖此属性查找要撤回的消息
692
+ */
693
+ messageUId: string;
694
+ /**
695
+ * 消息发送时间,服务端依赖此属性查找要撤回的消息
696
+ */
697
+ sentTime: number;
698
+ /**
699
+ * 撤回消息携带用户信息
700
+ */
701
+ user?: IUserProfile;
702
+ /**
703
+ * 是否发送静默消息
704
+ * @description
705
+ * 当值为 `true` 时,服务器将不会发送 Push 信息,移动端也不会弹出本地通知提醒
706
+ */
707
+ disableNotification?: boolean;
708
+ /**
709
+ * 移动端推送配置
710
+ */
711
+ pushConfig?: IPushConfig;
712
+ }): Promise<{
713
+ code: number;
714
+ data: IAReceivedMessage;
715
+ }>;
716
+ /**
717
+ * 按消息 id 删除消息
718
+ */
719
+ declare function deleteMessages(conversation: IConversationOption, messages: {
720
+ /**
721
+ * 消息 id
722
+ */
723
+ messageUId: string;
724
+ /**
725
+ * 消息发送时间
726
+ */
727
+ sentTime: number;
728
+ /**
729
+ * 消息方向
730
+ * * 1: 发送
731
+ * * 2: 接收
732
+ */
733
+ messageDirection: MessageDirection;
734
+ }[]): Promise<void>;
735
+ /**
736
+ * 按时间戳删除消息
737
+ */
738
+ declare function clearHistoryMessages(conversation: IConversationOption, options: {
739
+ /**
740
+ * 清除时间点, 该时间之前的消息将被清除
741
+ */
742
+ timestamp: number;
743
+ }): Promise<void>;
744
+ /**
745
+ * 更新(添加、替换)消息扩展属性
746
+ * @param expansion 要更新的消息扩展信息键值对
747
+ * @param message 要更新的原始消息体
748
+ */
749
+ declare function updateMessageExpansion(conversation: IConversationOption, expansion: {
750
+ [key: string]: any;
751
+ }, message: IAReceivedMessage): Promise<void>;
752
+ /**
753
+ * 删除扩展存储
754
+ * @params keys 需删除消息扩展的 keys
755
+ * @params message 原始消息体
756
+ */
757
+ declare function removeMessageExpansionForKey(conversation: IConversationOption, keys: string[], message: IAReceivedMessage): Promise<void>;
758
+ /**
759
+ * 发送typing消息
760
+ * @param typingContentType 输入状态消息类型
761
+ * @returns
762
+ */
763
+ declare function sendTypingStatusMessage(conversation: IConversationOption, typingContentType: string): Promise<{
764
+ code: number;
765
+ data: IAReceivedMessage;
766
+ }>;
767
+ /**
768
+ * 获取群已读列表
769
+ * @param messageUId 消息UID
770
+ * @returns
771
+ */
772
+ declare function getMessageReader(targetId: string, messageUId: string, channelId: string): Promise<{
773
+ code: number;
774
+ data: IMessageReaderResponse;
775
+ }>;
776
+ /**
777
+ * 注册自定义消息
778
+ * @param messageType 消息类型
779
+ * @param isPersited 是否存储
780
+ * @param isCounted 是否计数
781
+ * @param prototypes 消息属性名称
782
+ */
783
+ declare function registerMessageType(messageType: string, isPersited: boolean, isCounted: boolean, prototypes?: string[]): Promise<void>;
784
+ /**
785
+ * 获取第一条未读消息
786
+ * @param conversation
787
+ */
788
+ declare function getFirstUnreadMessage(conversation: IConversationOption): Promise<IAsyncRes<IReceivedMessage | null>>;
789
+
790
+ /**
791
+ * 创建标签
792
+ * @param tag 标签信息
793
+ */
794
+ declare function addTag(tag: ITagParam): Promise<void>;
795
+ /**
796
+ * 删除标签
797
+ * @param tagId 标签 ID
798
+ */
799
+ declare function removeTag(tagId: string): Promise<void>;
800
+ /**
801
+ * 编辑标签
802
+ * @param tag 标签信息
803
+ */
804
+ declare function updateTag(tag: ITagParam): Promise<void>;
805
+ /**
806
+ * 获取标签列表
807
+ */
808
+ declare function getTags(): Promise<{
809
+ code: number;
810
+ data: ITagInfo[] | undefined;
811
+ }>;
812
+ /**
813
+ * 获取会话下的标签
814
+ * @param conversation 会话信息
815
+ */
816
+ declare function getTagsFromConversation(conversation: IConversationOption): Promise<{
817
+ code: number;
818
+ data: IConversationTag[] | undefined;
819
+ }>;
820
+ /**
821
+ * 添加会话到指定标签
822
+ * @param tagId 标签 ID
823
+ * @param conversations 要添加的会话列表
824
+ */
825
+ declare function addConversationsToTag(tagId: string, conversations: IConversationOption[]): Promise<void>;
826
+ /**
827
+ * 删除指定标签中会话
828
+ * @param tagId 标签 ID
829
+ * @param conversations 要删除的会话列表
830
+ */
831
+ declare function removeConversationsFromTag(tagId: string, conversations: IConversationOption[]): Promise<void>;
832
+ /**
833
+ * 从指定会话中删除多个标签
834
+ * @param conversation 会话
835
+ * @param tagIds 要删除的标签列表
836
+ */
837
+ declare function removeTagsFromConversation(conversation: IConversationOption, tagIds: string[]): Promise<void>;
838
+ /**
839
+ * 从多个会话中删除指定的标签
840
+ * @param tagId 标签 ID
841
+ * @param conversations 要删除的会话列表
842
+ */
843
+ declare function removeTagFromConversations(tagId: string, conversations: IConversationOption[]): Promise<void>;
844
+ /**
845
+ * 分页获取标签下会话列表
846
+ * @param tagId 标签id
847
+ * @param count 获取数量
848
+ * @param timestamp 会话时间戳
849
+ */
850
+ declare function getConversationsFromTagByPage(tagId: string, count: number, startTime: number): Promise<{
851
+ code: number;
852
+ data: IReceivedConversationByTag[] | undefined;
853
+ }>;
854
+ /**
855
+ * 根据标签获取未读消息数
856
+ * @param tagId 标签id
857
+ * @param containMuted 是否包含免打扰
858
+ */
859
+ declare function getUnreadCountByTag(tagId: string, containMuted: boolean): Promise<{
860
+ code: number;
861
+ data: number | undefined;
862
+ }>;
863
+ /**
864
+ * 设置标签中会话置顶
865
+ * @param tagId 标签id
866
+ * @param conversation 会话
867
+ * @param status 状态
868
+ */
869
+ declare function setConversationToTopInTag(tagId: string, conversation: IConversationOption, isTop: boolean): Promise<void>;
870
+
871
+ declare enum WatchEvent {
872
+ CONNECTING = "connecting",
873
+ CONNECTED = "connected",
874
+ DISCONNECT = "disconnect",
875
+ SUSPEND = "suspend",
876
+ MESSAGES = "messages",
877
+ READ_RECEIPT_RECEIVED = "readReceiptReceived",
878
+ MESSAGE_RECEIPT_REQUEST = "messageReceiptRequest",
879
+ MESSAGE_RECEIPT_RESPONSE = "messageReceiptResponse",
880
+ CONVERSATION = "conversation",
881
+ CHATROOM = "chatroom",
882
+ EXPANSION = "expansion",
883
+ PULL_OFFLINE_MESSAGE_FINISHED = "pullOfflineMessageFinished",
884
+ TAG = "tag",
885
+ CONVERSATION_TAG = "conversationTag",
886
+ TYPING_STATUS = "typingStatus"
887
+ }
888
+
889
+ /**
890
+ * 图片消息
891
+ */
892
+
893
+ interface IImageMessageBody extends ISendMessageBody {
894
+ /**
895
+ * 图片的略缩图
896
+ * @description
897
+ * 1. 必须是 base64 字符串, 图片类型为 JPG
898
+ * 2. base64 字符串大小不可超过 80 KB
899
+ * 3. 字符串前无媒体类型前缀
900
+ */
901
+ content: string;
902
+ /**
903
+ * 原图远程地址
904
+ */
905
+ imageUri: string;
906
+ }
907
+ declare const _default$5: any;
908
+
909
+ /**
910
+ * 图片消息
911
+ */
912
+
913
+ interface IHQVoiceMessageBody extends ISendMessageBody {
914
+ /**
915
+ * 远程媒体资源地址
916
+ */
917
+ remoteUrl: string;
918
+ /**
919
+ * 编解码类型,默认为 aac 音频
920
+ */
921
+ type?: string;
922
+ /**
923
+ * 语音消息的时长,最大值为 60 (单位:秒)
924
+ */
925
+ duration: number;
926
+ }
927
+ declare const _default$4: any;
928
+
929
+ /**
930
+ * 短视频消息
931
+ */
932
+
933
+ interface ISightMessageBody extends ISendMessageBody {
934
+ /**
935
+ * 远程视频资源 url 地址
936
+ */
937
+ sightUrl: string;
938
+ /**
939
+ * 小视频首帧的缩略图进行 Base64 编码的结果值,格式为 JPG
940
+ * @description 注意在 Base64 进行 Encode 后需要将所有 \r\n 和 \r 和 \n 替换成空
941
+ */
942
+ content: string;
943
+ /**
944
+ * 视频时长,单位:秒
945
+ */
946
+ duration: number;
947
+ /**
948
+ * 视频尺寸,单位:Byte
949
+ */
950
+ size: number;
951
+ /**
952
+ * 视频文件名称
953
+ */
954
+ name: string;
955
+ }
956
+ declare const _default$3: any;
957
+
958
+ /**
959
+ * 文本消息
960
+ */
961
+
962
+ interface ITextMessageBody extends ISendMessageBody {
963
+ /**
964
+ * 文本消息内容
965
+ */
966
+ content: string;
967
+ }
968
+ declare const _default$2: any;
969
+
970
+ /**
971
+ * 富文本消息
972
+ */
973
+
974
+ interface ICombineMessageBody extends ISendMessageBody {
975
+ /**
976
+ * 存储在融云服务器的远端 HTML 文件路径
977
+ */
978
+ remoteUrl: string;
979
+ /**
980
+ * 在会话界面显示的合并转发消息中,前 4 条消息的用户名称
981
+ */
982
+ nameList: string;
983
+ /**
984
+ * 在会话界面显示的合并转发消息中,前 4 条消息的简略信息,与 nameList 属 性相对应
985
+ */
986
+ summaryList: string;
987
+ /**
988
+ * 会话类型,目前合并转发功能支持二人会话及群聊会话,二人会话是 1 、群组会话是 3
989
+ */
990
+ conversationType: ConversationType;
991
+ }
992
+ declare const _default$1: any;
993
+
994
+ /**
995
+ * 文件消息
996
+ */
997
+
998
+ declare const _default: any;
999
+
1000
+ export { _default$1 as CombineMessage, _default as FileMessage, GetHistoryMessageOption, GetHistoryMessageResult, _default$4 as HQVoiceMessage, IAReceivedConversation, IAReceivedMessage, ICombineMessageBody, IConversationUpdateItem, IHQVoiceMessageBody, IImageMessageBody, IInitOption, IReceivedUpdateConversation, IRemoveChatroomEntriesOption, IRemoveChatroomEntryOption, ISendMessageBody, ISendMessageOptions, ISetChatroomEntriesOption, ISetChatroomEntryOption, ISightMessageBody, ITextMessageBody, _default$5 as ImageMessage, MentionedInfo, _default$3 as SightMessage, _default$2 as TextMessage, WatchEvent, addConversationsToTag, addEvent, addTag, clearEvents, clearHistoryMessages, clearMessagesUnreadStatus, clearTextMessageDraft, connect, deleteMessages, disconnect, forceRemoveChatRoomEntry, forceSetChatRoomEntry, getAllChatRoomEntries, getBlockedConversationList, getChatRoomEntry, getChatRoomInfo, getChatroomHistoryMessages, getConnectionStatus, getConversation, getConversationList, getConversationNotificationStatus, getConversationsFromTagByPage, getCurrentUserId, getFirstUnreadMessage, getHistoryMessages, getMessageReader, getRemoteHistoryMessages, getServerTime, getTags, getTagsFromConversation, getTextMessageDraft, getTopConversationList, getTotalUnreadCount, getUnreadCount, getUnreadCountByTag, init, installPlugin, joinChatRoom, joinExistChatRoom, onceEvent, quitChatRoom, recallMessage, registerMessageType, removeAllEvents, removeChatRoomEntries, removeChatRoomEntry, removeConversation, removeConversationsFromTag, removeEvent, removeMessageExpansionForKey, removeTag, removeTagFromConversations, removeTagsFromConversation, saveTextMessageDraft, sendCombineMessage, sendFileMessage, sendHQVoiceMessage, sendImageMessage, sendMessage, sendReadReceiptMessage, sendReadReceiptRequest, sendReadReceiptResponse, sendSightMessage, sendSyncReadStatusMessage, sendTextMessage, sendTypingStatusMessage, setChatRoomEntries, setChatRoomEntry, setConversationNotificationStatus, setConversationToTop, setConversationToTopInTag, updateMessageExpansion, updateTag };