A Twitch Helix API client written in Go (Golang).
This project is a work in progress. Twitch has not finished all available endpoints/features for the Helix API, but as these get released they are likely to be implemented in this package.
All documentation and usage examples for this package can be found in the docs directory. If you are looking for the Twitch API docs, see the Twitch Developer website.
Authentication:
- Generate Authorization URL ("code" or "token" authorization)
- Get App Access Tokens (OAuth Client Credentials Flow)
- Get User Access Tokens (OAuth Authorization Code Flow)
- Refresh User Access Tokens
- Revoke User Access Tokens
- Validate Access Token
API Endpoint:
- Start Commercial
- Get Extension Analytics
- Get Game Analytics
- Get Bits Leaderboard
- Get Cheermotes
- Get Extension Transactions
- Get Channel Information
- Modify Channel Information
- Get Channel Editors
- Create Custom Rewards
- Delete Custom Reward
- Get Custom Reward
- Get Custom Reward Redemption
- Update Custom Reward
- Update Redemption Status
- Create Clip
- Get Clip
- Get Clips
- Create Entitlement Grants Upload URL
- Get Code Status
- Get Drops Entitlements
- Redeem Code
- Create / Remove / List EventSub Subscriptions
- Get Top Games
- Get Games
- Get Hype Train Events
- Check AutoMod Status
- Get Banned Events
- Get Banned Users
- Get Moderators
- Get Moderator Events
- Search Categories
- Search Channels
- Get Stream Key
- Get Streams
- Get Followed Streams
- Create Stream Marker
- Get Stream Markers
- Get Broadcaster Subscriptions
- Check User Subscription
- Get All Stream Tags
- Get Stream Tags
- Replace Stream Tags
- Get Channel Teams
- Get Teams
- Get Users
- Update User
- Get Users Follows
- Create User Follows
- Delete User Follows
- Get User Block List
- Block User
- UnBlock User
- Get User Extensions
- Get User Active Extensions
- Update User Extensions
- Get Videos
- Delete Videos
- Get Webhook Subscriptions
- Create Extension Secret
- Get Extension Secret
- Revoke Extension Secrets
- Get Live Channels with Extension Activated
- Set Extension Required Configuration
- Set Extension Configuration Segment
- Get Extension Channel Configuration
- Get Extension Configuration Segment
- Send Extension PubSub Message
- Send Extension Chat Message
This is a quick example of how to get users. Note that you don't need to provide both a list of ids and logins, one or the other will suffice.
client, err := helix.NewClient(&helix.Options{
ClientID: "your-client-id",
})
if err != nil {
// handle error
}
resp, err := client.GetUsers(&helix.UsersParams{
IDs: []string{"26301881", "18074328"},
Logins: []string{"summit1g", "lirik"},
})
if err != nil {
// handle error
}
fmt.Printf("Status code: %d\n", resp.StatusCode)
fmt.Printf("Rate limit: %d\n", resp.GetRateLimit())
fmt.Printf("Rate limit remaining: %d\n", resp.GetRateLimitRemaining())
fmt.Printf("Rate limit reset: %d\n\n", resp.GetRateLimitReset())
for _, user := range resp.Data.Users {
fmt.Printf("ID: %s Name: %s\n", user.ID, user.DisplayName)
}
Output:
Status code: 200
Rate limit: 30
Rate limit remaining: 29
Rate limit reset: 1517695315
ID: 26301881 Name: sodapoppin
ID: 18074328 Name: destiny
ID: 26490481 Name: summit1g
ID: 23161357 Name: lirik
PRs are very much welcome. Where possible, please write tests for any code that is introduced by your PRs.
This package is distributed under the terms of the MIT License.