Search code examples
getstream-io

what is the point of 'timeline' in array or param for get_news_feed?


I went through all tutorials and docs which stream-django provided.

And there was one thing that I could't understand.

I can't find the differences between these feed_manager methods.

# (1)
feed = feed_manager.get_news_feed('timeline', request.id)
# (2)
feed = feed_manager.get_news_feed(request.id)['timeline']
# (3)
feed = feed_manager.get_news_feed(request.id)

Could you explain the difference? Are they doing exactly same thing? timeline means flat feed, then why do we put timeline in param?

Thank you


Solution

  • timeline is the name of the feed group that you've created within Stream.

    Once you create a feed group in Stream, you'll select the type of feed group ("flat" in this case, but can also be "aggregated" or "notification"), then, you'll name the feed group - common names are timeline/news_feed (a homepage feed showing activity from other users) or profile/user (a profile page feed showing all activities from a single user). There are no "reserved" words in feed group names.

    Re: whether or not these methods are all doing the same thing:

    • feed_manager.get_news_feed('timeline', request.id) (1) is definitely correct. It'll fetch the feed activities for the specific timeline:1234 feed, where 1234 is most likely your user's ID.
    • (2) and (3) I'm not sure about - it's likely that they're doing the same thing as (1), but I'm not able to tell at the first glance at the docs.

    Hopefully that helps!