-
Notifications
You must be signed in to change notification settings - Fork 96
feat: GetHypetrainStatus and refactor EventSub for Hype Train V2 events #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: GetHypetrainStatus and refactor EventSub for Hype Train V2 events #242
Conversation
- change fields to match hype train v2
Pull Request Test Coverage Report for Build 17500025555Details
💛 - Coveralls |
…' into feat/jackmc/hype-train-event-sub-v2
|
@nicklaw5 hope all is well |
|
@jackmcguire1 does this PR introduce breaking changes? Or can both v1 and v2 hype train events co-exist with your implementation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new GetHypeTrainStatus API method to replace the deprecated GetHypeTrainEvents method, and updates EventSub Hype Train event structures to version 2 with enhanced shared train support.
- Introduces
GetHypeTrainStatusfunction with corresponding types for the Hype Train status API - Deprecates the existing
GetHypeTrainEventsfunction - Updates EventSub Hype Train event types (begin, progress, end) to v2 with new fields for shared trains
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| hype_train.go | Adds new types and GetHypeTrainStatus function; marks GetHypeTrainEvents as deprecated |
| hype_train_test.go | Adds comprehensive test coverage for GetHypeTrainStatus including success, error, and edge cases |
| eventsub.go | Updates EventSub Hype Train event types to v2, adds shared train participant type, and modifies contribution/charity amount types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| UserLogin string `json:"user_login"` | ||
| UserName string `json:"user_name"` | ||
| Type string `json:"type"` | ||
| Total int64 `json:"total"` |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type inconsistency: HypeTrainStatusContribution.Total is int64, but the equivalent EventSubContribution.Total in eventsub.go (line 756) is int. This creates unnecessary type conversion overhead when mapping between API and EventSub structures. Consider using consistent types across related structures.
| StartedAt Time `json:"started_at"` | ||
| EndedAt Time `json:"ended_at"` | ||
| } | ||
|
|
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EventSubCharityAmount struct now has both Value and Amount fields which appear to serve the same purpose. This is confusing and potentially error-prone. If both fields are required by the API, add a comment explaining the difference between them.
| // EventSubCharityAmount represents a monetary amount in a charity event. | |
| // Both Value and Amount are present in the API response: | |
| // - Value: The raw amount value, typically used for calculations. | |
| // - Amount: May be a duplicate of Value, or used for display purposes; refer to API documentation for exact usage. | |
| // If both fields are required by the API, ensure to use the correct field as per context. |
nicklaw5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackmcguire1 Review copilot's suggestions. I'm going to give this a ✅ as I don't believing this introduces breaking changes.
Notes
Breaking
2025‑06‑13
This pull request introduces significant improvements and extensions to the handling of Hype Train events and status in the codebase. The main changes include the addition of new data structures and API methods for retrieving detailed Hype Train status, updates to event types to support new features, and comprehensive tests for the new functionality.
Hype Train Status API and Data Structures
hype_train.goto represent Hype Train status, contributions, shared train participants, all-time high records, and response wrappers. Introduced theGetHypeTrainStatusAPI method for retrieving the current and historical Hype Train status for a broadcaster, with a note that the previousGetHypeTrainEventsmethod is now deprecated. [1] [2]Event Data Model Enhancements
eventsub.go(EventSubHypeTrainBeginEvent,EventSubHypeTrainProgressEvent,EventSubHypeTrainEndEvent) to support new fields such asID,Level,AllTimeHighLevel,AllTimeHighTotal,SharedTrainParticipants,Type, andIsSharedTrain, reflecting the latest event schema (V2).EventSubSharedTrainParticipanttype toeventsub.goand updatedEventSubContributionto useintforTotalinstead ofint64, aligning with new event payloads.Test Coverage
TestGetHypeTrainStatusinhype_train_test.goto verify correct API behavior, including error handling, response parsing, and edge cases for broadcasters with and without active Hype Trains.Miscellaneous Data Model Updates
EventSubCharityAmountineventsub.goto include anAmountfield alongsideValue, supporting additional charity event data.