Universal Feed
The LikeMinds React Feed SDK provides Universal Feed feature for your react application.
Steps to fetch Universal feed
- Use the
getFeed()
function provided by thelmFeedClient
object created earlier. - Create an instance of
GetFeedRequest
, as shown in the snippet and pass it to the above method. - 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
- Use the
getTopics()
function provided by thelmFeedClient
object created earlier. - Create an instance of
GetFeedRequest
, as shown in the snippet and pass it to the above method. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
page | int | Page number for paginated feed data. | |
pageSize | int | Page size for paginated feed data. | |
topicIds | string[] | Array of Topic IDs selected by user | ✔️ |
GetFeedResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
post | Post | Object of the created post. | ✔️ |
users | Record<string, User> | Map of user unique id to user object. | ✔️ |
topics | Record<string, Topic> | Map of topic id to topic object. | ✔️ |
widgets | Record<string, Widget> | Map of widgets. | ✔️ |