Socket
Socket
Sign inDemoInstall

github.com/canobbioe/twitchapi

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/canobbioe/twitchapi


Version published
Created
Source

GoDoc Build Status

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 the package
import (
	"fmt"
	"github.com/canobbioe/twitchapi"
)

func main() {
	// Create a new client
	c := twitchapi.NewClient("your-client-id")

	// Create an input struct as needed
	qp := twitchapi.StreamQueryParameters{
		First:    5,
		Language: []string{"en"},
	}

	// Perform the API call
	streams, _, err := c.GetStreams(qp)
	if err != nil {
		// handle error
	}

	// Access the values
	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

FAQs

Package last updated on 04 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc