Skip to content

Scorfly/gokick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

86 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GoKICK logo

GoKICK

A comprehensive Go client library for the Kick.com API. GoKICK provides a type-safe, idiomatic Go interface to interact with Kick's streaming platform, including authentication, channels, chat, moderation, livestreams, and webhooks.

Coverage Status Release

Features

  • πŸ” Complete OAuth2 Authentication - User and app access token management with automatic token refresh
  • πŸ“Ί Channel Management - Get channels, update stream metadata, manage channel rewards
  • πŸ’¬ Chat Operations - Send and delete chat messages
  • πŸ›‘οΈ Moderation Tools - Ban and unban users
  • πŸ“Š Livestream Data - Get livestreams and statistics
  • 🎁 Kicks & Rewards - Access leaderboards and manage channel rewards
  • πŸ”” Webhook Events - Subscribe to and handle webhook events
  • 🏷️ Categories & Users - Browse categories and user information
  • πŸ”„ Auto Token Refresh - Automatic user token refresh with callback support
  • πŸ§ͺ Well Tested - Comprehensive test coverage

Installation

go get github.com/scorfly/gokick

Quick Start

Basic Client Setup

package main

import (
    "context"
    "fmt"
    "github.com/scorfly/gokick"
)

func main() {
    // Create a client with app access token
    client, err := gokick.NewClient(&gokick.ClientOptions{
        AppAccessToken: "your-app-access-token",
    })
    if err != nil {
        panic(err)
    }

    // Get categories
    categories, err := client.GetCategories(context.Background())
    if err != nil {
        panic(err)
    }

    fmt.Printf("Found %d categories\n", len(categories.Result))
}

OAuth2 Authentication Flow

// 1. Get authorization URL
client, _ := gokick.NewClient(&gokick.ClientOptions{
    ClientID: "your-client-id",
})

authURL, _ := client.GetAuthorize(
    "http://localhost:3000/oauth/kick/callback",
    "state-value",
    "code-challenge",
    []gokick.Scope{gokick.ScopeUserRead, gokick.ScopeChannelRead},
)

// 2. Redirect user to authURL, then exchange code for token
client, _ = gokick.NewClient(&gokick.ClientOptions{
    ClientID:     "your-client-id",
    ClientSecret: "your-client-secret",
})

token, _ := client.GetToken(
    context.Background(),
    "http://localhost:3000/oauth/kick/callback",
    "authorization-code",
    "code-verifier",
)

// 3. Use the token
client.SetUserAccessToken(token.AccessToken)

Automatic Token Refresh

client, _ := gokick.NewClient(&gokick.ClientOptions{
    ClientID:        "your-client-id",
    ClientSecret:    "your-client-secret",
    UserAccessToken: "current-access-token",
    UserRefreshToken: "refresh-token",
})

// Set callback to save new tokens when refreshed
client.OnUserAccessTokenRefreshed(func(accessToken, refreshToken string) {
    // Save tokens to your storage
    fmt.Printf("Tokens refreshed: %s\n", accessToken)
})

// Client will automatically refresh expired tokens
channels, err := client.GetChannels(context.Background(), gokick.NewChannelListFilter())

Documentation

API Reference

See the documentation directory for detailed examples and supported endpoints:

Supported Endpoints

GoKICK supports a comprehensive set of Kick API endpoints:

  • βœ… Authentication - Authorization, token exchange, refresh, revoke, app tokens
  • βœ… Categories - List and get category details
  • βœ… Users - Get users, token introspection
  • βœ… Channels - Get channels, update stream metadata, manage rewards
  • βœ… Chat - Send and delete messages
  • βœ… Moderation - Ban and unban users
  • βœ… Livestreams - Get livestreams and statistics
  • βœ… Public Key - Get public key for webhook verification
  • βœ… Kicks - Get kicks leaderboard
  • βœ… Events - Subscribe to webhook events

See the full feature list for complete details.

Development

Running Tests

make test

Linting

make lint

Requirements

  • Go 1.25.5 or later

Kick API Documentation

For official Kick API documentation, see the KICK Developer website.

License

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

About

🐹 Golang SDK for KICK APIs πŸ› οΈ

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •