Skip to content

fix missing id on hypetrain eventsub #208

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

Merged
merged 2 commits into from
Sep 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* Added function `get_follow_relationships`, `get_broadcaster_subscribers`, `get_global_emotes`, `get_channel_emotes_from_id`, `get_channel_emotes_from_login` and `get_emote_sets` to `HelixClient`
* Added fields `format`, `scale`, `theme_mode` and `template` to `ChannelEmote`, `GetEmoteSets` and `GlobalEmote`
* Added functions `HelixClient::req_<method>_custom` to return a specific struct/enum defined by the user. This also enables references in responses for these functions.
* Added `HypeTrainId` to relevant eventsub and helix endpoints

### Changed

Expand Down
3 changes: 3 additions & 0 deletions src/eventsub/channel/hypetrain/begin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ impl EventSubscription for ChannelHypeTrainBeginV1 {
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct ChannelHypeTrainBeginV1Payload {
/// The Hype Train ID.
pub id: types::HypeTrainId,
/// The requested broadcaster ID.
pub broadcaster_user_id: types::UserId,
/// The requested broadcaster login.
Expand Down Expand Up @@ -71,6 +73,7 @@ fn parse_payload() {
"created_at": "2019-11-16T10:11:12.123Z"
},
"event": {
"id": "1b0AsbInCHZW2SQFQkCzqN07Ib2",
"broadcaster_user_id": "1337",
"broadcaster_user_login": "cool_user",
"broadcaster_user_name": "Cool_User",
Expand Down
3 changes: 3 additions & 0 deletions src/eventsub/channel/hypetrain/end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ impl EventSubscription for ChannelHypeTrainEndV1 {
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct ChannelHypeTrainEndV1Payload {
/// The Hype Train ID.
pub id: types::HypeTrainId,
/// The requested broadcaster ID.
pub broadcaster_user_id: types::UserId,
/// The requested broadcaster login.
Expand Down Expand Up @@ -68,6 +70,7 @@ fn parse_payload() {
"created_at": "2019-11-16T10:11:12.123Z"
},
"event": {
"id": "1b0AsbInCHZW2SQFQkCzqN07Ib2",
"broadcaster_user_id": "1337",
"broadcaster_user_login": "cool_user",
"broadcaster_user_name": "Cool_User",
Expand Down
3 changes: 3 additions & 0 deletions src/eventsub/channel/hypetrain/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ impl EventSubscription for ChannelHypeTrainProgressV1 {
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct ChannelHypeTrainProgressV1Payload {
/// The Hype Train ID.
pub id: types::HypeTrainId,
/// The requested broadcaster ID.
pub broadcaster_user_id: types::UserId,
/// The requested broadcaster login.
Expand Down Expand Up @@ -73,6 +75,7 @@ fn parse_payload() {
"created_at": "2019-11-16T10:11:12.123Z"
},
"event": {
"id": "1b0AsbInCHZW2SQFQkCzqN07Ib2",
"broadcaster_user_id": "1337",
"broadcaster_user_login": "cool_user",
"broadcaster_user_name": "Cool_User",
Expand Down
2 changes: 1 addition & 1 deletion src/helix/hypetrain/get_hypetrain_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub struct HypeTrainEventData {
/// Total points contributed to the hype train.
pub total: i64,
/// The distinct ID of this Hype Train
pub id: String,
pub id: types::HypeTrainId,
}

impl Request for GetHypeTrainEventsRequest {
Expand Down
12 changes: 11 additions & 1 deletion src/pubsub/hypetrain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ pub struct HypeTrainEnd {
pub ending_reason: EndingReason,
}

/// Hype train cooldown expired
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct HypeTrainCooldownExpiration {}

/// Hype train conductor updated
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
Expand Down Expand Up @@ -199,8 +205,12 @@ pub enum HypeTrainEventsV1Reply {
#[serde(rename = "hype-train-end")]
HypeTrainEnd(HypeTrainEnd),
/// Hype train cooldown expired
///
/// # Note
///
/// There is no data associated with this event.
#[serde(rename = "hype-train-cooldown-expiration")]
HypeTrainCooldownExpiration(#[doc(hidden)] Option<()>),
HypeTrainCooldownExpiration(Option<HypeTrainCooldownExpiration>),
/// Hype train conductor updated
#[serde(rename = "hype-train-conductor-update")]
HypeTrainConductorUpdate(HypeTrainConductorUpdate),
Expand Down
4 changes: 4 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,10 @@ pub struct EmoteSetId;
#[aliri_braid::braid(serde)]
pub struct StreamSegmentId;

/// A Hype Train ID
#[aliri_braid::braid(serde)]
pub struct HypeTrainId;

/// An emote index as defined by eventsub, similar to IRC `emotes` twitch tag.
#[derive(PartialEq, Eq, Deserialize, Serialize, Debug, Clone)]
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
Expand Down