Skip to content

Commit

Permalink
Change to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyak committed Oct 24, 2024
1 parent 5f5cffe commit b005255
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Go Report Card](https://goreportcard.com/badge/github.com/joeyak/go-twitch-eventsub)](https://goreportcard.com/report/github.com/joeyak/go-twitch-eventsub)
![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)
[![GoDoc](https://godoc.org/github.com/joeyak/go-twitch-eventsub?status.svg)](https://godoc.org/github.com/joeyak/go-twitch-eventsub/v2)
[![GoDoc](https://godoc.org/github.com/joeyak/go-twitch-eventsub?status.svg)](https://godoc.org/github.com/joeyak/go-twitch-eventsub/v3)
![tests](https://github.com/joeyak/go-twitch-eventsub/actions/workflows/main.yaml/badge.svg)


Expand All @@ -14,6 +14,15 @@ If a websocket connection has no subscriptions, then it will close automatically

v2 changes `OnRawEvent` from passing `EventSubscription` to `PayloadSubscription`. This allows extra information to be passed in the event instead of just the type.

v3 changes to event types

* Added pointers where it made sense and values were null or optional
* Changed EventChannelBan times to be `time.Time` instead of `string`
* Fixed EventChannelGoalBegin, EventChannelGoalProgress, and EventChannelGoalEnd which seemed to have charity info
* Campaign objects did not have CampaignID
* EventChannelShieldModeBegin should not have StoppedAt
* EventChannelShieldModeEnd should not have StartedAt

## Authorization

For authorization, a user access token must be used. An app access token will cause an error. See the Authorization section in the [Twitch Docs](https://dev.twitch.tv/docs/eventsub/manage-subscriptions/#subscribing-to-events)
Expand All @@ -38,7 +47,7 @@ package main
import (
"fmt"

"github.com/joeyak/go-twitch-eventsub/v2"
"github.com/joeyak/go-twitch-eventsub/v3"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/coder/websocket"
"github.com/google/uuid"
"github.com/joeyak/go-twitch-eventsub/v2"
"github.com/joeyak/go-twitch-eventsub/v3"
)

//go:embed testEvents.json
Expand Down
2 changes: 1 addition & 1 deletion connEvent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package twitch_test
import (
"testing"

"github.com/joeyak/go-twitch-eventsub/v2"
"github.com/joeyak/go-twitch-eventsub/v3"
)

func assertSpecificEventOccured(t *testing.T, register func(client *twitch.Client, ch chan struct{}), event twitch.EventSubscription, suffixes ...string) {
Expand Down
3 changes: 1 addition & 2 deletions conn_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package twitch_test

import (
"context"
"fmt"
"testing"
"time"

"github.com/joeyak/go-twitch-eventsub/v2"
"github.com/joeyak/go-twitch-eventsub/v3"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 4 additions & 2 deletions events_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package twitch
package twitch_test

import (
"fmt"
"testing"

"github.com/joeyak/go-twitch-eventsub/v3"
)

func TestGoalAmount(t *testing.T) {
Expand All @@ -21,7 +23,7 @@ func TestGoalAmount(t *testing.T) {

for _, tc := range testCases {
t.Run(fmt.Sprintf("%d-%d", tc.Value, tc.DecimalPlaces), func(t *testing.T) {
amount := GoalAmount{
amount := twitch.GoalAmount{
Value: tc.Value,
DecimalPlaces: tc.DecimalPlaces,
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/joeyak/go-twitch-eventsub/v2
module github.com/joeyak/go-twitch-eventsub/v3

go 1.19

Expand Down
2 changes: 1 addition & 1 deletion subscriptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"testing"

"github.com/joeyak/go-twitch-eventsub/v2"
"github.com/joeyak/go-twitch-eventsub/v3"
)

func TestEventVersion(t *testing.T) {
Expand Down

0 comments on commit b005255

Please sign in to comment.