Feed & Timeline
Let your users showcase their unique personality right in their timelines
Feed is a new way for users to create content on various areas of the SDK. Currently, users and groups can have feeds. Each feed consists of a collection of posts. Users are able to create posts on any groups that they are a member of and any user that they can find.
There are 3 types of feeds:
User Feed This is a collection of posts for a user's timeline.
Group Feed This is a collection of posts from members of the group or community.
Global Feed This is an aggregate of both User and Group feeds.
Feed management methods are all contained in a PostRepository
class.
Query User Feed
You can get any user's feed by calling the method below with the userId
:
When querying posts, the tags parameter is always optional regardless of which feed you are querying. Up to five tags can be added and each tag can be up to 24 characters long. If you don't want to filter by tags when querying, just omit the tags parameter. Do not pass an empty array.
There is a quick easy method to get your own feed:
Query Group Feed
You can get any group's feed by calling the method below with the communityId
:
Query Global Feed
You can retrieve your global feed by calling the queryAllPosts
method. This method accepts the following parameters:
Parameter | Data type | Description |
---|---|---|
| boolean |
|
| boolean |
|
| string | sort by ' |
| boolean |
|
All these parameters are optional. Below is the sample code to query the global feed.
The method will return a LiveCollection instance of post model.
The queryAllPosts method
will throw an error if parameters passed are incorrect.
Implementing feed pagination
Whether you're querying a user, group, or global feed, Live Collection will return a maximum of 20 posts in each page. You can easily fetch more posts by using the nextPage()
method from the same live collection.
The dataUpdated
event will be dispatched when the first set of data from the server is loaded. Calling nextPage
will load the next set of data. Once all data are loaded, the dataUpdated
event will once again be dispatched.
Last updated