-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds support to creating, editing, getting, and deleting stage instances. See discord/discord-api-docs#2898 and discord/discord-api-docs#2933
- Loading branch information
1 parent
87564a4
commit 3e6d131
Showing
12 changed files
with
416 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::collections::HashMap; | ||
|
||
use serde_json::Value; | ||
|
||
use crate::internal::prelude::*; | ||
|
||
/// Creates a [`StageInstance`]. | ||
/// | ||
/// [`StageInstance`]: crate::model::channel::StageInstance | ||
#[derive(Clone, Debug, Default)] | ||
pub struct CreateStageInstance(pub HashMap<&'static str, Value>); | ||
|
||
impl CreateStageInstance { | ||
// Sets the stage channel id of the stage channel instance. | ||
pub fn channel_id(&mut self, id: u64) -> &mut Self { | ||
self.0.insert("channel_id", Value::Number(Number::from(id))); | ||
self | ||
} | ||
|
||
/// Sets the topic of the stage channel instance. | ||
pub fn topic<D: ToString>(&mut self, topic: D) -> &mut Self { | ||
self.0.insert("topic", Value::String(topic.to_string())); | ||
|
||
self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::collections::HashMap; | ||
|
||
use serde_json::Value; | ||
|
||
/// Edits a [`StageInstance`]. | ||
/// | ||
/// [`StageInstance`]: crate::model::channel::StageInstance | ||
#[derive(Clone, Debug, Default)] | ||
pub struct EditStageInstance(pub HashMap<&'static str, Value>); | ||
|
||
impl EditStageInstance { | ||
/// Sets the topic of the stage channel instance. | ||
pub fn topic<D: ToString>(&mut self, topic: D) -> &mut Self { | ||
self.0.insert("topic", Value::String(topic.to_string())); | ||
|
||
self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.