titanium_model/builder/
thread.rs1use crate::TitanString;
2
3#[derive(Debug, Clone, serde::Serialize, Default)]
5pub struct StartThread<'a> {
6 pub name: TitanString<'a>,
7 #[serde(skip_serializing_if = "Option::is_none")]
8 pub auto_archive_duration: Option<u32>,
9 #[serde(skip_serializing_if = "Option::is_none")]
10 pub type_: Option<u8>, #[serde(skip_serializing_if = "Option::is_none")]
12 pub invitable: Option<bool>,
13 #[serde(skip_serializing_if = "Option::is_none")]
14 pub rate_limit_per_user: Option<u32>,
15}
16
17#[derive(Debug, Clone)]
19#[must_use]
20pub struct StartThreadBuilder<'a> {
21 params: StartThread<'a>,
22}
23
24impl<'a> StartThreadBuilder<'a> {
25 pub fn new(name: impl Into<TitanString<'a>>) -> Self {
27 Self {
28 params: StartThread {
29 name: name.into(),
30 ..Default::default()
31 },
32 }
33 }
34
35 pub fn auto_archive_duration(mut self, duration: u32) -> Self {
37 self.params.auto_archive_duration = Some(duration);
38 self
39 }
40
41 pub fn kind(mut self, kind: u8) -> Self {
43 self.params.type_ = Some(kind);
44 self
45 }
46
47 pub fn invitable(mut self, invitable: bool) -> Self {
49 self.params.invitable = Some(invitable);
50 self
51 }
52
53 pub fn rate_limit_per_user(mut self, limit: u32) -> Self {
55 self.params.rate_limit_per_user = Some(limit);
56 self
57 }
58
59 #[must_use]
61 pub fn build(self) -> StartThread<'a> {
62 self.params
63 }
64}