I've created a feed reference and fetched the followers like so:
var admin = client.feed('user', 'admin');
const res = await admin.followers();
But the returned result contains paginated data. How can I count the total number of followers?
Will this feature be available or any rough estimation on the roadmap?
Is there any other recommended architecture to get this total count when working with Stream?
Looks like this is not supported yet.
Dwight Gunning wrote on github on 3rd of May, 2018:
Thanks for the interest. This is still on our long-range backlog.
https://github.com/GetStream/stream-django/issues/42
It's now supported with the client.followStats()
function:
// get follower and following stats of the feed
client.feed('user', 'me').followStats()
// get follower and following stats of the feed but also filter with given slugs
// count by how many timelines follow me
// count by how many markets are followed
client.feed.followStats({followerSlugs: ['timeline'], followingSlugs: ['market']})
Which returns something like:
{
results: {
followers: { count: 1529, feed: 'user:me' },
followings: { count: 81, feed: 'user:me' }
},
duration: '1.92ms'
}
Here is the API documentation for it: https://getstream.io/activity-feeds/docs/node/following/?language=javascript#reading-follow-stats
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With