Skip to content

Commit f36c51f

Browse files
Merge #72
72: Fixes r=Emilgardis a=Emilgardis Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
2 parents a965559 + a63d7e9 commit f36c51f

File tree

3 files changed

+51
-22
lines changed

3 files changed

+51
-22
lines changed

src/eventsub/channel/ban.rs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,30 @@ impl EventSubscription for ChannelBanV1 {
2525
#[cfg_attr(not(feature = "allow_unknown_fields"), serde(deny_unknown_fields))]
2626
#[non_exhaustive]
2727
pub struct ChannelBanV1Payload {
28-
/// The requested broadcaster ID.
29-
pub broadcaster_user_id: types::UserId,
30-
/// The requested broadcaster login.
31-
pub broadcaster_user_login: types::UserName,
32-
/// The requested broadcaster display name.
33-
pub broadcaster_user_name: types::DisplayName,
3428
/// The user ID for the user who was banned on the specified channel.
3529
pub user_id: types::UserId,
3630
/// The user login for the user who was banned on the specified channel.
3731
pub user_login: types::UserName,
3832
/// The requested broadcaster display name.
3933
pub user_name: types::DisplayName,
34+
/// The requested broadcaster ID.
35+
pub broadcaster_user_id: types::UserId,
36+
/// The requested broadcaster login.
37+
pub broadcaster_user_login: types::UserName,
38+
/// The requested broadcaster display name.
39+
pub broadcaster_user_name: types::DisplayName,
40+
/// The user ID of the issuer of the ban.
41+
pub moderator_user_id: types::UserId,
42+
/// The user login of the issuer of the ban.
43+
pub moderator_user_login: types::UserName,
44+
/// The user name of the issuer of the ban.
45+
pub moderator_user_name: types::DisplayName,
46+
/// The reason behind the ban.
47+
pub reason: String,
48+
/// Will be null if permanent ban. If it is a timeout, this field shows when the timeout will end.
49+
pub ends_at: Option<types::Timestamp>,
50+
/// Indicates whether the ban is permanent (true) or a timeout (false). If true, ends_at will be null.
51+
pub is_permanent: bool,
4052
}
4153

4254
#[test]
@@ -62,7 +74,13 @@ fn parse_payload() {
6274
"user_name": "Cool_User",
6375
"broadcaster_user_id": "1337",
6476
"broadcaster_user_login": "cooler_user",
65-
"broadcaster_user_name": "Cooler_User"
77+
"broadcaster_user_name": "Cooler_User",
78+
"moderator_user_id": "1339",
79+
"moderator_user_login": "mod_user",
80+
"moderator_user_name": "Mod_User",
81+
"reason": "Offensive language",
82+
"ends_at": "2020-07-15T18:16:11.17106713Z",
83+
"is_permanent": false
6684
}
6785
}
6886
"#;

src/eventsub/channel/unban.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ pub struct ChannelUnbanV1Payload {
3737
pub user_login: types::UserName,
3838
/// The user display name for the user who was unbanned on the specified channel.
3939
pub user_name: types::DisplayName,
40+
/// The user ID of the issuer of the unban.
41+
pub moderator_user_id: types::UserId,
42+
/// The user login of the issuer of the unban.
43+
pub moderator_user_login: types::UserName,
44+
/// The user name of the issuer of the unban.
45+
pub moderator_user_name: types::DisplayName,
4046
}
4147

4248
#[test]
@@ -62,7 +68,10 @@ fn parse_payload() {
6268
"user_name": "Cool_User",
6369
"broadcaster_user_id": "1337",
6470
"broadcaster_user_login": "cooler_user",
65-
"broadcaster_user_name": "Cooler_User"
71+
"broadcaster_user_name": "Cooler_User",
72+
"moderator_user_id": "1339",
73+
"moderator_user_login": "mod_user",
74+
"moderator_user_name": "Mod_User"
6675
}
6776
}
6877
"#;

src/helix/users/get_users.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,22 @@ fn test_request() {
107107
// FIXME: This is not valid anymore. Twitch....
108108
let data = br#"
109109
{
110-
"data": [{
111-
"id": "44322889",
112-
"login": "dallas",
113-
"display_name": "dallas",
114-
"type": "staff",
115-
"broadcaster_type": "",
116-
"description": "Just a gamer playing games and chatting. :)",
117-
"profile_image_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/dallas-profile_image-1a2c906ee2c35f12-300x300.png",
118-
"offline_image_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/dallas-channel_offline_image-1a2c906ee2c35f12-1920x1080.png",
119-
"view_count": 191836881,
120-
"email": "login@provider.com",
121-
"created_at": "2013-06-03T19:12:02.580593Z"
122-
}]
123-
}
110+
"data": [
111+
{
112+
"id": "141981764",
113+
"login": "twitchdev",
114+
"display_name": "TwitchDev",
115+
"type": "",
116+
"broadcaster_type": "partner",
117+
"description": "Supporting third-party developers building Twitch integrations from chatbots to game integrations.",
118+
"profile_image_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/8a6381c7-d0c0-4576-b179-38bd5ce1d6af-profile_image-300x300.png",
119+
"offline_image_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/3f13ab61-ec78-4fe6-8481-8682cb3b0ac2-channel_offline_image-1920x1080.png",
120+
"view_count": 5980557,
121+
"email": "not-real@email.com",
122+
"created_at": "2016-12-14T20:32:28.894263Z"
123+
}
124+
]
125+
}
124126
"#
125127
.to_vec();
126128

0 commit comments

Comments
 (0)