Closed brian6932 closed 6 months ago
I think a REST endpoint should be included as well with similar functionality.
This would mean:
Either have the same endpoint as v2 (/users/{login}
) but restricted to the login only, or an endpoint like /users/query
that takes a object_id
or login
as query parameter.
A query like
userByLogin(login: String!): User
that only takes the username - no user-id.
The REST endpoint for querying by a twitch connection should resemble something like /v3/users/twitch/{twitch-id}
. (same with youtube, or other connection types)
I don't currently see a use for querying by login or username, aside from convenience for testing, there are no valid use cases that I'm aware of for implementations.
I was thinking of Chatterino though I just noticed it uses the twitch-id, so that's not really an issue (=> would need a GQL query + REST endpoint for querying by connection-id).
For the webinterface it would be nice if you could go to a users profile by only knowing their name (when typing the URL) without going through user-search. Though query by connection-id is more important.
I believe I have this issue, the few docs there are specify an endpoint for querying id by username, but it doesnt seem to be working. I need this for a TwitchBot that a user configures with their username, and looks up all 7tv emotes to give the bot access to for their channel.
@starstormtwitch You can't currently by login, but you can by uid
{userByConnection(id:"twitch_id"platform:TWITCH){emote_sets{emotes{data{name}name id}}}}
Replace twitch_id
with the actual Twitch uid
Yeah but if I don't have a way to programmatically look up the UID the point is moot. Thanks though.
On Fri, Oct 20, 2023, 4:25 PM Brian @.***> wrote:
@starstormtwitch https://github.com/starstormtwitch You can't currently by login, but you can by uid
{userByConnection(id:"twitch_id"platform:TWITCH){emote_sets{emotes{id name}}}}
— Reply to this email directly, view it on GitHub https://github.com/SevenTV/API/issues/65#issuecomment-1773414196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVMU6GRH6Z3Q3OZKE5KOPFLYALT5JAVCNFSM55QEZ6F2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXGM2DCNBRHE3A . You are receiving this because you were mentioned.Message ID: @.***>
@starstormtwitch This isn't to say this solves the issue, it would be nice for 7TV v3 to have login based querying, but with that being said.
Getting a UID is very simple once you have a login, if you're doing this from Twitch chat, every privmsg
has a user-id
(the user sending the message's ID) and room-id
(the creator of the channel's ID) tag. If not, you can either send the following GQL queries to https://gql.twitch.tv/gql
(this requires a first party cid)
{user(login:"twitch_login"lookupType:ALL){id}}
or if you need batching (this requires a first party cid)
{users(logins:["twitch_login""twitch_login2"]){id}}
or make a request to Twitch's Helix API (this requires a token with third party token scopes) to the following endpoint https://api.twitch.tv/helix/users?login=twitch_login&login=twitch_login2
https://dev.twitch.tv/docs/api/reference/#get-users
In v2 GQL, you could: Get a user by id, login or current authenticated user (@me). Example: https://old.7tv.app/users/brian6932 returns: https://old.7tv.app/users/60b04a7fad7fb4b50bd3a982
This is currently not possible with v3 https://7tv.app/users/brian6932 should return: https://7tv.app/users/60b04a7fad7fb4b50bd3a982
Problem being, this either generates unnecessary v2 REST requests, or forces people to use v2 GQL to query logins