1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-07-13 21:38:06 +00:00

Display group posts

This commit is contained in:
2020-04-16 08:24:34 +02:00
parent e777c4c991
commit f0a23bcb47
2 changed files with 35 additions and 2 deletions

@ -84,6 +84,24 @@ class PostsHelper {
}
}
/// Get the list of posts of a group
Future<PostsList> getGroupPosts(int groupID, {int from = 0}) async {
final response = await (APIRequest(uri: "posts/get_group", needLogin: true)
..addInt("groupID", groupID)
..addInt("startFrom", from == 0 ? 0 : from - 1))
.exec();
if (response.code != 200) return null;
try {
// Parse & return the list of posts
return PostsList()..addAll(response.getArray().map((f) => _apiToPost(f)));
} catch (e) {
print(e.toString());
return null;
}
}
/// Get a single post information
Future<Post> getSingle(int postID) async {
final response = await APIRequest(