getMessages method

Future<int> getMessages(
  1. RCIMIWConversationType type,
  2. String targetId,
  3. String? channelId,
  4. int sentTime,
  5. RCIMIWTimeOrder order,
  6. RCIMIWMessageOperationPolicy policy,
  7. int count, {
  8. IRCIMIWGetMessagesCallback? callback,
})

ZH

加载历史消息

  • type 会话类型
  • targetId 会话 ID
  • channelId 频道 ID,仅支持超级群使用,其他会话类型传 null 即可。
  • sentTime 当前消息时间戳
  • order 获取消息的方向。BEFORE:获取 sentTime 之前的消息 (时间递减),AFTER:获取 sentTime 之后的消息 (时间递增)
  • policy 消息的加载策略。LOCAL:只加载本地,REMOTE:只加载远端,LOCAL_REMOTE:本地远端都加载
  • count 获取的消息数量,0 < count ≤ 20
  • callback 事件回调。
  • 返回值 当次接口操作的状态码。0 代表调用成功 具体结果需要实现接口回调,非 0 代表当前接口调用操作失败,不会触发接口回调,详细错误参考错误码

EN Load Historical Messages

  • type Conversation type
  • targetId Conversation ID
  • channelId Channel ID, only supported for ultra groups. For other conversation types, pass null.
  • sentTime Timestamp of the current message
  • order Direction to fetch messages. BEFORE: Fetch messages before sentTime (in descending order). AFTER: Fetch messages after sentTime (in ascending order).
  • policy Message loading strategy. LOCAL: Load only local messages. REMOTE: Load only remote messages. LOCAL_REMOTE: Load both local and remote messages.
  • count Number of messages to fetch, where 0 < count ≤ 20
  • callback Event callback. SDK supports callback starting from version 5.3.1. Other callback methods for this interface are deprecated as of version 5.4.0 and will be removed in version 6.x. If the callback parameter is provided, only the callback will be triggered. @listener onMessagesLoaded

Implementation

Future<int> getMessages(
  RCIMIWConversationType type,
  String targetId,
  String? channelId,
  int sentTime,
  RCIMIWTimeOrder order,
  RCIMIWMessageOperationPolicy policy,
  int count, {
  IRCIMIWGetMessagesCallback? callback,
}) async {
  return RCIMWrapperPlatform.instance.getMessages(
    type,
    targetId,
    channelId,
    sentTime,
    order,
    policy,
    count,
    callback: callback,
  );
}