Skip to main content

Universal Feed

The LikeMinds React Feed SDK provides Universal Feed feature for your react application.

Steps to fetch Universal feed

  1. Use the getFeed() function provided by the lmFeedClient object created earlier.
  2. Create an instance of GetFeedRequest, as shown in the snippet and pass it to the above method.
  3. Use the response as per your requirement
try {
const getFeedRequest = GetFeedRequest.builder()
.setPage(1) // page number for paginated feed data
.setPageSize(10) // page size for paginated feed data
.build();
const response = await lmFeedClient.getFeed(getFeedRequest);
// Use the response as per your requirement.
} catch (error) {
// Use the error as per your requirement.
}

Steps to fetch Universal feed with selected topics

  1. Use the getTopics() function provided by the lmFeedClient object created earlier.
  2. Create an instance of GetFeedRequest, as shown in the snippet and pass it to the above method.
  3. Use the response as per your requirement
try {
const getFeedRequest = GetFeedRequest.builder()
.setPage(1) // page number for paginated feed data
.setPageSize(10) // page size for paginated feed data
.topics(["ENTER_TOPIC_IDs"]) // fetches posts with given topics from feed
.build();
const response = await lmFeedClient.getFeed(getFeedRequest);
// Use the response as per your requirement.
} catch (error) {
// Use the error as per your requirement.
}

Models

GetFeedRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
pageintPage number for paginated feed data.
pageSizeintPage size for paginated feed data.
topicIdsstring[]Array of Topic IDs selected by user✔️

GetFeedResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
postPostObject of the created post.✔️
usersRecord<string, User>Map of user unique id to user object.✔️
topicsRecord<string, Topic>Map of topic id to topic object.✔️
widgetsRecord<string, Widget>Map of widgets.✔️