Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Twitch login query for v3 GQL #65

Closed
brian6932 opened this issue Aug 3, 2022 · 7 comments
Closed

Feature Request: Twitch login query for v3 GQL #65

brian6932 opened this issue Aug 3, 2022 · 7 comments

Comments

@brian6932
Copy link

brian6932 commented Aug 3, 2022

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

@Nerixyz
Copy link
Contributor

Nerixyz commented Aug 5, 2022

I think a REST endpoint should be included as well with similar functionality.

This would mean:

v3 REST

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.

v3 GQL

A query like

userByLogin(login: String!): User

that only takes the username - no user-id.

@AnatoleAM
Copy link
Contributor

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.

@Nerixyz
Copy link
Contributor

Nerixyz commented Aug 5, 2022

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.

@starstormtwitch
Copy link

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.

@brian6932
Copy link
Author

brian6932 commented Oct 20, 2023

@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

@starstormtwitch
Copy link

starstormtwitch commented Oct 24, 2023 via email

@brian6932
Copy link
Author

brian6932 commented Oct 24, 2023

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants