TwitchAPI
THIS IS NOT UP TO DATE
This project is no longer up to date with the newest endpoints that twitch API offers. Furthermore, now that I feel more confident with Go I am working on a better, cooler and possibly easier to use version of this.
Description
This project is a go wrapper for the New Twitch API.
The package provides a set of functcions to perform calls to the new Twitch API.
Although most functions checks for input correctness, I highly recomend to check the API reference before starting to use twitchapi .
Why twitchapi?
To this day this is the most updated and complete go wrapper for the new Twitch API.
Installation
Using go get:
go get github.com/canobbioe/twitchapi
Functions supported
Authentication
Authentication is not yet implemented within this package.
Authentication involves:
Usage
The documentation can be found on go doc.
Example
Make sure to have a registered client, hence a client id.
This code gets the top five English streams and prints the resutlt:
import (
"fmt"
"github.com/canobbioe/twitchapi"
)
func main() {
c := twitchapi.NewClient("your-client-id")
qp := twitchapi.StreamQueryParameters{
First: 5,
Language: []string{"en"},
}
streams, _, err := c.GetStreams(qp)
if err != nil {
}
for _, stream := range streams {
fmt.Printf("%s : %d\n", stream.Title, stream.ViewerCount)
}
}
Output:
TSM Dakotaz - 1400+ Wins 🏆 | youtube.com/dakotaz | twitter.com/dakotaz : 18768
LCK Spring: ROX vs. KZ - KSV vs. JAG : 15100
Giving GabeN all my money || [A] @AdmiralBulldog : 10714
IWD - Jungle Abuse : 6600
[PC] Day 2 of troll alert sounds, Sanity barely being held on to | Twitter @JacobHysteria 1100+ wins : 5570
TODO
- There must be a way to simplify the code...
- Authentication
- GetExtensionAnalytic
- GetGameAnalytics
- CreateStreamMarker
- GetStreamMarkers
- GetUserExtensions
- GetUserActiveExtensions
- UpdateUserExtensions
- GetWebHookSubscriptions