Skip to main content

Fetch Post

Retrieves a specific post from the server, allowing users to view its content, comments, likes, and other associated information.

Steps to fetch a post

  1. Use the getPost() function provided by the lmFeedClient object created earlier.
  2. Create an instance of GetPostRequest, as shown in the snippet and pass it to the above method.
  3. Use the response as per your requirement
try {
const getPostRequest = GetPostRequest.builder()
.setPostId("<ENTER_POST_ID>")
.setPage(1)
.setPageSize(10)
.build();
const response = await lmFeedClient.getPost(getPostRequest);
// Use the response as per your requirement.
} catch (error) {
// Use the error as per your requirement.
}

Models

GetPostRequest

VariableTypeDescriptionOptional
postIdstringUnique id of the post fetched.
pageintpage number✔️
pageSizeintnumber of items per page✔️

GetPostResponse

VariableTypeDescriptionOptional
postPostObject of the created post.✔️
usersMap<string,User>Map of user unique id to user object.
topicsMap<string,Topic>Map of topic id to topic object.✔️
widgetIWidgetWidget data for the post.