Fetch Comment Likes
The getCommentLikes()
function enables users to retrieve the list of individuals who have expressed their appreciation for a particular comment. This feature provides valuable insights into the popularity and impact of comments within the community.
Steps to Get Comment Likes
- Create an instance of
GetCommentLikesRequest
with the required parameters:commentId
,postId
,page
, andpageSize
. - Call the
getCommentLikes()
function using the instance of theLMFeedClient
class, passing the request as a parameter. - Use the response as per your requirement.
// Create an instance of GetCommentLikesRequest
GetCommentLikesRequest request = (GetCommentLikesRequestBuilder()
..commentId("comment_id")
..page(1)
..pageSize(10)
..postId("post_id"))
.build();
// Get the response from calling the function
final GetCommentLikesResponse commentLikesResponse = await lmFeedClient.getCommentLikes(commentLikesRequest);
// Process the response, as per requirement
if (commentLikesResponse.success) {
// your function to handle successful retrieval of comment likes
handleCommentLikesSuccess(commentLikesResponse.commentLikes, commentLikesResponse.totalCount);
} else {
// your function to handle error message
handleCommentLikesError(commentLikesResponse.errorMessage);
}
Models
GetCommentLikesRequest
List of parameters for the GetCommentLikesRequest
class
Variable | Type | Description |
---|---|---|
commentId | String | Comment ID to retrieve likes |
postId | String | Post ID associated with the comment |
page | int | Page number for pagination |
pageSize | int | Number of items per page |
GetCommentLikesResponse
List of parameters for the GetCommentLikesResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
success | bool | API success status | |
errorMessage | String | Error message in failure | ✔ |
commentLikes | List<Like > | List of liked comments | |
users | Map<String , User > | Map of user UUIDs to User entities | |
totalCount | int | Total count of likes |