fetchConversationsByOptions method
- required ConversationFetchOptions options,
根据会话过滤选项获取服务端的会话。
Param options
会话过滤选项, 详见 ConversationFetchOptions。
Returns 会话列表。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。
Implementation
Future<ChatCursorResult<ChatConversation>> fetchConversationsByOptions({
required ConversationFetchOptions options,
}) async {
Map req = options.toJson();
Map result = await ChatChannel.invokeMethod(
ChatMethodKeys.fetchConversationsByOptions, req);
try {
ChatError.hasErrorFromResult(result);
return ChatCursorResult<ChatConversation>.fromJson(
result[ChatMethodKeys.fetchConversationsByOptions],
dataItemCallback: (value) {
return ChatConversation.fromJson(value);
});
} on ChatError catch (e) {
throw e;
}
}