mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Display user posts
This commit is contained in:
@ -59,6 +59,28 @@ class PostsHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the list of posts of a user
|
||||
Future<PostsList> getUserPosts(int userID, {int from = 0}) async {
|
||||
final response = await APIRequest(
|
||||
uri: "posts/get_user",
|
||||
needLogin: true,
|
||||
args: {
|
||||
"userID": userID.toString(),
|
||||
"startFrom": from.toString()
|
||||
}
|
||||
).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;
|
||||
}
|
||||
}
|
||||
|
||||
/// Update a post content
|
||||
Future<bool> updateContent(int id, String newContent) async {
|
||||
return (await APIRequest(
|
||||
|
Reference in New Issue
Block a user