titanium_model/builder/
stage.rs

1/// Payload for creating a stage instance.
2#[derive(Debug, Clone, serde::Serialize, Default)]
3pub struct CreateStageInstance {
4    pub channel_id: crate::Snowflake,
5    pub topic: String,
6    #[serde(skip_serializing_if = "Option::is_none")]
7    pub privacy_level: Option<crate::voice::StagePrivacyLevel>,
8    #[serde(skip_serializing_if = "Option::is_none")]
9    pub send_start_notification: Option<bool>,
10}
11
12/// Builder for creating a Stage Instance.
13#[derive(Debug, Clone)]
14pub struct StageInstanceBuilder {
15    params: CreateStageInstance,
16}
17
18impl StageInstanceBuilder {
19    /// Create a new `StageInstanceBuilder`.
20    pub fn new(channel_id: impl Into<crate::Snowflake>, topic: impl Into<String>) -> Self {
21        Self {
22            params: CreateStageInstance {
23                channel_id: channel_id.into(),
24                topic: topic.into(),
25                privacy_level: None,
26                send_start_notification: None,
27            },
28        }
29    }
30
31    /// Set privacy level.
32    #[inline]
33    #[must_use]
34    pub fn privacy_level(mut self, level: crate::voice::StagePrivacyLevel) -> Self {
35        self.params.privacy_level = Some(level);
36        self
37    }
38
39    /// Set send start notification.
40    #[inline]
41    #[must_use]
42    pub fn send_start_notification(mut self, send: bool) -> Self {
43        self.params.send_start_notification = Some(send);
44        self
45    }
46
47    /// Build the `CreateStageInstance` payload.
48    #[inline]
49    #[must_use]
50    pub fn build(self) -> CreateStageInstance {
51        self.params
52    }
53}