Skip to main content

Like Post

The likePost() function enables users to express their appreciation for posts by other members. With just a simple tap, users can indicate their interest and support for specific content on their feed.

Steps to Like a Post​

  1. Create an instance of LikePostRequest with the required parameter: postId for the post to be liked.
  2. Call the likePost() 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 LikePostRequest
ikePostRequest request = (LikePostRequestBuilder()
..postId("post_id"))
.build();

// Get the response from calling the function
final LikePostResponse likePostResponse = await lmFeedClient.likePost(likePostRequest);

// Process the response, as per requirement
if (likePostResponse.success) {
// your function to handle successful post liking
handleLikePostSuccess(likePostResponse.likes);
} else {
// your function to handle error message
handleLikePostError(likePostResponse.errorMessage);
}

Models​

LikePostRequest​

List of parameters for the LikePostRequest class

VariableTypeDescriptionOptional
postIdStringID of the post to be liked

LikePostResponse​

List of parameters for the LikePostResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in case of failure✔