15

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?

Yaron Levi
  • 12,535
  • 16
  • 69
  • 118

2 Answers2

3

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

Vladimir Marton
  • 569
  • 4
  • 31
2

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

tobias
  • 934
  • 8
  • 17