@rongcloud/engine 5.7.2-beem.5 → 5.7.2-beem.7

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.
Files changed (4) hide show
  1. package/index.d.ts +2098 -2030
  2. package/index.esm.js +1 -1
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1506,2844 +1506,2868 @@ declare enum SentStatus {
1506
1506
  DESTROYED = 60
1507
1507
  }
1508
1508
 
1509
- declare enum StoreKeys {
1509
+ /**
1510
+ * @category Interface
1511
+ */
1512
+ interface IChatroomEntryListenerData {
1510
1513
  /**
1511
- * Navi 数据缓存,暂未使用
1512
- */
1513
- NAVI = "rc-navi",
1514
+ * 更新的键
1515
+ */
1516
+ key: string;
1514
1517
  /**
1515
- * 实时日志已上报的时间戳
1516
- */
1517
- REALTIME_LOG_TIMESTAMP = "rc-realtime-log-timestamp"
1518
- }
1519
-
1520
- declare enum UltraGroupChannelType {
1521
- PUBLIC = 0,
1522
- PRIVATE = 1
1523
- }
1524
- declare enum UltraGroupChannelChangeType {
1525
- PUBLIC_TO_PRIVATE = 2,
1526
- PRIVATE_TO_PUBLIC = 3,
1527
- PUBLIC_TO_PRIVATE_USER_NOT_IN = 6
1528
- }
1529
- /** PB 结构 MsgChange 属性 changeType 对应枚举值 */
1530
- declare enum UltraMsgChangeType {
1531
- MSG_EXPANSION = 1,
1532
- MSG_MODIFY = 2,
1533
- MSG_RECALL = 3,
1534
- CHANNEL_CHANGE = 4,
1535
- USER_GROUP_CHANGE = 5
1518
+ * 更新的值
1519
+ */
1520
+ value: string;
1521
+ /**
1522
+ * 更新的时间
1523
+ */
1524
+ timestamp: number;
1525
+ /**
1526
+ * 更新的聊天室 ID
1527
+ */
1528
+ chatroomId: string;
1529
+ /**
1530
+ * 更新类型
1531
+ */
1532
+ type: ChatroomEntryType;
1536
1533
  }
1537
- /** PB 结构 MsgChange 属性 subChangeType 对应枚举值 */
1538
- declare enum UltraMsgSubChangeType {
1539
- CHANNEL_DELETE = 1,
1540
- PUBLIC_TO_PRIVATE = 2,
1541
- PRIVATE_TO_PUBLIC = 3,
1542
- PRIVATE_CHANNEL_USER_JOIN_PUBLIC = 4,
1543
- CHANNEL_USER_KICKED = 5,
1544
- PUBLIC_TO_PRIVATE_USER_NOT_IN = 6
1534
+ /**
1535
+ * @category Interface
1536
+ */
1537
+ interface IChatroomRejoinedFailed {
1538
+ /**
1539
+ * 自动重新加入的聊天室 ID
1540
+ */
1541
+ chatroomId: string;
1542
+ /**
1543
+ * 自动重新加入失败的 code
1544
+ */
1545
+ errorCode: number;
1545
1546
  }
1546
- declare enum UserGroupChangeType {
1547
- REMOVE_USER_GROUP = 1,
1548
- JOIN_USER_GROUP = 2,
1549
- EXIT_USER_GROUP = 3,
1550
- CHANNEL_BIND_USER_GROUP = 4,
1551
- CHANNEL_UNBIND_USER_GROUP = 5
1547
+ /**
1548
+ * @category Interface
1549
+ */
1550
+ interface IChatroomRejoinedSuccessed {
1551
+ /**
1552
+ * 自动重新加入的聊天室 ID
1553
+ */
1554
+ chatroomId: string;
1555
+ /**
1556
+ * 自动重新加入的聊天室拉取消息的数量
1557
+ */
1558
+ count: number;
1552
1559
  }
1553
-
1554
1560
  /**
1555
- * 音视频模式
1561
+ * @category Interface
1556
1562
  */
1557
- declare enum RTCMode {
1563
+ interface IChatroomUserChangeInfo {
1564
+ users: {
1565
+ [userId: string]: ChatroomUserChangeType;
1566
+ };
1567
+ chatroomId: string;
1568
+ }
1569
+ declare type IChatroomRejoinedInfo = IChatroomRejoinedFailed | IChatroomRejoinedSuccessed;
1570
+ /**
1571
+ * 聊天室信息
1572
+ * @category Interface
1573
+ */
1574
+ interface IChatroomListenerData {
1558
1575
  /**
1559
- * 普通音视频模式
1576
+ * SDK 内部重连聊天室信息
1577
+ */
1578
+ rejoinedRoom?: IChatroomRejoinedInfo;
1579
+ /**
1580
+ * 监听到的聊天室 KV 更新
1581
+ */
1582
+ updatedEntries?: IChatroomEntryListenerData[];
1583
+ /**
1584
+ * 登录退出的用户通知
1560
1585
  */
1561
- RTC = 0,
1586
+ userChange?: IChatroomUserChangeInfo;
1562
1587
  /**
1563
- * 直播模式
1588
+ * 聊天室销毁
1564
1589
  */
1565
- LIVE = 2,
1590
+ chatroomDestroyed?: string;
1591
+ }
1592
+ /**
1593
+ * @category Interface
1594
+ */
1595
+ interface IChatroomEntry {
1566
1596
  /**
1567
- *sip呼叫
1597
+ * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
1568
1598
  */
1569
- SIP = 4,
1599
+ key: string;
1570
1600
  /**
1571
- * 呼叫模式.包括单呼和群呼
1601
+ * 属性对应的值, 最大长度 4096 字符
1572
1602
  */
1573
- CALL = 5,
1603
+ value: string;
1574
1604
  /**
1575
- * 会议
1605
+ * 设置成功后是否发送通知消息
1576
1606
  */
1577
- MEETING = 6,
1607
+ isSendNotification?: boolean;
1578
1608
  /**
1579
- * 跨应用多人房间
1609
+ * RC:chrmKVNotiMsg 消息中携带的附加信息
1580
1610
  */
1581
- CROSS_MUTI = 7,
1611
+ notificationExtra?: string;
1582
1612
  /**
1583
- * 跨应用直播
1613
+ * 用户退出聊天室时是否清除此属性
1584
1614
  */
1585
- CROSS_LIVE = 8
1615
+ isAutoDelete?: boolean;
1586
1616
  }
1587
1617
  /**
1588
- * 直播类型
1618
+ * @category Interface
1589
1619
  */
1590
- declare enum LiveType {
1620
+ interface IChatroomUser {
1591
1621
  /**
1592
- * 音视频直播
1622
+ * 用户 id
1593
1623
  */
1594
- AUDIO_AND_VIDEO = 0,
1624
+ id: string;
1595
1625
  /**
1596
- * 音频直播
1626
+ * 加入聊天室的时间
1597
1627
  */
1598
- AUDIO = 1
1628
+ time: number;
1599
1629
  }
1600
- declare enum LiveRole {
1630
+ /**
1631
+ * @category Interface
1632
+ */
1633
+ interface IChatroomInfo {
1601
1634
  /**
1602
- * 主播身份
1635
+ * 成员列表
1636
+ * @todo 需确认数组元素的数据结构
1603
1637
  */
1604
- ANCHOR = 1,
1638
+ userInfos: IChatroomUser[];
1605
1639
  /**
1606
- * 观众身份
1640
+ * 房间内总人数
1607
1641
  */
1608
- AUDIENCE = 2
1609
- }
1610
- /**
1611
- * CallLib 流程消息
1612
- */
1613
- declare const CallLibMsgType: {
1614
- 'RC:VCAccept': string;
1615
- 'RC:VCRinging': string;
1616
- 'RC:VCSummary': string;
1617
- 'RC:VCHangup': string;
1618
- 'RC:VCInvite': string;
1619
- 'RC:VCModifyMedia': string;
1620
- 'RC:VCModifyMem': string;
1621
- };
1622
- declare enum RTCApiType {
1623
- ROOM = 1,
1624
- PERSON = 2
1625
- }
1626
- declare enum RTCIdentityChangeType {
1627
- AnchorToViewer = 1,
1628
- ViewerToAnchor = 2
1642
+ userCount: number;
1629
1643
  }
1630
1644
  /**
1631
- * RTC 房间加入类型
1645
+ * @category Interface
1632
1646
  */
1633
- declare enum RTCJoinType {
1647
+ interface IRemoveChatroomEntry {
1634
1648
  /**
1635
- * 踢前一个设备
1649
+ * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
1636
1650
  */
1637
- KICK = 0,
1651
+ key: string;
1638
1652
  /**
1639
- * 当前加入拒绝
1653
+ * 删除成功后是否发送通知消息
1640
1654
  */
1641
- REFUSE = 1,
1655
+ isSendNotification?: boolean;
1642
1656
  /**
1643
- * 两个设备共存
1657
+ * RC:chrmKVNotiMsg 消息中携带的附加信息
1644
1658
  */
1645
- COEXIST = 2
1659
+ notificationExtra?: string;
1646
1660
  }
1647
-
1648
1661
  /**
1649
1662
  * @category Interface
1650
1663
  */
1651
- interface IGooglePushConfig {
1664
+ interface IRemoveChatroomEntries {
1652
1665
  /**
1653
- * 分组ID
1666
+ * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
1654
1667
  */
1655
- collapseKey?: string;
1668
+ entries: {
1669
+ key: string;
1670
+ }[];
1656
1671
  /**
1657
- *
1672
+ * 删除成功后是否发送通知消息
1658
1673
  */
1659
- imageUrl?: string;
1660
1674
  /**
1661
- *优先级
1675
+ * RC:chrmKVNotiMsg 消息中携带的附加信息
1662
1676
  */
1663
- priority?: 'high' | 'normal';
1677
+ notificationExtra?: string;
1664
1678
  }
1665
1679
  /**
1666
1680
  * @category Interface
1667
1681
  */
1668
- interface IiOSPushConfig {
1682
+ interface IChatroomEntries {
1669
1683
  /**
1670
- * iOS 用于通知分组的 id
1684
+ * entries ,要设置的属性列表
1685
+ * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
1686
+ * value 属性对应的值, 最大长度 4096 字符
1671
1687
  */
1672
- threadId?: string;
1688
+ entries: {
1689
+ key: string;
1690
+ value: string;
1691
+ }[];
1673
1692
  /**
1674
- * iOS 用于通知覆盖的 id
1693
+ * 设置成功后是否发送通知消息
1675
1694
  */
1676
- apnsCollapseId?: string;
1677
1695
  /**
1678
- * iOS 分类,如果不设置后台默认取消息类型字符串,如RC:TxtMsg
1696
+ * RC:chrmKVNotiMsg 消息中携带的附加信息
1679
1697
  */
1680
- category?: string;
1698
+ notificationExtra?: string;
1681
1699
  /**
1682
- * 和 category 对应
1700
+ * 用户退出聊天室时是否清除此属性
1683
1701
  */
1684
- richMediaUri?: string;
1702
+ isAutoDelete?: boolean;
1703
+ /**
1704
+ * 是否强制覆盖
1705
+ */
1706
+ isForce?: boolean;
1685
1707
  }
1708
+
1686
1709
  /**
1687
1710
  * @category Interface
1688
1711
  */
1689
- interface IAndroidPushConfig {
1712
+ interface IAsyncRes<T = void> {
1690
1713
  /**
1691
- * Android 的通知 id
1714
+ * Promise 执行结果
1692
1715
  */
1693
- notificationId?: string;
1716
+ code: ErrorCode;
1694
1717
  /**
1695
- * 小米的 channelId
1718
+ * 结果数据
1696
1719
  */
1697
- channelIdMi?: string;
1698
- /**
1699
- * 小米 Large icon 链接
1700
- * Large icon 可以出现在大图版和多字版消息中,显示在右边。
1701
- * 国内版仅 MIUI12 以上版本支持,以下版本均不支持;国际版支持。
1702
- * 图片要求:大小 120 * 120px,格式为 png 或者 jpg 格式。
1703
- */
1704
- miLargeIconUrl?: string;
1705
- /**
1706
- * 华为的 channelId
1707
- */
1708
- channelIdHW?: string;
1709
- /**
1710
- * 华为推送消息分类
1711
- * 更多信息请参考华为消息分类标准文档: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835
1712
- * 5.7.3 版本开始支持
1713
- */
1714
- categoryHW?: string;
1715
- /**
1716
- * 华为推送消息级别
1717
- * LOW: 表示消息为资讯营销
1718
- * NORMAL: 消息为服务与通讯
1719
- */
1720
- importanceHW?: 'NORMAL' | 'LOW';
1721
- /**
1722
- * 华为通知类型的推送所使用的通知图片 url
1723
- */
1724
- imageUrlHW?: string;
1725
- /**
1726
- * OPPO 的 channelId
1727
- */
1728
- channelIdOPPO?: string;
1720
+ data?: T;
1729
1721
  /**
1730
- * vivo 的类型
1722
+ * 错误消息
1731
1723
  */
1732
- typeVivo?: string;
1733
- /**
1734
- * google FCM 的推送配置
1735
- */
1736
- googleConfig?: IGooglePushConfig;
1724
+ msg?: string;
1737
1725
  }
1738
1726
  /**
1739
- * 推送配置
1740
- * @category Interface
1727
+ * 异步任务结果定义
1728
+ * @description
1729
+ * 通过 `Promise.resolve` 来处理预期内的异常,进而通过 Uncatch Promise Error 暴露预期外的异常
1741
1730
  */
1742
- interface IPushConfig {
1743
- /**
1744
- * 推送标题
1745
- * 如果没有设置,会使用下面的默认标题显示规则
1746
- * 默认标题显示规则:
1747
- * 内置消息:单聊通知标题显示为发送者名称,群聊通知标题显示为群名称。
1748
- * 自定义消息:默认不显示标题。
1749
- */
1750
- pushTitle: string;
1751
- /**
1752
- * 推送内容
1753
- * 优先使用 IPushConfig.pushContent, 如果没有,则使用发送消息的 pushContent 参数
1754
- */
1755
- pushContent: string;
1756
- /**
1757
- * 远程推送附加信息
1758
- * 优先使用 IPushConfig.pushData, 如果没有,则使用发送消息的 pushContent 参数
1759
- */
1760
- pushData: string;
1761
- /**
1762
- * iOSConfig
1763
- */
1764
- iOSConfig?: IiOSPushConfig;
1765
- /**
1766
- * androidConfig
1767
- */
1768
- androidConfig?: IAndroidPushConfig;
1731
+ declare type IPromiseResult<T = void> = Promise<IAsyncRes<T>>;
1732
+ interface IConnectResult {
1769
1733
  /**
1770
- * 是否显示推送标题. 仅针对 iOS 平台有效
1734
+ * 连接错误码
1771
1735
  */
1772
- disablePushTitle: boolean;
1736
+ code: ErrorCode;
1773
1737
  /**
1774
- * 是否强制推送
1738
+ * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
1775
1739
  */
1776
- forceShowDetailContent: boolean;
1777
- /**
1778
- * 推送模板id
1779
- */
1780
- templateId: string;
1740
+ userId?: string;
1781
1741
  }
1782
1742
 
1783
- /**
1784
- * 已读回执数据结构
1785
- * @category Interface
1786
- */
1787
- interface IMessageReader {
1788
- readTime: number;
1789
- userId: string;
1743
+ declare enum UltraGroupChannelType {
1744
+ PUBLIC = 0,
1745
+ PRIVATE = 1
1790
1746
  }
1791
- /**
1792
- * @category Interface
1793
- */
1794
- interface IMessageReaderResponse {
1795
- totalMemberCount: number;
1796
- list: IMessageReader[];
1747
+ declare enum UltraGroupChannelChangeType {
1748
+ PUBLIC_TO_PRIVATE = 2,
1749
+ PRIVATE_TO_PUBLIC = 3,
1750
+ PUBLIC_TO_PRIVATE_USER_NOT_IN = 6
1797
1751
  }
1798
- interface ILocalReadReceiptInfo {
1799
- hasRespond?: boolean;
1800
- readerInfo?: {
1801
- [userId: string]: number;
1802
- };
1803
- readCount?: number;
1804
- totalCount?: number;
1752
+ /** PB 结构 MsgChange 属性 changeType 对应枚举值 */
1753
+ declare enum UltraMsgChangeType {
1754
+ MSG_EXPANSION = 1,
1755
+ MSG_MODIFY = 2,
1756
+ MSG_RECALL = 3,
1757
+ CHANNEL_CHANGE = 4,
1758
+ USER_GROUP_CHANGE = 5
1805
1759
  }
1806
- /**
1807
- * @category Interface
1808
- */
1809
- interface IReadReceiptInfo {
1810
- /**
1811
- * 是否已经发送已读回执
1812
- */
1813
- hasRespond?: boolean;
1814
- /**
1815
- * 已阅读用户列表(不准确)
1816
- */
1817
- readerList?: IMessageReader[];
1818
- /**
1819
- * 阅读人数(不准确)
1820
- */
1821
- readCount?: number;
1760
+ /** PB 结构 MsgChange 属性 subChangeType 对应枚举值 */
1761
+ declare enum UltraMsgSubChangeType {
1762
+ CHANNEL_DELETE = 1,
1763
+ PUBLIC_TO_PRIVATE = 2,
1764
+ PRIVATE_TO_PUBLIC = 3,
1765
+ PRIVATE_CHANNEL_USER_JOIN_PUBLIC = 4,
1766
+ CHANNEL_USER_KICKED = 5,
1767
+ PUBLIC_TO_PRIVATE_USER_NOT_IN = 6
1768
+ }
1769
+ declare enum UserGroupChangeType {
1770
+ REMOVE_USER_GROUP = 1,
1771
+ JOIN_USER_GROUP = 2,
1772
+ EXIT_USER_GROUP = 3,
1773
+ CHANNEL_BIND_USER_GROUP = 4,
1774
+ CHANNEL_UNBIND_USER_GROUP = 5
1775
+ }
1776
+
1777
+ interface IMentionInfo {
1778
+ type: MentionedType;
1822
1779
  /**
1823
- * 群组总人数(不准确)
1780
+ * 被 @ 的用户 Id 列表,仅在 `type` 为 `2` 时有效
1824
1781
  */
1825
- totalCount?: number;
1782
+ userIdList: string[];
1826
1783
  }
1827
1784
  /**
1828
- * 从服务端接收到的消息数据
1785
+ * 从服务器拉取到的会话数据结构
1829
1786
  * @category Interface
1830
1787
  */
1831
- interface IReceivedMessage {
1788
+ interface IReceivedConversation {
1832
1789
  /**
1833
1790
  * 会话的业务标识
1834
1791
  */
1835
1792
  channelId?: string;
1836
1793
  /**
1837
1794
  * 会话类型
1838
- * * 1: 单聊
1839
- * * 3: 群聊
1840
- * * 4: 聊天室
1841
- * * 5: 客服会话
1842
- * * 6: 系统消息
1843
- * * 7: 默认关注的公众号
1844
- * * 8: 手动关注的公众号
1845
- * * 9: RTCLib 房间
1846
1795
  */
1847
1796
  conversationType: ConversationType;
1848
1797
  /**
1849
- * 会话 targetId
1798
+ * 会话 Id
1799
+ * @description
1800
+ * 1. 当 `conversationType` 为 `ConversationType.GROUP` 时,该值为群组 Id
1801
+ * 1. 当 `conversationType` 为 `ConversationType.PRIVATE` 时,该值为对方用户 Id
1850
1802
  */
1851
1803
  targetId: string;
1852
1804
  /**
1853
- * 消息发送者的用户 Id
1854
- */
1855
- senderUserId: string;
1856
- /**
1857
- * 消息内容
1858
- */
1859
- content: any;
1860
- /**
1861
- * 消息结构名称,即消息类型
1862
- * @example RC:TxtMsg
1863
- */
1864
- messageType: string;
1865
- /**
1866
- * 服务端存储的消息 Id
1867
- */
1868
- messageUId: string;
1869
- /**
1870
- * 消息方向是发出 or 收取
1805
+ * 当前会话的未读消息数
1871
1806
  */
1872
- messageDirection: MessageDirection;
1807
+ unreadMessageCount: number;
1873
1808
  /**
1874
- * 是否为离线消息
1809
+ * 会话中的最后一条消息
1875
1810
  */
1876
- isOffLineMessage: boolean;
1811
+ latestMessage: IReceivedMessage | null;
1877
1812
  /**
1878
- * 消息在服务器端的发送时间
1813
+ * 是否包含 @ 自己的消息,此数据仅在 `conversationType` 为 `ConversationType.GROUP` 时有效
1879
1814
  */
1880
- sentTime: number;
1815
+ hasMentioned?: boolean;
1881
1816
  /**
1882
- * 消息接收时间,该时间通过消息的 `sentTime` 值在本地进行计算得出,不推荐使用
1883
- * @description 当 isOffLineMessage 为 true 时,该值无效
1817
+ * 消息中的 @ 数据,仅在 `conversationType` 为 `ConversationType.GROUP` 时有效
1884
1818
  */
1885
- receivedTime: number;
1819
+ mentionedInfo?: IMentionInfo | null;
1886
1820
  /**
1887
- * 是否存储
1888
- * @default true
1821
+ * 会话免打扰状态
1822
+ * @description
1823
+ * 1. 已开启免打扰
1824
+ * 2. 未开启免打扰
1889
1825
  */
1890
- isPersited: boolean;
1826
+ notificationStatus: NotificationStatus;
1827
+ notificationLevel?: NotificationLevel;
1891
1828
  /**
1892
- * 是否计数
1893
- * @default true
1829
+ * 会话是否已置顶
1894
1830
  */
1895
- isCounted: boolean;
1831
+ isTop: boolean;
1896
1832
  /**
1897
- * 是否为 @ 消息
1833
+ * 会话中消息的最后未读时间
1898
1834
  */
1899
- isMentioned: boolean;
1835
+ lastUnreadTime: number;
1900
1836
  /**
1901
- * 消息是否静默
1902
- * @description 静默消息不会发送 Push 信息和本地通知提醒
1837
+ * 搜索到的会话数量
1903
1838
  */
1904
- disableNotification: boolean;
1839
+ matchCount?: number;
1905
1840
  /**
1906
- * 是否是状态消息
1841
+ * 会话项变更时间戳
1907
1842
  */
1908
- isStatusMessage: boolean;
1909
- /**
1910
- * 是否支持消息扩展存储
1911
- */
1912
- canIncludeExpansion: boolean;
1843
+ versionTime?: number;
1844
+ unreadMentionedCount?: number;
1845
+ }
1846
+ /**
1847
+ * @category Interface
1848
+ */
1849
+ interface IReceivedConversationByTag extends IReceivedConversation {
1850
+ isTopInTag: boolean;
1851
+ }
1852
+ interface IUltraGroupConversation extends IReceivedConversation {
1853
+ channelType?: UltraGroupChannelType;
1913
1854
  /**
1914
- * 消息携带的扩展存储
1855
+ * 第一条未读消息
1915
1856
  */
1916
- expansion: {
1917
- [key: string]: any;
1918
- } | null;
1857
+ firstUnreadMessage?: IUltraUnreadMsg | null;
1858
+ }
1859
+ /**
1860
+ * 设置会话状态 参数 信息
1861
+ */
1862
+ interface ISetConversationStatusOptions {
1863
+ conversationType: ConversationType;
1864
+ targetId: string;
1865
+ isTop?: boolean;
1866
+ notificationStatus?: number;
1867
+ notificationLevel?: number;
1868
+ channelId?: string;
1869
+ }
1870
+ interface IUpdatedConversation {
1871
+ updatedItems: {
1872
+ [key: string]: {
1873
+ time: number;
1874
+ val: any;
1875
+ };
1876
+ };
1877
+ conversationType: number;
1878
+ targetId: string;
1879
+ latestMessage?: IReceivedMessage;
1880
+ unreadMessageCount?: number;
1881
+ hasMentioned?: boolean;
1882
+ mentionedInfo?: {
1883
+ /**
1884
+ * `@ 类型,其中 1 为 @ 所有人,2 为 @ 部分人`
1885
+ */
1886
+ type: 1 | 2;
1887
+ /**
1888
+ * 被 @ 的用户 Id 列表,仅在 `type` 为 `2` 时有效
1889
+ */
1890
+ userIdList: string[];
1891
+ };
1892
+ lastUnreadTime?: number;
1893
+ notificationStatus?: number;
1894
+ notificationLevel?: number;
1895
+ isTop?: boolean;
1919
1896
  /**
1920
- * 消息接收状态
1897
+ * 会话标识
1921
1898
  */
1922
- receivedStatus: number;
1899
+ channelId?: string;
1900
+ tags?: IUpdatedConversation[];
1901
+ versionTime?: number;
1923
1902
  /**
1924
- * 消息本地 ID, web 端由 lib 内生成, PC 端由协议栈数据库生成自增ID
1925
- */
1926
- messageId?: number;
1903
+ * @ 消息未读数
1904
+ */
1905
+ unreadMentionedCount?: number;
1906
+ }
1907
+ /**
1908
+ * @category Interface
1909
+ */
1910
+ interface IBaseConversationInfo {
1911
+ conversationType: ConversationType;
1912
+ targetId: string;
1913
+ channelId: string;
1914
+ }
1915
+ /**
1916
+ * @category Interface
1917
+ */
1918
+ interface IConversationState extends IBaseConversationInfo {
1919
+ unreadCount: number;
1920
+ unreadMentionedCount: number;
1921
+ }
1922
+ /**
1923
+ * 指定超级群会话传参
1924
+ * @category Interface
1925
+ */
1926
+ interface IUltraGroupOption {
1927
+ targetId: string;
1928
+ channelId?: string;
1929
+ }
1930
+ /**
1931
+ * @category Interface
1932
+ */
1933
+ interface IGetUltraGroupListOption {
1934
+ targetId?: string;
1935
+ channelType?: UltraGroupChannelType;
1936
+ }
1937
+ /**
1938
+ * 超级群频道变更通知内容
1939
+ */
1940
+ interface IUltraChannelChangeInfo {
1941
+ targetId: string;
1942
+ channelId: string;
1943
+ channelType: UltraGroupChannelType;
1944
+ changeType: UltraGroupChannelChangeType;
1945
+ }
1946
+ /**
1947
+ * 超级群私有频道用户被踢出白名单通知内容
1948
+ */
1949
+ interface IUltraChannelUserKickedInfo {
1950
+ targetId: string;
1951
+ channelId: string;
1952
+ channelType: UltraGroupChannelType;
1953
+ userId: string;
1954
+ }
1955
+ /**
1956
+ * 超级群频道被删除通知内容
1957
+ */
1958
+ interface IUltraChannelDeleteInfo {
1959
+ targetId: string;
1960
+ channelId: string;
1961
+ channelType: UltraGroupChannelType;
1962
+ deleteTime: number;
1963
+ }
1964
+ /**
1965
+ * 获取超级群获取指定会话未读 @ 消息列表
1966
+ */
1967
+ interface IUltraUnreadConversation {
1968
+ targetId: string;
1969
+ channelId?: string;
1970
+ }
1971
+
1972
+ /**
1973
+ * 拓展方法定义,便于 electron-solution 实现时保持接口类型推导可用
1974
+ */
1975
+ interface IExtraMethod {
1976
+ getConversationsByPage(conversationTypes: ConversationType[], sentTime: number, count: number, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
1977
+ getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, sentTime: number, count: number, objectNames: string[], desc: 0 | 1, tag: string): Promise<IAsyncRes<{
1978
+ list: IReceivedMessage[];
1979
+ hasMore: boolean;
1980
+ }>>;
1981
+ updateMessageReceiptStatus(conersationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<IAsyncRes<boolean>>;
1982
+ }
1983
+
1984
+ /**
1985
+ * 连接协议
1986
+ * 截止 5.7.4 版本,暂不支持 rpp 和 quic
1987
+ * v2 版本文档: https://a5bq662kv5.feishu.cn/wiki/wikcnfo3lEo2CPbonDxuXFvU0Kb#K7nbeN
1988
+ */
1989
+ declare enum EConnectProtocol {
1990
+ RMTP = 1,
1991
+ TLS = 2,
1992
+ RPP = 3,
1993
+ QUIC = 4,
1994
+ WS = 5,
1995
+ WSS = 6
1996
+ }
1997
+ interface INaviRequestOption {
1998
+ appkey: string;
1999
+ uri: string;
2000
+ token: string;
2001
+ platform: string;
2002
+ isTcp?: boolean;
2003
+ }
2004
+ interface ICmpData {
2005
+ addr: string;
2006
+ protocol: EConnectProtocol;
2007
+ weight: number;
2008
+ }
2009
+ /**
2010
+ * 导航信息数据结构
2011
+ */
2012
+ interface INaviInfo {
1927
2013
  /**
1928
- * 消息发送状态, web 端由 lib 内根据消息状态设置值为 发送中、已发送和发送失败 ,PC 端由协议栈自动维护或用户自己设置
1929
- */
1930
- sentStatus?: SentStatus;
2014
+ * Navi 数据请求响应码,200 为成功请求
2015
+ */
2016
+ code: number;
1931
2017
  /**
1932
- * 已读回执信息(导航配置grpRRVer=1时群组类型消息内存在, 其他情况为undefined)
2018
+ * 获取 Navi 数据失败时的提示信息
1933
2019
  */
1934
- readReceiptInfo?: IReadReceiptInfo;
2020
+ errorMessage?: string;
1935
2021
  /**
1936
- * 推送扩展
2022
+ * 获取 Navi 数据失败时的请求 url 信息
1937
2023
  */
1938
- pushConfig?: IPushConfig;
2024
+ url?: string;
1939
2025
  /**
1940
- * 超级群专有字段,是否断档,服务端收到大量消息可能会断档,所以消息存在此标志位,断档需要客户手动拉取历史消息
2026
+ * 请求导航数据时使用的协议:http / https
2027
+ * @description 该字段为 SDK 内增加的字段,导航接口数据中不存在
1941
2028
  */
1942
- isInterrupt?: boolean;
2029
+ protocol: 'http' | 'https';
1943
2030
  /**
1944
- * 拉取历史消息时表示该消息是否修改过(仅超级群有效)
2031
+ * 获取导航时使用的 userId,小程序不走导航,故拿不到 userId
1945
2032
  */
1946
- isModifyMessage?: boolean;
2033
+ userId?: string;
1947
2034
  /**
1948
- * 拉取历史消息时表示该消息是否为超级群频道类型(仅超级群有效)
2035
+ * CMP 服务 Websocket 连接地址,包含域名与端口,不含 ws 或 wss 协议头
2036
+ * @example a.domain.com:443
2037
+ * @note 在 V2 版本废弃
1949
2038
  */
1950
- channelType?: UltraGroupChannelType;
2039
+ server: string;
1951
2040
  /**
1952
- * 扩展内容
1953
- */
1954
- extraContent?: string;
1955
- }
1956
- /**
1957
- * @category Interface
1958
- */
1959
- interface IUserProfile {
2041
+ * 备用 CMP 服务地址,包含域名与端口,不含 ws 或 wss 协议头,多个备用地址以 ',' 分割
2042
+ * @example a.domain.com:443,b.domain.com:443
2043
+ * @note 在 V2 版本废弃
2044
+ */
2045
+ backupServer?: string;
1960
2046
  /**
1961
- * 用户 ID
1962
- */
1963
- id?: string;
2047
+ * 备用 CMP 服务地址,POST 请求 TCP 连接返回的是 bs 字段,非 backupServer 字段
2048
+ * @note 在 V2 版本废弃
2049
+ */
2050
+ bs?: string;
1964
2051
  /**
1965
- * 用户名
2052
+ * RTC 服务配置,其值可能为 null、无效字符串、有效 JSON 字符串
2053
+ * 1. 公有云未开通音视频时,值为 null
2054
+ * 2. 私有云无配置时为 `{ "strategy": 0 }`
1966
2055
  */
1967
- name?: string;
2056
+ voipCallInfo: string | null;
1968
2057
  /**
1969
- * 用户头像地址
1970
- * @deprecated
2058
+ * 聊天室 kv 存储开关
2059
+ * @todo 需确认详细有效值
2060
+ * @description 公有云独有配置
1971
2061
  */
1972
- portraitUri?: string;
2062
+ kvStorage: number;
1973
2063
  /**
1974
- * user info 中附加信息
2064
+ * HttpDNS 功能开关,在 web 端无效
2065
+ * @description 公有云独有配置
1975
2066
  */
1976
- extra?: string;
2067
+ openHttpDNS: boolean;
1977
2068
  /**
1978
- * 用户头像地址(向移动端兼容)
2069
+ * 历史消息云存储功能开关
2070
+ * @description
2071
+ * 1. 公有云通过 `developer.rongcloud.cn` 管理后台 `单群聊消息云端存储` 功能开关进行配置
2072
+ * 2. 私有云默认为 `true`
1979
2073
  */
1980
- portrait?: string;
1981
- }
1982
- interface IOperateInfo {
1983
- targetId: string;
1984
- channelId?: string;
1985
- userId: string;
1986
- operationType: OperateStatus;
1987
- operationTime?: number;
1988
- }
1989
- interface IOperateSummary {
1990
- targetId: string;
1991
- channelId?: string;
1992
- count: number;
1993
- operationType: OperateStatus;
1994
- }
1995
- interface IOperateStatusNotify {
1996
- conversationType: ConversationType;
1997
- hasInfo: boolean;
1998
- hasSummary: boolean;
1999
- info: IOperateInfo[];
2000
- summary: IOperateSummary[];
2001
- }
2002
- interface IRecallMsgOptions {
2074
+ historyMsg: boolean;
2003
2075
  /**
2004
- * 会话组织机构标识
2005
- * 默认值未 空字符串
2006
- */
2007
- channelId: string;
2076
+ * 聊天室历史消息开关
2077
+ * @description
2078
+ * 1. 私有云对聊天室功能支持有限,默认为 `false`
2079
+ * 2. TODO: 公有云配置待确认
2080
+ */
2081
+ chatroomMsg: boolean;
2008
2082
  /**
2009
- * 发送消息携带的用户信息
2010
- */
2011
- user?: IUserProfile;
2083
+ * 文件服务器地址
2084
+ * @description
2085
+ * 1. 公有云下,该地址为七牛云服务器地址
2086
+ * 2. 私有云下,该地址为私有云自研文件服务器地址
2087
+ * @note 在 V2 版本废弃
2088
+ */
2089
+ uploadServer: string;
2012
2090
  /**
2013
- * Push 信息
2014
- */
2015
- pushContent?: string;
2091
+ * 实时位置共享配置,web 端无需处理
2092
+ */
2093
+ location: null | string;
2016
2094
  /**
2017
- * 原消息体
2018
- */
2019
- oriContent?: any;
2095
+ * 实时日志上传开关
2096
+ * @todo 需确认有效值及作用
2097
+ */
2098
+ monitor: number;
2020
2099
  /**
2021
- * 是否发送静默消息
2100
+ * 是否允许加入多聊天室开关
2101
+ */
2102
+ joinMChrm: boolean;
2103
+ /**
2104
+ * 是否开启公众号功能:`0` 为未开启,`1` 为已开启
2105
+ */
2106
+ openMp: 0 | 1;
2107
+ /**
2108
+ * 是否开启用户级配置,若开启,需连接成功后立即拉取实时配置,0 | 1
2022
2109
  * @description
2023
- * 当值为 `true` 时,服务器将不会发送 Push 信息,移动端也不会弹出本地通知提醒
2024
- */
2025
- disableNotification?: boolean;
2110
+ * 配置来源:
2111
+ * 1. 导航
2112
+ * 2. 服务端实时下发
2113
+ * 已有配置字段:
2114
+ * 1. Lan. 推送使用的语言设置,用户端可自定义修改. Web 端未做设置, 只做接收
2115
+ * 2. ShPushSwit. 推送是否显示详情设置,用户端可自定义修改. Web 端未做设置, 只做接收
2116
+ * 3. MobPushSwit: Web/PC 在线,移动端不在线是否发送推送开关,用户端可自定义修改. Web 端未做设置, 只做接收
2117
+ * 4. OffMsgDur: 离线消息保存天数,设置天数不可大于App级对应配置,用户端可自定义修改. Web 端未做设置, 只做接收
2118
+ * 5. VoipInfo: 音视频相关配置,用户端不可自定义修改. 由服务端决定,与导航下发格式一致
2119
+ * @todo 需确认公有云与私有云区别
2120
+ */
2121
+ openUS: 0 | 1;
2026
2122
  /**
2027
- * 移动端推送配置
2028
- */
2029
- pushConfig?: IPushConfig;
2123
+ * 超级群功能开关,1表示开
2124
+ */
2125
+ ugMsg?: 0 | 1;
2030
2126
  /**
2031
- * 其他拓展信息
2032
- */
2033
- extra?: string;
2127
+ * 群离线消息最大下发条数,`0` 为关闭
2128
+ * @description 公有云独有配合
2129
+ */
2130
+ grpMsgLimit: number;
2034
2131
  /**
2035
- * 是否删除原始消息(在移动端会使用到),为 true 时移动端会不显示小灰条提示
2132
+ * 消息加密开关,0 为关闭
2133
+ * @todo
2134
+ * 1. 确定其控制的功能
2135
+ * 2. 确定 web 相关性
2136
+ * @note 在 V2 版本废弃
2036
2137
  */
2037
- isDelete?: boolean;
2038
- }
2039
- interface IRecallMsgContent {
2040
- conversationType: number;
2041
- targetId: string;
2042
- sentTime: number;
2043
- messageUId: string;
2138
+ isFormatted: number;
2044
2139
  /**
2045
- * 会话组织机构标识
2046
- * 默认值未 空字符串
2047
- */
2048
- channelId: string;
2140
+ * GIF 动图大小限制,默认 2048 KB
2141
+ */
2142
+ gifSize: number;
2049
2143
  /**
2050
- * 其他拓展信息
2051
- */
2052
- extra?: string;
2144
+ * 上传小视频时长限制,单位:秒
2145
+ * @description 公有云字段,即私有云配置中的 `uploadVideoTimeLimit`
2146
+ */
2147
+ videoTimes?: number;
2053
2148
  /**
2054
- * 发送消息携带的用户信息
2055
- */
2056
- user?: IUserProfile;
2149
+ * 上传小视频时长限制,单位:秒
2150
+ * @description 私有云字段,即公有云配置中的 `videoTimes`
2151
+ */
2152
+ uploadVideoTimeLimit?: number;
2057
2153
  /**
2058
- * 是否删除原始消息(在移动端会使用到),为 true 时移动端会不显示小灰条提示
2154
+ * 实时日志上传开关:`0` 为关闭,`1` 为开启
2059
2155
  */
2060
- isDelete?: boolean;
2061
- }
2062
- /**
2063
- * 发送消息时的可选项信息
2064
- */
2065
- interface ISendMsgOptions {
2156
+ logSwitch: number;
2066
2157
  /**
2067
- * 消息类型,即消息结构的 ObjectName
2158
+ * 实时日志上传策略,值为 JSON 字符串
2159
+ * @example `'{
2160
+ * "url": "logcollection.ronghub.com", // 上传地址
2161
+ * "level": 1, // 日志等级
2162
+ * "itv": 6, // 上传频率,即时间间隔,单位 s
2163
+ * "times": 5 // 重试次数?
2164
+ * }'`
2068
2165
  */
2069
- messageType: string;
2166
+ logPolicy: string;
2070
2167
  /**
2071
- * 消息内容
2168
+ * 百度 BOS 存储服务地址
2169
+ * @description 公有云独有配置
2170
+ * @example `gz.bcebos.com`
2171
+ * @deprecated 已废弃
2072
2172
  */
2073
- content: {
2074
- /**
2075
- * 消息内容 key-value,最终会进行 JSON 序列化后发送
2076
- */
2077
- [key: string]: any;
2078
- /**
2079
- * 消息可携带的用户数据
2080
- */
2081
- user?: IUserProfile;
2082
- /**
2083
- * 其他拓展信息
2084
- */
2085
- extra?: string;
2086
- };
2173
+ bosAddr?: string;
2087
2174
  /**
2088
- * 是否存储
2089
- * @description 只在发送未注册过的自定义消息时有效,否则使用注册时的配置
2175
+ * 阿里上传配置,字符串数组,数组顺序代表 七牛、百度、阿里云 上传权重
2176
+ * @example
2177
+ * ```
2178
+ * `[{"qiniu":"upload.qiniup.com","p":"1"},
2179
+ * {"baidu":"gz.bcebos.com","p":"2"},
2180
+ * {"aliyun":"oss-cn-beijing.aliyuncs.com","p":"3"}]`
2181
+ * ```
2090
2182
  */
2091
- isPersited?: boolean;
2183
+ ossConfig?: string;
2092
2184
  /**
2093
- * 是否计数
2094
- * @description 只在发送未注册过的自定义消息时有效,否则使用注册时的配置
2185
+ * 私有云专有属性,可用来判断当前环境是公有云还是私有云,私有云环境下该值为 `1`
2095
2186
  */
2096
- isCounted?: boolean;
2187
+ type?: number;
2097
2188
  /**
2098
- * 是否是状态消息,一般为无需注册的自定义消息
2099
- * @description
2100
- * 1. 状态消息只有 pub,没有 ack 应答
2101
- * 2. 状态消息默认不存储,不计数,`isPersited` 与 `isCounted` 配置将失效
2189
+ * @deprecated 已废弃
2102
2190
  */
2103
- isStatusMessage?: boolean;
2191
+ compDays: number;
2104
2192
  /**
2105
- * 是否发送静默消息
2106
- * @description
2107
- * 当值为 `true` 时,服务器将不会发送 Push 信息,移动端也不会弹出本地通知提醒
2193
+ * @deprecated 已废弃
2108
2194
  */
2109
- disableNotification?: boolean;
2195
+ msgAck: unknown;
2110
2196
  /**
2111
- * Push 信息
2197
+ * @deprecated 已废弃
2112
2198
  */
2113
- pushContent?: string;
2199
+ activeServer: string;
2114
2200
  /**
2115
- * Push 通知携带的附加信息
2201
+ * @deprecated 已废弃
2116
2202
  */
2117
- pushData?: string;
2203
+ qnAddr: string;
2118
2204
  /**
2119
- * 是否为 @ 消息,只当 conversationType 值为 `ConversationType.GROUP` 时有效
2205
+ * @deprecated 已废弃
2120
2206
  */
2121
- isMentioned?: boolean;
2207
+ extkitSwitch: number;
2122
2208
  /**
2123
- * `@` 消息类型
2124
- * @description `1: @ 所有人 2: @ 指定用户`
2209
+ * @deprecated 已废弃
2125
2210
  */
2126
- mentionedType?: 1 | 2;
2211
+ alone: boolean;
2127
2212
  /**
2128
- * @ 的用户 Id 列表,当 `mentionedType` 值为 `1` 时,该值可为空
2213
+ * @deprecated 已废弃
2129
2214
  */
2130
- mentionedUserIdList?: string[];
2215
+ voipServer: string;
2131
2216
  /**
2132
- * 用于发送群定向消息,只当 conversationType 值为 `ConversationType.GROUP` 时有效
2217
+ * 离线日志上报地址
2218
+ * @deprecated 已废弃
2133
2219
  */
2134
- directionalUserIdList?: string[];
2220
+ offlinelogserver: string;
2135
2221
  /**
2136
- * 当对方为 iOS 设备且未在线时,其将收到 Voip Push. 此配置对 Android 无影响
2222
+ * 在线日志上报地址
2223
+ * @deprecated 已废弃
2137
2224
  */
2138
- isVoipPush?: boolean;
2225
+ onlinelogserver?: string;
2139
2226
  /**
2140
- * 消息是否支持拓展内容
2227
+ * 链路加密字段,内容为 JSON 字符串,仅限 C++ 可用
2228
+ * @note 在 V2 版本废弃
2141
2229
  */
2142
- canIncludeExpansion?: boolean;
2230
+ crypto?: string;
2143
2231
  /**
2144
- * 消息拓展内容数据
2232
+ * 群组回执开关, 1: 打开,0(或者没有): 关闭
2145
2233
  */
2146
- expansion?: {
2147
- [key: string]: string;
2148
- };
2234
+ grpRRVer?: number;
2149
2235
  /**
2150
- * 黑/白名单
2151
- * @todo 功能未知,需确认
2236
+ * 防黑产开关, 1: 打开,0:关闭
2152
2237
  */
2153
- isFilerWhiteBlacklist?: boolean;
2238
+ openAnti?: number;
2154
2239
  /**
2155
- * 移动端推送配置
2156
- */
2157
- pushConfig?: IPushConfig;
2240
+ * 鉴权认证
2241
+ */
2242
+ jwt?: string;
2243
+ /**
2244
+ * 数据中心
2245
+ */
2246
+ dc?: string;
2247
+ /**
2248
+ * 是否开启 tls
2249
+ */
2250
+ openTLS?: number;
2251
+ /**
2252
+ * V2 版本中新增字段
2253
+ * 服务地址列表
2254
+ */
2255
+ serverAddr?: ICmpData[];
2256
+ /**
2257
+ * V2 版本中新增字段
2258
+ * 新版本控制tag
2259
+ */
2260
+ excludeLogTag?: string;
2261
+ }
2262
+
2263
+ declare type INaviCache = {
2264
+ token: string;
2265
+ naviInfo: INaviInfo;
2266
+ timestamp: number;
2267
+ };
2268
+ /**
2269
+ * 导航数据管理类,负责管理导航有效期、导航请求、导航缓存
2270
+ */
2271
+ declare abstract class BasicNavi {
2272
+ protected readonly appkey: string;
2273
+ protected readonly logger: BasicLogger;
2158
2274
  /**
2159
- * 会话业务标识
2160
- * @description
2161
- * 20 个字符长度限制
2162
- */
2163
- channelId?: string;
2275
+ * 业务层的自定义导航配置
2276
+ */
2277
+ protected readonly navigators: string[];
2278
+ constructor(appkey: string, logger: BasicLogger,
2164
2279
  /**
2165
- * 客户端的消息标识
2166
- * 重发消息时用到,重发消息的消息 ID
2280
+ * 业务层的自定义导航配置
2167
2281
  */
2168
- messageId?: number;
2282
+ navigators: string[]);
2169
2283
  /**
2170
- * 超级群专有字段,是否断档,若断档需要客户判断是否拉取
2284
+ * 当前进行中的导航请求
2171
2285
  */
2172
- isInterrupt?: boolean;
2286
+ private crtRequest;
2173
2287
  /**
2174
- * 标识该消息是否为重发消息,仅 electron 中有效。
2175
- */
2176
- isResend?: boolean;
2177
- }
2178
- interface IInsertMsgOptions {
2179
- senderUserId: string;
2180
- messageType: string;
2181
- content: any;
2182
- messageDirection: number;
2183
- readStatus?: number;
2184
- sentStatus?: number;
2185
- sentTime?: number;
2186
- searchContent?: string;
2187
- isUnread?: boolean;
2188
- messageUId?: string;
2189
- disableNotification?: boolean;
2190
- canIncludeExpansion?: boolean;
2191
- expansionMsg?: string;
2192
- channelId: string;
2193
- }
2194
- interface IInsertMessage {
2195
- conversationType: number;
2196
- targetId: string;
2197
- channelId: string;
2198
- messageDirection: number;
2199
- messageType: string;
2200
- content: any;
2201
- messageUId: string;
2202
- senderUserId: string;
2203
- sentStatus?: number;
2204
- sentTime?: number;
2205
- disableNotification?: boolean;
2206
- canIncludeExpansion?: boolean;
2207
- expansion?: {
2208
- [key: string]: any;
2209
- } | null;
2210
- receivedStatus?: number;
2288
+ * 请求导航数据
2289
+ * @param token
2290
+ * @param ignoreCache 是否忽略缓存,强制从服务器重新拉取。
2291
+ * @param ignoreExpire 是否忽略有效期检查。理论上只需要在建立连接时需要检测 navi 有效期,其他场景无需检测
2292
+ * @param traceId 事务日志跟踪 ID
2293
+ */
2294
+ request(token: string, ignoreCache: boolean, ignoreExpire: boolean, traceId: string): IPromiseResult<INaviInfo>;
2295
+ private sendRequest;
2211
2296
  /**
2212
- * 插入消息是否计入未读数: true 计数 false 不计数, 默认不计数
2297
+ * 从指定服务列表中顺序尝试获取导航
2298
+ * @param uris 导航服务列表
2299
+ * @param token
2300
+ * @param traceId
2213
2301
  */
2214
- isUnread?: boolean;
2302
+ private requestHandler;
2215
2303
  /**
2216
- * 消息搜索关键字
2304
+ * 向目标导航服务发送请求
2305
+ * @param uri 导航服务地址
2306
+ * @param appkey
2307
+ * @param token
2308
+ * @param version
2309
+ * @param timeout 请求超时时间
2310
+ * @param traceId
2217
2311
  */
2218
- searchContent?: string;
2312
+ protected abstract httpRequest(uri: string, appkey: string, token: string, traceId: string, finished: boolean): IPromiseResult<INaviInfo>;
2219
2313
  /**
2220
- * 来源
2314
+ * 向目标导航服务发送请求
2315
+ * @param uri 导航服务地址
2316
+ * @param appkey
2317
+ * @param token
2318
+ * @param version
2319
+ * @param timeout 请求超时时间
2320
+ * @param traceId
2221
2321
  */
2222
- source?: string;
2223
- isMentioned?: boolean;
2224
- }
2225
- interface ISendExMsgOptions {
2226
- channelId: string;
2227
- conversationType: ConversationType;
2228
- targetId: string;
2322
+ protected abstract httpRequestV2(uri: string, appkey: string, token: string, traceId: string, finished: boolean): IPromiseResult<INaviInfo>;
2229
2323
  /**
2230
- * 消息 ID
2231
- */
2232
- messageUId: string;
2324
+ * 转换 Navi 接口 HTTP 请求状态码为 ErrorCode 定义
2325
+ * @param code
2326
+ */
2327
+ protected transHttpCode(code: number): ErrorCode;
2233
2328
  /**
2234
- * 原始消息是否支持扩展的字段
2235
- */
2236
- canIncludeExpansion: boolean;
2329
+ * 设置缓存
2330
+ * @param formatedToken
2331
+ * @param naviInfo
2332
+ * @description 设置缓存的同时会检测缓存中的既有数据,适当清理,避免无效数据长时间占用存储空间
2333
+ */
2334
+ protected abstract setNaviCache(formatedToken: string, naviInfo: INaviInfo): void;
2237
2335
  /**
2238
- * 删除的 keys
2239
- */
2240
- keys?: string[];
2336
+ * 获取缓存数据
2337
+ * @param formatedToken
2338
+ */
2339
+ protected abstract getNaviCache(formatedToken: string): INaviCache | null;
2241
2340
  /**
2242
- * 扩展对象
2243
- */
2244
- expansion?: {
2245
- [key: string]: string;
2246
- };
2341
+ * 获取缓存的导航信息
2342
+ * @param token
2343
+ */
2344
+ getNaviInfoFromCache(token: string): INaviInfo | null;
2247
2345
  /**
2248
- * 是否删除所有扩展
2249
- */
2250
- removeAll?: boolean;
2346
+ * RTC 配置变更,更新 navi 缓存
2347
+ * @param token
2348
+ * @param voipCallInfo
2349
+ */
2350
+ updateVoipCallInfo(token: string, voipCallInfo: string): void;
2351
+ protected getNaviV2RequestOption(option: INaviRequestOption): IRequest;
2251
2352
  /**
2252
- * 原始消息的扩展
2253
- */
2254
- originExpansion?: {
2255
- [key: string]: string;
2256
- } | null;
2353
+ * 是否使用 v2 版本导航
2354
+ * 仅私有云 rcx 使用 v1 版本
2355
+ */
2356
+ useV2Navi(): boolean;
2257
2357
  }
2258
- interface IUltraExMsgOptions {
2259
- canIncludeExpansion: boolean;
2260
- channelId: string;
2261
- conversationType: ConversationType;
2262
- targetId: string;
2263
- messageUId: string;
2264
- sendTime: number;
2265
- /**
2266
- * 删除的 keys
2267
- */
2268
- keys?: string[];
2269
- /**
2270
- * 扩展对象
2271
- */
2272
- expansion?: {
2273
- [key: string]: string;
2274
- };
2358
+
2359
+ /**
2360
+ * Websocket 导航工具类
2361
+ */
2362
+ declare class WebSocketNavi extends BasicNavi {
2363
+ private runtime;
2275
2364
  /**
2276
- * 是否删除所有扩展
2277
- */
2278
- removeAll?: boolean;
2279
- }
2280
- interface IUltraModifyMsgOptions {
2281
- canIncludeExpansion?: boolean;
2282
- channelId: string;
2283
- conversationType: ConversationType;
2284
- targetId: string;
2285
- messageUId: string;
2286
- sendTime: number;
2365
+ * 小程序平台服务地址,多个地址以 ',' 分割
2366
+ */
2367
+ private readonly miniCmpUris;
2368
+ constructor(appkey: string, logger: BasicLogger, runtime: IRuntime,
2287
2369
  /**
2288
- * 消息内容
2370
+ * 小程序平台服务地址,多个地址以 ',' 分割
2289
2371
  */
2290
- content: {
2291
- /**
2292
- * 消息内容 key-value,最终会进行 JSON 序列化后发送
2293
- */
2294
- [key: string]: any;
2295
- /**
2296
- * 消息可携带的用户数据
2297
- */
2298
- user?: IUserProfile;
2299
- /**
2300
- * 其他拓展信息
2301
- */
2302
- extra?: string;
2303
- };
2304
- }
2305
- interface IUltraMsgQueryInfo {
2306
- sendTime: number;
2307
- messageUId: string;
2308
- channelId?: string;
2309
- }
2310
- interface IUltraMsgQueryOptions {
2311
- conversationType: ConversationType;
2312
- targetId: string;
2313
- messages: IUltraMsgQueryInfo[];
2372
+ miniCmpUris: string[], navigators?: string[]);
2373
+ protected httpRequest(uri: string, appkey: string, token: string, traceId: string, finished: boolean): IPromiseResult<INaviInfo>;
2374
+ protected httpRequestV2(uri: string, appkey: string, token: string, traceId: string): IPromiseResult<INaviInfo>;
2375
+ protected getNaviCache(formatedToken: string): INaviCache | null;
2376
+ protected setNaviCache(formatedToken: string, naviInfo: INaviInfo): void;
2314
2377
  }
2378
+
2315
2379
  /**
2316
- * 被拦截的消息信息
2317
2380
  * @category Interface
2318
2381
  */
2319
- interface IBlockedMessageInfo {
2320
- blockedMessageUId: string;
2321
- conversationType: number;
2322
- targetId: string;
2323
- channelId: string;
2324
- blockType: MessageBlockType;
2325
- extra: any;
2326
- sourceType?: MessageBlockSourceType;
2327
- sourceContent?: {
2328
- [key: string]: any;
2329
- };
2330
- }
2331
- /**
2332
- * 超级群获取指定会话未读 @ 消息列表参数
2333
- */
2334
- interface IUltraGroupUnreadMentionedOption {
2335
- /**
2336
- * 会话 ID
2337
- */
2338
- targetId: string;
2339
- /**
2340
- * 频道 ID
2341
- */
2342
- channelId?: string;
2382
+ interface IUploadAuth {
2343
2383
  /**
2344
- * 消息的时间戳,首次获取传 0, 后续查询传未读 @ 列表中的消息时间戳
2384
+ * 七牛 token 有效期
2345
2385
  */
2346
- sentTime: number;
2386
+ deadline: number;
2347
2387
  /**
2348
- * 数据个数,最大50
2349
- */
2350
- count: number;
2351
- }
2352
- /**
2353
- * 超级群获取指定会话 @ 未读消息列表结果
2354
- */
2355
- interface IUltraUnreadMsg {
2388
+ * 七牛上传 token
2389
+ */
2390
+ token: string;
2356
2391
  /**
2357
- * 消息 ID
2392
+ * 百度上传 token
2358
2393
  */
2359
- messageUId?: string;
2394
+ bosToken: string;
2360
2395
  /**
2361
- * 消息时间戳
2396
+ * 百度上传 header Date
2362
2397
  */
2363
- sentTime: number;
2398
+ bosDate: string;
2364
2399
  /**
2365
- * @ 类型: 1 所有人;2: 部分人
2400
+ * 百度上传路径
2366
2401
  */
2367
- mentionedType?: number;
2368
- }
2369
-
2370
- interface IMentionInfo {
2371
- type: MentionedType;
2402
+ path: string;
2372
2403
  /**
2373
- * 被 @ 的用户 Id 列表,仅在 `type` 为 `2` 时有效
2404
+ * 上传文件名,阿里上传获取下载地址时,必须使用上传文件名,所以需抛出到业务端
2374
2405
  */
2375
- userIdList: string[];
2376
- }
2377
- /**
2378
- * 从服务器拉取到的会话数据结构
2379
- * @category Interface
2380
- */
2381
- interface IReceivedConversation {
2382
- /**
2383
- * 会话的业务标识
2384
- */
2385
- channelId?: string;
2406
+ fileName: string;
2386
2407
  /**
2387
- * 会话类型
2408
+ * 阿里云 oss 的 AccessKeyId
2388
2409
  */
2389
- conversationType: ConversationType;
2410
+ osskeyId: string;
2390
2411
  /**
2391
- * 会话 Id
2392
- * @description
2393
- * 1. 当 `conversationType` 为 `ConversationType.GROUP` 时,该值为群组 Id
2394
- * 1. 当 `conversationType` 为 `ConversationType.PRIVATE` 时,该值为对方用户 Id
2412
+ * 阿里云 oss post 请求表单域中的字段 policy
2395
2413
  */
2396
- targetId: string;
2414
+ ossPolicy: string;
2397
2415
  /**
2398
- * 当前会话的未读消息数
2416
+ * 阿里云 oss 根据 policy 计算的签名信息
2399
2417
  */
2400
- unreadMessageCount: number;
2418
+ ossSign: string;
2401
2419
  /**
2402
- * 会话中的最后一条消息
2420
+ * 阿里云 oss 存储空间名称
2403
2421
  */
2404
- latestMessage: IReceivedMessage | null;
2422
+ ossBucketName: string;
2405
2423
  /**
2406
- * 是否包含 @ 自己的消息,此数据仅在 `conversationType` 为 `ConversationType.GROUP` 时有效
2424
+ * s3 认证凭证,对应 post上传 x-amz-credential 字段
2407
2425
  */
2408
- hasMentioned?: boolean;
2426
+ s3Credential: string;
2409
2427
  /**
2410
- * 消息中的 @ 数据,仅在 `conversationType` 为 `ConversationType.GROUP` 时有效
2428
+ * 加密算法,对应 post上传 x-amz-algorithm 字段
2411
2429
  */
2412
- mentionedInfo?: IMentionInfo | null;
2430
+ s3Algorithm: string;
2413
2431
  /**
2414
- * 会话免打扰状态
2415
- * @description
2416
- * 1. 已开启免打扰
2417
- * 2. 未开启免打扰
2432
+ * s3 日期,对应 post上传 x-amz-date 字段
2418
2433
  */
2419
- notificationStatus: NotificationStatus;
2420
- notificationLevel?: NotificationLevel;
2434
+ s3Date: string;
2421
2435
  /**
2422
- * 会话是否已置顶
2436
+ * s3 policy,对应 post上传 policy 字段
2423
2437
  */
2424
- isTop: boolean;
2438
+ s3Policy: string;
2425
2439
  /**
2426
- * 会话中消息的最后未读时间
2440
+ * s3 签名信息,对应 post上传 x-amz-signature 字段
2427
2441
  */
2428
- lastUnreadTime: number;
2442
+ s3Signature: string;
2429
2443
  /**
2430
- * 搜索到的会话数量
2444
+ * s3 存储空间名称
2431
2445
  */
2432
- matchCount?: number;
2446
+ s3BucketName: string;
2433
2447
  /**
2434
- * 会话项变更时间戳
2448
+ * stc Authorization 头
2435
2449
  */
2436
- versionTime?: number;
2437
- unreadMentionedCount?: number;
2438
- }
2439
- /**
2440
- * @category Interface
2441
- */
2442
- interface IReceivedConversationByTag extends IReceivedConversation {
2443
- isTopInTag: boolean;
2444
- }
2445
- interface IUltraGroupConversation extends IReceivedConversation {
2446
- channelType?: UltraGroupChannelType;
2450
+ stcAuthorization: string;
2447
2451
  /**
2448
- * 第一条未读消息
2449
- */
2450
- firstUnreadMessage?: IUltraUnreadMsg | null;
2451
- }
2452
- /**
2453
- * 设置会话状态 参数 信息
2454
- */
2455
- interface ISetConversationStatusOptions {
2456
- conversationType: ConversationType;
2457
- targetId: string;
2458
- isTop?: boolean;
2459
- notificationStatus?: number;
2460
- notificationLevel?: number;
2461
- channelId?: string;
2462
- }
2463
- interface IUpdatedConversation {
2464
- updatedItems: {
2465
- [key: string]: {
2466
- time: number;
2467
- val: any;
2468
- };
2469
- };
2470
- conversationType: number;
2471
- targetId: string;
2472
- latestMessage?: IReceivedMessage;
2473
- unreadMessageCount?: number;
2474
- hasMentioned?: boolean;
2475
- mentionedInfo?: {
2476
- /**
2477
- * `@ 类型,其中 1 为 @ 所有人,2 为 @ 部分人`
2478
- */
2479
- type: 1 | 2;
2480
- /**
2481
- * 被 @ 的用户 Id 列表,仅在 `type` 为 `2` 时有效
2482
- */
2483
- userIdList: string[];
2484
- };
2485
- lastUnreadTime?: number;
2486
- notificationStatus?: number;
2487
- notificationLevel?: number;
2488
- isTop?: boolean;
2452
+ * stc xAmzContentSha256
2453
+ */
2454
+ stcContentSha256: string;
2489
2455
  /**
2490
- * 会话标识
2491
- */
2492
- channelId?: string;
2493
- tags?: IUpdatedConversation[];
2494
- versionTime?: number;
2456
+ * stc date
2457
+ */
2458
+ stcDate: string;
2495
2459
  /**
2496
- * @ 消息未读数
2460
+ * stc 存储空间名称
2497
2461
  */
2498
- unreadMentionedCount?: number;
2499
- }
2500
- /**
2501
- * @category Interface
2502
- */
2503
- interface IBaseConversationInfo {
2504
- conversationType: ConversationType;
2505
- targetId: string;
2506
- channelId: string;
2507
- }
2508
- /**
2509
- * @category Interface
2510
- */
2511
- interface IConversationState extends IBaseConversationInfo {
2512
- unreadCount: number;
2513
- unreadMentionedCount: number;
2514
- }
2515
- /**
2516
- * 指定超级群会话传参
2517
- * @category Interface
2518
- */
2519
- interface IUltraGroupOption {
2520
- targetId: string;
2521
- channelId?: string;
2522
- }
2523
- /**
2524
- * @category Interface
2525
- */
2526
- interface IGetUltraGroupListOption {
2527
- targetId?: string;
2528
- channelType?: UltraGroupChannelType;
2462
+ stcBucketName: string;
2529
2463
  }
2464
+
2530
2465
  /**
2531
- * 超级群频道变更通知内容
2466
+ * 当前运行时设备信息
2532
2467
  */
2533
- interface IUltraChannelChangeInfo {
2534
- targetId: string;
2535
- channelId: string;
2536
- channelType: UltraGroupChannelType;
2537
- changeType: UltraGroupChannelChangeType;
2468
+ interface IOSInfo {
2469
+ /** 软件运行时的 CPU 架构信息 */
2470
+ arch: string;
2471
+ /** 平台标识 */
2472
+ platform: string;
2473
+ /** 操作系统名称 */
2474
+ type: string;
2475
+ /** 操作系统 release 标识 */
2476
+ release: string;
2477
+ /** 操作系统版本信息 */
2478
+ version: string;
2479
+ /** 内存余量 */
2480
+ freemem: number;
2481
+ /** 系统内存总量 */
2482
+ totalmem: number;
2483
+ /** 本次操作系统运行时长 */
2484
+ uptime: number;
2485
+ cpus: {
2486
+ /** CPU 型号标识 */
2487
+ model: string;
2488
+ /** 主频 MHz */
2489
+ speed: number;
2490
+ times: {
2491
+ user: number;
2492
+ nice: number;
2493
+ sys: number;
2494
+ idle: number;
2495
+ irq: number;
2496
+ };
2497
+ }[];
2498
+ networkInterfaces: {
2499
+ /** 网卡接口标识 */
2500
+ [link: string]: {
2501
+ /** IP */
2502
+ address: string;
2503
+ /** 子网掩码 */
2504
+ netmask: string;
2505
+ /** IP 协议版本 */
2506
+ family: string;
2507
+ /** Mac Address */
2508
+ mac: string;
2509
+ /** 是否回环地址 */
2510
+ internal: boolean;
2511
+ /** CIDR */
2512
+ cidr: string | null;
2513
+ }[] | undefined;
2514
+ };
2538
2515
  }
2539
- /**
2540
- * 超级群私有频道用户被踢出白名单通知内容
2541
- */
2542
- interface IUltraChannelUserKickedInfo {
2543
- targetId: string;
2544
- channelId: string;
2545
- channelType: UltraGroupChannelType;
2546
- userId: string;
2516
+
2517
+ interface IProcessInfo {
2518
+ title: string;
2519
+ platform: string;
2520
+ arch: string;
2521
+ pid: number;
2522
+ ppid: number;
2523
+ uptime: number;
2524
+ cpuUsage: {
2525
+ user: number;
2526
+ system: number;
2527
+ };
2528
+ memoryUsage: {
2529
+ rss: number;
2530
+ heapTotal: number;
2531
+ heapUsed: number;
2532
+ external: number;
2533
+ arrayBuffers: number;
2534
+ };
2535
+ resourceUsage: {
2536
+ userCPUTime: number;
2537
+ systemCPUTime: number;
2538
+ maxRSS: number;
2539
+ sharedMemorySize: number;
2540
+ unsharedDataSize: number;
2541
+ unsharedStackSize: number;
2542
+ minorPageFault: number;
2543
+ majorPageFault: number;
2544
+ swappedOut: number;
2545
+ fsRead: number;
2546
+ fsWrite: number;
2547
+ ipcSent: number;
2548
+ ipcReceived: number;
2549
+ signalsCount: number;
2550
+ voluntaryContextSwitches: number;
2551
+ involuntaryContextSwitches: number;
2552
+ };
2547
2553
  }
2554
+
2548
2555
  /**
2549
- * 超级群频道被删除通知内容
2556
+ * 代理信息
2550
2557
  */
2551
- interface IUltraChannelDeleteInfo {
2552
- targetId: string;
2553
- channelId: string;
2554
- channelType: UltraGroupChannelType;
2555
- deleteTime: number;
2556
- }
2557
- /**
2558
- * 获取超级群获取指定会话未读 @ 消息列表
2559
- */
2560
- interface IUltraUnreadConversation {
2561
- targetId: string;
2562
- channelId?: string;
2558
+ interface IProxy {
2559
+ socksHost: string;
2560
+ socksPort: number;
2561
+ socksUsername?: string;
2562
+ socksPassword?: string;
2563
2563
  }
2564
2564
 
2565
- /**
2566
- * @category Interface
2567
- */
2568
- interface IChatroomEntryListenerData {
2569
- /**
2570
- * 更新的键
2571
- */
2572
- key: string;
2573
- /**
2574
- * 更新的值
2575
- */
2576
- value: string;
2577
- /**
2578
- * 更新的时间
2579
- */
2580
- timestamp: number;
2581
- /**
2582
- * 更新的聊天室 ID
2583
- */
2584
- chatroomId: string;
2585
- /**
2586
- * 更新类型
2587
- */
2588
- type: ChatroomEntryType;
2565
+ declare enum HttpMethod {
2566
+ GET = "GET",
2567
+ POST = "POST"
2589
2568
  }
2590
- /**
2591
- * @category Interface
2592
- */
2593
- interface IChatroomRejoinedFailed {
2594
- /**
2595
- * 自动重新加入的聊天室 ID
2596
- */
2597
- chatroomId: string;
2569
+ interface IRequest {
2570
+ url: string;
2598
2571
  /**
2599
- * 自动重新加入失败的 code
2600
- */
2601
- errorCode: number;
2602
- }
2603
- /**
2604
- * @category Interface
2605
- */
2606
- interface IChatroomRejoinedSuccessed {
2572
+ * @default `HttpMethod.GET`
2573
+ */
2574
+ method?: HttpMethod | 'GET' | 'POST';
2607
2575
  /**
2608
- * 自动重新加入的聊天室 ID
2609
- */
2610
- chatroomId: string;
2576
+ * 查询数据
2577
+ */
2578
+ query?: {
2579
+ [key: string]: string | number | null;
2580
+ };
2611
2581
  /**
2612
- * 自动重新加入的聊天室拉取消息的数量
2613
- */
2614
- count: number;
2615
- }
2616
- /**
2617
- * @category Interface
2618
- */
2619
- interface IChatroomUserChangeInfo {
2620
- users: {
2621
- [userId: string]: ChatroomUserChangeType;
2582
+ * Request Header 信息
2583
+ */
2584
+ headers?: {
2585
+ [key: string]: string;
2622
2586
  };
2623
- chatroomId: string;
2624
- }
2625
- declare type IChatroomRejoinedInfo = IChatroomRejoinedFailed | IChatroomRejoinedSuccessed;
2626
- /**
2627
- * 聊天室信息
2628
- * @category Interface
2629
- */
2630
- interface IChatroomListenerData {
2631
2587
  /**
2632
- * SDK 内部重连聊天室信息
2633
- */
2634
- rejoinedRoom?: IChatroomRejoinedInfo;
2588
+ * Request Body 数据
2589
+ */
2590
+ body?: Object | string;
2635
2591
  /**
2636
- * 监听到的聊天室 KV 更新
2637
- */
2638
- updatedEntries?: IChatroomEntryListenerData[];
2592
+ * 超时设置,默认 `60s`
2593
+ */
2594
+ timeout?: number;
2639
2595
  /**
2640
- * 登录退出的用户通知
2596
+ * 【Alipay-Only】
2597
+ * 期望返回的数据格式,如果为 json 则返回后会对返回的数据进行一次 JSON.parse
2641
2598
  */
2642
- userChange?: IChatroomUserChangeInfo;
2599
+ dataType?: 'json' | 'text' | 'base64' | 'arraybuffer';
2643
2600
  /**
2644
- * 聊天室销毁
2601
+ * socks5 代理参数,仅 Electron 平台有效,web 平台默认为 null
2645
2602
  */
2646
- chatroomDestroyed?: string;
2603
+ proxy?: IProxy | null;
2604
+ }
2605
+ interface IStorage {
2606
+ setItem(key: string, value: string): void;
2607
+ getItem(key: string): string | null;
2608
+ removeItem(key: string): void;
2609
+ clear(): void;
2610
+ }
2611
+ interface IResponse {
2612
+ status: number;
2613
+ data?: string;
2647
2614
  }
2648
2615
  /**
2649
- * @category Interface
2616
+ * 网络状态枚举
2650
2617
  */
2651
- interface IChatroomEntry {
2618
+ declare enum NetworkType {
2619
+ WIFI = "wifi",
2620
+ FOUR_G = "4g",
2621
+ THREE_G = "3g",
2622
+ TWO_G = "2g",
2623
+ FIVE_G = "2g",
2624
+ THREE_GENT = "3gnet",
2625
+ UNKONWN = "unknown"
2626
+ }
2627
+ interface IWebSocket {
2628
+ id: number;
2652
2629
  /**
2653
- * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2630
+ * 监听连接建立事件,此时 WebSocket 实例已准备好收发数据
2631
+ * @param callback
2654
2632
  */
2655
- key: string;
2633
+ onOpen(callback: () => void): void;
2656
2634
  /**
2657
- * 属性对应的值, 最大长度 4096 字符
2635
+ * 监听连接关闭事件
2636
+ * @param callback
2658
2637
  */
2659
- value: string;
2638
+ onClose(callback: (code?: number, reason?: string) => void): void;
2660
2639
  /**
2661
- * 设置成功后是否发送通知消息
2640
+ * 监听接收服务器消息事件
2641
+ * @param callback
2662
2642
  */
2663
- isSendNotification?: boolean;
2643
+ onMessage(callback: (data: string | ArrayBuffer) => void): void;
2664
2644
  /**
2665
- * RC:chrmKVNotiMsg 消息中携带的附加信息
2645
+ * 监听链接错误事件
2646
+ * @param callback
2666
2647
  */
2667
- notificationExtra?: string;
2648
+ onError(callback: (error: unknown) => void): void;
2668
2649
  /**
2669
- * 用户退出聊天室时是否清除此属性
2650
+ * 向服务器发送数据
2651
+ * @param data
2670
2652
  */
2671
- isAutoDelete?: boolean;
2653
+ send(data: ArrayBuffer | string): void;
2654
+ /**
2655
+ * 关闭连接
2656
+ * @param code
2657
+ * @param reason
2658
+ */
2659
+ close(code?: number, reason?: string): void;
2672
2660
  }
2673
2661
  /**
2674
- * @category Interface
2662
+ * 平台运行时抽象
2675
2663
  */
2676
- interface IChatroomUser {
2664
+ interface IRuntime {
2677
2665
  /**
2678
- * 用户 id
2666
+ * 平台标识
2679
2667
  */
2680
- id: string;
2668
+ tag: string;
2681
2669
  /**
2682
- * 加入聊天室的时间
2670
+ * 发送 http 请求
2671
+ * @param options
2683
2672
  */
2684
- time: number;
2685
- }
2686
- /**
2687
- * @category Interface
2688
- */
2689
- interface IChatroomInfo {
2673
+ httpReq(options: IRequest): Promise<IResponse>;
2690
2674
  /**
2691
- * 成员列表
2692
- * @todo 需确认数组元素的数据结构
2675
+ * 是否使用导航
2693
2676
  */
2694
- userInfos: IChatroomUser[];
2677
+ useNavi: boolean;
2695
2678
  /**
2696
- * 房间内总人数
2679
+ * websocket 地址上附加的平台字段
2697
2680
  */
2698
- userCount: number;
2699
- }
2700
- /**
2701
- * @category Interface
2702
- */
2703
- interface IRemoveChatroomEntry {
2681
+ connectPlatform: string;
2704
2682
  /**
2705
- * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2683
+ * websocket 地址上 apiVer 字段,代表代码是否来源于 uniapp
2706
2684
  */
2707
- key: string;
2685
+ isFromUniapp: boolean;
2708
2686
  /**
2709
- * 删除成功后是否发送通知消息
2687
+ * 创建长连接实例
2710
2688
  */
2711
- isSendNotification?: boolean;
2689
+ createWebSocket(url: string, protocols?: string[]): IWebSocket;
2712
2690
  /**
2713
- * RC:chrmKVNotiMsg 消息中携带的附加信息
2691
+ * 存储模块
2714
2692
  */
2715
- notificationExtra?: string;
2693
+ localStorage: IStorage;
2694
+ /**
2695
+ * 在某些非浏览器平台,其等同于 localStorage
2696
+ */
2697
+ sessionStorage: IStorage;
2698
+ /**
2699
+ * 获取网络状态
2700
+ * 2g 3g 4g wifi unkown
2701
+ */
2702
+ getNetworkType(): Promise<NetworkType>;
2716
2703
  }
2704
+
2717
2705
  /**
2718
- * @category Interface
2706
+ * 连接状态定义枚举值
2719
2707
  */
2720
- interface IRemoveChatroomEntries {
2708
+ declare enum RCConnectionStatus {
2721
2709
  /**
2722
- * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2710
+ * 已连接
2723
2711
  */
2724
- entries: {
2725
- key: string;
2726
- }[];
2712
+ CONNECTED = 0,
2727
2713
  /**
2728
- * 删除成功后是否发送通知消息
2714
+ * 连接中
2729
2715
  */
2716
+ CONNECTING = 1,
2730
2717
  /**
2731
- * RC:chrmKVNotiMsg 消息中携带的附加信息
2718
+ * 无连接,或已断开
2732
2719
  */
2733
- notificationExtra?: string;
2734
- }
2735
- /**
2736
- * @category Interface
2737
- */
2738
- interface IChatroomEntries {
2720
+ DISCONNECTED = 2,
2739
2721
  /**
2740
- * entries ,要设置的属性列表
2741
- * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2742
- * value 属性对应的值, 最大长度 4096 字符
2722
+ * 连接暂停状态,SDK 内部 5s 后会自动尝试重连
2743
2723
  */
2744
- entries: {
2745
- key: string;
2746
- value: string;
2747
- }[];
2724
+ SUSPENDED = 3
2725
+ }
2726
+ interface IConnectionListener {
2748
2727
  /**
2749
- * 设置成功后是否发送通知消息
2728
+ * 连接成功
2750
2729
  */
2730
+ onConnected(): void;
2751
2731
  /**
2752
- * RC:chrmKVNotiMsg 消息中携带的附加信息
2732
+ * 连接中止,SDK 内部会进行重连
2733
+ * @param code 中止原因
2753
2734
  */
2754
- notificationExtra?: string;
2735
+ onSuspend(code: ErrorCode): void;
2755
2736
  /**
2756
- * 用户退出聊天室时是否清除此属性
2737
+ * 连接中
2757
2738
  */
2758
- isAutoDelete?: boolean;
2739
+ onConnecting(): void;
2759
2740
  /**
2760
- * 是否强制覆盖
2741
+ * 连接已终止
2742
+ * @param code 连接终止原因
2761
2743
  */
2762
- isForce?: boolean;
2744
+ onDisconnected(code: ErrorCode): void;
2763
2745
  }
2764
-
2765
2746
  /**
2766
- * @category Interface
2747
+ * 抽象连接管理器类,负责 engine 层的连接状态维持,和对外的连接状态通知
2767
2748
  */
2768
- interface IUploadAuth {
2749
+ declare abstract class AConnectionMgr {
2750
+ protected readonly appkey: string;
2751
+ private navi;
2752
+ protected logger: BasicLogger;
2753
+ private listener;
2754
+ constructor(appkey: string, navi: BasicNavi, logger: BasicLogger, listener: IConnectionListener);
2769
2755
  /**
2770
- * 七牛 token 有效期
2771
- */
2772
- deadline: number;
2756
+ * 当前连接所用 token
2757
+ */
2758
+ private token;
2773
2759
  /**
2774
- * 七牛上传 token
2775
- */
2776
- token: string;
2760
+ * 获取当前连接中使用的 token
2761
+ * @returns
2762
+ */
2763
+ getToken(): string;
2764
+ private reconnectKick;
2777
2765
  /**
2778
- * 百度上传 token
2779
- */
2780
- bosToken: string;
2766
+ * 当前连接状态
2767
+ */
2768
+ private _crtConnectionStatus;
2781
2769
  /**
2782
- * 百度上传 header Date
2783
- */
2784
- bosDate: string;
2770
+ * 当前用户 ID
2771
+ */
2772
+ protected _crtUserId: string;
2785
2773
  /**
2786
- * 百度上传路径
2787
- */
2788
- path: string;
2774
+ * 获取当前用户 ID
2775
+ * @returns
2776
+ */
2777
+ getCurrentUserId(): string;
2789
2778
  /**
2790
- * 上传文件名,阿里上传获取下载地址时,必须使用上传文件名,所以需抛出到业务端
2779
+ * 缓存的 cmp 权重
2780
+ * disconnect 时重置
2791
2781
  */
2792
- fileName: string;
2782
+ private cmpWeightCache?;
2793
2783
  /**
2794
- * 阿里云 oss 的 AccessKeyId
2784
+ * 修改连接状态
2785
+ * @param status
2786
+ * @param code
2795
2787
  */
2796
- osskeyId: string;
2788
+ private setConnectionStatus;
2797
2789
  /**
2798
- * 阿里云 oss post 请求表单域中的字段 policy
2790
+ * 获取当前连接状态
2791
+ * @returns
2799
2792
  */
2800
- ossPolicy: string;
2793
+ getConnectionStatus(): RCConnectionStatus;
2801
2794
  /**
2802
- * 阿里云 oss 根据 policy 计算的签名信息
2795
+ * 建立连接
2796
+ * @param token
2797
+ * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
2798
+ * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
2799
+ * 由于 SDK 有断线重连功能,存在下面情况。
2800
+ * 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
2801
+ * 用户此时又在 B 设备登录,B 设备连接成功。
2802
+ * A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
2803
+ * 这个字段就是为这种情况加的。
2804
+ * 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
2803
2805
  */
2804
- ossSign: string;
2806
+ connect(token: string, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
2805
2807
  /**
2806
- * 阿里云 oss 存储空间名称
2808
+ * 执行中的连接事务
2807
2809
  */
2808
- ossBucketName: string;
2810
+ private _crtConnectionTask;
2809
2811
  /**
2810
- * s3 认证凭证,对应 post上传 x-amz-credential 字段
2812
+ * 尝试建立连接
2813
+ * @param token
2814
+ * @param reconnectKickEnable
2815
+ * @param ignoreNaviCache
2816
+ * @param traceId
2817
+ * @description 函数会检测当前是否有进行中的连接任务,若存在,则直接返回当前连接任务
2811
2818
  */
2812
- s3Credential: string;
2819
+ private try2Connect;
2813
2820
  /**
2814
- * 加密算法,对应 post上传 x-amz-algorithm 字段
2821
+ * 创建连接任务
2822
+ * @param token
2823
+ * @param reconnectKickEnable
2824
+ * @param ignoreNaviCache
2825
+ * @param traceId
2826
+ * @returns
2815
2827
  */
2816
- s3Algorithm: string;
2828
+ private createConnectionTask;
2829
+ private reconnectTimer;
2817
2830
  /**
2818
- * s3 日期,对应 post上传 x-amz-date 字段
2831
+ * 尝试重连
2832
+ * @param ignoreNaviCache 是否忽略 navi 缓存以重新请求 navi
2819
2833
  */
2820
- s3Date: string;
2834
+ private try2Reconnect;
2821
2835
  /**
2822
- * s3 policy,对应 post上传 policy 字段
2836
+ * 服务器主动断开时由子类调用,函数将根据 reason 确定是否尝试重连
2837
+ * @param reason
2823
2838
  */
2824
- s3Policy: string;
2839
+ protected onDisconnectByServer(code: ErrorCode): void;
2825
2840
  /**
2826
- * s3 签名信息,对应 post上传 x-amz-signature 字段
2841
+ * Socket 异常中断时由子类调用,SDK 尝试恢复重连
2827
2842
  */
2828
- s3Signature: string;
2843
+ protected onDisconenctUnusual(code: ErrorCode): void;
2829
2844
  /**
2830
- * s3 存储空间名称
2845
+ * 建立 Socket 连接,由子类集成实现
2846
+ * @param token
2847
+ * @param naviInfo
2848
+ * @param reconnectKickEnable
2849
+ * @param traceId
2831
2850
  */
2832
- s3BucketName: string;
2851
+ protected abstract connectWithToken(token: string, naviInfo: INaviInfo, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
2833
2852
  /**
2834
- * stc Authorization 头
2853
+ * 当前累计心跳超时次数
2835
2854
  */
2836
- stcAuthorization: string;
2855
+ private _failedCount;
2837
2856
  /**
2838
- * stc xAmzContentSha256
2857
+ * 允许连续 PING 超时次数,超出指定次数后会主动关闭 socket 并重新连接
2839
2858
  */
2840
- stcContentSha256: string;
2859
+ private readonly ALLOW_FAILED_TIMES;
2841
2860
  /**
2842
- * stc date
2861
+ * 启动心跳计时器
2843
2862
  */
2844
- stcDate: string;
2863
+ private checkAlive;
2845
2864
  /**
2846
- * stc 存储空间名称
2865
+ * 关闭连接
2866
+ * @param inReconnect
2847
2867
  */
2848
- stcBucketName: string;
2849
- }
2850
-
2851
- interface IRTCRoomInfo {
2852
- roomId: string;
2853
- roomData: unknown[];
2854
- userCount: number;
2855
- list: unknown[];
2856
- }
2857
- interface IRtcTokenData {
2858
- rtcToken: string;
2859
- }
2860
- interface IRTCUsers {
2861
- users: {
2862
- [userId: string]: {
2863
- /**
2864
- * 发布的资源数据,是一个 JSON 字符串,解析后为发布的资源列表
2865
- */
2866
- uris?: string;
2867
- /**
2868
- * 加房间的身份标识,保存主房间 roomId
2869
- */
2870
- extra?: string;
2871
- };
2872
- };
2873
- }
2874
- interface IJoinRTCRoomData extends IRTCUsers {
2875
- token: string;
2876
- sessionId: string;
2877
- roomInfo: {
2878
- key: string;
2879
- value: string;
2880
- }[];
2881
- kvEntries: IServerRTCRoomEntry[];
2882
- offlineKickTime: number;
2883
- }
2884
- interface KVString {
2885
- [key: string]: string;
2886
- }
2887
- /**
2888
- * 设置 RTC 人员 inner、outer 数据
2889
- */
2890
- interface IRTCUserData {
2891
- [key: string]: string;
2892
- }
2893
-
2894
- /**
2895
- * @category Interface
2896
- */
2897
- interface IAsyncRes<T = void> {
2868
+ protected abstract close(inReconnect: boolean, closeDB?: boolean): void;
2898
2869
  /**
2899
- * Promise 执行结果
2870
+ * 完成一次 ping 过程,并返回响应状态码
2871
+ * @param timeout 超时时间
2900
2872
  */
2901
- code: ErrorCode;
2873
+ protected abstract sendPing(timeout: number): Promise<ErrorCode>;
2902
2874
  /**
2903
- * 结果数据
2875
+ * 业务层主动断开连接时调用
2904
2876
  */
2905
- data?: T;
2877
+ disconnect(closeDB?: boolean): Promise<void>;
2906
2878
  /**
2907
- * 错误消息
2879
+ * 清理重连计时器
2908
2880
  */
2909
- msg?: string;
2910
- }
2911
- /**
2912
- * 异步任务结果定义
2913
- * @description
2914
- * 通过 `Promise.resolve` 来处理预期内的异常,进而通过 Uncatch Promise Error 暴露预期外的异常
2915
- */
2916
- declare type IPromiseResult<T = void> = Promise<IAsyncRes<T>>;
2917
- interface IConnectResult {
2881
+ private stopReconnectTimer;
2918
2882
  /**
2919
- * 连接错误码
2883
+ * 获取 CMP 列表
2920
2884
  */
2921
- code: ErrorCode;
2885
+ protected getCmpList(navi: INaviInfo, isTcp?: boolean): ICmpData[];
2922
2886
  /**
2923
- * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
2887
+ * 修改 CMP 权重
2924
2888
  */
2925
- userId?: string;
2889
+ protected updateCmpWeight(cmpUrl: string, isRise?: boolean): void;
2890
+ private clearCmpWeightCache;
2926
2891
  }
2927
2892
 
2928
2893
  /**
2929
- * 代理信息
2894
+ * 查询错误码是否为服务下发的 disconnect 通知 status 所转换
2895
+ * @param code
2896
+ * @description 排除重定向 31006,因 disconnect 和 connAck 都包含元素可被转换为 31006
2930
2897
  */
2931
- interface IProxy {
2932
- socksHost: string;
2933
- socksPort: number;
2934
- socksUsername?: string;
2935
- socksPassword?: string;
2936
- }
2898
+ declare const isDisconnectCode: (code: ErrorCode) => boolean;
2899
+ /**
2900
+ * 查询错误码是否为服务下发的 connAck status 所转换
2901
+ * @param code
2902
+ * @description 排除重定向 31006,因 disconnect 和 connAck 都包含元素可被转换为 31006
2903
+ */
2904
+ declare const isConnnectAckCode: (code: ErrorCode) => boolean;
2937
2905
 
2938
- declare enum HttpMethod {
2939
- GET = "GET",
2940
- POST = "POST"
2906
+ /**
2907
+ * 进程内缓存数据
2908
+ */
2909
+ interface IProcessCache {
2910
+ crtUserId: string;
2911
+ connectedTime: number;
2912
+ naviInfo: INaviInfo | null;
2913
+ connectionStatus: RCConnectionStatus;
2914
+ deviceId: string;
2941
2915
  }
2942
- interface IRequest {
2943
- url: string;
2916
+ /**
2917
+ * meeting 信令
2918
+ */
2919
+ declare enum MeetingEventType {
2920
+ meetingData = 1,
2921
+ meetingState = 2,
2922
+ meetingUserState = 3,
2923
+ meetingResourceState = 4,
2924
+ rtcNackSeqId = 5
2925
+ }
2926
+ /**
2927
+ * 约束主进程 CppEngine 与 CppService 间的方法定义,以便于代码检查
2928
+ */
2929
+ interface IEngine {
2944
2930
  /**
2945
- * @default `HttpMethod.GET`
2931
+ * 注册本渲染进程至主进程,以接收主进程的消息通知,同时同步主进程的当前缓存数据
2946
2932
  */
2947
- method?: HttpMethod | 'GET' | 'POST';
2933
+ getMainProcessCache(): IProcessCache;
2948
2934
  /**
2949
- * 查询数据
2935
+ * 建立连接
2936
+ * @param token
2937
+ * @param reconnectKickEnable
2950
2938
  */
2951
- query?: {
2952
- [key: string]: string | number | null;
2953
- };
2939
+ connect(token: string, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
2940
+ getNaviInfoFromCache(): INaviInfo | null;
2954
2941
  /**
2955
- * Request Header 信息
2942
+ * 上报版本信息
2943
+ * @param version
2956
2944
  */
2957
- headers?: {
2958
- [key: string]: string;
2959
- };
2945
+ reportSDKInfo(version: {
2946
+ [name: string]: string;
2947
+ }): void;
2960
2948
  /**
2961
- * Request Body 数据
2949
+ * 连接时间
2962
2950
  */
2963
- body?: Object | string;
2951
+ getConnectedTime(): number;
2964
2952
  /**
2965
- * 超时设置,默认 `60s`
2953
+ * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
2954
+ * 对于未实现的方法,接口响应 Unsupport 错误码
2955
+ * @param method
2956
+ * @param args
2966
2957
  */
2967
- timeout?: number;
2958
+ callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
2968
2959
  /**
2969
- * 【Alipay-Only】
2970
- * 期望返回的数据格式,如果为 json 则返回后会对返回的数据进行一次 JSON.parse
2960
+ * 获取历史消息
2961
+ * @param conversationType
2962
+ * @param targetId
2963
+ * @param timestamp
2964
+ * @param count
2965
+ * @param order
2971
2966
  */
2972
- dataType?: 'json' | 'text' | 'base64' | 'arraybuffer';
2967
+ getHistoryMessage(conversationType: ConversationType, targetId: string,
2973
2968
  /**
2974
- * socks5 代理参数,仅 Electron 平台有效,web 平台默认为 null
2969
+ * 拉取时间戳,值为 `0` 表示从当前时间拉取
2975
2970
  */
2976
- proxy?: IProxy | null;
2977
- }
2978
- interface IStorage {
2979
- setItem(key: string, value: string): void;
2980
- getItem(key: string): string | null;
2981
- removeItem(key: string): void;
2982
- clear(): void;
2983
- }
2984
- interface IResponse {
2985
- status: number;
2986
- data?: string;
2987
- }
2988
- /**
2989
- * 网络状态枚举
2990
- */
2991
- declare enum NetworkType {
2992
- WIFI = "wifi",
2993
- FOUR_G = "4g",
2994
- THREE_G = "3g",
2995
- TWO_G = "2g",
2996
- FIVE_G = "2g",
2997
- THREE_GENT = "3gnet",
2998
- UNKONWN = "unknown"
2999
- }
3000
- interface IWebSocket {
3001
- id: number;
2971
+ timestamp: number,
3002
2972
  /**
3003
- * 监听连接建立事件,此时 WebSocket 实例已准备好收发数据
3004
- * @param callback
2973
+ * 获取条数, 有效值 `1` - `20`
3005
2974
  */
3006
- onOpen(callback: () => void): void;
2975
+ count: number,
3007
2976
  /**
3008
- * 监听连接关闭事件
3009
- * @param callback
2977
+ * @description
2978
+ * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
2979
+ * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3010
2980
  */
3011
- onClose(callback: (code?: number, reason?: string) => void): void;
2981
+ order: 0 | 1,
3012
2982
  /**
3013
- * 监听接收服务器消息事件
3014
- * @param callback
2983
+ * 会话的业务标识
3015
2984
  */
3016
- onMessage(callback: (data: string | ArrayBuffer) => void): void;
2985
+ channelId: string,
3017
2986
  /**
3018
- * 监听链接错误事件
3019
- * @param callback
2987
+ * 消息类型
3020
2988
  */
3021
- onError(callback: (error: unknown) => void): void;
2989
+ objectName: string): IPromiseResult<{
2990
+ list: IReceivedMessage[];
2991
+ hasMore: boolean;
2992
+ }>;
3022
2993
  /**
3023
- * 向服务器发送数据
3024
- * @param data
2994
+ * 获取指定消息类型的历史消息
3025
2995
  */
3026
- send(data: ArrayBuffer | string): void;
2996
+ getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, timestamp: number, count: number, messageTypes: string[], order: number, channelId: string): Promise<IAsyncRes<{
2997
+ list: IReceivedMessage[];
2998
+ hasMore: boolean;
2999
+ }>>;
3027
3000
  /**
3028
- * 关闭连接
3029
- * @param code
3030
- * @param reason
3001
+ * 删除历史消息 通过 messageUId
3031
3002
  */
3032
- close(code?: number, reason?: string): void;
3033
- }
3034
- /**
3035
- * 平台运行时抽象
3036
- */
3037
- interface IRuntime {
3003
+ deleteRemoteMessage(conversationType: ConversationType, targetId: string,
3038
3004
  /**
3039
- * 平台标识
3005
+ * @description
3006
+ * message 中 messageUId、setTime、messageDirection 为必须参数
3040
3007
  */
3041
- tag: string;
3008
+ messages: {
3009
+ messageUId: string;
3010
+ sentTime: number;
3011
+ messageDirection: MessageDirection;
3012
+ }[],
3042
3013
  /**
3043
- * 发送 http 请求
3044
- * @param options
3014
+ * 会话的业务标识
3045
3015
  */
3046
- httpReq(options: IRequest): Promise<IResponse>;
3016
+ channelId: string): Promise<ErrorCode>;
3017
+ recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3047
3018
  /**
3048
- * 是否使用导航
3019
+ * 删除历史消息 通过 时间戳
3020
+ * @param timestamp 小于等于传入时间戳的消息均删除
3049
3021
  */
3050
- useNavi: boolean;
3022
+ deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3051
3023
  /**
3052
- * websocket 地址上附加的平台字段
3024
+ * 会话的业务标识
3053
3025
  */
3054
- connectPlatform: string;
3026
+ channelId: string): Promise<ErrorCode>;
3055
3027
  /**
3056
- * websocket 地址上 apiVer 字段,代表代码是否来源于 uniapp
3028
+ * 获取会话列表
3029
+ * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3057
3030
  */
3058
- isFromUniapp: boolean;
3031
+ getConversationList(
3059
3032
  /**
3060
- * 创建长连接实例
3033
+ * 拉取数量, 有效值 0 - 1000, 默认 300
3061
3034
  */
3062
- createWebSocket(url: string, protocols?: string[]): IWebSocket;
3035
+ count: number,
3063
3036
  /**
3064
- * 存储模块
3037
+ * 会话类型
3038
+ * @todo 待确认是否生效
3065
3039
  */
3066
- localStorage: IStorage;
3040
+ conversationType?: ConversationType,
3067
3041
  /**
3068
- * 在某些非浏览器平台,其等同于 localStorage
3042
+ * 起始时间
3069
3043
  */
3070
- sessionStorage: IStorage;
3044
+ startTime?: number,
3071
3045
  /**
3072
- * 获取网络状态
3073
- * 2g 3g 4g wifi unkown
3046
+ * 获取顺序
3074
3047
  */
3075
- getNetworkType(): Promise<NetworkType>;
3076
- }
3077
-
3078
- /**
3079
- * 拓展方法定义,便于 electron-solution 实现时保持接口类型推导可用
3080
- */
3081
- interface IExtraMethod {
3082
- getConversationsByPage(conversationTypes: ConversationType[], sentTime: number, count: number, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3083
- getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, sentTime: number, count: number, objectNames: string[], desc: 0 | 1, tag: string): Promise<IAsyncRes<{
3084
- list: IReceivedMessage[];
3085
- hasMore: boolean;
3086
- }>>;
3087
- updateMessageReceiptStatus(conersationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<IAsyncRes<boolean>>;
3088
- }
3089
-
3090
- /**
3091
- * 连接协议
3092
- * 截止 5.7.4 版本,暂不支持 rpp 和 quic
3093
- * v2 版本文档: https://a5bq662kv5.feishu.cn/wiki/wikcnfo3lEo2CPbonDxuXFvU0Kb#K7nbeN
3094
- */
3095
- declare enum EConnectProtocol {
3096
- RMTP = 1,
3097
- TLS = 2,
3098
- RPP = 3,
3099
- QUIC = 4,
3100
- WS = 5,
3101
- WSS = 6
3102
- }
3103
- interface INaviRequestOption {
3104
- appkey: string;
3105
- uri: string;
3106
- token: string;
3107
- platform: string;
3108
- isTcp?: boolean;
3109
- }
3110
- interface ICmpData {
3111
- addr: string;
3112
- protocol: EConnectProtocol;
3113
- weight: number;
3114
- }
3115
- /**
3116
- * 导航信息数据结构
3117
- */
3118
- interface INaviInfo {
3048
+ order?: 0 | 1,
3119
3049
  /**
3120
- * Navi 数据请求响应码,200 为成功请求
3050
+ * 会话的业务标识
3121
3051
  */
3122
- code: number;
3052
+ channelId?: string): IPromiseResult<IReceivedConversation[]>;
3123
3053
  /**
3124
- * 获取 Navi 数据失败时的提示信息
3054
+ * 分页获取会话列表,仅 electron中使用
3125
3055
  */
3126
- errorMessage?: string;
3056
+ getConversationsByPage(conversationTypes: ConversationType[], startTime: number, count: number, channelId: string): IPromiseResult<IReceivedConversation[]>;
3127
3057
  /**
3128
- * 获取 Navi 数据失败时的请求 url 信息
3058
+ * 获取指定会话
3129
3059
  */
3130
- url?: string;
3060
+ getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3131
3061
  /**
3132
- * 请求导航数据时使用的协议:http / https
3133
- * @description 该字段为 SDK 内增加的字段,导航接口数据中不存在
3062
+ * 获取未读会话列表
3134
3063
  */
3135
- protocol: 'http' | 'https';
3064
+ getUnreadConversationList(conversationTypes: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3136
3065
  /**
3137
- * 获取导航时使用的 userId,小程序不走导航,故拿不到 userId
3066
+ * 删除会话
3067
+ * @description 该删除操作会删除服务器端存储的会话数据
3068
+ * @param conversationType
3069
+ * @param targetId
3138
3070
  */
3139
- userId?: string;
3071
+ removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3140
3072
  /**
3141
- * CMP 服务 Websocket 连接地址,包含域名与端口,不含 ws 或 wss 协议头
3142
- * @example a.domain.com:443
3143
- * @note 在 V2 版本废弃
3073
+ * 获取所有会话未读数
3074
+ * @param channelId 多组织 Id
3075
+ * @param conversationTypes
3076
+ * @param includeMuted 包含已设置免打扰的会话
3144
3077
  */
3145
- server: string;
3078
+ getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3146
3079
  /**
3147
- * 备用 CMP 服务地址,包含域名与端口,不含 ws 或 wss 协议头,多个备用地址以 ',' 分割
3148
- * @example a.domain.com:443,b.domain.com:443
3149
- * @note 在 V2 版本废弃
3080
+ * 获取指定会话未读数
3150
3081
  */
3151
- backupServer?: string;
3082
+ getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3152
3083
  /**
3153
- * 备用 CMP 服务地址,POST 请求 TCP 连接返回的是 bs 字段,非 backupServer 字段
3154
- * @note 在 V2 版本废弃
3084
+ * 清除指定会话未读数
3155
3085
  */
3156
- bs?: string;
3086
+ clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3157
3087
  /**
3158
- * RTC 服务配置,其值可能为 null、无效字符串、有效 JSON 字符串
3159
- * 1. 公有云未开通音视频时,值为 null
3160
- * 2. 私有云无配置时为 `{ "strategy": 0 }`
3088
+ * 获取第一个未读消息
3161
3089
  */
3162
- voipCallInfo: string | null;
3090
+ getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3163
3091
  /**
3164
- * 聊天室 kv 存储开关
3165
- * @todo 需确认详细有效值
3166
- * @description 公有云独有配置
3092
+ * 按UId批量取消息
3093
+ * @param msgUids
3167
3094
  */
3168
- kvStorage: number;
3095
+ getMessageByUids(msgUids: string[]): IReceivedMessage[];
3169
3096
  /**
3170
- * HttpDNS 功能开关,在 web 端无效
3171
- * @description 公有云独有配置
3097
+ * 设置消息可搜索内容
3098
+ * @param messageId
3099
+ * @param content
3172
3100
  */
3173
- openHttpDNS: boolean;
3101
+ setMessageSearchContent(messageId: number, content: string): Promise<ErrorCode>;
3174
3102
  /**
3175
- * 历史消息云存储功能开关
3176
- * @description
3177
- * 1. 公有云通过 `developer.rongcloud.cn` 管理后台 `单群聊消息云端存储` 功能开关进行配置
3178
- * 2. 私有云默认为 `true`
3103
+ * 按msgUids打量获取消息
3179
3104
  */
3180
- historyMsg: boolean;
3105
+ getMessageByMsgUids(targetId: string, channelId: string, conversationType: ConversationType, msgUids: string[]): IReceivedMessage[];
3181
3106
  /**
3182
- * 聊天室历史消息开关
3183
- * @description
3184
- * 1. 私有云对聊天室功能支持有限,默认为 `false`
3185
- * 2. TODO: 公有云配置待确认
3107
+ * 设置/保存指定会话消息草稿
3108
+ * @draft 草稿内容
3186
3109
  */
3187
- chatroomMsg: boolean;
3110
+ saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string, channelId: string): Promise<ErrorCode>;
3188
3111
  /**
3189
- * 文件服务器地址
3190
- * @description
3191
- * 1. 公有云下,该地址为七牛云服务器地址
3192
- * 2. 私有云下,该地址为私有云自研文件服务器地址
3193
- * @note 在 V2 版本废弃
3112
+ * 获取指定会话消息草稿
3194
3113
  */
3195
- uploadServer: string;
3114
+ getConversationMessageDraft(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<string>;
3196
3115
  /**
3197
- * 实时位置共享配置,web 端无需处理
3116
+ * 清除指定会话消息草稿
3198
3117
  */
3199
- location: null | string;
3118
+ clearConversationMessageDraft(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3200
3119
  /**
3201
- * 实时日志上传开关
3202
- * @todo 需确认有效值及作用
3120
+ * 从服务端拉取会话状态
3203
3121
  */
3204
- monitor: number;
3122
+ pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3205
3123
  /**
3206
- * 是否允许加入多聊天室开关
3124
+ * 批量设置会话 置顶、免打扰
3207
3125
  */
3208
- joinMChrm: boolean;
3126
+ batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3127
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void, traceId?: string): IPromiseResult<IReceivedMessage>;
3209
3128
  /**
3210
- * 是否开启公众号功能:`0` 为未开启,`1` 为已开启
3129
+ * 断开连接
3211
3130
  */
3212
- openMp: 0 | 1;
3131
+ disconnect(closeDB?: boolean): void;
3213
3132
  /**
3214
- * 是否开启用户级配置,若开启,需连接成功后立即拉取实时配置,0 | 1
3215
- * @description
3216
- * 配置来源:
3217
- * 1. 导航
3218
- * 2. 服务端实时下发
3219
- * 已有配置字段:
3220
- * 1. Lan. 推送使用的语言设置,用户端可自定义修改. Web 端未做设置, 只做接收
3221
- * 2. ShPushSwit. 推送是否显示详情设置,用户端可自定义修改. Web 端未做设置, 只做接收
3222
- * 3. MobPushSwit: Web/PC 在线,移动端不在线是否发送推送开关,用户端可自定义修改. Web 端未做设置, 只做接收
3223
- * 4. OffMsgDur: 离线消息保存天数,设置天数不可大于App级对应配置,用户端可自定义修改. Web 端未做设置, 只做接收
3224
- * 5. VoipInfo: 音视频相关配置,用户端不可自定义修改. 由服务端决定,与导航下发格式一致
3225
- * @todo 需确认公有云与私有云区别
3133
+ * 拉取用户级配置数据
3226
3134
  */
3227
- openUS: 0 | 1;
3135
+ pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3228
3136
  /**
3229
- * 超级群功能开关,1表示开
3137
+ * 消息注册
3138
+ * @description
3139
+ * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
3140
+ * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
3141
+ * @param objectName 消息类型,如:RC:TxtMsg
3142
+ * @param isPersited 是否存储
3143
+ * @param isCounted 是否技术
3144
+ * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3145
+ * @param isStatusMessage 是否是状态消息
3230
3146
  */
3231
- ugMsg?: 0 | 1;
3147
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[], isStatusMessage: boolean): void;
3232
3148
  /**
3233
- * 群离线消息最大下发条数,`0` 为关闭
3234
- * @description 公有云独有配合
3149
+ * 加入聊天室
3150
+ * @param count 拉取消息数量
3235
3151
  */
3236
- grpMsgLimit: number;
3152
+ joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3237
3153
  /**
3238
- * 消息加密开关,0 为关闭
3239
- * @todo
3240
- * 1. 确定其控制的功能
3241
- * 2. 确定 web 相关性
3242
- * @note 在 V2 版本废弃
3154
+ * 加入已存在的聊天室
3155
+ * @param count 拉取消息数量
3243
3156
  */
3244
- isFormatted: number;
3157
+ joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3245
3158
  /**
3246
- * GIF 动图大小限制,默认 2048 KB
3159
+ * 退出聊天室
3247
3160
  */
3248
- gifSize: number;
3161
+ quitChatroom(chatroomId: string): Promise<ErrorCode>;
3249
3162
  /**
3250
- * 上传小视频时长限制,单位:秒
3251
- * @description 公有云字段,即私有云配置中的 `uploadVideoTimeLimit`
3163
+ * 获取聊天室信息
3164
+ * @param count 获取人数, 范围 0 - 20
3165
+ * @param order 排序方式, 1 正序, 2 倒序
3252
3166
  */
3253
- videoTimes?: number;
3167
+ getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
3254
3168
  /**
3255
- * 上传小视频时长限制,单位:秒
3256
- * @description 私有云字段,即公有云配置中的 `videoTimes`
3169
+ * 获取聊天室历史消息
3257
3170
  */
3258
- uploadVideoTimeLimit?: number;
3171
+ getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
3172
+ list: IReceivedMessage[];
3173
+ hasMore: boolean;
3174
+ }>;
3259
3175
  /**
3260
- * 实时日志上传开关:`0` 为关闭,`1` 为开启
3176
+ * 设置聊天室属性
3261
3177
  */
3262
- logSwitch: number;
3178
+ setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3263
3179
  /**
3264
- * 实时日志上传策略,值为 JSON 字符串
3265
- * @example `'{
3266
- * "url": "logcollection.ronghub.com", // 上传地址
3267
- * "level": 1, // 日志等级
3268
- * "itv": 6, // 上传频率,即时间间隔,单位 s
3269
- * "times": 5 // 重试次数?
3270
- * }'`
3180
+ * 批量设置聊天室属性
3271
3181
  */
3272
- logPolicy: string;
3182
+ setChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
3183
+ code: ErrorCode;
3184
+ data?: any;
3185
+ }>;
3273
3186
  /**
3274
- * 百度 BOS 存储服务地址
3275
- * @description 公有云独有配置
3276
- * @example `gz.bcebos.com`
3277
- * @deprecated 已废弃
3187
+ * 强制设置聊天室属性
3278
3188
  */
3279
- bosAddr?: string;
3189
+ forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3280
3190
  /**
3281
- * 阿里上传配置,字符串数组,数组顺序代表 七牛、百度、阿里云 上传权重
3282
- * @example
3283
- * ```
3284
- * `[{"qiniu":"upload.qiniup.com","p":"1"},
3285
- * {"baidu":"gz.bcebos.com","p":"2"},
3286
- * {"aliyun":"oss-cn-beijing.aliyuncs.com","p":"3"}]`
3287
- * ```
3191
+ * 删除聊天室属性
3288
3192
  */
3289
- ossConfig?: string;
3193
+ removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3290
3194
  /**
3291
- * 私有云专有属性,可用来判断当前环境是公有云还是私有云,私有云环境下该值为 `1`
3195
+ * 批量删除聊天室属性
3292
3196
  */
3293
- type?: number;
3197
+ removeChatroomEntries(chatroomId: string, entries: IChrmKVEntries): Promise<{
3198
+ code: ErrorCode;
3199
+ data?: any;
3200
+ }>;
3294
3201
  /**
3295
- * @deprecated 已废弃
3202
+ * 强制删除聊天室属性
3296
3203
  */
3297
- compDays: number;
3204
+ forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3298
3205
  /**
3299
- * @deprecated 已废弃
3206
+ * 获取聊天室 key 对应 value
3300
3207
  */
3301
- msgAck: unknown;
3208
+ getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
3302
3209
  /**
3303
- * @deprecated 已废弃
3210
+ * 获取聊天室所有 key value
3304
3211
  */
3305
- activeServer: string;
3212
+ getAllChatroomEntry(chatroomId: string): IPromiseResult<{
3213
+ [key: string]: string;
3214
+ }>;
3306
3215
  /**
3307
- * @deprecated 已废弃
3216
+ * 获取上传认证信息
3217
+ * @description
3218
+ * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
3308
3219
  */
3309
- qnAddr: string;
3220
+ getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
3310
3221
  /**
3311
- * @deprecated 已废弃
3222
+ * 获取文件上传后下载地址
3312
3223
  */
3313
- extkitSwitch: number;
3224
+ getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
3225
+ downloadUrl: string;
3226
+ }>;
3314
3227
  /**
3315
- * @deprecated 已废弃
3228
+ * 创建标签
3229
+ * @param tag 标签
3316
3230
  */
3317
- alone: boolean;
3231
+ createTag(tag: ITagParam): IPromiseResult;
3318
3232
  /**
3319
- * @deprecated 已废弃
3233
+ * 删除标签
3234
+ * @param tagId 标签id
3320
3235
  */
3321
- voipServer: string;
3236
+ removeTag(tagId: string): IPromiseResult;
3322
3237
  /**
3323
- * 离线日志上报地址
3324
- * @deprecated 已废弃
3238
+ * 编辑标签
3239
+ * @param tag 标签
3325
3240
  */
3326
- offlinelogserver: string;
3241
+ updateTag(tag: ITagParam): IPromiseResult;
3327
3242
  /**
3328
- * 在线日志上报地址
3329
- * @deprecated 已废弃
3243
+ * 获取标签列表
3330
3244
  */
3331
- onlinelogserver?: string;
3245
+ getTagList(): IPromiseResult<Array<ITagInfo>>;
3332
3246
  /**
3333
- * 链路加密字段,内容为 JSON 字符串,仅限 C++ 可用
3334
- * @note V2 版本废弃
3247
+ * 添加会话到标签(给多个会话增加标签)
3248
+ * @param tagId 标签id
3249
+ * @param conversations 要添加的会话列表
3335
3250
  */
3336
- crypto?: string;
3251
+ addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult;
3337
3252
  /**
3338
- * 群组回执开关, 1: 打开,0(或者没有): 关闭
3253
+ * 删除标签中的会话(从多个会话中批量删除指定标签)
3254
+ * @param tagId 标签id
3255
+ * @param conversations 要删除的会话列表
3339
3256
  */
3340
- grpRRVer?: number;
3257
+ removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult;
3341
3258
  /**
3342
- * 防黑产开关, 1: 打开,0:关闭
3259
+ * 删除会话中的标签(从单一会话中批量删除标签)
3260
+ * @param conversationType 会话类型
3261
+ * @param targetId 会话id
3262
+ * @param tagIds 要删除的标签列表
3343
3263
  */
3344
- openAnti?: number;
3264
+ removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult;
3345
3265
  /**
3346
- * 鉴权认证
3266
+ * 获取标签下的会话列表
3267
+ * @param tagId 标签id
3347
3268
  */
3348
- jwt?: string;
3269
+ getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
3349
3270
  /**
3350
- * 数据中心
3271
+ * 获取标签下的未读消息数
3272
+ * @param tagId 标签id
3273
+ * @param containMuted 是否包含免打扰会话
3351
3274
  */
3352
- dc?: string;
3275
+ getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
3353
3276
  /**
3354
- * 是否开启 tls
3277
+ * 设置标签中会话置顶
3278
+ * @param conversation 会话
3355
3279
  */
3356
- openTLS?: number;
3280
+ setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult;
3357
3281
  /**
3358
- * V2 版本中新增字段
3359
- * 服务地址列表
3282
+ * 获取会话里的标签
3283
+ * @param config
3360
3284
  */
3361
- serverAddr?: ICmpData[];
3285
+ getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
3362
3286
  /**
3363
- * V2 版本中新增字段
3364
- * 新版本控制tag
3287
+ * 发送群组消息已读回执
3288
+ * 导航下发已读回执开关为 true 时调用
3365
3289
  */
3366
- excludeLogTag?: string;
3367
- }
3368
-
3369
- declare type INaviCache = {
3370
- token: string;
3371
- naviInfo: INaviInfo;
3372
- timestamp: number;
3373
- };
3374
- /**
3375
- * 导航数据管理类,负责管理导航有效期、导航请求、导航缓存
3376
- */
3377
- declare abstract class BasicNavi {
3378
- protected readonly appkey: string;
3379
- protected readonly logger: BasicLogger;
3290
+ sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3380
3291
  /**
3381
- * 业务层的自定义导航配置
3292
+ * 获取群组消息已读列表
3382
3293
  */
3383
- protected readonly navigators: string[];
3384
- constructor(appkey: string, logger: BasicLogger,
3294
+ getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
3385
3295
  /**
3386
- * 业务层的自定义导航配置
3296
+ * 设置群语音消息已听状态
3297
+ * @param targetId
3298
+ * @param channelId
3299
+ * @param messageUId
3387
3300
  */
3388
- navigators: string[]);
3301
+ setGroupVoiceMessagePlayed(targetId: string, channelId: string, messageUId: string): Promise<IAsyncRes>;
3389
3302
  /**
3390
- * 当前进行中的导航请求
3303
+ * 获取群语音消息已听列表
3304
+ * @param targetId
3305
+ * @param channelId
3306
+ * @param messageUId
3391
3307
  */
3392
- private crtRequest;
3308
+ getGroupVoiceMessageReader(targetId: string, channelId: string, messageUId: string): IPromiseResult<IMessageReaderResponse>;
3393
3309
  /**
3394
- * 请求导航数据
3395
- * @param token
3396
- * @param ignoreCache 是否忽略缓存,强制从服务器重新拉取。
3397
- * @param ignoreExpire 是否忽略有效期检查。理论上只需要在建立连接时需要检测 navi 有效期,其他场景无需检测
3398
- * @param traceId 事务日志跟踪 ID
3310
+ * 设置群组消息已读
3399
3311
  */
3400
- request(token: string, ignoreCache: boolean, ignoreExpire: boolean, traceId: string): IPromiseResult<INaviInfo>;
3401
- private sendRequest;
3312
+ setReadMessages(targetId: string, channelId: string, beginMessageUId: string, endMessageUId: string): Promise<IAsyncRes>;
3402
3313
  /**
3403
- * 从指定服务列表中顺序尝试获取导航
3404
- * @param uris 导航服务列表
3405
- * @param token
3406
- * @param traceId
3314
+ * 获取群组消息已读回执信息
3407
3315
  */
3408
- private requestHandler;
3316
+ getMessageReceiptInfo(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
3409
3317
  /**
3410
- * 向目标导航服务发送请求
3411
- * @param uri 导航服务地址
3412
- * @param appkey
3413
- * @param token
3414
- * @param version
3415
- * @param timeout 请求超时时间
3416
- * @param traceId
3318
+ * 获取服务器时间
3417
3319
  */
3418
- protected abstract httpRequest(uri: string, appkey: string, token: string, traceId: string, finished: boolean): IPromiseResult<INaviInfo>;
3320
+ getServerTime(): number;
3419
3321
  /**
3420
- * 向目标导航服务发送请求
3421
- * @param uri 导航服务地址
3422
- * @param appkey
3423
- * @param token
3424
- * @param version
3425
- * @param timeout 请求超时时间
3426
- * @param traceId
3322
+ * 获取设备ID
3427
3323
  */
3428
- protected abstract httpRequestV2(uri: string, appkey: string, token: string, traceId: string, finished: boolean): IPromiseResult<INaviInfo>;
3324
+ getDeviceId(): string;
3429
3325
  /**
3430
- * 转换 Navi 接口 HTTP 请求状态码为 ErrorCode 定义
3431
- * @param code
3326
+ * 获取当前 userId
3432
3327
  */
3433
- protected transHttpCode(code: number): ErrorCode;
3328
+ getCurrentUserId(): string;
3329
+ getConversationListWithAllChannel(): IPromiseResult<IReceivedConversation[]>;
3330
+ getConversationListWithAllChannelByPage(index: number, limit: number): IPromiseResult<IReceivedConversation[]>;
3434
3331
  /**
3435
- * 设置缓存
3436
- * @param formatedToken
3437
- * @param naviInfo
3438
- * @description 设置缓存的同时会检测缓存中的既有数据,适当清理,避免无效数据长时间占用存储空间
3332
+ * 设置用户在线状态监听器
3439
3333
  */
3440
- protected abstract setNaviCache(formatedToken: string, naviInfo: INaviInfo): void;
3334
+ setUserStatusListener(config: {
3335
+ userIds: string[];
3336
+ }, listener: Function): void;
3441
3337
  /**
3442
- * 获取缓存数据
3443
- * @param formatedToken
3338
+ * 设置当前用户在线状态
3444
3339
  */
3445
- protected abstract getNaviCache(formatedToken: string): INaviCache | null;
3340
+ setUserStatus(status: number): Promise<ErrorCode>;
3446
3341
  /**
3447
- * 获取缓存的导航信息
3448
- * @param token
3342
+ * 订阅用户在线状态
3449
3343
  */
3450
- getNaviInfoFromCache(token: string): INaviInfo | null;
3344
+ subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
3451
3345
  /**
3452
- * RTC 配置变更,更新 navi 缓存
3453
- * @param token
3454
- * @param voipCallInfo
3346
+ * 获取用户状态
3455
3347
  */
3456
- updateVoipCallInfo(token: string, voipCallInfo: string): void;
3457
- protected getNaviV2RequestOption(option: INaviRequestOption): IRequest;
3348
+ getUserStatus(userId: string): IPromiseResult<{
3349
+ status: string;
3350
+ }>;
3458
3351
  /**
3459
- * 是否使用 v2 版本导航
3460
- * 仅私有云 rcx 使用 v1 版本
3352
+ * 清空所有会话
3461
3353
  */
3462
- useV2Navi(): boolean;
3463
- }
3464
-
3465
- /**
3466
- * Websocket 导航工具类
3467
- */
3468
- declare class WebSocketNavi extends BasicNavi {
3469
- private runtime;
3354
+ clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
3470
3355
  /**
3471
- * 小程序平台服务地址,多个地址以 ',' 分割
3356
+ * 加入黑名单
3472
3357
  */
3473
- private readonly miniCmpUris;
3474
- constructor(appkey: string, logger: BasicLogger, runtime: IRuntime,
3358
+ addToBlacklist(userId: string): Promise<ErrorCode>;
3475
3359
  /**
3476
- * 小程序平台服务地址,多个地址以 ',' 分割
3477
- */
3478
- miniCmpUris: string[], navigators?: string[]);
3479
- protected httpRequest(uri: string, appkey: string, token: string, traceId: string, finished: boolean): IPromiseResult<INaviInfo>;
3480
- protected httpRequestV2(uri: string, appkey: string, token: string, traceId: string): IPromiseResult<INaviInfo>;
3481
- protected getNaviCache(formatedToken: string): INaviCache | null;
3482
- protected setNaviCache(formatedToken: string, naviInfo: INaviInfo): void;
3483
- }
3484
-
3485
- /**
3486
- * 当前运行时设备信息
3487
- */
3488
- interface IOSInfo {
3489
- /** 软件运行时的 CPU 架构信息 */
3490
- arch: string;
3491
- /** 平台标识 */
3492
- platform: string;
3493
- /** 操作系统名称 */
3494
- type: string;
3495
- /** 操作系统 release 标识 */
3496
- release: string;
3497
- /** 操作系统版本信息 */
3498
- version: string;
3499
- /** 内存余量 */
3500
- freemem: number;
3501
- /** 系统内存总量 */
3502
- totalmem: number;
3503
- /** 本次操作系统运行时长 */
3504
- uptime: number;
3505
- cpus: {
3506
- /** CPU 型号标识 */
3507
- model: string;
3508
- /** 主频 MHz */
3509
- speed: number;
3510
- times: {
3511
- user: number;
3512
- nice: number;
3513
- sys: number;
3514
- idle: number;
3515
- irq: number;
3516
- };
3517
- }[];
3518
- networkInterfaces: {
3519
- /** 网卡接口标识 */
3520
- [link: string]: {
3521
- /** IP */
3522
- address: string;
3523
- /** 子网掩码 */
3524
- netmask: string;
3525
- /** IP 协议版本 */
3526
- family: string;
3527
- /** Mac Address */
3528
- mac: string;
3529
- /** 是否回环地址 */
3530
- internal: boolean;
3531
- /** CIDR */
3532
- cidr: string | null;
3533
- }[] | undefined;
3534
- };
3535
- }
3536
-
3537
- interface IProcessInfo {
3538
- title: string;
3539
- platform: string;
3540
- arch: string;
3541
- pid: number;
3542
- ppid: number;
3543
- uptime: number;
3544
- cpuUsage: {
3545
- user: number;
3546
- system: number;
3547
- };
3548
- memoryUsage: {
3549
- rss: number;
3550
- heapTotal: number;
3551
- heapUsed: number;
3552
- external: number;
3553
- arrayBuffers: number;
3554
- };
3555
- resourceUsage: {
3556
- userCPUTime: number;
3557
- systemCPUTime: number;
3558
- maxRSS: number;
3559
- sharedMemorySize: number;
3560
- unsharedDataSize: number;
3561
- unsharedStackSize: number;
3562
- minorPageFault: number;
3563
- majorPageFault: number;
3564
- swappedOut: number;
3565
- fsRead: number;
3566
- fsWrite: number;
3567
- ipcSent: number;
3568
- ipcReceived: number;
3569
- signalsCount: number;
3570
- voluntaryContextSwitches: number;
3571
- involuntaryContextSwitches: number;
3572
- };
3573
- }
3574
-
3575
- /**
3576
- * 连接状态定义枚举值
3577
- */
3578
- declare enum RCConnectionStatus {
3360
+ * 将指定用户移除黑名单
3361
+ */
3362
+ removeFromBlacklist(userId: string): Promise<ErrorCode>;
3579
3363
  /**
3580
- * 已连接
3364
+ * 获取黑名单列表
3581
3365
  */
3582
- CONNECTED = 0,
3366
+ getBlacklist(): IPromiseResult<string[]>;
3583
3367
  /**
3584
- * 连接中
3368
+ * 获取指定人员在黑名单中的状态
3585
3369
  */
3586
- CONNECTING = 1,
3370
+ getBlacklistStatus(userId: string): IPromiseResult<number>;
3587
3371
  /**
3588
- * 无连接,或已断开
3372
+ * 向本地插入一条消息,不发送到服务器
3589
3373
  */
3590
- DISCONNECTED = 2,
3374
+ insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
3591
3375
  /**
3592
- * 连接暂停状态,SDK 内部 5s 后会自动尝试重连
3376
+ * 删除本地消息
3593
3377
  */
3594
- SUSPENDED = 3
3595
- }
3596
- interface IConnectionListener {
3378
+ deleteMessages(messageIds: number[]): Promise<ErrorCode>;
3597
3379
  /**
3598
- * 连接成功
3380
+ * 通过时间戳删除本地消息
3599
3381
  */
3600
- onConnected(): void;
3382
+ deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
3601
3383
  /**
3602
- * 连接中止,SDK 内部会进行重连
3603
- * @param code 中止原因
3384
+ * 清空会话下历史消息
3604
3385
  */
3605
- onSuspend(code: ErrorCode): void;
3386
+ clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3606
3387
  /**
3607
- * 连接中
3388
+ * 获取消息
3608
3389
  */
3609
- onConnecting(): void;
3390
+ getMessage(messageId: number | string): IPromiseResult<IReceivedMessage>;
3610
3391
  /**
3611
- * 连接已终止
3612
- * @param code 连接终止原因
3392
+ * 设置消息附加信息
3613
3393
  */
3614
- onDisconnected(code: ErrorCode): void;
3615
- }
3616
- /**
3617
- * 抽象连接管理器类,负责 engine 层的连接状态维持,和对外的连接状态通知
3618
- */
3619
- declare abstract class AConnectionMgr {
3620
- protected readonly appkey: string;
3621
- private navi;
3622
- protected logger: BasicLogger;
3623
- private listener;
3624
- constructor(appkey: string, navi: BasicNavi, logger: BasicLogger, listener: IConnectionListener);
3394
+ setTextMessageExtra(messageId: number, content: any): Promise<ErrorCode>;
3625
3395
  /**
3626
- * 当前连接所用 token
3396
+ * 设置消息内容
3627
3397
  */
3628
- private token;
3398
+ setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
3629
3399
  /**
3630
- * 获取当前连接中使用的 token
3631
- * @returns
3400
+ * 设置消息搜索字段
3632
3401
  */
3633
- getToken(): string;
3634
- private reconnectKick;
3402
+ setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3635
3403
  /**
3636
- * 当前连接状态
3404
+ * 通过关键字与 channelId 搜索所有会话
3637
3405
  */
3638
- private _crtConnectionStatus;
3406
+ searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3407
+ searchConversationByContentWithAllChannel(keyword: string, customMessageTypes: string[], conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3639
3408
  /**
3640
- * 当前用户 ID
3409
+ * 按内容搜索会话内的消息
3641
3410
  */
3642
- protected _crtUserId: string;
3411
+ searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
3412
+ messages: IReceivedMessage[];
3413
+ count: number;
3414
+ }>;
3643
3415
  /**
3644
- * 获取当前用户 ID
3645
- * @returns
3416
+ * 按内容搜索指定会话(不区分 channelId)的消息
3646
3417
  */
3647
- getCurrentUserId(): string;
3418
+ searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): IPromiseResult<{
3419
+ messages: IReceivedMessage[];
3420
+ count: number;
3421
+ }>;
3648
3422
  /**
3649
- * 缓存的 cmp 权重
3650
- * disconnect 时重置
3423
+ * 按内容搜索时间范围内指定会话(不区分 channelId)的消息
3424
+ */
3425
+ searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): IPromiseResult<{
3426
+ messages: IReceivedMessage[];
3427
+ }>;
3428
+ /**
3429
+ * 获取会话下所有未读的 @ 消息
3651
3430
  */
3652
- private cmpWeightCache?;
3431
+ getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
3653
3432
  /**
3654
- * 修改连接状态
3655
- * @param status
3656
- * @param code
3433
+ * 设置消息发送状态
3657
3434
  */
3658
- private setConnectionStatus;
3435
+ setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
3659
3436
  /**
3660
- * 获取当前连接状态
3661
- * @returns
3437
+ * 设置消息接收状态
3662
3438
  */
3663
- getConnectionStatus(): RCConnectionStatus;
3439
+ setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3664
3440
  /**
3665
- * 建立连接
3666
- * @param token
3667
- * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
3668
- * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
3669
- * 由于 SDK 有断线重连功能,存在下面情况。
3670
- * 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
3671
- * 用户此时又在 B 设备登录,B 设备连接成功。
3672
- * A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
3673
- * 这个字段就是为这种情况加的。
3674
- * 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
3441
+ * 将自己发送的指定时间之前的消息标记对方已读,状态值为 SentStatus.READ
3675
3442
  */
3676
- connect(token: string, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
3443
+ updateMessageReceiptStatus(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): IPromiseResult<boolean>;
3677
3444
  /**
3678
- * 执行中的连接事务
3445
+ * 删除时间戳前的未读数
3679
3446
  */
3680
- private _crtConnectionTask;
3447
+ clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
3681
3448
  /**
3682
- * 尝试建立连接
3683
- * @param token
3684
- * @param reconnectKickEnable
3685
- * @param ignoreNaviCache
3686
- * @param traceId
3687
- * @description 函数会检测当前是否有进行中的连接任务,若存在,则直接返回当前连接任务
3449
+ * 获取会话免打扰状态
3688
3450
  */
3689
- private try2Connect;
3451
+ getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
3690
3452
  /**
3691
- * 创建连接任务
3692
- * @param token
3693
- * @param reconnectKickEnable
3694
- * @param ignoreNaviCache
3695
- * @param traceId
3696
- * @returns
3453
+ * 协议栈获取远端历史消息
3697
3454
  */
3698
- private createConnectionTask;
3699
- private reconnectTimer;
3455
+ getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
3456
+ list: IReceivedMessage[];
3457
+ hasMore: boolean;
3458
+ }>;
3700
3459
  /**
3701
- * 尝试重连
3702
- * @param ignoreNaviCache 是否忽略 navi 缓存以重新请求 navi
3460
+ * 无差别获取本地免打扰列表
3703
3461
  */
3704
- private try2Reconnect;
3462
+ getBlockConversationList(): Promise<IAsyncRes<IBaseConversationInfo[]>>;
3705
3463
  /**
3706
- * 服务器主动断开时由子类调用,函数将根据 reason 确定是否尝试重连
3707
- * @param reason
3464
+ * 无差别获取本地置顶列表
3708
3465
  */
3709
- protected onDisconnectByServer(code: ErrorCode): void;
3466
+ getTopConversationList(conversationTypes?: ConversationType[], channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3710
3467
  /**
3711
- * Socket 异常中断时由子类调用,SDK 尝试恢复重连
3468
+ * 获取单个群聊会话 @ 消息未读数
3712
3469
  */
3713
- protected onDisconenctUnusual(code: ErrorCode): void;
3470
+ getUnreadMentionedCount(conversation: IConversationOption): Promise<IAsyncRes<number>>;
3714
3471
  /**
3715
- * 建立 Socket 连接,由子类集成实现
3716
- * @param token
3717
- * @param naviInfo
3718
- * @param reconnectKickEnable
3719
- * @param traceId
3472
+ * 获取所有群聊会话 @ 消息未读数
3720
3473
  */
3721
- protected abstract connectWithToken(token: string, naviInfo: INaviInfo, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
3474
+ getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
3475
+ clearData(): Promise<IAsyncRes<boolean>>;
3722
3476
  /**
3723
- * 当前累计心跳超时次数
3477
+ * 获取运行时的系统信息,仅限 Electron 平台可用
3724
3478
  */
3725
- private _failedCount;
3479
+ getOSInfo(): IPromiseResult<IOSInfo>;
3726
3480
  /**
3727
- * 允许连续 PING 超时次数,超出指定次数后会主动关闭 socket 并重新连接
3481
+ * 获取应用主进程信息,仅限 Electron 平台可用
3728
3482
  */
3729
- private readonly ALLOW_FAILED_TIMES;
3483
+ getMainProcessInfo(): IPromiseResult<IProcessInfo>;
3730
3484
  /**
3731
- * 启动心跳计时器
3485
+ * 设置代理
3732
3486
  */
3733
- private checkAlive;
3487
+ setProxy(proxy: IProxy | null): IPromiseResult<IProxy>;
3734
3488
  /**
3735
- * 关闭连接
3736
- * @param inReconnect
3489
+ * 获取代理
3737
3490
  */
3738
- protected abstract close(inReconnect: boolean, closeDB?: boolean): void;
3491
+ getProxy(): IPromiseResult<IProxy>;
3739
3492
  /**
3740
- * 完成一次 ping 过程,并返回响应状态码
3741
- * @param timeout 超时时间
3493
+ * 测试代理
3742
3494
  */
3743
- protected abstract sendPing(timeout: number): Promise<ErrorCode>;
3495
+ testProxy(proxy: IProxy, testHost: string): Promise<IResponse>;
3496
+ rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<any>>;
3497
+ rtcSignaling(roomId: string, method: string, isQuery: boolean, sourceData: any): Promise<{
3498
+ code: ErrorCode;
3499
+ buffer?: any;
3500
+ }>;
3501
+ }
3502
+
3503
+ declare enum StoreKeys {
3744
3504
  /**
3745
- * 业务层主动断开连接时调用
3505
+ * Navi 数据缓存,暂未使用
3746
3506
  */
3747
- disconnect(closeDB?: boolean): Promise<void>;
3507
+ NAVI = "rc-navi",
3748
3508
  /**
3749
- * 清理重连计时器
3509
+ * 实时日志已上报的时间戳
3750
3510
  */
3751
- private stopReconnectTimer;
3511
+ REALTIME_LOG_TIMESTAMP = "rc-realtime-log-timestamp"
3512
+ }
3513
+
3514
+ /**
3515
+ * 音视频模式
3516
+ */
3517
+ declare enum RTCMode {
3752
3518
  /**
3753
- * 获取 CMP 列表
3519
+ * 普通音视频模式
3754
3520
  */
3755
- protected getCmpList(navi: INaviInfo, isTcp?: boolean): ICmpData[];
3521
+ RTC = 0,
3756
3522
  /**
3757
- * 修改 CMP 权重
3523
+ * 直播模式
3524
+ */
3525
+ LIVE = 2,
3526
+ /**
3527
+ *sip呼叫
3528
+ */
3529
+ SIP = 4,
3530
+ /**
3531
+ * 呼叫模式.包括单呼和群呼
3532
+ */
3533
+ CALL = 5,
3534
+ /**
3535
+ * 会议
3536
+ */
3537
+ MEETING = 6,
3538
+ /**
3539
+ * 跨应用多人房间
3540
+ */
3541
+ CROSS_MUTI = 7,
3542
+ /**
3543
+ * 跨应用直播
3544
+ */
3545
+ CROSS_LIVE = 8
3546
+ }
3547
+ /**
3548
+ * 直播类型
3549
+ */
3550
+ declare enum LiveType {
3551
+ /**
3552
+ * 音视频直播
3553
+ */
3554
+ AUDIO_AND_VIDEO = 0,
3555
+ /**
3556
+ * 音频直播
3557
+ */
3558
+ AUDIO = 1
3559
+ }
3560
+ declare enum LiveRole {
3561
+ /**
3562
+ * 主播身份
3563
+ */
3564
+ ANCHOR = 1,
3565
+ /**
3566
+ * 观众身份
3758
3567
  */
3759
- protected updateCmpWeight(cmpUrl: string, isRise?: boolean): void;
3760
- private clearCmpWeightCache;
3568
+ AUDIENCE = 2
3761
3569
  }
3762
-
3763
- /**
3764
- * 查询错误码是否为服务下发的 disconnect 通知 status 所转换
3765
- * @param code
3766
- * @description 排除重定向 31006,因 disconnect 和 connAck 都包含元素可被转换为 31006
3767
- */
3768
- declare const isDisconnectCode: (code: ErrorCode) => boolean;
3769
- /**
3770
- * 查询错误码是否为服务下发的 connAck status 所转换
3771
- * @param code
3772
- * @description 排除重定向 31006,因 disconnect 和 connAck 都包含元素可被转换为 31006
3773
- */
3774
- declare const isConnnectAckCode: (code: ErrorCode) => boolean;
3775
-
3776
3570
  /**
3777
- * 进程内缓存数据
3571
+ * CallLib 流程消息
3778
3572
  */
3779
- interface IProcessCache {
3780
- crtUserId: string;
3781
- connectedTime: number;
3782
- naviInfo: INaviInfo | null;
3783
- connectionStatus: RCConnectionStatus;
3784
- deviceId: string;
3573
+ declare const CallLibMsgType: {
3574
+ 'RC:VCAccept': string;
3575
+ 'RC:VCRinging': string;
3576
+ 'RC:VCSummary': string;
3577
+ 'RC:VCHangup': string;
3578
+ 'RC:VCInvite': string;
3579
+ 'RC:VCModifyMedia': string;
3580
+ 'RC:VCModifyMem': string;
3581
+ };
3582
+ declare enum RTCApiType {
3583
+ ROOM = 1,
3584
+ PERSON = 2
3585
+ }
3586
+ declare enum RTCIdentityChangeType {
3587
+ AnchorToViewer = 1,
3588
+ ViewerToAnchor = 2
3785
3589
  }
3786
3590
  /**
3787
- * 约束主进程 CppEngine 与 CppService 间的方法定义,以便于代码检查
3591
+ * RTC 房间加入类型
3788
3592
  */
3789
- interface IEngine {
3593
+ declare enum RTCJoinType {
3790
3594
  /**
3791
- * 注册本渲染进程至主进程,以接收主进程的消息通知,同时同步主进程的当前缓存数据
3595
+ * 踢前一个设备
3792
3596
  */
3793
- getMainProcessCache(): IProcessCache;
3597
+ KICK = 0,
3794
3598
  /**
3795
- * 建立连接
3796
- * @param token
3797
- * @param reconnectKickEnable
3599
+ * 当前加入拒绝
3798
3600
  */
3799
- connect(token: string, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
3800
- getNaviInfoFromCache(): INaviInfo | null;
3601
+ REFUSE = 1,
3801
3602
  /**
3802
- * 上报版本信息
3803
- * @param version
3603
+ * 两个设备共存
3804
3604
  */
3805
- reportSDKInfo(version: {
3806
- [name: string]: string;
3807
- }): void;
3605
+ COEXIST = 2
3606
+ }
3607
+
3608
+ /**
3609
+ * @category Interface
3610
+ */
3611
+ interface IGooglePushConfig {
3808
3612
  /**
3809
- * 连接时间
3613
+ * 分组ID
3810
3614
  */
3811
- getConnectedTime(): number;
3615
+ collapseKey?: string;
3812
3616
  /**
3813
- * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
3814
- * 对于未实现的方法,接口响应 Unsupport 错误码
3815
- * @param method
3816
- * @param args
3617
+ *
3817
3618
  */
3818
- callExtra(method: string | keyof IExtraMethod, ...args: any[]): Promise<IAsyncRes<unknown>>;
3619
+ imageUrl?: string;
3819
3620
  /**
3820
- * 获取历史消息
3821
- * @param conversationType
3822
- * @param targetId
3823
- * @param timestamp
3824
- * @param count
3825
- * @param order
3621
+ *优先级
3826
3622
  */
3827
- getHistoryMessage(conversationType: ConversationType, targetId: string,
3623
+ priority?: 'high' | 'normal';
3624
+ }
3625
+ /**
3626
+ * @category Interface
3627
+ */
3628
+ interface IiOSPushConfig {
3828
3629
  /**
3829
- * 拉取时间戳,值为 `0` 表示从当前时间拉取
3630
+ * iOS 用于通知分组的 id
3830
3631
  */
3831
- timestamp: number,
3632
+ threadId?: string;
3832
3633
  /**
3833
- * 获取条数, 有效值 `1` - `20`
3634
+ * iOS 用于通知覆盖的 id
3834
3635
  */
3835
- count: number,
3636
+ apnsCollapseId?: string;
3836
3637
  /**
3837
- * @description
3838
- * 1. `0` 表示升序,获取消息发送时间比传入 `sentTime` 小 的消息
3839
- * 2. `1` 表示降序,获取消息发送时间比传入 `sentTime` 大 的消息
3638
+ * iOS 分类,如果不设置后台默认取消息类型字符串,如RC:TxtMsg
3840
3639
  */
3841
- order: 0 | 1,
3640
+ category?: string;
3842
3641
  /**
3843
- * 会话的业务标识
3642
+ * 和 category 对应
3844
3643
  */
3845
- channelId: string,
3644
+ richMediaUri?: string;
3645
+ }
3646
+ /**
3647
+ * @category Interface
3648
+ */
3649
+ interface IAndroidPushConfig {
3846
3650
  /**
3847
- * 消息类型
3651
+ * Android 的通知 id
3848
3652
  */
3849
- objectName: string): IPromiseResult<{
3850
- list: IReceivedMessage[];
3851
- hasMore: boolean;
3852
- }>;
3653
+ notificationId?: string;
3853
3654
  /**
3854
- * 获取指定消息类型的历史消息
3655
+ * 小米的 channelId
3855
3656
  */
3856
- getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, timestamp: number, count: number, messageTypes: string[], order: number, channelId: string): Promise<IAsyncRes<{
3857
- list: IReceivedMessage[];
3858
- hasMore: boolean;
3859
- }>>;
3657
+ channelIdMi?: string;
3860
3658
  /**
3861
- * 删除历史消息 通过 messageUId
3659
+ * 小米 Large icon 链接
3660
+ * Large icon 可以出现在大图版和多字版消息中,显示在右边。
3661
+ * 国内版仅 MIUI12 以上版本支持,以下版本均不支持;国际版支持。
3662
+ * 图片要求:大小 120 * 120px,格式为 png 或者 jpg 格式。
3862
3663
  */
3863
- deleteRemoteMessage(conversationType: ConversationType, targetId: string,
3664
+ miLargeIconUrl?: string;
3864
3665
  /**
3865
- * @description
3866
- * message 中 messageUId、setTime、messageDirection 为必须参数
3666
+ * 华为的 channelId
3867
3667
  */
3868
- messages: {
3869
- messageUId: string;
3870
- sentTime: number;
3871
- messageDirection: MessageDirection;
3872
- }[],
3668
+ channelIdHW?: string;
3873
3669
  /**
3874
- * 会话的业务标识
3875
- */
3876
- channelId: string): Promise<ErrorCode>;
3877
- recallMsg(conversationType: ConversationType, targetId: string, messageUId: string, sentTime: number, recallMsgOptions: IRecallMsgOptions): IPromiseResult<IReceivedMessage>;
3670
+ * 华为推送消息分类
3671
+ * 更多信息请参考华为消息分类标准文档: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835
3672
+ * 5.7.3 版本开始支持
3673
+ */
3674
+ categoryHW?: string;
3878
3675
  /**
3879
- * 删除历史消息 通过 时间戳
3880
- * @param timestamp 小于等于传入时间戳的消息均删除
3676
+ * 华为推送消息级别
3677
+ * LOW: 表示消息为资讯营销
3678
+ * NORMAL: 消息为服务与通讯
3881
3679
  */
3882
- deleteRemoteMessageByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number,
3680
+ importanceHW?: 'NORMAL' | 'LOW';
3883
3681
  /**
3884
- * 会话的业务标识
3885
- */
3886
- channelId: string): Promise<ErrorCode>;
3682
+ * 华为通知类型的推送所使用的通知图片 url
3683
+ */
3684
+ imageUrlHW?: string;
3887
3685
  /**
3888
- * 获取会话列表
3889
- * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
3686
+ * OPPO 的 channelId
3890
3687
  */
3891
- getConversationList(
3688
+ channelIdOPPO?: string;
3892
3689
  /**
3893
- * 拉取数量, 有效值 0 - 1000, 默认 300
3690
+ * vivo 的类型
3894
3691
  */
3895
- count: number,
3692
+ typeVivo?: string;
3896
3693
  /**
3897
- * 会话类型
3898
- * @todo 待确认是否生效
3899
- */
3900
- conversationType?: ConversationType,
3694
+ * google FCM 的推送配置
3695
+ */
3696
+ googleConfig?: IGooglePushConfig;
3697
+ }
3698
+ /**
3699
+ * 推送配置
3700
+ * @category Interface
3701
+ */
3702
+ interface IPushConfig {
3901
3703
  /**
3902
- * 起始时间
3704
+ * 推送标题
3705
+ * 如果没有设置,会使用下面的默认标题显示规则
3706
+ * 默认标题显示规则:
3707
+ * 内置消息:单聊通知标题显示为发送者名称,群聊通知标题显示为群名称。
3708
+ * 自定义消息:默认不显示标题。
3903
3709
  */
3904
- startTime?: number,
3710
+ pushTitle: string;
3905
3711
  /**
3906
- * 获取顺序
3712
+ * 推送内容
3713
+ * 优先使用 IPushConfig.pushContent, 如果没有,则使用发送消息的 pushContent 参数
3907
3714
  */
3908
- order?: 0 | 1,
3715
+ pushContent: string;
3909
3716
  /**
3910
- * 会话的业务标识
3717
+ * 远程推送附加信息
3718
+ * 优先使用 IPushConfig.pushData, 如果没有,则使用发送消息的 pushContent 参数
3911
3719
  */
3912
- channelId?: string): IPromiseResult<IReceivedConversation[]>;
3720
+ pushData: string;
3913
3721
  /**
3914
- * 分页获取会话列表,仅 electron中使用
3722
+ * iOSConfig
3915
3723
  */
3916
- getConversationsByPage(conversationTypes: ConversationType[], startTime: number, count: number, channelId: string): IPromiseResult<IReceivedConversation[]>;
3724
+ iOSConfig?: IiOSPushConfig;
3917
3725
  /**
3918
- * 获取指定会话
3726
+ * androidConfig
3919
3727
  */
3920
- getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3728
+ androidConfig?: IAndroidPushConfig;
3921
3729
  /**
3922
- * 获取未读会话列表
3730
+ * 是否显示推送标题. 仅针对 iOS 平台有效
3923
3731
  */
3924
- getUnreadConversationList(conversationTypes: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3732
+ disablePushTitle: boolean;
3925
3733
  /**
3926
- * 删除会话
3927
- * @description 该删除操作会删除服务器端存储的会话数据
3928
- * @param conversationType
3929
- * @param targetId
3734
+ * 是否强制推送
3930
3735
  */
3931
- removeConversation(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3736
+ forceShowDetailContent: boolean;
3737
+ /**
3738
+ * 推送模板id
3739
+ */
3740
+ templateId: string;
3741
+ }
3742
+
3743
+ /**
3744
+ * 已读回执数据结构
3745
+ * @category Interface
3746
+ */
3747
+ interface IMessageReader {
3748
+ readTime: number;
3749
+ userId: string;
3750
+ }
3751
+ /**
3752
+ * @category Interface
3753
+ */
3754
+ interface IMessageReaderResponse {
3755
+ totalMemberCount: number;
3756
+ list: IMessageReader[];
3757
+ }
3758
+ interface ILocalReadReceiptInfo {
3759
+ hasRespond?: boolean;
3760
+ readerInfo?: {
3761
+ [userId: string]: number;
3762
+ };
3763
+ readCount?: number;
3764
+ totalCount?: number;
3765
+ }
3766
+ /**
3767
+ * @category Interface
3768
+ */
3769
+ interface IReadReceiptInfo {
3932
3770
  /**
3933
- * 获取所有会话未读数
3934
- * @param channelId 多组织 Id
3935
- * @param conversationTypes
3936
- * @param includeMuted 包含已设置免打扰的会话
3771
+ * 是否已经发送已读回执
3937
3772
  */
3938
- getAllConversationUnreadCount(channelId: string, conversationTypes: ConversationType[], includeMuted: boolean): IPromiseResult<number>;
3773
+ hasRespond?: boolean;
3939
3774
  /**
3940
- * 获取指定会话未读数
3775
+ * 已阅读用户列表(不准确)
3941
3776
  */
3942
- getConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<number>;
3777
+ readerList?: IMessageReader[];
3943
3778
  /**
3944
- * 清除指定会话未读数
3779
+ * 阅读人数(不准确)
3945
3780
  */
3946
- clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3781
+ readCount?: number;
3947
3782
  /**
3948
- * 获取第一个未读消息
3783
+ * 群组总人数(不准确)
3949
3784
  */
3950
- getFirstUnreadMessage(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedMessage | null>;
3785
+ totalCount?: number;
3786
+ }
3787
+ /**
3788
+ * 从服务端接收到的消息数据
3789
+ * @category Interface
3790
+ */
3791
+ interface IReceivedMessage {
3951
3792
  /**
3952
- * 按UId批量取消息
3953
- * @param msgUids
3954
- */
3955
- getMessageByUids(msgUids: string[]): IReceivedMessage[];
3793
+ * 会话的业务标识
3794
+ */
3795
+ channelId?: string;
3956
3796
  /**
3957
- * 设置消息可搜索内容
3958
- * @param messageId
3959
- * @param content
3797
+ * 会话类型
3798
+ * * 1: 单聊
3799
+ * * 3: 群聊
3800
+ * * 4: 聊天室
3801
+ * * 5: 客服会话
3802
+ * * 6: 系统消息
3803
+ * * 7: 默认关注的公众号
3804
+ * * 8: 手动关注的公众号
3805
+ * * 9: RTCLib 房间
3960
3806
  */
3961
- setMessageSearchContent(messageId: number, content: string): Promise<ErrorCode>;
3807
+ conversationType: ConversationType;
3962
3808
  /**
3963
- * 按msgUids打量获取消息
3809
+ * 会话 targetId
3964
3810
  */
3965
- getMessageByMsgUids(targetId: string, channelId: string, conversationType: ConversationType, msgUids: string[]): IReceivedMessage[];
3811
+ targetId: string;
3966
3812
  /**
3967
- * 设置/保存指定会话消息草稿
3968
- * @draft 草稿内容
3813
+ * 消息发送者的用户 Id
3969
3814
  */
3970
- saveConversationMessageDraft(conversationType: ConversationType, targetId: string, draft: string, channelId: string): Promise<ErrorCode>;
3815
+ senderUserId: string;
3971
3816
  /**
3972
- * 获取指定会话消息草稿
3817
+ * 消息内容
3973
3818
  */
3974
- getConversationMessageDraft(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<string>;
3819
+ content: any;
3975
3820
  /**
3976
- * 清除指定会话消息草稿
3821
+ * 消息结构名称,即消息类型
3822
+ * @example RC:TxtMsg
3977
3823
  */
3978
- clearConversationMessageDraft(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
3824
+ messageType: string;
3979
3825
  /**
3980
- * 从服务端拉取会话状态
3826
+ * 服务端存储的消息 Id
3981
3827
  */
3982
- pullConversationStatus(timestamp: number): Promise<IAsyncRes<IServerConversationStatus[]>>;
3828
+ messageUId: string;
3983
3829
  /**
3984
- * 批量设置会话 置顶、免打扰
3830
+ * 消息方向是发出 or 收取
3985
3831
  */
3986
- batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3987
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void, traceId?: string): IPromiseResult<IReceivedMessage>;
3832
+ messageDirection: MessageDirection;
3988
3833
  /**
3989
- * 断开连接
3834
+ * 是否为离线消息
3990
3835
  */
3991
- disconnect(closeDB?: boolean): void;
3836
+ isOffLineMessage: boolean;
3992
3837
  /**
3993
- * 拉取用户级配置数据
3838
+ * 消息在服务器端的发送时间
3994
3839
  */
3995
- pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
3840
+ sentTime: number;
3996
3841
  /**
3997
- * 消息注册
3998
- * @description
3999
- * 消息注册需在应用初始化完成前进行,否则在搭配 C++ 协议栈使用时,
4000
- * 本端发出的消息将不默认作为未知消息处理,不存储、不计数
4001
- * @param objectName 消息类型,如:RC:TxtMsg
4002
- * @param isPersited 是否存储
4003
- * @param isCounted 是否技术
4004
- * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4005
- * @param isStatusMessage 是否是状态消息
3842
+ * 消息接收时间,该时间通过消息的 `sentTime` 值在本地进行计算得出,不推荐使用
3843
+ * @description 当 isOffLineMessage 为 true 时,该值无效
4006
3844
  */
4007
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[], isStatusMessage: boolean): void;
3845
+ receivedTime: number;
4008
3846
  /**
4009
- * 加入聊天室
4010
- * @param count 拉取消息数量
3847
+ * 是否存储
3848
+ * @default true
4011
3849
  */
4012
- joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3850
+ isPersited: boolean;
4013
3851
  /**
4014
- * 加入已存在的聊天室
4015
- * @param count 拉取消息数量
3852
+ * 是否计数
3853
+ * @default true
4016
3854
  */
4017
- joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
3855
+ isCounted: boolean;
4018
3856
  /**
4019
- * 退出聊天室
3857
+ * 是否为 @ 消息
4020
3858
  */
4021
- quitChatroom(chatroomId: string): Promise<ErrorCode>;
3859
+ isMentioned: boolean;
4022
3860
  /**
4023
- * 获取聊天室信息
4024
- * @param count 获取人数, 范围 0 - 20
4025
- * @param order 排序方式, 1 正序, 2 倒序
3861
+ * 消息是否静默
3862
+ * @description 静默消息不会发送 Push 信息和本地通知提醒
4026
3863
  */
4027
- getChatroomInfo(chatroomId: string, count: number, order: number): IPromiseResult<IChatroomInfo>;
3864
+ disableNotification: boolean;
4028
3865
  /**
4029
- * 获取聊天室历史消息
3866
+ * 是否是状态消息
4030
3867
  */
4031
- getChatroomHistoryMessages(chatroomId: string, timestamp: number, count: number, order: number): IPromiseResult<{
4032
- list: IReceivedMessage[];
4033
- hasMore: boolean;
4034
- }>;
3868
+ isStatusMessage: boolean;
4035
3869
  /**
4036
- * 设置聊天室属性
4037
- */
4038
- setChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3870
+ * 是否支持消息扩展存储
3871
+ */
3872
+ canIncludeExpansion: boolean;
4039
3873
  /**
4040
- * 批量设置聊天室属性
4041
- */
4042
- setChatroomEntries(chatroomId: string, entry: IChrmKVEntries): Promise<{
4043
- code: ErrorCode;
4044
- data?: any;
4045
- }>;
3874
+ * 消息携带的扩展存储
3875
+ */
3876
+ expansion: {
3877
+ [key: string]: any;
3878
+ } | null;
4046
3879
  /**
4047
- * 强制设置聊天室属性
4048
- */
4049
- forceSetChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3880
+ * 消息接收状态
3881
+ */
3882
+ receivedStatus: number;
4050
3883
  /**
4051
- * 删除聊天室属性
4052
- */
4053
- removeChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3884
+ * 消息本地 ID, web 端由 lib 内生成, PC 端由协议栈数据库生成自增ID
3885
+ */
3886
+ messageId?: number;
4054
3887
  /**
4055
- * 批量删除聊天室属性
4056
- */
4057
- removeChatroomEntries(chatroomId: string, entries: IChrmKVEntries): Promise<{
4058
- code: ErrorCode;
4059
- data?: any;
4060
- }>;
3888
+ * 消息发送状态, web 端由 lib 内根据消息状态设置值为 发送中、已发送和发送失败 ,PC 端由协议栈自动维护或用户自己设置
3889
+ */
3890
+ sentStatus?: SentStatus;
4061
3891
  /**
4062
- * 强制删除聊天室属性
3892
+ * 已读回执信息(导航配置grpRRVer=1时群组类型消息内存在, 其他情况为undefined)
4063
3893
  */
4064
- forceRemoveChatroomEntry(chatroomId: string, entry: IChrmKVEntry): Promise<ErrorCode>;
3894
+ readReceiptInfo?: IReadReceiptInfo;
4065
3895
  /**
4066
- * 获取聊天室 key 对应 value
3896
+ * 推送扩展
4067
3897
  */
4068
- getChatroomEntry(chatroomId: string, key: string): IPromiseResult<string | null>;
3898
+ pushConfig?: IPushConfig;
4069
3899
  /**
4070
- * 获取聊天室所有 key value
3900
+ * 超级群专有字段,是否断档,服务端收到大量消息可能会断档,所以消息存在此标志位,断档需要客户手动拉取历史消息
4071
3901
  */
4072
- getAllChatroomEntry(chatroomId: string): IPromiseResult<{
4073
- [key: string]: string;
4074
- }>;
3902
+ isInterrupt?: boolean;
4075
3903
  /**
4076
- * 获取上传认证信息
4077
- * @description
4078
- * 若不传 fileName 百度上传认证字段(bosToken、bosDate、path)均返回 null
3904
+ * 拉取历史消息时表示该消息是否修改过(仅超级群有效)
4079
3905
  */
4080
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: string, queryUriString?: string): Promise<IAsyncRes<IUploadAuth>>;
3906
+ isModifyMessage?: boolean;
4081
3907
  /**
4082
- * 获取文件上传后下载地址
3908
+ * 拉取历史消息时表示该消息是否为超级群频道类型(仅超级群有效)
4083
3909
  */
4084
- getFileUrl(fileType: FileType, uploadMethod: UploadMethod, fileName?: string, originName?: string): IPromiseResult<{
4085
- downloadUrl: string;
4086
- }>;
3910
+ channelType?: UltraGroupChannelType;
4087
3911
  /**
4088
- * 创建标签
4089
- * @param tag 标签
4090
- */
4091
- createTag(tag: ITagParam): IPromiseResult;
3912
+ * 扩展内容
3913
+ */
3914
+ extraContent?: string;
3915
+ }
3916
+ /**
3917
+ * @category Interface
3918
+ */
3919
+ interface IUserProfile {
4092
3920
  /**
4093
- * 删除标签
4094
- * @param tagId 标签id
4095
- */
4096
- removeTag(tagId: string): IPromiseResult;
3921
+ * 用户 ID
3922
+ */
3923
+ id?: string;
4097
3924
  /**
4098
- * 编辑标签
4099
- * @param tag 标签
3925
+ * 用户名
4100
3926
  */
4101
- updateTag(tag: ITagParam): IPromiseResult;
3927
+ name?: string;
4102
3928
  /**
4103
- * 获取标签列表
3929
+ * 用户头像地址
3930
+ * @deprecated
4104
3931
  */
4105
- getTagList(): IPromiseResult<Array<ITagInfo>>;
3932
+ portraitUri?: string;
4106
3933
  /**
4107
- * 添加会话到标签(给多个会话增加标签)
4108
- * @param tagId 标签id
4109
- * @param conversations 要添加的会话列表
3934
+ * user info 中附加信息
4110
3935
  */
4111
- addTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult;
3936
+ extra?: string;
4112
3937
  /**
4113
- * 删除标签中的会话(从多个会话中批量删除指定标签)
4114
- * @param tagId 标签id
4115
- * @param conversations 要删除的会话列表
3938
+ * 用户头像地址(向移动端兼容)
4116
3939
  */
4117
- removeTagForConversations(tagId: string, conversations: IConversationOption[]): IPromiseResult;
3940
+ portrait?: string;
3941
+ }
3942
+ interface IOperateInfo {
3943
+ targetId: string;
3944
+ channelId?: string;
3945
+ userId: string;
3946
+ operationType: OperateStatus;
3947
+ operationTime?: number;
3948
+ }
3949
+ interface IOperateSummary {
3950
+ targetId: string;
3951
+ channelId?: string;
3952
+ count: number;
3953
+ operationType: OperateStatus;
3954
+ }
3955
+ interface IOperateStatusNotify {
3956
+ conversationType: ConversationType;
3957
+ hasInfo: boolean;
3958
+ hasSummary: boolean;
3959
+ info: IOperateInfo[];
3960
+ summary: IOperateSummary[];
3961
+ }
3962
+ interface IRecallMsgOptions {
4118
3963
  /**
4119
- * 删除会话中的标签(从单一会话中批量删除标签)
4120
- * @param conversationType 会话类型
4121
- * @param targetId 会话id
4122
- * @param tagIds 要删除的标签列表
4123
- */
4124
- removeTagsForConversation(conversation: IConversationOption, tagIds: string[]): IPromiseResult;
3964
+ * 会话组织机构标识
3965
+ * 默认值未 空字符串
3966
+ */
3967
+ channelId: string;
4125
3968
  /**
4126
- * 获取标签下的会话列表
4127
- * @param tagId 标签id
4128
- */
4129
- getConversationListByTag(tagId: string, startTime: number, count?: number, channelId?: string): IPromiseResult<IReceivedConversationByTag[]>;
3969
+ * 发送消息携带的用户信息
3970
+ */
3971
+ user?: IUserProfile;
4130
3972
  /**
4131
- * 获取标签下的未读消息数
4132
- * @param tagId 标签id
4133
- * @param containMuted 是否包含免打扰会话
4134
- */
4135
- getUnreadCountByTag(tagId: string, containMuted: boolean): IPromiseResult<number>;
3973
+ * Push 信息
3974
+ */
3975
+ pushContent?: string;
4136
3976
  /**
4137
- * 设置标签中会话置顶
4138
- * @param conversation 会话
4139
- */
4140
- setConversationStatusInTag(tagId: string, conversation: IConversationOption, status: ITagStatus): IPromiseResult;
3977
+ * 原消息体
3978
+ */
3979
+ oriContent?: any;
4141
3980
  /**
4142
- * 获取会话里的标签
4143
- * @param config
4144
- */
4145
- getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
3981
+ * 是否发送静默消息
3982
+ * @description
3983
+ * 当值为 `true` 时,服务器将不会发送 Push 信息,移动端也不会弹出本地通知提醒
3984
+ */
3985
+ disableNotification?: boolean;
4146
3986
  /**
4147
- * 发送群组消息已读回执
4148
- * 导航下发已读回执开关为 true 时调用
4149
- */
4150
- sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
3987
+ * 移动端推送配置
3988
+ */
3989
+ pushConfig?: IPushConfig;
4151
3990
  /**
4152
- * 获取群组消息已读列表
4153
- */
4154
- getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
3991
+ * 其他拓展信息
3992
+ */
3993
+ extra?: string;
4155
3994
  /**
4156
- * 设置群组消息已读
3995
+ * 是否删除原始消息(在移动端会使用到),为 true 时移动端会不显示小灰条提示
4157
3996
  */
4158
- setReadMessages(targetId: string, channelId: string, beginMessageUId: string, endMessageUId: string): Promise<IAsyncRes>;
3997
+ isDelete?: boolean;
3998
+ }
3999
+ interface IRecallMsgContent {
4000
+ conversationType: number;
4001
+ targetId: string;
4002
+ sentTime: number;
4003
+ messageUId: string;
4159
4004
  /**
4160
- * 获取群组消息已读回执信息
4161
- */
4162
- getMessageReceiptInfo(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
4005
+ * 会话组织机构标识
4006
+ * 默认值未 空字符串
4007
+ */
4008
+ channelId: string;
4163
4009
  /**
4164
- * 获取服务器时间
4165
- */
4166
- getServerTime(): number;
4010
+ * 其他拓展信息
4011
+ */
4012
+ extra?: string;
4167
4013
  /**
4168
- * 获取设备ID
4169
- */
4170
- getDeviceId(): string;
4014
+ * 发送消息携带的用户信息
4015
+ */
4016
+ user?: IUserProfile;
4171
4017
  /**
4172
- * 获取当前 userId
4018
+ * 是否删除原始消息(在移动端会使用到),为 true 时移动端会不显示小灰条提示
4173
4019
  */
4174
- getCurrentUserId(): string;
4175
- getConversationListWithAllChannel(): IPromiseResult<IReceivedConversation[]>;
4176
- getConversationListWithAllChannelByPage(index: number, limit: number): IPromiseResult<IReceivedConversation[]>;
4020
+ isDelete?: boolean;
4021
+ }
4022
+ /**
4023
+ * 发送消息时的可选项信息
4024
+ */
4025
+ interface ISendMsgOptions {
4177
4026
  /**
4178
- * 设置用户在线状态监听器
4027
+ * 消息类型,即消息结构的 ObjectName
4179
4028
  */
4180
- setUserStatusListener(config: {
4181
- userIds: string[];
4182
- }, listener: Function): void;
4029
+ messageType: string;
4183
4030
  /**
4184
- * 设置当前用户在线状态
4031
+ * 消息内容
4185
4032
  */
4186
- setUserStatus(status: number): Promise<ErrorCode>;
4033
+ content: {
4034
+ /**
4035
+ * 消息内容 key-value,最终会进行 JSON 序列化后发送
4036
+ */
4037
+ [key: string]: any;
4038
+ /**
4039
+ * 消息可携带的用户数据
4040
+ */
4041
+ user?: IUserProfile;
4042
+ /**
4043
+ * 其他拓展信息
4044
+ */
4045
+ extra?: string;
4046
+ };
4187
4047
  /**
4188
- * 订阅用户在线状态
4048
+ * 是否存储
4049
+ * @description 只在发送未注册过的自定义消息时有效,否则使用注册时的配置
4189
4050
  */
4190
- subscribeUserStatus(userIds: string[]): Promise<ErrorCode>;
4051
+ isPersited?: boolean;
4191
4052
  /**
4192
- * 获取用户状态
4053
+ * 是否计数
4054
+ * @description 只在发送未注册过的自定义消息时有效,否则使用注册时的配置
4193
4055
  */
4194
- getUserStatus(userId: string): IPromiseResult<{
4195
- status: string;
4196
- }>;
4056
+ isCounted?: boolean;
4197
4057
  /**
4198
- * 清空所有会话
4058
+ * 是否是状态消息,一般为无需注册的自定义消息
4059
+ * @description
4060
+ * 1. 状态消息只有 pub,没有 ack 应答
4061
+ * 2. 状态消息默认不存储,不计数,`isPersited` 与 `isCounted` 配置将失效
4199
4062
  */
4200
- clearConversations(conversationTypes?: ConversationType[], channelId?: string): Promise<ErrorCode>;
4063
+ isStatusMessage?: boolean;
4201
4064
  /**
4202
- * 加入黑名单
4065
+ * 是否发送静默消息
4066
+ * @description
4067
+ * 当值为 `true` 时,服务器将不会发送 Push 信息,移动端也不会弹出本地通知提醒
4203
4068
  */
4204
- addToBlacklist(userId: string): Promise<ErrorCode>;
4069
+ disableNotification?: boolean;
4205
4070
  /**
4206
- * 将指定用户移除黑名单
4071
+ * Push 信息
4207
4072
  */
4208
- removeFromBlacklist(userId: string): Promise<ErrorCode>;
4073
+ pushContent?: string;
4209
4074
  /**
4210
- * 获取黑名单列表
4075
+ * Push 通知携带的附加信息
4211
4076
  */
4212
- getBlacklist(): IPromiseResult<string[]>;
4077
+ pushData?: string;
4213
4078
  /**
4214
- * 获取指定人员在黑名单中的状态
4079
+ * 是否为 @ 消息,只当 conversationType 值为 `ConversationType.GROUP` 时有效
4215
4080
  */
4216
- getBlacklistStatus(userId: string): IPromiseResult<number>;
4081
+ isMentioned?: boolean;
4217
4082
  /**
4218
- * 向本地插入一条消息,不发送到服务器
4083
+ * `@` 消息类型
4084
+ * @description `1: @ 所有人 2: @ 指定用户`
4219
4085
  */
4220
- insertMessage(conversationType: ConversationType, targetId: string, insertOptions: IInsertMsgOptions): IPromiseResult<IReceivedMessage>;
4086
+ mentionedType?: 1 | 2;
4221
4087
  /**
4222
- * 删除本地消息
4088
+ * 被 @ 的用户 Id 列表,当 `mentionedType` 值为 `1` 时,该值可为空
4223
4089
  */
4224
- deleteMessages(messageIds: number[]): Promise<ErrorCode>;
4090
+ mentionedUserIdList?: string[];
4225
4091
  /**
4226
- * 通过时间戳删除本地消息
4092
+ * 用于发送群定向消息,只当 conversationType 值为 `ConversationType.GROUP` 时有效
4227
4093
  */
4228
- deleteMessagesByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, cleanSpace: boolean, channelId: string): Promise<ErrorCode>;
4094
+ directionalUserIdList?: string[];
4229
4095
  /**
4230
- * 清空会话下历史消息
4096
+ * 当对方为 iOS 设备且未在线时,其将收到 Voip Push. 此配置对 Android 无影响
4231
4097
  */
4232
- clearMessages(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
4098
+ isVoipPush?: boolean;
4233
4099
  /**
4234
- * 获取消息
4100
+ * 消息是否支持拓展内容
4235
4101
  */
4236
- getMessage(messageId: number | string): IPromiseResult<IReceivedMessage>;
4102
+ canIncludeExpansion?: boolean;
4237
4103
  /**
4238
- * 设置消息附加信息
4104
+ * 消息拓展内容数据
4239
4105
  */
4240
- setTextMessageExtra(messageId: number, content: any): Promise<ErrorCode>;
4106
+ expansion?: {
4107
+ [key: string]: string;
4108
+ };
4241
4109
  /**
4242
- * 设置消息内容
4110
+ * 黑/白名单
4111
+ * @todo 功能未知,需确认
4243
4112
  */
4244
- setMessageContent(messageId: number, content: any, messageType: string): Promise<ErrorCode>;
4113
+ isFilerWhiteBlacklist?: boolean;
4245
4114
  /**
4246
- * 设置消息搜索字段
4247
- */
4248
- setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
4115
+ * 移动端推送配置
4116
+ */
4117
+ pushConfig?: IPushConfig;
4249
4118
  /**
4250
- * 通过关键字与 channelId 搜索所有会话
4251
- */
4252
- searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
4253
- searchConversationByContentWithAllChannel(keyword: string, customMessageTypes: string[], conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
4119
+ * 会话业务标识
4120
+ * @description
4121
+ * 20 个字符长度限制
4122
+ */
4123
+ channelId?: string;
4254
4124
  /**
4255
- * 按内容搜索会话内的消息
4125
+ * 客户端的消息标识
4126
+ * 重发消息时用到,重发消息的消息 ID
4256
4127
  */
4257
- searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId: string): IPromiseResult<{
4258
- messages: IReceivedMessage[];
4259
- count: number;
4260
- }>;
4128
+ messageId?: number;
4261
4129
  /**
4262
- * 按内容搜索指定会话(不区分 channelId)的消息
4130
+ * 超级群专有字段,是否断档,若断档需要客户判断是否拉取
4263
4131
  */
4264
- searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): IPromiseResult<{
4265
- messages: IReceivedMessage[];
4266
- count: number;
4267
- }>;
4132
+ isInterrupt?: boolean;
4268
4133
  /**
4269
- * 按内容搜索时间范围内指定会话(不区分 channelId)的消息
4134
+ * 标识该消息是否为重发消息,仅 electron 中有效。
4270
4135
  */
4271
- searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): IPromiseResult<{
4272
- messages: IReceivedMessage[];
4273
- }>;
4136
+ isResend?: boolean;
4137
+ }
4138
+ interface IInsertMsgOptions {
4139
+ senderUserId: string;
4140
+ messageType: string;
4141
+ content: any;
4142
+ messageDirection: number;
4143
+ readStatus?: number;
4144
+ sentStatus?: number;
4145
+ sentTime?: number;
4146
+ searchContent?: string;
4147
+ isUnread?: boolean;
4148
+ messageUId?: string;
4149
+ disableNotification?: boolean;
4150
+ canIncludeExpansion?: boolean;
4151
+ expansionMsg?: string;
4152
+ channelId: string;
4153
+ }
4154
+ interface IInsertMessage {
4155
+ conversationType: number;
4156
+ targetId: string;
4157
+ channelId: string;
4158
+ messageDirection: number;
4159
+ messageType: string;
4160
+ content: any;
4161
+ messageUId: string;
4162
+ senderUserId: string;
4163
+ sentStatus?: number;
4164
+ sentTime?: number;
4165
+ disableNotification?: boolean;
4166
+ canIncludeExpansion?: boolean;
4167
+ expansion?: {
4168
+ [key: string]: any;
4169
+ } | null;
4170
+ receivedStatus?: number;
4274
4171
  /**
4275
- * 获取会话下所有未读的 @ 消息
4172
+ * 插入消息是否计入未读数: true 计数 false 不计数, 默认不计数
4276
4173
  */
4277
- getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId: string): IReceivedMessage[];
4174
+ isUnread?: boolean;
4278
4175
  /**
4279
- * 设置消息发送状态
4176
+ * 消息搜索关键字
4280
4177
  */
4281
- setMessageSentStatus(messageId: number, sentStatus: number): Promise<ErrorCode>;
4178
+ searchContent?: string;
4282
4179
  /**
4283
- * 设置消息接收状态
4180
+ * 来源
4284
4181
  */
4285
- setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
4182
+ source?: string;
4183
+ isMentioned?: boolean;
4184
+ }
4185
+ interface ISendExMsgOptions {
4186
+ channelId: string;
4187
+ conversationType: ConversationType;
4188
+ targetId: string;
4286
4189
  /**
4287
- * 将自己发送的指定时间之前的消息标记对方已读,状态值为 SentStatus.READ
4288
- */
4289
- updateMessageReceiptStatus(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): IPromiseResult<boolean>;
4190
+ * 消息 ID
4191
+ */
4192
+ messageUId: string;
4290
4193
  /**
4291
- * 删除时间戳前的未读数
4292
- */
4293
- clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId: string): Promise<ErrorCode>;
4194
+ * 原始消息是否支持扩展的字段
4195
+ */
4196
+ canIncludeExpansion: boolean;
4294
4197
  /**
4295
- * 获取会话免打扰状态
4296
- */
4297
- getConversationNotificationStatus(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<NotificationStatus>;
4198
+ * 删除的 keys
4199
+ */
4200
+ keys?: string[];
4298
4201
  /**
4299
- * 协议栈获取远端历史消息
4300
- */
4301
- getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, timestamp: number, count: number, order: 0 | 1, channelId: string): IPromiseResult<{
4302
- list: IReceivedMessage[];
4303
- hasMore: boolean;
4304
- }>;
4202
+ * 扩展对象
4203
+ */
4204
+ expansion?: {
4205
+ [key: string]: string;
4206
+ };
4305
4207
  /**
4306
- * 无差别获取本地免打扰列表
4307
- */
4308
- getBlockConversationList(): Promise<IAsyncRes<IBaseConversationInfo[]>>;
4208
+ * 是否删除所有扩展
4209
+ */
4210
+ removeAll?: boolean;
4309
4211
  /**
4310
- * 无差别获取本地置顶列表
4311
- */
4312
- getTopConversationList(conversationTypes?: ConversationType[], channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
4212
+ * 原始消息的扩展
4213
+ */
4214
+ originExpansion?: {
4215
+ [key: string]: string;
4216
+ } | null;
4217
+ }
4218
+ interface IUltraExMsgOptions {
4219
+ canIncludeExpansion: boolean;
4220
+ channelId: string;
4221
+ conversationType: ConversationType;
4222
+ targetId: string;
4223
+ messageUId: string;
4224
+ sendTime: number;
4313
4225
  /**
4314
- * 获取单个群聊会话 @ 消息未读数
4315
- */
4316
- getUnreadMentionedCount(conversation: IConversationOption): Promise<IAsyncRes<number>>;
4226
+ * 删除的 keys
4227
+ */
4228
+ keys?: string[];
4317
4229
  /**
4318
- * 获取所有群聊会话 @ 消息未读数
4319
- */
4320
- getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
4321
- clearData(): Promise<IAsyncRes<boolean>>;
4230
+ * 扩展对象
4231
+ */
4232
+ expansion?: {
4233
+ [key: string]: string;
4234
+ };
4322
4235
  /**
4323
- * 获取运行时的系统信息,仅限 Electron 平台可用
4324
- */
4325
- getOSInfo(): IPromiseResult<IOSInfo>;
4236
+ * 是否删除所有扩展
4237
+ */
4238
+ removeAll?: boolean;
4239
+ }
4240
+ interface IUltraModifyMsgOptions {
4241
+ canIncludeExpansion?: boolean;
4242
+ channelId: string;
4243
+ conversationType: ConversationType;
4244
+ targetId: string;
4245
+ messageUId: string;
4246
+ sendTime: number;
4326
4247
  /**
4327
- * 获取应用主进程信息,仅限 Electron 平台可用
4248
+ * 消息内容
4328
4249
  */
4329
- getMainProcessInfo(): IPromiseResult<IProcessInfo>;
4250
+ content: {
4251
+ /**
4252
+ * 消息内容 key-value,最终会进行 JSON 序列化后发送
4253
+ */
4254
+ [key: string]: any;
4255
+ /**
4256
+ * 消息可携带的用户数据
4257
+ */
4258
+ user?: IUserProfile;
4259
+ /**
4260
+ * 其他拓展信息
4261
+ */
4262
+ extra?: string;
4263
+ };
4264
+ }
4265
+ interface IUltraMsgQueryInfo {
4266
+ sendTime: number;
4267
+ messageUId: string;
4268
+ channelId?: string;
4269
+ }
4270
+ interface IUltraMsgQueryOptions {
4271
+ conversationType: ConversationType;
4272
+ targetId: string;
4273
+ messages: IUltraMsgQueryInfo[];
4274
+ }
4275
+ /**
4276
+ * 被拦截的消息信息
4277
+ * @category Interface
4278
+ */
4279
+ interface IBlockedMessageInfo {
4280
+ blockedMessageUId: string;
4281
+ conversationType: number;
4282
+ targetId: string;
4283
+ channelId: string;
4284
+ blockType: MessageBlockType;
4285
+ extra: any;
4286
+ sourceType?: MessageBlockSourceType;
4287
+ sourceContent?: {
4288
+ [key: string]: any;
4289
+ };
4290
+ }
4291
+ /**
4292
+ * 超级群获取指定会话未读 @ 消息列表参数
4293
+ */
4294
+ interface IUltraGroupUnreadMentionedOption {
4330
4295
  /**
4331
- * 设置代理
4332
- */
4333
- setProxy(proxy: IProxy | null): IPromiseResult<IProxy>;
4296
+ * 会话 ID
4297
+ */
4298
+ targetId: string;
4334
4299
  /**
4335
- * 获取代理
4336
- */
4337
- getProxy(): IPromiseResult<IProxy>;
4300
+ * 频道 ID
4301
+ */
4302
+ channelId?: string;
4338
4303
  /**
4339
- * 测试代理
4340
- */
4341
- testProxy(proxy: IProxy, testHost: string): Promise<IResponse>;
4342
- rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<any>>;
4343
- rtcSignaling(roomId: string, method: string, isQuery: boolean, sourceData: any): Promise<{
4344
- code: ErrorCode;
4345
- buffer?: any;
4346
- }>;
4304
+ * 消息的时间戳,首次获取传 0, 后续查询传未读 @ 列表中的消息时间戳
4305
+ */
4306
+ sentTime: number;
4307
+ /**
4308
+ * 数据个数,最大50
4309
+ */
4310
+ count: number;
4311
+ }
4312
+ /**
4313
+ * 超级群获取指定会话 @ 未读消息列表结果
4314
+ */
4315
+ interface IUltraUnreadMsg {
4316
+ /**
4317
+ * 消息 ID
4318
+ */
4319
+ messageUId?: string;
4320
+ /**
4321
+ * 消息时间戳
4322
+ */
4323
+ sentTime: number;
4324
+ /**
4325
+ * @ 类型: 1 所有人;2: 部分人
4326
+ */
4327
+ mentionedType?: number;
4328
+ }
4329
+
4330
+ interface IRTCRoomInfo {
4331
+ roomId: string;
4332
+ roomData: unknown[];
4333
+ userCount: number;
4334
+ list: unknown[];
4335
+ }
4336
+ interface IRtcTokenData {
4337
+ rtcToken: string;
4338
+ }
4339
+ interface IRTCUsers {
4340
+ users: {
4341
+ [userId: string]: {
4342
+ /**
4343
+ * 发布的资源数据,是一个 JSON 字符串,解析后为发布的资源列表
4344
+ */
4345
+ uris?: string;
4346
+ /**
4347
+ * 加房间的身份标识,保存主房间 roomId
4348
+ */
4349
+ extra?: string;
4350
+ };
4351
+ };
4352
+ }
4353
+ interface IJoinRTCRoomData extends IRTCUsers {
4354
+ token: string;
4355
+ sessionId: string;
4356
+ roomInfo: {
4357
+ key: string;
4358
+ value: string;
4359
+ }[];
4360
+ kvEntries: IServerRTCRoomEntry[];
4361
+ offlineKickTime: number;
4362
+ }
4363
+ interface KVString {
4364
+ [key: string]: string;
4365
+ }
4366
+ /**
4367
+ * 设置 RTC 人员 inner、outer 数据
4368
+ */
4369
+ interface IRTCUserData {
4370
+ [key: string]: string;
4347
4371
  }
4348
4372
 
4349
4373
  interface IExpansionMsgContent {
@@ -5203,6 +5227,7 @@ declare class APIContext {
5203
5227
  * rtc 数据变更通知 pluginContext
5204
5228
  */
5205
5229
  private _rtcDataChange;
5230
+ private _meetingEvent;
5206
5231
  /**
5207
5232
  * 导航数据变更通知
5208
5233
  */
@@ -5273,6 +5298,10 @@ declare class APIContext {
5273
5298
  * @param listener
5274
5299
  */
5275
5300
  registerRTCSignalingListener(listener?: (buffer: Uint8Array) => void): void;
5301
+ /**
5302
+ * 监听 RTC Meeting 下行信令通知
5303
+ */
5304
+ registerMeetingEventListener(listener?: (eventType: MeetingEventType, buffer: Uint8Array) => void): void;
5276
5305
  checkSearchPropsMsg(messageType: string, msgContent: any): IAsyncRes;
5277
5306
  /**
5278
5307
  * 发送消息
@@ -5303,6 +5332,20 @@ declare class APIContext {
5303
5332
  * @param messageUIds
5304
5333
  */
5305
5334
  getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
5335
+ /**
5336
+ * 设置群语音消息已听状态
5337
+ * @param targetId
5338
+ * @param channelId
5339
+ * @param messageUId
5340
+ */
5341
+ setGroupVoiceMessagePlayed(targetId: string, channelId: string, messageUId: string): Promise<IAsyncRes>;
5342
+ /**
5343
+ * 获取群语音消息已听列表
5344
+ * @param targetId
5345
+ * @param channelId
5346
+ * @param messageUId
5347
+ */
5348
+ getGroupVoiceMessageReader(targetId: string, channelId: string, messageUId: string): IPromiseResult<IMessageReaderResponse>;
5306
5349
  setReadMessages(targetId: string, channelId: string, beginMessageUId: string, endMessageUId: string): Promise<IAsyncRes>;
5307
5350
  /**
5308
5351
  * 获取群组消息已读回执
@@ -6177,6 +6220,10 @@ declare class RTCPluginContext extends PluginContext {
6177
6220
  * @param listener
6178
6221
  */
6179
6222
  registerRTCSignalListener(listener?: (buffer: Uint8Array) => void): void;
6223
+ /**
6224
+ * 监听 RTC Meeting 下行信令通知
6225
+ */
6226
+ registerMeetingEventListener(listener?: (eventType: MeetingEventType, buffer: Uint8Array) => void): void;
6180
6227
  /**
6181
6228
  * RTC 调用 signal 服务的通用接口
6182
6229
  * @param roomId 房间 ID
@@ -6227,6 +6274,7 @@ interface IEngineWatcher extends IConnectionListener {
6227
6274
  * RTC 数据变更
6228
6275
  */
6229
6276
  onRTCDataChange: (data: IServerRTCRoomEntry[], roomId?: string) => void;
6277
+ onMeetingEvent: (eventType: number, buffer?: Uint8Array) => void;
6230
6278
  pullFinished: () => void;
6231
6279
  messageDelivered: (data: IMessageDeliver[]) => void;
6232
6280
  groupMessageDeliveredStatus: (data: IGroupMessageDeliverStatus) => void;
@@ -6255,11 +6303,16 @@ declare abstract class AEngine {
6255
6303
  */
6256
6304
  constructor(runtime: IRuntime, rtcCodec: Codec<RTCKeyMaps>, _watcher: IEngineWatcher, _options: IAPIContextOption, logger: BasicLogger);
6257
6305
  protected _rtcSignalingListener?: (buffer: Uint8Array) => void;
6306
+ protected _meetingEventListener?: (eventType: MeetingEventType, buffer: Uint8Array) => void;
6258
6307
  /**
6259
6308
  * 注册 RTC KV 变更监听器
6260
6309
  * @param listener
6261
6310
  */
6262
6311
  registerRTCSignalingListener(listener: ((buffer: Uint8Array) => void) | undefined): void;
6312
+ /**
6313
+ * 注册Meeting事件监听器
6314
+ */
6315
+ registerMeetingEventListener(listener: ((eventType: MeetingEventType, buffer: Uint8Array) => void) | undefined): void;
6263
6316
  /**
6264
6317
  * 忽视缓存,重新请求导航数据
6265
6318
  */
@@ -6493,6 +6546,20 @@ declare abstract class AEngine {
6493
6546
  * @param messageUIds
6494
6547
  */
6495
6548
  abstract getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
6549
+ /**
6550
+ * 设置群语音消息已听状态
6551
+ * @param targetId
6552
+ * @param channelId
6553
+ * @param messageUId
6554
+ */
6555
+ abstract setGroupVoiceMessagePlayed(targetId: string, channelId: string, messageUId: string): Promise<IAsyncRes>;
6556
+ /**
6557
+ * 获取群语音消息已听列表
6558
+ * @param targetId
6559
+ * @param channelId
6560
+ * @param messageUId
6561
+ */
6562
+ abstract getGroupVoiceMessageReader(targetId: string, channelId: string, messageUId: string): IPromiseResult<IMessageReaderResponse>;
6496
6563
  /**
6497
6564
  * 发送群组消息已读回执
6498
6565
  */
@@ -7006,6 +7073,7 @@ declare abstract class AEngine {
7006
7073
  * 接收 rtc 资源变更
7007
7074
  */
7008
7075
  protected _receiveRtcKv(buffer: Uint8Array): void;
7076
+ protected _receiveMeetingEvent(eventType: MeetingEventType, buffer: Uint8Array): void;
7009
7077
  /**
7010
7078
  * Engine 反初始化
7011
7079
  */
@@ -7579,4 +7647,4 @@ declare type AbsCodec<T> = Codec<T>;
7579
7647
  */
7580
7648
  declare const version: string;
7581
7649
 
7582
- export { AConnectionMgr, AEngine, APIContext, AbsCodec, AppStorage, AssertRules, BAIDU_STORAGE_SERVER_URI, BasicLogger, BasicNavi, BasicReporter, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType, Codec, CodecPBMaps, ConnectionStatus, ConversationType, DB_LOG_FLUSH_FREQUENCY, DB_LOG_MAX_SIZE, DEFAULT_LOG_POLICY, DelayTimer, EnableLogL, ErrorCode, EventEmitter, FORMATED_VERSION, FileType, HTTP_TIMEOUT, HttpMethod, IAPIContextOption, IAndroidPushConfig, IAsyncRes, IBaseConversationInfo, IBlockedMessageInfo, ICancelRoomPKOptions, IChannelAndUserGroupChangeData, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomEntryListenerData, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChatroomRejoinedFailed, IChatroomRejoinedInfo, IChatroomRejoinedSuccessed, IChatroomUser, IChatroomUserChangeInfo, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionListener, IConnectionStatusListener, IConversationIdentifier, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDeletedExpansion, IDeliveredUser, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGetMsgOption, IGetUltraGroupListOption, IGooglePushConfig, IGroupMessageDeliverInfo, IGroupMessageDeliverStatus, IGroupMessageDeliveredStatusInfo, IInsertMessage, IInsertMsgOptions, IIsValidExpansion, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, ILogDB, ILogData, ILogger, IM_CHATROOM_PULL_INTERVAL_TIME, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageDeliver, IMessageDeliveredListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviCache, INaviInfo, IOSInfo, IOperateInfo, IOperateStatusNotify, IOperateSummary, IPluginGenerator, IProcessCache, IProcessInfo, IPromiseResult, IProxy, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomBindOption, IRTCRoomInfo, IRTCUserData, IRTCUsers, IReadReceiptInfo, IRecallMsgContent, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatroomEntries, IRemoveChatroomEntry, IReqRoomPKOptions, IRequest, IResRoomPKOptions, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUltraChannelChangeInfo, IUltraChannelDeleteInfo, IUltraChannelUserKickedInfo, IUltraExMsgOptions, IUltraGroupConversation, IUltraGroupOption, IUltraGroupUnreadMentionedOption, IUltraModifyMsgOptions, IUltraMsgQueryOptions, IUltraUnreadConversation, IUltraUnreadMsg, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserGroupChangeData, IUserGroupStatusInfo, IUserProfile, IWatcher, IWebSocket, IiOSPushConfig, IndexDBLogger, IndexDBReporter, RTCKeyMaps as InnerRTCKeyMaps, ItypingStateListener, KVString, LiveRole, LiveType, LogContent, LogL, LogLevel, LogSource, LogTagId, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MAX_MESSAGE_EXPANSION_KEY_LENGTH, MAX_MESSAGE_EXPANSION_VAL_LENGTH, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockSourceType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NetworkType, NotificationLevel, NotificationStatus, ONE_LOG_SIZE_MAX, OperateStatus, PUBLIC_CLOUD_NAVI_URIS, PluginContext, QINIU_STORAGE_SERVER_URI, RCAssertError, RCConnectionStatus, REAT_TIME_LOG_SIZE, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, SentStatus, StoreKeys, TagChangeType, UltraGroupChannelChangeType, UltraGroupChannelType, UltraMsgChangeType, UltraMsgSubChangeType, UploadMethod, UserGroupChangeType, VERSION, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketNavi, appendUrl, assert, clone, cloneByJSON, deInitLogDB, logger as engineLogger, forEach, getBrowser, getClientMessageId, getMimeKey, getUUID, getUUID22, getUploadFileName, indexOf, initLogDB, isArray, isArrayBuffer, isBoolean, isConnnectAckCode as isConnnectAck, isDisconnectCode as isDisconnectedByServer, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isTypeInConversationList, isUndefined, isValidChannelId, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, isValidNotificationLevel, base as logger, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, transcsv, usingCppEngine, validate, version };
7650
+ export { AConnectionMgr, AEngine, APIContext, AbsCodec, AppStorage, AssertRules, BAIDU_STORAGE_SERVER_URI, BasicLogger, BasicNavi, BasicReporter, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType, Codec, CodecPBMaps, ConnectionStatus, ConversationType, DB_LOG_FLUSH_FREQUENCY, DB_LOG_MAX_SIZE, DEFAULT_LOG_POLICY, DelayTimer, EnableLogL, ErrorCode, EventEmitter, FORMATED_VERSION, FileType, HTTP_TIMEOUT, HttpMethod, IAPIContextOption, IAndroidPushConfig, IAsyncRes, IBaseConversationInfo, IBlockedMessageInfo, ICancelRoomPKOptions, IChannelAndUserGroupChangeData, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomEntryListenerData, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChatroomRejoinedFailed, IChatroomRejoinedInfo, IChatroomRejoinedSuccessed, IChatroomUser, IChatroomUserChangeInfo, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionListener, IConnectionStatusListener, IConversationIdentifier, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDeletedExpansion, IDeliveredUser, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGetMsgOption, IGetUltraGroupListOption, IGooglePushConfig, IGroupMessageDeliverInfo, IGroupMessageDeliverStatus, IGroupMessageDeliveredStatusInfo, IInsertMessage, IInsertMsgOptions, IIsValidExpansion, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, ILogDB, ILogData, ILogger, IM_CHATROOM_PULL_INTERVAL_TIME, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageDeliver, IMessageDeliveredListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviCache, INaviInfo, IOSInfo, IOperateInfo, IOperateStatusNotify, IOperateSummary, IPluginGenerator, IProcessCache, IProcessInfo, IPromiseResult, IProxy, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomBindOption, IRTCRoomInfo, IRTCUserData, IRTCUsers, IReadReceiptInfo, IRecallMsgContent, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatroomEntries, IRemoveChatroomEntry, IReqRoomPKOptions, IRequest, IResRoomPKOptions, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUltraChannelChangeInfo, IUltraChannelDeleteInfo, IUltraChannelUserKickedInfo, IUltraExMsgOptions, IUltraGroupConversation, IUltraGroupOption, IUltraGroupUnreadMentionedOption, IUltraModifyMsgOptions, IUltraMsgQueryOptions, IUltraUnreadConversation, IUltraUnreadMsg, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserGroupChangeData, IUserGroupStatusInfo, IUserProfile, IWatcher, IWebSocket, IiOSPushConfig, IndexDBLogger, IndexDBReporter, RTCKeyMaps as InnerRTCKeyMaps, ItypingStateListener, KVString, LiveRole, LiveType, LogContent, LogL, LogLevel, LogSource, LogTagId, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MAX_MESSAGE_EXPANSION_KEY_LENGTH, MAX_MESSAGE_EXPANSION_VAL_LENGTH, MINI_SOCKET_CONNECT_URIS, MeetingEventType, MentionedType, MessageBlockSourceType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NetworkType, NotificationLevel, NotificationStatus, ONE_LOG_SIZE_MAX, OperateStatus, PUBLIC_CLOUD_NAVI_URIS, PluginContext, QINIU_STORAGE_SERVER_URI, RCAssertError, RCConnectionStatus, REAT_TIME_LOG_SIZE, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, SentStatus, StoreKeys, TagChangeType, UltraGroupChannelChangeType, UltraGroupChannelType, UltraMsgChangeType, UltraMsgSubChangeType, UploadMethod, UserGroupChangeType, VERSION, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketNavi, appendUrl, assert, clone, cloneByJSON, deInitLogDB, logger as engineLogger, forEach, getBrowser, getClientMessageId, getMimeKey, getUUID, getUUID22, getUploadFileName, indexOf, initLogDB, isArray, isArrayBuffer, isBoolean, isConnnectAckCode as isConnnectAck, isDisconnectCode as isDisconnectedByServer, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isTypeInConversationList, isUndefined, isValidChannelId, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, isValidNotificationLevel, base as logger, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, transcsv, usingCppEngine, validate, version };