mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-07-13 21:38:06 +00:00
Display group posts
This commit is contained in:
lib
@ -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(
|
||||
|
Reference in New Issue
Block a user