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
Build a
GetUserPostRequestobject using theGetUserPostRequestBuilderclass.Call the
getUserCreatedPosts()function using the instance of theLMFeedClientclass.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
| Variable | Type | Description | Optional |
|---|---|---|---|
| page | int | Page number for pagination | |
| pageSize | int | Number of items per page | |
| uuid | String | Unique identifier of the user |
GetUserPostResponse
List of parameters for the GetUserPostResponse 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 | ✔ |
| users | Map<String, User> | Map of user models (key: user ID) | ✔ |
| topics | Map<String, Topic> | Map of topic models (key: topic ID) | ✔ |
| widgets | Map<String, WidgetModel> | Map of widget models (key: widget ID) | ✔ |
| repostedPosts | Map<String, Post> | Map of reposted post models (key: post ID) | ✔ |
| filteredComments | Map<String, Comment> | Map of filtered comments | ✔ |
| userTopics | Map<String, List<String>> | Map of user topics (key: user ID) | ✔ |