Fetch User Created Comment
To retrieve comments created by a specific user, you need to fetch them within the system. This process allows you to get all comments associated with a user in the LikeMinds Feed.
Steps to Fetch User Created Comments
Build a
GetUserCommentsRequestobject using theGetUserCommentsRequestBuilderclass.Call the
getUserComments()function using the instance of theLMFeedClientclass.Use the response as per your requirement.
// Provide user details for fetching comments
String uuid = "user_uuid_here";
int page = 1;
int pageSize = 20;
// Build the request object
GetUserCommentsRequest request = (GetUserCommentsRequestBuilder()
..uuid(uuid)
..page(page)
..pageSize(pageSize))
.build();
// Get the response from calling the function
final GetUserCommentsResponse response = await lmFeedClient.getUserComments(request);
// Process the response, as per requirement
if(response.success){
// your function to process fetched comments
processFetchedComments(response.comments);
}else{
// your function to process error message
processError(response.errorMessage);
}
tip
Fetching user-created comments allows you to display all comments made by a user in the LikeMinds community.
Models
GetUserCommentsRequest
List of parameters for the GetUserCommentsRequest class
| Variable | Type | Description | Optional |
|---|---|---|---|
| uuid | String | UUID of the user | |
| page | int | Page number for pagination | |
| pageSize | int | Number of items per page |
GetUserCommentsResponse
List of parameters for the GetUserCommentsResponse class
| Variable | Type | Description | Optional |
|---|---|---|---|
| success | bool | API success status | |
| errorMessage | String | Error message in case of failure | ✔ |
| comments | List<Comment> | List of comments created by the user | ✔ |
| users | Map<String, User> | Map of user details | ✔ |
| posts | Map<String, Post> | Map of post details | ✔ |
| topics | Map<String, Topic> | Map of topic details | ✔ |
| widgets | Map<String, WidgetModel> | Map of widget details | ✔ |
| userTopics | Map<String, List<String>> | Map of user topics | ✔ |