Skip to main content

Like Comment

The likeComment() function provides users with the ability to express their appreciation for a comment by liking it. This feature enhances user engagement and allows them to interact positively with the content shared by others.

Steps to Like Comment

  1. Create an instance of ToggleLikeCommentRequest with the required parameters: postId and commentId.
  2. Call the likeComment() 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 ToggleLikeCommentRequest
ToggleLikeCommentRequest request = (ToggleLikeCommentRequestBuilder()
..postId("post_id")
..commentId("comment_id"))
.build();

// Get the response from calling the function
final ToggleLikeCommentResponse likeCommentResponse = await lmFeedClient.likeComment(likeCommentRequest);

// Process the response, as per requirement
if (likeCommentResponse.success) {
// your function to handle successful liking of comment
handleLikeCommentSuccess();
} else {
// your function to handle error message
handleLikeCommentError(likeCommentResponse.errorMessage);
}

Models

ToggleLikeCommentRequest

List of parameters for the ToggleLikeCommentRequest class

VariableTypeDescription
postIdStringPost ID of the comment
commentIdStringComment ID to be liked

ToggleLikeCommentResponse

List of parameters for the ToggleLikeCommentResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in failure