1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
use crate::{id::RoleId, user::User};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct InviteStageInstance {
pub members: Vec<InviteStageInstanceMember>,
pub participant_count: u64,
pub speaker_count: u64,
pub topic: String,
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct InviteStageInstanceMember {
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar: Option<String>,
pub joined_at: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub nick: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pending: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub premium_since: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub roles: Vec<RoleId>,
pub user: User,
}
#[cfg(test)]
mod tests {
use super::{InviteStageInstance, InviteStageInstanceMember};
use serde::{Deserialize, Serialize};
use static_assertions::{assert_fields, assert_impl_all};
use std::{fmt::Debug, hash::Hash};
assert_fields!(
InviteStageInstance: members,
participant_count,
speaker_count,
topic
);
assert_fields!(
InviteStageInstanceMember: avatar,
joined_at,
nick,
pending,
premium_since,
roles,
user
);
assert_impl_all!(
InviteStageInstance: Clone,
Debug,
Deserialize<'static>,
Eq,
Hash,
PartialEq,
Serialize,
Send,
Sync
);
assert_impl_all!(
InviteStageInstanceMember: Clone,
Debug,
Deserialize<'static>,
Eq,
Hash,
PartialEq,
Serialize,
Send,
Sync
);
}