fetchChatThreadsWithParentId method
~english Get the subareas under a group from the server
Param parentId
Parent ID, generally refers to group ID.
Param cursor
The initial value can be empty or empty string.
Param limit
The number of fetches at one time. Value range 1, 50
.
Return result of ChatCursorResult
, including the cursor for getting data next time and the chat thread object list.
Throws A description of the exception. See ChatError. ~end
~chinese 分页从服务器端获取指定群组的子区列表。
Param parentId
群组 ID。
Param cursor
开始取数据的游标位置。首次获取数据时可以不传,按子区创建时间的倒序获取数据。
Param limit
每页期望返回的子区数。取值范围为 1,50
。
Return 若调用成功,返回子区列表;失败则抛出异常。
Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 ChatError。 ~end
Implementation
Future<ChatCursorResult<ChatThread>> fetchChatThreadsWithParentId({
required String parentId,
String? cursor,
int limit = 20,
}) async {
Map req = {
"parentId": parentId,
"pageSize": limit,
};
req.putIfNotNull("cursor", cursor);
Map result = await _channel.invokeMethod(
ChatMethodKeys.fetchChatThreadsWithParentId, req);
try {
ChatError.hasErrorFromResult(result);
return ChatCursorResult.fromJson(
result[ChatMethodKeys.fetchChatThreadsWithParentId],
dataItemCallback: (map) {
return ChatThread.fromJson(map);
});
} on ChatError catch (e) {
throw e;
}
}