Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(http): add guild_scheduled_event_id to create_stage_instance #2283

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> {
})
}

/// Guild scheduled event associated with this Stage instance.
suneettipirneni marked this conversation as resolved.
Show resolved Hide resolved
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