rtdlib/types/
group_call.rs1
2use crate::types::*;
3use crate::errors::*;
4use uuid::Uuid;
5
6
7
8
9#[derive(Debug, Clone, Default, Serialize, Deserialize)]
11pub struct GroupCall {
12 #[doc(hidden)]
13 #[serde(rename(serialize = "@type", deserialize = "@type"))]
14 td_name: String,
15 #[doc(hidden)]
16 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
17 extra: Option<String>,
18 id: i64,
20 title: String,
22 scheduled_start_date: i64,
24 enabled_start_notification: bool,
26 is_active: bool,
28 is_joined: bool,
30 need_rejoin: bool,
32 can_be_managed: bool,
34 participant_count: i64,
36 loaded_all_participants: bool,
38 recent_speakers: Vec<GroupCallRecentSpeaker>,
40 is_my_video_enabled: bool,
42 is_my_video_paused: bool,
44 can_enable_video: bool,
46 mute_new_participants: bool,
48 can_toggle_mute_new_participants: bool,
50 record_duration: i64,
52 is_video_recorded: bool,
54 duration: i64,
56
57}
58
59impl RObject for GroupCall {
60 #[doc(hidden)] fn td_name(&self) -> &'static str { "groupCall" }
61 #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
62 fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
63}
64
65
66
67impl GroupCall {
68 pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
69 pub fn builder() -> RTDGroupCallBuilder {
70 let mut inner = GroupCall::default();
71 inner.td_name = "groupCall".to_string();
72 inner.extra = Some(Uuid::new_v4().to_string());
73 RTDGroupCallBuilder { inner }
74 }
75
76 pub fn id(&self) -> i64 { self.id }
77
78 pub fn title(&self) -> &String { &self.title }
79
80 pub fn scheduled_start_date(&self) -> i64 { self.scheduled_start_date }
81
82 pub fn enabled_start_notification(&self) -> bool { self.enabled_start_notification }
83
84 pub fn is_active(&self) -> bool { self.is_active }
85
86 pub fn is_joined(&self) -> bool { self.is_joined }
87
88 pub fn need_rejoin(&self) -> bool { self.need_rejoin }
89
90 pub fn can_be_managed(&self) -> bool { self.can_be_managed }
91
92 pub fn participant_count(&self) -> i64 { self.participant_count }
93
94 pub fn loaded_all_participants(&self) -> bool { self.loaded_all_participants }
95
96 pub fn recent_speakers(&self) -> &Vec<GroupCallRecentSpeaker> { &self.recent_speakers }
97
98 pub fn is_my_video_enabled(&self) -> bool { self.is_my_video_enabled }
99
100 pub fn is_my_video_paused(&self) -> bool { self.is_my_video_paused }
101
102 pub fn can_enable_video(&self) -> bool { self.can_enable_video }
103
104 pub fn mute_new_participants(&self) -> bool { self.mute_new_participants }
105
106 pub fn can_toggle_mute_new_participants(&self) -> bool { self.can_toggle_mute_new_participants }
107
108 pub fn record_duration(&self) -> i64 { self.record_duration }
109
110 pub fn is_video_recorded(&self) -> bool { self.is_video_recorded }
111
112 pub fn duration(&self) -> i64 { self.duration }
113
114}
115
116#[doc(hidden)]
117pub struct RTDGroupCallBuilder {
118 inner: GroupCall
119}
120
121impl RTDGroupCallBuilder {
122 pub fn build(&self) -> GroupCall { self.inner.clone() }
123
124
125 pub fn id(&mut self, id: i64) -> &mut Self {
126 self.inner.id = id;
127 self
128 }
129
130
131 pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
132 self.inner.title = title.as_ref().to_string();
133 self
134 }
135
136
137 pub fn scheduled_start_date(&mut self, scheduled_start_date: i64) -> &mut Self {
138 self.inner.scheduled_start_date = scheduled_start_date;
139 self
140 }
141
142
143 pub fn enabled_start_notification(&mut self, enabled_start_notification: bool) -> &mut Self {
144 self.inner.enabled_start_notification = enabled_start_notification;
145 self
146 }
147
148
149 pub fn is_active(&mut self, is_active: bool) -> &mut Self {
150 self.inner.is_active = is_active;
151 self
152 }
153
154
155 pub fn is_joined(&mut self, is_joined: bool) -> &mut Self {
156 self.inner.is_joined = is_joined;
157 self
158 }
159
160
161 pub fn need_rejoin(&mut self, need_rejoin: bool) -> &mut Self {
162 self.inner.need_rejoin = need_rejoin;
163 self
164 }
165
166
167 pub fn can_be_managed(&mut self, can_be_managed: bool) -> &mut Self {
168 self.inner.can_be_managed = can_be_managed;
169 self
170 }
171
172
173 pub fn participant_count(&mut self, participant_count: i64) -> &mut Self {
174 self.inner.participant_count = participant_count;
175 self
176 }
177
178
179 pub fn loaded_all_participants(&mut self, loaded_all_participants: bool) -> &mut Self {
180 self.inner.loaded_all_participants = loaded_all_participants;
181 self
182 }
183
184
185 pub fn recent_speakers(&mut self, recent_speakers: Vec<GroupCallRecentSpeaker>) -> &mut Self {
186 self.inner.recent_speakers = recent_speakers;
187 self
188 }
189
190
191 pub fn is_my_video_enabled(&mut self, is_my_video_enabled: bool) -> &mut Self {
192 self.inner.is_my_video_enabled = is_my_video_enabled;
193 self
194 }
195
196
197 pub fn is_my_video_paused(&mut self, is_my_video_paused: bool) -> &mut Self {
198 self.inner.is_my_video_paused = is_my_video_paused;
199 self
200 }
201
202
203 pub fn can_enable_video(&mut self, can_enable_video: bool) -> &mut Self {
204 self.inner.can_enable_video = can_enable_video;
205 self
206 }
207
208
209 pub fn mute_new_participants(&mut self, mute_new_participants: bool) -> &mut Self {
210 self.inner.mute_new_participants = mute_new_participants;
211 self
212 }
213
214
215 pub fn can_toggle_mute_new_participants(&mut self, can_toggle_mute_new_participants: bool) -> &mut Self {
216 self.inner.can_toggle_mute_new_participants = can_toggle_mute_new_participants;
217 self
218 }
219
220
221 pub fn record_duration(&mut self, record_duration: i64) -> &mut Self {
222 self.inner.record_duration = record_duration;
223 self
224 }
225
226
227 pub fn is_video_recorded(&mut self, is_video_recorded: bool) -> &mut Self {
228 self.inner.is_video_recorded = is_video_recorded;
229 self
230 }
231
232
233 pub fn duration(&mut self, duration: i64) -> &mut Self {
234 self.inner.duration = duration;
235 self
236 }
237
238}
239
240impl AsRef<GroupCall> for GroupCall {
241 fn as_ref(&self) -> &GroupCall { self }
242}
243
244impl AsRef<GroupCall> for RTDGroupCallBuilder {
245 fn as_ref(&self) -> &GroupCall { &self.inner }
246}
247
248
249