Skip to content

Commit cd46986

Browse files
Merge #77
77: eventsub fixes r=Emilgardis a=Emilgardis Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
2 parents 8835442 + fe199f6 commit cd46986

File tree

23 files changed

+202
-71
lines changed

23 files changed

+202
-71
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ serde_repr = "0.1.6"
2626
reqwest = { version = "0.11.0", optional = true }
2727
surf = { version = "2.1.0", optional = true }
2828
http-types = { version = "2.10.0", optional = true, features = ["hyperium_http"] }
29+
sha2 = { version = "0.9.3", optional = true }
30+
crypto_hmac = { package = "hmac", version = "0.10.1", optional = true }
2931

3032
[features]
3133
default = []
@@ -57,7 +59,9 @@ pubsub = ["serde_json"]
5759

5860
eventsub = ["serde_json"]
5961

60-
all = ["tmi", "helix", "surf_client", "reqwest_client", "client", "pubsub", "eventsub"]
62+
hmac = ["crypto_hmac","sha2"]
63+
64+
all = ["tmi", "helix", "surf_client", "reqwest_client", "client", "pubsub", "eventsub", "hmac"]
6165

6266
[dev-dependencies]
6367
tokio = { version = "1.2.0", features = ["rt-multi-thread", "macros"] }

src/eventsub/channel/ban.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ fn parse_payload() {
5959
"id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
6060
"type": "channel.ban",
6161
"version": "1",
62+
"status": "enabled",
6263
"condition": {
6364
"broadcaster_user_id": "1337"
6465
},

src/eventsub/channel/channel_points_custom_reward/add.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ pub struct ChannelPointsCustomRewardAddV1Payload {
3030
pub background_color: String,
3131
/// The requested broadcaster ID.
3232
pub broadcaster_user_id: types::UserId,
33-
/// The requested broadcaster name.
34-
pub broadcaster_user_name: types::UserName,
33+
/// The requested broadcaster login.
34+
pub broadcaster_user_login: types::UserName,
35+
/// The requested broadcaster display name.
36+
pub broadcaster_user_name: types::DisplayName,
3537
/// Timestamp of the cooldown expiration. null if the reward isn’t on cooldown.
3638
pub cooldown_expires_at: Option<types::Timestamp>,
3739
/// The reward cost.
@@ -74,6 +76,7 @@ fn parse_payload() {
7476
"id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
7577
"type": "channel.channel_points_custom_reward.add",
7678
"version": "1",
79+
"status": "enabled",
7780
"condition": {
7881
"broadcaster_user_id": "1337"
7982
},
@@ -86,7 +89,8 @@ fn parse_payload() {
8689
"event": {
8790
"id": "9001",
8891
"broadcaster_user_id": "1337",
89-
"broadcaster_user_name": "cool_user",
92+
"broadcaster_user_login": "cool_user",
93+
"broadcaster_user_name": "Cool_User",
9094
"is_enabled": true,
9195
"is_paused": false,
9296
"is_in_stock": true,

src/eventsub/channel/channel_points_custom_reward/remove.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ pub struct ChannelPointsCustomRewardRemoveV1Payload {
3131
pub background_color: String,
3232
/// The requested broadcaster ID.
3333
pub broadcaster_user_id: types::UserId,
34-
/// The requested broadcaster name.
34+
/// The requested broadcaster login.
35+
pub broadcaster_user_login: types::UserName,
36+
/// The requested broadcaster display name.
3537
pub broadcaster_user_name: types::UserName,
3638
/// Timestamp of the cooldown expiration. null if the reward isn’t on cooldown.
3739
pub cooldown_expires_at: Option<types::Timestamp>,
@@ -76,6 +78,7 @@ fn parse_payload() {
7678
"id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
7779
"type": "channel.channel_points_custom_reward.remove",
7880
"version": "1",
81+
"status": "enabled",
7982
"condition": {
8083
"broadcaster_user_id": "1337",
8184
"reward_id": "12345"
@@ -89,7 +92,8 @@ fn parse_payload() {
8992
"event": {
9093
"id": "9001",
9194
"broadcaster_user_id": "1337",
92-
"broadcaster_user_name": "cool_user",
95+
"broadcaster_user_login": "cool_user",
96+
"broadcaster_user_name": "Cool_User",
9397
"is_enabled": true,
9498
"is_paused": false,
9599
"is_in_stock": true,

src/eventsub/channel/channel_points_custom_reward/update.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ pub struct ChannelPointsCustomRewardUpdateV1Payload {
3131
pub background_color: String,
3232
/// The requested broadcaster ID.
3333
pub broadcaster_user_id: types::UserId,
34-
/// The requested broadcaster name.
35-
pub broadcaster_user_name: types::UserName,
34+
/// The requested broadcaster login.
35+
pub broadcaster_user_login: types::UserName,
36+
/// The requested broadcaster display name.
37+
pub broadcaster_user_name: types::DisplayName,
3638
/// Timestamp of the cooldown expiration. null if the reward isn’t on cooldown.
3739
pub cooldown_expires_at: Option<types::Timestamp>,
3840
/// The reward cost.
@@ -75,6 +77,7 @@ fn parse_payload() {
7577
"id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
7678
"type": "channel.channel_points_custom_reward.update",
7779
"version": "1",
80+
"status": "enabled",
7881
"condition": {
7982
"broadcaster_user_id": "1337"
8083
@@ -88,7 +91,8 @@ fn parse_payload() {
8891
"event": {
8992
"id": "9001",
9093
"broadcaster_user_id": "1337",
91-
"broadcaster_user_name": "cool_user",
94+
"broadcaster_user_login": "cool_user",
95+
"broadcaster_user_name": "Cool_User",
9296
"is_enabled": true,
9397
"is_paused": false,
9498
"is_in_stock": true,

src/eventsub/channel/channel_points_custom_reward_redemption/add.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ fn parse_payload() {
6060
"id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
6161
"type": "channel.channel_points_custom_reward_redemption.add",
6262
"version": "1",
63+
"status": "enabled",
6364
"condition": {
6465
"broadcaster_user_id": "1337"
6566
},

src/eventsub/channel/channel_points_custom_reward_redemption/update.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ fn parse_payload() {
5959
"id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
6060
"type": "channel.channel_points_custom_reward_redemption.update",
6161
"version": "1",
62+
"status": "enabled",
6263
"condition": {
6364
"broadcaster_user_id": "1337"
6465
},

src/eventsub/channel/cheer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ fn parse_payload() {
5353
"id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
5454
"type": "channel.cheer",
5555
"version": "1",
56+
"status": "enabled",
5657
"condition": {
5758
"broadcaster_user_id": "1337"
5859
},

src/eventsub/channel/follow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ fn parse_payload() {
4747
"id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
4848
"type": "channel.follow",
4949
"version": "1",
50+
"status": "enabled",
5051
"condition": {
5152
"broadcaster_user_id": "1337"
5253
},

0 commit comments

Comments
 (0)