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
typeConversation typetargetIdConversation IDchannelIdChannel ID, only supported for ultra groups. For other conversation types, pass null.sentTimeTimestamp of the current messageorderDirection to fetch messages. BEFORE: Fetch messages before sentTime (in descending order). AFTER: Fetch messages after sentTime (in ascending order).policyMessage loading strategy. LOCAL: Load only local messages. REMOTE: Load only remote messages. LOCAL_REMOTE: Load both local and remote messages.countNumber of messages to fetch, where 0 < count ≤ 20callbackEvent 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. results need to be implemented via the interface callback. Non-zero indicates the current operation failed, and no interface callback will be triggered. Refer to the error codes for detailed error information. @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,
);
}