2020-03-14 12:13:57 +01:00
# Twitch API
2021-02-21 14:45:42 +01:00
2020-03-14 12:13:57 +01:00
this folder describes what sort of API requests we do, what permissions are required for the requests etc
## Kraken (V5)
2021-02-21 14:45:42 +01:00
2021-05-14 13:14:43 +02:00
We use few Kraken endpoints in Chatterino2.
2020-03-14 12:13:57 +01:00
### Get User Emotes
2021-02-21 14:45:42 +01:00
2020-03-14 12:13:57 +01:00
URL: https://dev.twitch.tv/docs/v5/reference/users#get-user-emotes
Requires `user_subscriptions` scope
Migration path: **Unknown**
2021-02-21 14:45:42 +01:00
- We use this in `providers/twitch/TwitchAccount.cpp loadEmotes` to figure out which emotes a user is allowed to use!
2020-03-14 12:13:57 +01:00
## Helix
2021-02-21 14:45:42 +01:00
2020-03-14 12:13:57 +01:00
Full Helix API reference: https://dev.twitch.tv/docs/api/reference
### Get Users
2021-02-21 14:45:42 +01:00
2020-03-14 12:13:57 +01:00
URL: https://dev.twitch.tv/docs/api/reference#get-users
2021-02-21 14:45:42 +01:00
- We implement this in `providers/twitch/api/Helix.cpp fetchUsers` .
Used in:
- `UserInfoPopup` to get ID, viewCount, displayName, createdAt of username we clicked
- `CommandController` to power any commands that need to get a user ID
- `Toasts` to get the profile picture of a streamer who just went live
- `TwitchAccount` block and unblock features to translate user name to user ID
2020-03-14 12:13:57 +01:00
### Get Users Follows
2021-02-21 14:45:42 +01:00
2020-03-14 12:13:57 +01:00
URL: https://dev.twitch.tv/docs/api/reference#get-users-follows
2021-02-21 14:45:42 +01:00
- We implement this in `providers/twitch/api/Helix.cpp fetchUsersFollows`
Used in:
- `UserInfoPopup` to get number of followers a user has
2020-03-14 12:13:57 +01:00
### Get Streams
2021-02-21 14:45:42 +01:00
2020-03-14 12:13:57 +01:00
URL: https://dev.twitch.tv/docs/api/reference#get-streams
2021-02-21 14:45:42 +01:00
- We implement this in `providers/twitch/api/Helix.cpp fetchStreams`
Used in:
- `TwitchChannel` to get live status, game, title, and viewer count of a channel
- `NotificationController` to provide notifications for channels you might not have open in Chatterino, but are still interested in getting notifications for
2020-03-14 12:13:57 +01:00
2020-12-22 09:55:58 +01:00
### Follow User
2021-02-21 14:45:42 +01:00
2021-01-17 14:47:34 +01:00
URL: https://dev.twitch.tv/docs/api/reference#create-user-follows
2020-12-22 09:55:58 +01:00
Requires `user:edit:follows` scope
2021-02-21 14:45:42 +01:00
- We implement this in `providers/twitch/api/Helix.cpp followUser`
Used in:
- `widgets/dialogs/UserInfoPopup.cpp` to follow a user by ticking follow checkbox in usercard
- `controllers/commands/CommandController.cpp` in /follow command
2020-12-22 09:55:58 +01:00
### Unfollow User
2021-02-21 14:45:42 +01:00
2021-01-17 14:47:34 +01:00
URL: https://dev.twitch.tv/docs/api/reference#delete-user-follows
2020-12-22 09:55:58 +01:00
Requires `user:edit:follows` scope
2021-02-21 14:45:42 +01:00
- We implement this in `providers/twitch/api/Helix.cpp unfollowUser`
Used in:
- `widgets/dialogs/UserInfoPopup.cpp` to unfollow a user by unticking follow checkbox in usercard
- `controllers/commands/CommandController.cpp` in /unfollow command
2020-12-22 09:55:58 +01:00
2021-01-17 14:47:34 +01:00
### Create Clip
2021-02-21 14:45:42 +01:00
2021-01-17 14:47:34 +01:00
URL: https://dev.twitch.tv/docs/api/reference#create-clip
Requires `clips:edit` scope
2021-02-21 14:45:42 +01:00
- We implement this in `providers/twitch/api/Helix.cpp createClip`
Used in:
- `TwitchChannel` to create a clip of a live broadcast
2021-01-17 14:47:34 +01:00
2021-01-21 13:48:48 +01:00
### Get Channel
2021-02-21 14:45:42 +01:00
2021-01-21 13:48:48 +01:00
URL: https://dev.twitch.tv/docs/api/reference#get-channel-information
2021-05-15 19:02:47 +02:00
- We implement this in `providers/twitch/api/Helix.cpp getChannel`
2021-02-21 14:45:42 +01:00
Used in:
- `TwitchChannel` to refresh stream title
2021-01-21 13:48:48 +01:00
2021-04-04 17:31:08 +02:00
### Update Channel
2021-05-15 19:02:47 +02:00
URL: https://dev.twitch.tv/docs/api/reference#modify-channel-information
2021-04-04 17:31:08 +02:00
Requires `channel:manage:broadcast` scope
2021-05-15 19:02:47 +02:00
- We implement this in `providers/twitch/api/Helix.cpp updateChannel`
2021-04-04 17:31:08 +02:00
Used in:
- `/setgame` to update the game in the current channel
- `/settitle` to update the title in the current channel
2021-01-30 15:39:01 +01:00
### Create Stream Marker
2021-02-21 14:45:42 +01:00
2021-01-30 15:39:01 +01:00
URL: https://dev.twitch.tv/docs/api/reference/#create-stream-marker
Requires `user:edit:broadcast` scope
2021-02-21 14:45:42 +01:00
- We implement this in `providers/twitch/api/Helix.cpp createStreamMarker`
Used in:
- `controllers/commands/CommandController.cpp` in /marker command
2021-01-30 15:39:01 +01:00
2021-02-14 14:01:13 +01:00
### Get User Block List
2021-02-21 14:45:42 +01:00
2021-05-15 19:02:47 +02:00
URL: https://dev.twitch.tv/docs/api/reference#get-user-block-list
2021-02-14 14:01:13 +01:00
Requires `user:read:blocked_users` scope
2021-05-15 19:02:47 +02:00
- We implement this in `providers/twitch/api/Helix.cpp loadBlocks`
2021-02-21 14:45:42 +01:00
Used in:
- `providers/twitch/TwitchAccount.cpp loadBlocks` to load list of blocked (blocked) users by current user
2021-02-14 14:01:13 +01:00
### Block User
2021-02-21 14:45:42 +01:00
2021-05-15 19:02:47 +02:00
URL: https://dev.twitch.tv/docs/api/reference#block-user
2021-02-14 14:01:13 +01:00
Requires `user:manage:blocked_users` scope
2021-05-15 19:02:47 +02:00
- We implement this in `providers/twitch/api/Helix.cpp blockUser`
2021-02-21 14:45:42 +01:00
Used in:
- `widgets/dialogs/UserInfoPopup.cpp` to block a user via checkbox in the usercard
- `controllers/commands/CommandController.cpp` to block a user via "/block" command
2021-02-14 14:01:13 +01:00
### Unblock User
2021-02-21 14:45:42 +01:00
2021-05-15 19:02:47 +02:00
URL: https://dev.twitch.tv/docs/api/reference#unblock-user
2021-02-14 14:01:13 +01:00
Requires `user:manage:blocked_users` scope
2021-05-15 19:02:47 +02:00
- We implement this in `providers/twitch/api/Helix.cpp unblockUser`
2021-02-21 14:45:42 +01:00
Used in:
- `widgets/dialogs/UserInfoPopup.cpp` to unblock a user via checkbox in the usercard
- `controllers/commands/CommandController.cpp` to unblock a user via "/unblock" command
2021-02-14 14:01:13 +01:00
2021-04-11 01:34:27 +02:00
### Search Categories
URL: https://dev.twitch.tv/docs/api/reference#search-categories
2021-05-15 19:02:47 +02:00
- We implement this in `providers/twitch/api/Helix.cpp searchGames`
2021-04-11 01:34:27 +02:00
Used in:
- `controllers/commands/CommandController.cpp` in `/setgame` command to fuzzy search for game titles
2021-05-14 13:14:43 +02:00
### Manage Held AutoMod Messages
2021-05-15 19:02:47 +02:00
URL: https://dev.twitch.tv/docs/api/reference#manage-held-automod-messages
2021-05-14 13:14:43 +02:00
Requires `moderator:manage:automod` scope
2021-05-15 19:02:47 +02:00
- We implement this in `providers/twitch/api/Helix.cpp manageAutoModMessages`
2021-05-14 13:14:43 +02:00
Used in:
- `providers/twitch/TwitchAccount.cpp` to approve/deny held AutoMod messages
2021-05-15 19:02:47 +02:00
### Get Cheermotes
URL: https://dev.twitch.tv/docs/api/reference/#get-cheermotes
- We implement this in `providers/twitch/api/Helix.cpp getCheermotes`
Used in:
- `providers/twitch/TwitchChannel.cpp` to resolve a chats available cheer emotes. This helps us parse incoming messages like `pajaCheer1000`
2020-03-14 12:13:57 +01:00
## TMI
2021-02-21 14:45:42 +01:00
2020-03-14 12:13:57 +01:00
The TMI api is undocumented.
### Get Chatters
2021-02-21 14:45:42 +01:00
2020-03-14 12:13:57 +01:00
**Undocumented**
2021-02-21 14:45:42 +01:00
- We use this in `widgets/splits/Split.cpp showViewerList`
- We use this in `providers/twitch/TwitchChannel.cpp refreshChatters`