rust_tdlib/types/
group_call_video_source_group.rs1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct GroupCallVideoSourceGroup {
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 semantics: String,
17 #[serde(default)]
20 source_ids: Vec<i32>,
21}
22
23impl RObject for GroupCallVideoSourceGroup {
24 #[doc(hidden)]
25 fn extra(&self) -> Option<&str> {
26 self.extra.as_deref()
27 }
28 #[doc(hidden)]
29 fn client_id(&self) -> Option<i32> {
30 self.client_id
31 }
32}
33
34impl GroupCallVideoSourceGroup {
35 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
36 Ok(serde_json::from_str(json.as_ref())?)
37 }
38 pub fn builder() -> GroupCallVideoSourceGroupBuilder {
39 let mut inner = GroupCallVideoSourceGroup::default();
40 inner.extra = Some(Uuid::new_v4().to_string());
41
42 GroupCallVideoSourceGroupBuilder { inner }
43 }
44
45 pub fn semantics(&self) -> &String {
46 &self.semantics
47 }
48
49 pub fn source_ids(&self) -> &Vec<i32> {
50 &self.source_ids
51 }
52}
53
54#[doc(hidden)]
55pub struct GroupCallVideoSourceGroupBuilder {
56 inner: GroupCallVideoSourceGroup,
57}
58
59#[deprecated]
60pub type RTDGroupCallVideoSourceGroupBuilder = GroupCallVideoSourceGroupBuilder;
61
62impl GroupCallVideoSourceGroupBuilder {
63 pub fn build(&self) -> GroupCallVideoSourceGroup {
64 self.inner.clone()
65 }
66
67 pub fn semantics<T: AsRef<str>>(&mut self, semantics: T) -> &mut Self {
68 self.inner.semantics = semantics.as_ref().to_string();
69 self
70 }
71
72 pub fn source_ids(&mut self, source_ids: Vec<i32>) -> &mut Self {
73 self.inner.source_ids = source_ids;
74 self
75 }
76}
77
78impl AsRef<GroupCallVideoSourceGroup> for GroupCallVideoSourceGroup {
79 fn as_ref(&self) -> &GroupCallVideoSourceGroup {
80 self
81 }
82}
83
84impl AsRef<GroupCallVideoSourceGroup> for GroupCallVideoSourceGroupBuilder {
85 fn as_ref(&self) -> &GroupCallVideoSourceGroup {
86 &self.inner
87 }
88}