go-twitch

module
v0.0.0-...-3e1bd26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2017 License: MIT

README

go-twitch

Forked from go-twitch

travis-ci status Coverage Status

Go library for accessing v5 of the Twitch-API.

This is still a work in progress.

Currently only GET requests are implemented.

Usage

To install go-twitch run the command:

$ go get github.com/julusian/go-twitch

Full docs at GoDocs

Here's an example program that gets the top 10 twitch games:

package main

import (
	"fmt"
	"github.com/julusian/go-twitch/twitch"
	"github.com/julusian/go-twitch/twitchapi"
	"log"
	"net/http"
)

func main() {
	client := twitchapi.NewClient(&http.Client{}, os.Getenv("CLIENT_ID"))
	opt := &twitch.ListOptions{
		Limit:  10,
		Offset: 0,
	}

	games, err := client.Games.Top(opt)
	if err != nil {
		log.Fatal(err)
	}

	for i, s := range games.Top {
		fmt.Printf("%d - %s (%d)\n", i+1, s.Game.Name, s.Viewers)
	}
}
Authentication

TODO

License

All files under this repository fall under the MIT License (see the file LICENSE).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL