Skip to main content

Get User Created Posts

The getUserCreatedPosts() function is used to retrieve the posts created by a specific user, including posts, users, topics, widgets, and reposted posts associated with the user.

Steps to Get User Created Posts​

  1. Build a GetUserPostRequest object using the GetUserPostRequestBuilder class.

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

  3. Use the response as per your requirement.

     // Build the request object
    final GetUserPostRequest request = (GetUserPostRequestBuilder()
    ..page(1)
    ..pageSize(10)
    ..uuid("user_id_here"))
    .build();

    // Get the response from calling the function
    final GetUserPostResponse response = await lmFeedClient.getUserCreatedPosts(request);

    // Process the response, as per requirement
    if(response.success){
    // your function to handle successful retrieval of user created posts
    handleUserCreatedPosts(response);
    }else{
    // your function to handle error message
    handleUserCreatedPostsError(response.errorMessage);
    }
tip

Fetching the user-created posts allows you to provide users with personalized content, including posts, users, topics, and widgets based on their preferences and interactions.

Models​

GetUserPostRequest​

List of parameters for the GetUserPostRequest class

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

GetUserPostResponse​

List of parameters for the GetUserPostResponse class

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