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
- Create an instance of
LikePostRequestwith the required parameter:postIdfor the post to be liked. - Call the
likePost()function using the instance of theLMFeedClientclass, passing the request as a parameter. - 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
| Variable | Type | Description | Optional |
|---|---|---|---|
| postId | String | ID of the post to be liked |
LikePostResponse
List of parameters for the LikePostResponse class
| Variable | Type | Description | Optional |
|---|---|---|---|
| success | bool | API success status | |
| errorMessage | String | Error message in case of failure | ✔ |