Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tserkov/go-twitch-api
A golang wrapper for Twitch's Kraken API
https://github.com/tserkov/go-twitch-api
golang twitch twitch-api twitch-api-v5
Last synced: about 1 month ago
JSON representation
A golang wrapper for Twitch's Kraken API
- Host: GitHub
- URL: https://github.com/tserkov/go-twitch-api
- Owner: tserkov
- License: mit
- Created: 2017-05-17T23:30:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-08T07:54:17.000Z (almost 7 years ago)
- Last Synced: 2024-06-20T08:08:04.650Z (7 months ago)
- Topics: golang, twitch, twitch-api, twitch-api-v5
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Twitch API (Golang)
[![Travis](https://img.shields.io/travis/tserkov/go-twitch-api.svg)]()
[![GitHub issues](https://img.shields.io/github/issues/tserkov/go-twitch-api.svg)]()
[![Coveralls](https://img.shields.io/coveralls/tserkov/go-twitch-api.svg)]()
[![license](https://img.shields.io/github/license/tserkov/go-twitch-api.svg)]()
[![Beerpay](https://img.shields.io/beerpay/tserkov/go-twitch-api.svg)](https://beerpay.io/tserkov/go-twitch-api)This is a Go wrapper for the [Twitch.tv Kraken API](https://dev.twitch.tv/docs), initially created for an internal project, but am making public as I build it out to our requirements.
### Usage
```go
package mainimport (
"fmt""github.com/tserkov/go-twitch-api"
)func main() {
t := twitch.NewClient("CLIENT_ID", "CLIENT_SECRET", "CLIENT_REDIRECT")u, err := t.Users.GetByLogin("tserkov")
if err != nil {
fmt.Printf("Failed to get users: %s", err)return
}if u.Total == 0 {
fmt.Printf("No users found with login/username tserkov")return
}tserkov := u.Users[0]
fmt.Printf("User ID for %s is %s", tserkov.DisplayName, tserkov.Id)
}
```### Users
* GetAccessToken (authorizationCode _string_) _string_
- Exchanges an authorization code (which you somehow obtained from Twitch's OAuth flow) for an access token.
* GetAuthenticated (accessToken _string_) _twitch.User_, _error_
- Gets the user associated with the provided access token.
* GetByLogin (username _string_) _twitch.Users_, _error_
- Returns users matching the provided username/login. Useful for converting username/login to user id.
* GetFollowedChannelInfo (followerId _string_, channelId _string_) _twitch.Follows_, _error_
- If the provided user id is following the provided channel id, returns the related follow info.### Todo
* Channels endpoints
* Chat endpoints
* Games endpoints
* Ingests endpoints
* Search endpoints
* Streams endpoints
* Teams endpoints
* Users endpoints
* Videos endpointsYea... all the endpoints.