rust_tdlib/types/
set_group_call_participant_is_speaking.rs1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct SetGroupCallParticipantIsSpeaking {
8 #[doc(hidden)]
9 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
10 extra: Option<String>,
11 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
12 client_id: Option<i32>,
13 #[serde(default)]
16 group_call_id: i32,
17 #[serde(default)]
20 audio_source: i32,
21 #[serde(default)]
24 is_speaking: bool,
25
26 #[serde(rename(serialize = "@type"))]
27 td_type: String,
28}
29
30impl RObject for SetGroupCallParticipantIsSpeaking {
31 #[doc(hidden)]
32 fn extra(&self) -> Option<&str> {
33 self.extra.as_deref()
34 }
35 #[doc(hidden)]
36 fn client_id(&self) -> Option<i32> {
37 self.client_id
38 }
39}
40
41impl RFunction for SetGroupCallParticipantIsSpeaking {}
42
43impl SetGroupCallParticipantIsSpeaking {
44 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
45 Ok(serde_json::from_str(json.as_ref())?)
46 }
47 pub fn builder() -> SetGroupCallParticipantIsSpeakingBuilder {
48 let mut inner = SetGroupCallParticipantIsSpeaking::default();
49 inner.extra = Some(Uuid::new_v4().to_string());
50
51 inner.td_type = "setGroupCallParticipantIsSpeaking".to_string();
52
53 SetGroupCallParticipantIsSpeakingBuilder { inner }
54 }
55
56 pub fn group_call_id(&self) -> i32 {
57 self.group_call_id
58 }
59
60 pub fn audio_source(&self) -> i32 {
61 self.audio_source
62 }
63
64 pub fn is_speaking(&self) -> bool {
65 self.is_speaking
66 }
67}
68
69#[doc(hidden)]
70pub struct SetGroupCallParticipantIsSpeakingBuilder {
71 inner: SetGroupCallParticipantIsSpeaking,
72}
73
74#[deprecated]
75pub type RTDSetGroupCallParticipantIsSpeakingBuilder = SetGroupCallParticipantIsSpeakingBuilder;
76
77impl SetGroupCallParticipantIsSpeakingBuilder {
78 pub fn build(&self) -> SetGroupCallParticipantIsSpeaking {
79 self.inner.clone()
80 }
81
82 pub fn group_call_id(&mut self, group_call_id: i32) -> &mut Self {
83 self.inner.group_call_id = group_call_id;
84 self
85 }
86
87 pub fn audio_source(&mut self, audio_source: i32) -> &mut Self {
88 self.inner.audio_source = audio_source;
89 self
90 }
91
92 pub fn is_speaking(&mut self, is_speaking: bool) -> &mut Self {
93 self.inner.is_speaking = is_speaking;
94 self
95 }
96}
97
98impl AsRef<SetGroupCallParticipantIsSpeaking> for SetGroupCallParticipantIsSpeaking {
99 fn as_ref(&self) -> &SetGroupCallParticipantIsSpeaking {
100 self
101 }
102}
103
104impl AsRef<SetGroupCallParticipantIsSpeaking> for SetGroupCallParticipantIsSpeakingBuilder {
105 fn as_ref(&self) -> &SetGroupCallParticipantIsSpeaking {
106 &self.inner
107 }
108}