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
- Create an instance of
ToggleLikeCommentRequest
with the required parameters:postId
andcommentId
. - Call the
likeComment()
function using the instance of theLMFeedClient
class, passing the request as a parameter. - 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
Variable | Type | Description |
---|---|---|
postId | String | Post ID of the comment |
commentId | String | Comment ID to be liked |
ToggleLikeCommentResponse
List of parameters for the ToggleLikeCommentResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
success | bool | API success status | |
errorMessage | String | Error message in failure | ✔ |