getMessages method
Future<int>
getMessages(
- RCIMIWConversationType type,
- String targetId,
- String? channelId,
- int sentTime,
- RCIMIWTimeOrder order,
- RCIMIWMessageOperationPolicy policy,
- int count, {
- IRCIMIWGetMessagesCallback? callback,
ZH
加载历史消息
type
会话类型targetId
会话 IDchannelId
频道 ID,仅支持超级群使用,其他会话类型传 null 即可。sentTime
当前消息时间戳order
获取消息的方向。BEFORE:获取 sentTime 之前的消息 (时间递减),AFTER:获取 sentTime 之后的消息 (时间递增)policy
消息的加载策略。LOCAL:只加载本地,REMOTE:只加载远端,LOCAL_REMOTE:本地远端都加载count
获取的消息数量,0 < count ≤ 20callback
事件回调。返回值
当次接口操作的状态码。0 代表调用成功 具体结果需要实现接口回调,非 0 代表当前接口调用操作失败,不会触发接口回调,详细错误参考错误码
EN
Load Historical Messages
type
Conversation typetargetId
Conversation IDchannelId
Channel ID, only supported for ultra groups. For other conversation types, pass null.sentTime
Timestamp of the current messageorder
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 ≤ 20callback
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,
);
}