searchMessages method

Future<int> searchMessages(
  1. RCIMIWConversationType type,
  2. String targetId,
  3. String? channelId,
  4. String keyword,
  5. int startTime,
  6. int count, {
  7. IRCIMIWSearchMessagesCallback? callback,
})

ZH

根据关键字搜索指定会话中的消息。

  • type 会话类型
  • targetId 会话 ID
  • channelId 频道 ID,仅支持超级群使用,其他会话类型传 null 即可。
  • keyword 搜索的关键字
  • startTime 查询 beginTime 之前的消息, 传 0 时从最新消息开始搜索,从该时间往前搜索。
  • count 查询的数量,0 < count ≤ 50。
  • callback 事件回调。SDK 从 5.3.1 版本开始支持 callback 方式回调。从 5.4.0 版本废弃该接口的其他回调方式,预计将在 6.x 版本删除此其他回调方式。如果传入了 callback 参数,仅触发 callback 回调。
  • 返回值 当次接口操作的状态码。0 代表调用成功 具体结果需要实现接口回调,非 0 代表当前接口调用操作失败,不会触发接口回调,详细错误参考错误码
  • 接口回调 onMessagesSearched

EN

Search for messages in a specified conversation based on keywords.

  • type Conversation type
  • targetId Conversation ID
  • channelId Channel ID, only supported for ultra groups. For other conversation types, pass null.
  • keyword Keyword to search for
  • startTime Search for messages before this timestamp. Pass 0 to start searching from the latest message and move backward in time.
  • count Number of messages to query, where 0 < count ≤ 50.
  • callback Event callback. The SDK has supported callback-based responses since version 5.3.1. Other callback methods for this interface were deprecated in version 5.4.0 and are expected to be removed in version 6.x. If the callback parameter is provided, only the callback will be triggered. call, and specific results need to be handled in the interface callback. Non-zero values indicate that the current operation failed, and no interface callback will be triggered. Refer to the error codes for detailed error information.

此接口不支持 Flutter For Web 端

Implementation

Future<int> searchMessages(
  RCIMIWConversationType type,
  String targetId,
  String? channelId,
  String keyword,
  int startTime,
  int count, {
  IRCIMIWSearchMessagesCallback? callback,
}) async {
  return RCIMWrapperPlatform.instance.searchMessages(
    type,
    targetId,
    channelId,
    keyword,
    startTime,
    count,
    callback: callback,
  );
}