Skip to content

Commit c65ad5c

Browse files
Merge #208
208: fix missing id on hypetrain eventsub r=Emilgardis a=Emilgardis Co-authored-by: Emil Gardström <[email protected]>
2 parents 8fd9309 + 88c9e63 commit c65ad5c

File tree

7 files changed

+26
-2
lines changed

7 files changed

+26
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* 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`
4040
* Added fields `format`, `scale`, `theme_mode` and `template` to `ChannelEmote`, `GetEmoteSets` and `GlobalEmote`
4141
* 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.
42+
* Added `HypeTrainId` to relevant eventsub and helix endpoints
4243

4344
### Changed
4445

src/eventsub/channel/hypetrain/begin.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ impl EventSubscription for ChannelHypeTrainBeginV1 {
2727
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
2828
#[non_exhaustive]
2929
pub struct ChannelHypeTrainBeginV1Payload {
30+
/// The Hype Train ID.
31+
pub id: types::HypeTrainId,
3032
/// The requested broadcaster ID.
3133
pub broadcaster_user_id: types::UserId,
3234
/// The requested broadcaster login.
@@ -71,6 +73,7 @@ fn parse_payload() {
7173
"created_at": "2019-11-16T10:11:12.123Z"
7274
},
7375
"event": {
76+
"id": "1b0AsbInCHZW2SQFQkCzqN07Ib2",
7477
"broadcaster_user_id": "1337",
7578
"broadcaster_user_login": "cool_user",
7679
"broadcaster_user_name": "Cool_User",

src/eventsub/channel/hypetrain/end.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ impl EventSubscription for ChannelHypeTrainEndV1 {
2727
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
2828
#[non_exhaustive]
2929
pub struct ChannelHypeTrainEndV1Payload {
30+
/// The Hype Train ID.
31+
pub id: types::HypeTrainId,
3032
/// The requested broadcaster ID.
3133
pub broadcaster_user_id: types::UserId,
3234
/// The requested broadcaster login.
@@ -68,6 +70,7 @@ fn parse_payload() {
6870
"created_at": "2019-11-16T10:11:12.123Z"
6971
},
7072
"event": {
73+
"id": "1b0AsbInCHZW2SQFQkCzqN07Ib2",
7174
"broadcaster_user_id": "1337",
7275
"broadcaster_user_login": "cool_user",
7376
"broadcaster_user_name": "Cool_User",

src/eventsub/channel/hypetrain/progress.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ impl EventSubscription for ChannelHypeTrainProgressV1 {
2727
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
2828
#[non_exhaustive]
2929
pub struct ChannelHypeTrainProgressV1Payload {
30+
/// The Hype Train ID.
31+
pub id: types::HypeTrainId,
3032
/// The requested broadcaster ID.
3133
pub broadcaster_user_id: types::UserId,
3234
/// The requested broadcaster login.
@@ -73,6 +75,7 @@ fn parse_payload() {
7375
"created_at": "2019-11-16T10:11:12.123Z"
7476
},
7577
"event": {
78+
"id": "1b0AsbInCHZW2SQFQkCzqN07Ib2",
7679
"broadcaster_user_id": "1337",
7780
"broadcaster_user_login": "cool_user",
7881
"broadcaster_user_name": "Cool_User",

src/helix/hypetrain/get_hypetrain_events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub struct HypeTrainEventData {
113113
/// Total points contributed to the hype train.
114114
pub total: i64,
115115
/// The distinct ID of this Hype Train
116-
pub id: String,
116+
pub id: types::HypeTrainId,
117117
}
118118

119119
impl Request for GetHypeTrainEventsRequest {

src/pubsub/hypetrain.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ pub struct HypeTrainEnd {
106106
pub ending_reason: EndingReason,
107107
}
108108

109+
/// Hype train cooldown expired
110+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
111+
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
112+
#[non_exhaustive]
113+
pub struct HypeTrainCooldownExpiration {}
114+
109115
/// Hype train conductor updated
110116
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
111117
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
@@ -199,8 +205,12 @@ pub enum HypeTrainEventsV1Reply {
199205
#[serde(rename = "hype-train-end")]
200206
HypeTrainEnd(HypeTrainEnd),
201207
/// Hype train cooldown expired
208+
///
209+
/// # Note
210+
///
211+
/// There is no data associated with this event.
202212
#[serde(rename = "hype-train-cooldown-expiration")]
203-
HypeTrainCooldownExpiration(#[doc(hidden)] Option<()>),
213+
HypeTrainCooldownExpiration(Option<HypeTrainCooldownExpiration>),
204214
/// Hype train conductor updated
205215
#[serde(rename = "hype-train-conductor-update")]
206216
HypeTrainConductorUpdate(HypeTrainConductorUpdate),

src/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,10 @@ pub struct EmoteSetId;
666666
#[aliri_braid::braid(serde)]
667667
pub struct StreamSegmentId;
668668

669+
/// A Hype Train ID
670+
#[aliri_braid::braid(serde)]
671+
pub struct HypeTrainId;
672+
669673
/// An emote index as defined by eventsub, similar to IRC `emotes` twitch tag.
670674
#[derive(PartialEq, Eq, Deserialize, Serialize, Debug, Clone)]
671675
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]

0 commit comments

Comments
 (0)