Coder Social home page Coder Social logo

helix's Introduction

helix

A Twitch Helix API client written in Go (Golang).

Build Status Coverage Status

Package Status

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.

Documentation & Examples

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.

Supported Endpoints & Features

Authentication:

  • Generate Authorization URL
  • Get App Access Tokens (OAuth Client Credentials Flow)
  • Get User Access Tokens (OAuth Authorization Code Flow)
  • Refresh User Access Tokens
  • Revoke User Access Tokens

API Endpoint:

  • Get Bits Leaderboard
  • Get Clip
  • Create Clip
  • Create Entitlement Grants Upload URL
  • Get Games
  • Get Top Games
  • Get Extension Analytics
  • Get Game Analytics
  • Get Streams
  • Get Streams Metadata
  • Create Stream Marker
  • Get Stream Markers
  • Get Users
  • Get Users Follows
  • Update User
  • Get Videos
  • Get Webhook Subscriptions

Quick Usage Example

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

Contributions

PRs are very much welcome. Where possible, please write tests for any code that is introduced by your PRs.

Contributors

Thanks to all of the following people (ordered alphabetically) for contributing their time for improving this library:

License

This package is distributed under the terms of the MIT License.

helix's People

Contributors

bamnet avatar chronophylos avatar damoun avatar flipkick avatar iwinulose avatar nicklaw5 avatar u5surf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.