revolt_models/v0/channel_invites.rs
1use super::{Channel, File, Server, User};
2
3auto_derived!(
4 /// Invite
5 #[serde(tag = "type")]
6 pub enum Invite {
7 /// Invite to a specific server channel
8 Server {
9 /// Invite code
10 #[cfg_attr(feature = "serde", serde(rename = "_id"))]
11 code: String,
12 /// Id of the server this invite points to
13 server: String,
14 /// Id of user who created this invite
15 creator: String,
16 /// Id of the server channel this invite points to
17 channel: String,
18 },
19 /// Invite to a group channel
20 Group {
21 /// Invite code
22 #[cfg_attr(feature = "serde", serde(rename = "_id"))]
23 code: String,
24 /// Id of user who created this invite
25 creator: String,
26 /// Id of the group channel this invite points to
27 channel: String,
28 },
29 }
30
31 /// Public invite response
32 #[allow(clippy::large_enum_variant)]
33 #[serde(tag = "type")]
34 pub enum InviteResponse {
35 /// Server channel invite
36 Server {
37 /// Invite code
38 code: String,
39 /// Id of the server
40 server_id: String,
41 /// Name of the server
42 server_name: String,
43 /// Attachment for server icon
44 #[serde(skip_serializing_if = "Option::is_none")]
45 server_icon: Option<File>,
46 /// Attachment for server banner
47 #[serde(skip_serializing_if = "Option::is_none")]
48 server_banner: Option<File>,
49 /// Enum of server flags
50 #[serde(skip_serializing_if = "Option::is_none")]
51 server_flags: Option<i32>,
52 /// Id of server channel
53 channel_id: String,
54 /// Name of server channel
55 channel_name: String,
56 /// Description of server channel
57 #[serde(skip_serializing_if = "Option::is_none")]
58 channel_description: Option<String>,
59 /// Name of user who created the invite
60 user_name: String,
61 /// Avatar of the user who created the invite
62 #[serde(skip_serializing_if = "Option::is_none")]
63 user_avatar: Option<File>,
64 /// Number of members in this server
65 member_count: i64,
66 },
67 /// Group channel invite
68 Group {
69 /// Invite code
70 code: String,
71 /// Id of group channel
72 channel_id: String,
73 /// Name of group channel
74 channel_name: String,
75 /// Description of group channel
76 #[serde(skip_serializing_if = "Option::is_none")]
77 channel_description: Option<String>,
78 /// Name of user who created the invite
79 user_name: String,
80 /// Avatar of the user who created the invite
81 #[serde(skip_serializing_if = "Option::is_none")]
82 user_avatar: Option<File>,
83 },
84 }
85
86 /// Invite join response
87 #[serde(tag = "type")]
88 #[allow(clippy::large_enum_variant)]
89 pub enum InviteJoinResponse {
90 Server {
91 /// Channels in the server
92 channels: Vec<Channel>,
93 /// Server we are joining
94 server: Server,
95 },
96 Group {
97 /// Group channel we are joining
98 channel: Channel,
99 /// Members of this group
100 users: Vec<User>,
101 },
102 }
103);