package main

import (
  "fmt"
  "os"
  "github.com/nicklaw5/helix/v2"
)

func main() {
  debug := os.Getenv("GODEBUG")
  fmt.Printf("%v\n\n", debug)

  client, err := helix.NewClient(&helix.Options{
    ClientID: "57116762594c61061237ed15fcdf0f",
    APIBaseURL: "http://127.0.0.1:8081/mock",
    AppAccessToken: "a2bc8f684ea663d",
  })

  if err != nil { panic(err) }

  resp, err := client.GetUsers(&helix.UsersParams{
    IDs: []string{"64812820"},
    Logins: []string{"marcusjill866"},
  })
  if err != nil { panic(err) }

  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)
  }

  event_resp, err := client.CreateEventSubSubscription(&helix.EventSubSubscription{
      Type: helix.EventSubTypeStreamOnline,
      Version: "1",
      Transport: helix.EventSubTransport{
          Method: "webhook",
          Callback: "https://fuckyou.com/follow",
          Secret: "s3cre7w0rd",
      },
  })
  if err != nil { panic(err) }

  fmt.Printf("%+v\n", event_resp)
}
