Skip to content

Commit

Permalink
feat(http): add guild_scheduled_event_id to create_stage_instance (
Browse files Browse the repository at this point in the history
  • Loading branch information
suneettipirneni committed Nov 24, 2023
1 parent 742563f commit 2d8b170
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion twilight-http/src/request/channel/stage/create_stage_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ use serde::Serialize;
use std::future::IntoFuture;
use twilight_model::{
channel::{stage_instance::PrivacyLevel, StageInstance},
id::{marker::ChannelMarker, Id},
id::{
marker::{ChannelMarker, ScheduledEventMarker},
Id,
},
};
use twilight_validate::request::{stage_topic as validate_stage_topic, ValidationError};

#[derive(Serialize)]
struct CreateStageInstanceFields<'a> {
channel_id: Id<ChannelMarker>,
#[serde(skip_serializing_if = "Option::is_none")]
guild_scheduled_event_id: Option<Id<ScheduledEventMarker>>,
#[serde(skip_serializing_if = "Option::is_none")]
privacy_level: Option<PrivacyLevel>,
#[serde(skip_serializing_if = "Option::is_none")]
send_start_notification: Option<bool>,
Expand All @@ -43,6 +48,7 @@ impl<'a> CreateStageInstance<'a> {
Ok(Self {
fields: CreateStageInstanceFields {
channel_id,
guild_scheduled_event_id: None,
privacy_level: None,
send_start_notification: None,
topic,
Expand All @@ -51,6 +57,16 @@ impl<'a> CreateStageInstance<'a> {
})
}

/// Set the guild scheduled event associated with this stage instance.
pub const fn guild_scheduled_event_id(
mut self,
guild_scheduled_event_id: Id<ScheduledEventMarker>,
) -> Self {
self.fields.guild_scheduled_event_id = Some(guild_scheduled_event_id);

self
}

/// Set the [`PrivacyLevel`] of the instance.
pub const fn privacy_level(mut self, privacy_level: PrivacyLevel) -> Self {
self.fields.privacy_level = Some(privacy_level);
Expand Down

0 comments on commit 2d8b170

Please sign in to comment.