Get Saved Posts
The getSavedPost()
function is used to retrieve the posts saved by a specific user, including posts, users, topics, widgets, and reposted posts associated with the user.
Steps to Get Saved Posts
Build a
GetSavedPostRequest
object using theGetSavedPostRequestBuilder
class.Call the
getSavedPost()
function using the instance of theLMFeedClient
class.Use the response as per your requirement.
// Build the request object
final GetSavedPostRequest request = (GetSavedPostRequestBuilder()
..page(1)
..pageSize(10)
..uuid("user_id_here"))
.build();
// Get the response from calling the function
final GetSavedPostResponse response = await lmFeedClient.getSavedPost(request);
// Process the response, as per requirement
if(response.success){
// your function to handle successful retrieval of saved posts
handleSavedPosts(response);
}else{
// your function to handle error message
handleSavedPostsError(response.errorMessage);
}
tip
Fetching the saved posts allows you to provide users with personalized content, including posts, users, topics, and widgets based on their preferences and interactions.
Models
GetSavedPostRequest
List of parameters for the GetSavedPostRequest
class
Variable | Type | Description | Optional |
---|---|---|---|
uuid | String | Unique identifier of the user | |
page | int | Page number for pagination | |
pageSize | int | Number of items per page |
GetSavedPostResponse
List of parameters for the GetSavedPostResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
success | bool | API success status | |
errorMessage | String | Error message in case of failure | ✔ |
posts | List<Post > | List of post models | ✔ |
repostedPosts | Map<String, Post > | Map of reposted post models (key: post ID) | ✔ |
topics | Map<String, Topic > | Map of topic models (key: topic ID) | ✔ |
widgets | Map<String, WidgetModel > | Map of widget models (key: widget ID) | ✔ |
users | Map<String, User > | Map of user models (key: user ID) | ✔ |
filteredComments | Map<String, Comment > | Map of filtered comments | ✔ |
userTopics | Map<String, List<String>> | Map of user topics (key: user ID) | ✔ |
totalCount | int | Total count of saved posts | ✔ |