Categorygithub.com/onestay/go-new-twitch
modulepackage
0.0.0-20200118131921-bae2bb438a68
Repository: https://github.com/onestay/go-new-twitch.git
Documentation: pkg.go.dev

# README

go-new-twitch

it's working but you should probably use https://github.com/nicklaw5/helix since this is not that well maintained

Description

I decided to write this api wrapper because there were none for the New Twitch Api and all the other ones are fairly outdated.

It's still pretty early in development and not all api endpoints are added.

There are still a lot of endpoints added to the API and they might not immediately be added here but I'll try to keep this as updated as possible.

Usage

Create a new Twitch Application here to get a client id. You can then create a new twitch client with the NewClient method and start using all the methods.

Documentation can be found here https://godoc.org/github.com/Onestay/go-new-twitch and the oficiall New Twich API reference here https://dev.twitch.tv/docs/api/reference

Example

package main
import (
	"fmt"
	twitch "github.com/Onestay/go-new-twitch"
)

func main() {
	client := twitch.NewClient("<your client_id>")
    
    users, err := client.GetUsersByLogin("lirik")
    if err != nil {
		fmt.Printf("Error getting twitch user: %v", err)
	}
    
    fmt.Println(users[0].Login)
}

# Functions

NewClient will initialize a new client for the twitch api.

# Structs

Client represents a client to interact with the twitch API.
ClipData represents the data in a single clip.
GameData represents the data of a single game.
GetClipsInput represents the query string parameters to get clips https://dev.twitch.tv/docs/api/reference#get-clips.
GetStreamsInput represents the query string parameters to get streams https://dev.twitch.tv/docs/api/reference#get-streams.
Pagination data returned from helix paged requests.
StreamData represents the data a single stream.
UserData struct represents a user as defined by the twitch api.