Skip to main content

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

  1. Create an instance of GetCommentLikesRequest with the required parameters: commentId, postId, page, and pageSize.
  2. Call the getCommentLikes() function using the instance of the LMFeedClient class, passing the request as a parameter.
  3. 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

VariableTypeDescription
commentIdStringComment ID to retrieve likes
postIdStringPost ID associated with the comment
pageintPage number for pagination
pageSizeintNumber of items per page

GetCommentLikesResponse

List of parameters for the GetCommentLikesResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in failure
commentLikesList<Like>List of liked comments
usersMap<String, User>Map of user UUIDs to User entities
totalCountintTotal count of likes