Save Post
The savePost()
function allows users to save posts for layer. You can integrate it in your Flutter app to enhance user experience by allowing them to bookmark and revisit their favorite posts at their convenience. Enable seamless content curation, empowering users to organize and access valuable information with ease.
Steps to Save a Post
- Create an instance of
SavePostRequest
with the required parameter:postId
for the post to be saved. - Call the
savePost()
function using the instance of theLMFeedClient
class, passing the request as a parameter. - Use the response as per your requirement.
// Create an instance of SavePostRequest
SavePostRequest request = (SavePostRequestBuilder()
..postId("post_id"))
.build();
// Get the response from calling the function
final SavePostResponse savePostResponse = await lmFeedClient.savePost(savePostRequest);
// Process the response, as per requirement
if (savePostResponse.success) {
// your function to handle successful post saving
handleSavePostSuccess();
} else {
// your function to handle error message
handleSavePostError(savePostResponse.errorMessage);
}
Models
SavePostRequest
List of parameters for the SavePostRequest
class
Variable | Type | Description | Optional |
---|---|---|---|
postId | String | ID of the post to be saved |
SavePostResponse
List of parameters for the SavePostResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
success | bool | API success status | |
errorMessage | String | Error message in case of failure | ✔ |