Make channel_type in ChannelCreateSchema of type enum "ChannelType"
This commit is contained in:
parent
500ab0e3d0
commit
9ac5925bf9
|
@ -176,10 +176,22 @@ pub struct DefaultReaction {
|
||||||
pub emoji_name: Option<String>,
|
pub emoji_name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone, Copy, Debug, Serialize_repr, Deserialize_repr, PartialEq, Eq, Hash)]
|
#[derive(
|
||||||
|
Default,
|
||||||
|
Clone,
|
||||||
|
Copy,
|
||||||
|
Debug,
|
||||||
|
Serialize_repr,
|
||||||
|
Deserialize_repr,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
PartialOrd,
|
||||||
|
Ord,
|
||||||
|
)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
#[repr(i32)]
|
#[repr(u32)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/channel#channel-type>
|
/// See <https://discord-userdoccers.vercel.app/resources/channel#channel-type>
|
||||||
pub enum ChannelType {
|
pub enum ChannelType {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::types::ChannelType;
|
||||||
use crate::types::{entities::PermissionOverwrite, Snowflake};
|
use crate::types::{entities::PermissionOverwrite, Snowflake};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, PartialEq, PartialOrd)]
|
#[derive(Debug, Deserialize, Serialize, Default, PartialEq, PartialOrd)]
|
||||||
|
@ -8,7 +9,7 @@ use crate::types::{entities::PermissionOverwrite, Snowflake};
|
||||||
pub struct ChannelCreateSchema {
|
pub struct ChannelCreateSchema {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub channel_type: Option<u8>,
|
pub channel_type: Option<ChannelType>,
|
||||||
pub topic: Option<String>,
|
pub topic: Option<String>,
|
||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
pub bitrate: Option<i32>,
|
pub bitrate: Option<i32>,
|
||||||
|
|
|
@ -73,7 +73,7 @@ pub(crate) async fn setup() -> TestBundle {
|
||||||
};
|
};
|
||||||
let channel_create_schema = ChannelCreateSchema {
|
let channel_create_schema = ChannelCreateSchema {
|
||||||
name: "testchannel".to_string(),
|
name: "testchannel".to_string(),
|
||||||
channel_type: Some(0),
|
channel_type: Some(chorus::types::ChannelType::GuildText),
|
||||||
topic: None,
|
topic: None,
|
||||||
icon: None,
|
icon: None,
|
||||||
bitrate: None,
|
bitrate: None,
|
||||||
|
|
Loading…
Reference in New Issue