start working on channel create

This commit is contained in:
bitfl0wer 2023-05-22 23:22:34 +02:00
parent f599a3f229
commit 69425f18ac
2 changed files with 38 additions and 1 deletions

View File

@ -5,7 +5,7 @@ use crate::api::schemas;
use crate::api::types;
use crate::errors::InstanceServerError;
impl<'a> types::Guild {
impl types::Guild {
/// Creates a new guild with the given parameters.
///
/// # Arguments
@ -113,4 +113,16 @@ impl<'a> types::Guild {
None
}
}
pub async fn create_channel() {}
}
impl types::Channel {
pub async fn create(
token: &str,
url_api: &str,
guild_id: &str,
schema: schemas::ChannelCreateSchema,
) {
}
}

View File

@ -314,6 +314,31 @@ pub struct UserModifySchema {
pub discriminator: Option<i16>,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
// TODO: Implement in polyphony/types
pub struct ChannelCreateSchema {
pub name: String,
#[serde(rename = "type")]
pub channel_type: Option<u8>,
pub topic: Option<String>,
pub icon: Option<String>,
pub bitrate: Option<i32>,
pub user_limit: Option<i32>,
pub rate_limit_per_user: Option<i32>,
pub position: Option<i32>,
pub permission_overwrites: Option<Vec<crate::api::types::PermissionOverwrite>>,
pub parent_id: Option<String>,
pub id: Option<String>,
pub nsfw: Option<bool>,
pub rtc_region: Option<String>,
pub default_auto_archive_duration: Option<i32>,
pub default_reaction_emoji: Option<String>,
pub flags: Option<i32>,
pub default_thread_rate_limit_per_user: Option<i32>,
pub video_quality_mode: Option<i32>,
}
// I know that some of these tests are... really really basic and unneccessary, but sometimes, I
// just feel like writing tests, so there you go :) -@bitfl0wer
#[cfg(test)]