Skip to main content

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

  1. Build a GetSavedPostRequest object using the GetSavedPostRequestBuilder class.

  2. Call the getSavedPost() function using the instance of the LMFeedClient class.

  3. 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

VariableTypeDescriptionOptional
uuidStringUnique identifier of the user
pageintPage number for pagination
pageSizeintNumber of items per page

GetSavedPostResponse

List of parameters for the GetSavedPostResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in case of failure
postsList<Post>List of post models
repostedPostsMap<String, Post>Map of reposted post models (key: post ID)
topicsMap<String, Topic>Map of topic models (key: topic ID)
widgetsMap<String, WidgetModel>Map of widget models (key: widget ID)
usersMap<String, User>Map of user models (key: user ID)
filteredCommentsMap<String, Comment>Map of filtered comments
userTopicsMap<String, List<String>>Map of user topics (key: user ID)
totalCountintTotal count of saved posts