Decicus/DecAPI

Hosts Count

Closed this issue · 5 comments

Heyo!

I've been using your API and very much appreciate your development on it! So first off, thanks :)

Secondly I have a feature request if at all possible - and that is to add the ability to show the amount of users hosting another, rather than an actual list. I understand that according to your blog write up (which by the way, is awesome) the hosts is an undocumented end point and is technically not supported. However in your example on Line 6 it shows "_total": 22,. Is there a way for your API to query just that information? If not, I see there's also a way to set an offset, so perhaps that can be added to your API? Basically what I'm hearing from streamers who are well established - they may have 20-30 people hosting them and they'd prefer to either have a count, or maybe the 5 most recent (via offset) instead of a full list.

Thanks again for your work on this!

The endpoint you linked isn't used in DecAPI, this one is (if you're thinking about /twitch/hosts).

Regardless, implementing a count/offset shouldn't be too hard. I'll hopefully be able to take a look at it at some point this week.

Ah gotcha, thanks for clarifying! And great, glad to hear that.

So now that I've found some time to look at this, I've thought about the following:

  1. First of all, an offset is a bit pointless (in this specific case). As the list seems to be random on every request (this is on Twitch API's side, unfortunately). Alternatively, I sort it alphabetically and THEN offset, but it wouldn't really help your case.
  2. I'm probably not gonna add an option to just display the "host count" in /twitch/hosts as I think that is outside the "scope" of the endpoint. However, I'm thinking of adding a /twitch/hostscount endpoint that would just return the number of hosts a channel has.
  3. As an alternative to the hostscount endpoint though, I was thinking of doing something with the limit, so if say you specify limit=2 and you have 10 people hosting, it would say something like decicus, mellow and 8 others are now hosting <channel> - which includes the channel names up until a limit and append the remaining count to the returned string.

What do you think of this?

Thanks for taking a look into that. I'm in agreement. And I really like your alternative solution using limit. Having a message similar to the one you gave as an example would be awesome. So yeah, I'm all for!

This is merged into master now (#14).

Let me know if you notice any weird issues and we can re-open this issue.