Move role schemas to own file

This commit is contained in:
bitfl0wer 2023-06-09 20:47:45 +02:00
parent d475584fea
commit 486e210062
No known key found for this signature in database
GPG Key ID: 84BBB60DF895ABF2
3 changed files with 28 additions and 24 deletions

View File

@ -14,27 +14,3 @@ pub struct GuildCreateSchema {
pub system_channel_id: Option<String>,
pub rules_channel_id: Option<String>,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
/// Represents the schema which needs to be sent to create or modify a Role.
/// See: [https://docs.spacebar.chat/routes/#cmp--schemas-rolemodifyschema](https://docs.spacebar.chat/routes/#cmp--schemas-rolemodifyschema)
pub struct RoleCreateModifySchema {
pub name: Option<String>,
pub permissions: Option<String>,
pub color: Option<u32>,
pub hoist: Option<bool>,
pub icon: Option<Vec<u8>>,
pub unicode_emoji: Option<String>,
pub mentionable: Option<bool>,
pub position: Option<i32>,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
/// Represents the schema which needs to be sent to update a roles' position.
/// See: [https://docs.spacebar.chat/routes/#cmp--schemas-rolepositionupdateschema](https://docs.spacebar.chat/routes/#cmp--schemas-rolepositionupdateschema)
pub struct RolePositionUpdateSchema {
pub id: Snowflake,
pub position: i32,
}

View File

@ -3,6 +3,7 @@ mod auth;
mod channel;
mod guild;
mod message;
mod role;
mod user;
pub use apierror::*;
@ -10,6 +11,7 @@ pub use auth::*;
pub use channel::*;
pub use guild::*;
pub use message::*;
pub use role::*;
pub use user::*;
#[cfg(test)]

26
src/types/schema/role.rs Normal file
View File

@ -0,0 +1,26 @@
use crate::types::Snowflake;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
/// Represents the schema which needs to be sent to create or modify a Role.
/// See: [https://docs.spacebar.chat/routes/#cmp--schemas-rolemodifyschema](https://docs.spacebar.chat/routes/#cmp--schemas-rolemodifyschema)
pub struct RoleCreateModifySchema {
pub name: Option<String>,
pub permissions: Option<String>,
pub color: Option<u32>,
pub hoist: Option<bool>,
pub icon: Option<Vec<u8>>,
pub unicode_emoji: Option<String>,
pub mentionable: Option<bool>,
pub position: Option<i32>,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
/// Represents the schema which needs to be sent to update a roles' position.
/// See: [https://docs.spacebar.chat/routes/#cmp--schemas-rolepositionupdateschema](https://docs.spacebar.chat/routes/#cmp--schemas-rolepositionupdateschema)
pub struct RolePositionUpdateSchema {
pub id: Snowflake,
pub position: i32,
}