Extract private fields to symfonia, type lock fields
This commit is contained in:
parent
4164d0c8cf
commit
f642cb05b0
|
@ -22,9 +22,6 @@ pub struct Application {
|
|||
pub verify_key: String,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub owner: User,
|
||||
#[cfg(feature = "sqlx")]
|
||||
#[serde(skip)]
|
||||
pub owner_id: Snowflake,
|
||||
pub flags: u64,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub redirect_uris: Option<sqlx::types::Json<Vec<String>>>,
|
||||
|
@ -38,11 +35,6 @@ pub struct Application {
|
|||
pub integration_require_code_grant: bool,
|
||||
pub discoverability_state: i64,
|
||||
pub discovery_eligibility_flags: i64,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub bot_user: Option<User>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
#[serde(skip)]
|
||||
pub bot_user_id: Option<Snowflake>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub tags: Option<sqlx::types::Json<Vec<String>>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
|
@ -56,9 +48,6 @@ pub struct Application {
|
|||
pub privacy_policy_url: Option<String>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub team: Option<Team>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
#[serde(skip)]
|
||||
pub team_id: Option<Snowflake>,
|
||||
}
|
||||
|
||||
impl Application {
|
||||
|
|
|
@ -15,8 +15,6 @@ pub struct Attachment {
|
|||
pub proxy_url: String,
|
||||
pub height: Option<u64>,
|
||||
pub width: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub message_id: Option<Snowflake>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub message: Option<Message>,
|
||||
pub ephemeral: Option<bool>,
|
||||
|
|
|
@ -30,8 +30,9 @@ pub struct Channel {
|
|||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub recipients: Option<Vec<User>>,
|
||||
pub icon: Option<String>,
|
||||
pub owner_id: Option<String>,
|
||||
pub application_id: Option<String>,
|
||||
pub owner_id: Option<Snowflake>,
|
||||
pub application_id: Option<Snowflake>,
|
||||
pub managed: Option<bool>,
|
||||
pub parent_id: Option<String>,
|
||||
pub last_pin_timestamp: Option<String>,
|
||||
pub rtc_region: Option<String>,
|
||||
|
|
|
@ -12,14 +12,6 @@ pub struct Emoji {
|
|||
pub roles: Option<sqlx::types::Json<Vec<Snowflake>>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub roles: Option<Vec<Snowflake>>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
#[serde(skip)]
|
||||
pub guild_id: Snowflake,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub guild: Guild,
|
||||
#[cfg(feature = "sqlx")]
|
||||
#[serde(skip)]
|
||||
pub user_id: Option<Snowflake>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub user: Option<User>,
|
||||
pub require_colons: Option<bool>,
|
||||
|
|
|
@ -8,7 +8,8 @@ use crate::types::{
|
|||
};
|
||||
|
||||
/// See https://discord.com/developers/docs/resources/guild
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct Guild {
|
||||
pub id: Snowflake,
|
||||
pub name: String,
|
||||
|
@ -16,24 +17,27 @@ pub struct Guild {
|
|||
pub icon_hash: Option<String>,
|
||||
pub splash: Option<String>,
|
||||
pub discovery_splash: Option<String>,
|
||||
pub owner: Option<User>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub owner: bool, // True if requesting user is owner
|
||||
pub owner_id: Option<Snowflake>,
|
||||
pub permissions: Option<String>,
|
||||
pub afk_channel_id: Option<Snowflake>,
|
||||
pub afk_timeout: Option<u8>,
|
||||
pub widget_enabled: Option<bool>,
|
||||
pub widget_channel_id: Option<Snowflake>,
|
||||
pub widget_channel: Option<Channel>,
|
||||
pub verification_level: Option<u8>,
|
||||
pub default_message_notifications: Option<u8>,
|
||||
pub explicit_content_filter: Option<u8>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub roles: Vec<RoleObject>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub emojis: Vec<Emoji>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub features: Vec<String>,
|
||||
pub application_id: Option<String>,
|
||||
pub system_channel_id: Option<Snowflake>,
|
||||
pub system_channel_flags: Option<u8>,
|
||||
pub rules_channel_id: Option<String>,
|
||||
pub rules_channel_id: Option<Snowflake>,
|
||||
pub rules_channel: Option<String>,
|
||||
pub max_presences: Option<u64>,
|
||||
pub max_members: Option<u64>,
|
||||
|
@ -44,47 +48,48 @@ pub struct Guild {
|
|||
pub premium_subscription_count: Option<u64>,
|
||||
pub preferred_locale: Option<String>,
|
||||
pub public_updates_channel_id: Option<Snowflake>,
|
||||
pub public_updates_channel: Option<Channel>,
|
||||
pub max_video_channel_users: Option<u8>,
|
||||
pub max_stage_video_channel_users: Option<u8>,
|
||||
pub approximate_member_count: Option<u64>,
|
||||
pub approximate_presence_count: Option<u64>,
|
||||
pub member_count: Option<u64>,
|
||||
pub presence_count: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub welcome_screen: Option<sqlx::types::Json<WelcomeScreenObject>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub welcome_screen: Option<WelcomeScreenObject>,
|
||||
pub nsfw_level: u8,
|
||||
pub nsfw: bool,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub stickers: Option<Vec<Sticker>>,
|
||||
pub premium_progress_bar_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub joined_at: String,
|
||||
pub afk_channel: Option<Channel>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub bans: Option<Vec<GuildBan>>,
|
||||
pub primary_category_id: Option<Snowflake>,
|
||||
pub large: Option<bool>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub channels: Option<Vec<Channel>>,
|
||||
pub template_id: Option<Snowflake>,
|
||||
pub template: Option<GuildTemplate>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub invites: Option<Vec<GuildInvite>>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub voice_states: Option<Vec<VoiceState>>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub webhooks: Option<Vec<Webhook>>,
|
||||
pub mfa_level: Option<u8>,
|
||||
pub region: Option<String>,
|
||||
pub unavailable: bool,
|
||||
pub parent: Option<String>,
|
||||
}
|
||||
|
||||
/// See https://docs.spacebar.chat/routes/#get-/guilds/-guild_id-/bans/-user-
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct GuildBan {
|
||||
pub id: Snowflake,
|
||||
pub user_id: Snowflake,
|
||||
pub guild_id: Snowflake,
|
||||
pub executor_id: Snowflake,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
/// See https://docs.spacebar.chat/routes/#cmp--schemas-invite
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct GuildInvite {
|
||||
pub code: String,
|
||||
pub temporary: Option<bool>,
|
||||
|
|
|
@ -7,6 +7,7 @@ use crate::types::{
|
|||
};
|
||||
|
||||
#[derive(Default, Debug, Deserialize, Serialize, Clone)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
/// See https://discord.com/developers/docs/resources/guild#integration-object-integration-structure
|
||||
pub struct Integration {
|
||||
pub id: Snowflake,
|
||||
|
@ -19,11 +20,14 @@ pub struct Integration {
|
|||
pub enabled_emoticons: Option<bool>,
|
||||
pub expire_behaviour: Option<u8>,
|
||||
pub expire_grace_period: Option<u16>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub user: Option<User>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub account: IntegrationAccount,
|
||||
pub synced_at: Option<DateTime<Utc>>,
|
||||
pub subscriber_count: Option<f64>,
|
||||
pub revoked: Option<bool>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub application: Option<Application>,
|
||||
pub scopes: Option<Vec<String>>,
|
||||
}
|
||||
|
|
|
@ -8,43 +8,62 @@ use crate::types::{
|
|||
utils::Snowflake,
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct Message {
|
||||
id: Snowflake,
|
||||
pub id: Snowflake,
|
||||
pub channel_id: Snowflake,
|
||||
author: User,
|
||||
content: String,
|
||||
timestamp: String,
|
||||
edited_timestamp: Option<String>,
|
||||
tts: bool,
|
||||
mention_everyone: bool,
|
||||
mentions: Vec<User>,
|
||||
mention_roles: Vec<String>,
|
||||
mention_channels: Option<Vec<ChannelMention>>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub author: User,
|
||||
pub content: String,
|
||||
pub timestamp: String,
|
||||
pub edited_timestamp: Option<String>,
|
||||
pub tts: bool,
|
||||
pub mention_everyone: bool,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub mentions: Vec<User>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub mention_roles: Vec<Snowflake>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub mention_channels: Option<Vec<ChannelMention>>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub attachments: Vec<Attachment>,
|
||||
embeds: Vec<Embed>,
|
||||
reactions: Option<Vec<Reaction>>,
|
||||
nonce: Option<serde_json::Value>,
|
||||
pinned: bool,
|
||||
webhook_id: Option<String>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub embeds: Vec<sqlx::types::Json<Embed>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub embeds: Vec<Embed>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub reactions: Option<sqlx::types::Json<Vec<Reaction>>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub reactions: Option<Vec<Reaction>>,
|
||||
pub nonce: Option<serde_json::Value>,
|
||||
pub pinned: bool,
|
||||
pub webhook_id: Option<Snowflake>,
|
||||
#[serde(rename = "type")]
|
||||
message_type: i32,
|
||||
activity: Option<MessageActivity>,
|
||||
application: Option<Application>,
|
||||
application_id: Option<String>,
|
||||
message_reference: Option<MessageReference>,
|
||||
flags: Option<i32>,
|
||||
referenced_message: Option<Box<Message>>,
|
||||
interaction: Option<MessageInteraction>,
|
||||
thread: Option<Channel>,
|
||||
components: Option<Vec<Component>>,
|
||||
sticker_items: Option<Vec<StickerItem>>,
|
||||
stickers: Option<Vec<Sticker>>,
|
||||
position: Option<i32>,
|
||||
role_subscription_data: Option<RoleSubscriptionData>,
|
||||
pub message_type: i32,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub activity: Option<sqlx::types::Json<MessageActivity>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub activity: Option<MessageActivity>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub application: Option<Application>,
|
||||
pub application_id: Option<Snowflake>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub message_reference: Option<sqlx::types::Json<MessageReference>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub message_reference: Option<MessageReference>,
|
||||
pub flags: Option<u64>,
|
||||
pub referenced_message: Option<Box<Message>>,
|
||||
pub interaction: Option<MessageInteraction>,
|
||||
pub thread: Option<Channel>,
|
||||
pub components: Option<Vec<Component>>,
|
||||
pub sticker_items: Option<Vec<StickerItem>>,
|
||||
pub stickers: Option<Vec<Sticker>>,
|
||||
pub position: Option<i32>,
|
||||
pub role_subscription_data: Option<RoleSubscriptionData>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct MessageReference {
|
||||
pub message_id: Snowflake,
|
||||
pub channel_id: Snowflake,
|
||||
|
@ -52,7 +71,7 @@ pub struct MessageReference {
|
|||
pub fail_if_not_exists: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
pub struct MessageInteraction {
|
||||
pub id: Snowflake,
|
||||
#[serde(rename = "type")]
|
||||
|
@ -62,7 +81,7 @@ pub struct MessageInteraction {
|
|||
pub member: Option<GuildMember>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct AllowedMention {
|
||||
parse: Vec<AllowedMentionType>,
|
||||
roles: Vec<Snowflake>,
|
||||
|
@ -70,7 +89,7 @@ pub struct AllowedMention {
|
|||
replied_user: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum AllowedMentionType {
|
||||
Roles,
|
||||
|
@ -78,16 +97,16 @@ pub enum AllowedMentionType {
|
|||
Everyone,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct ChannelMention {
|
||||
id: Snowflake,
|
||||
guild_id: Snowflake,
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ChannelMention {
|
||||
pub id: Snowflake,
|
||||
pub guild_id: Snowflake,
|
||||
#[serde(rename = "type")]
|
||||
channel_type: i32,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct Embed {
|
||||
title: Option<String>,
|
||||
#[serde(rename = "type")]
|
||||
|
@ -105,30 +124,30 @@ pub struct Embed {
|
|||
fields: Option<Vec<EmbedField>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct EmbedFooter {
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct EmbedFooter {
|
||||
text: String,
|
||||
icon_url: Option<String>,
|
||||
proxy_icon_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct EmbedImage {
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct EmbedImage {
|
||||
url: String,
|
||||
proxy_url: String,
|
||||
height: Option<i32>,
|
||||
width: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct EmbedThumbnail {
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct EmbedThumbnail {
|
||||
url: String,
|
||||
proxy_url: Option<String>,
|
||||
height: Option<i32>,
|
||||
width: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
struct EmbedVideo {
|
||||
url: Option<String>,
|
||||
proxy_url: Option<String>,
|
||||
|
@ -136,29 +155,29 @@ struct EmbedVideo {
|
|||
width: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct EmbedProvider {
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct EmbedProvider {
|
||||
name: Option<String>,
|
||||
url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct EmbedAuthor {
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct EmbedAuthor {
|
||||
name: String,
|
||||
url: Option<String>,
|
||||
icon_url: Option<String>,
|
||||
proxy_icon_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
|
||||
struct EmbedField {
|
||||
pub struct EmbedField {
|
||||
name: String,
|
||||
value: String,
|
||||
inline: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct Reaction {
|
||||
pub count: i32,
|
||||
pub me: bool,
|
||||
|
@ -177,7 +196,7 @@ pub enum Component {
|
|||
ChannelSelect = 8,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct MessageActivity {
|
||||
#[serde(rename = "type")]
|
||||
pub activity_type: i64,
|
||||
|
|
|
@ -2,7 +2,8 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use crate::types::utils::Snowflake;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
/// See https://discord.com/developers/docs/topics/permissions#role-object
|
||||
pub struct RoleObject {
|
||||
pub id: Snowflake,
|
||||
|
@ -19,7 +20,7 @@ pub struct RoleObject {
|
|||
//pub tags: Option<RoleTags>
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct RoleSubscriptionData {
|
||||
pub role_subscription_listing_id: Snowflake,
|
||||
pub tier_name: String,
|
||||
|
|
|
@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::types::utils::Snowflake;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct SecurityKey {
|
||||
pub id: String,
|
||||
pub user_id: String,
|
||||
|
|
|
@ -2,7 +2,8 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use crate::types::{entities::User, utils::Snowflake};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct Sticker {
|
||||
pub id: Snowflake,
|
||||
pub pack_id: Option<Snowflake>,
|
||||
|
@ -14,12 +15,13 @@ pub struct Sticker {
|
|||
pub sticker_type: u8,
|
||||
pub format_type: u8,
|
||||
pub available: Option<bool>,
|
||||
pub guild_id: Option<u64>,
|
||||
pub guild_id: Option<Snowflake>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub user: Option<User>,
|
||||
pub sort_value: Option<u8>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct StickerItem {
|
||||
pub id: Snowflake,
|
||||
pub name: String,
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::entities::User;
|
||||
use crate::types::Snowflake;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct Team {
|
||||
pub icon: Option<String>,
|
||||
pub id: u64,
|
||||
pub id: Snowflake,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub members: Vec<TeamMember>,
|
||||
pub name: String,
|
||||
pub owner_user_id: u64,
|
||||
pub owner_user_id: Snowflake,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
|
||||
pub struct TeamMember {
|
||||
pub membership_state: u8,
|
||||
pub permissions: Vec<String>,
|
||||
pub team_id: u64,
|
||||
pub team_id: Snowflake,
|
||||
pub user: User,
|
||||
}
|
||||
|
|
|
@ -7,18 +7,21 @@ use crate::types::{
|
|||
};
|
||||
|
||||
/// See https://docs.spacebar.chat/routes/#cmp--schemas-template
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct GuildTemplate {
|
||||
pub code: String,
|
||||
pub name: String,
|
||||
pub description: Option<String>,
|
||||
pub usage_count: Option<u64>,
|
||||
pub creator_id: Snowflake,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub creator: User,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub source_guild_id: String,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub source_guild: Vec<Guild>, // Unsure how a {recursive: Guild} looks like, might be a Vec?
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub serialized_source_guild: Vec<Guild>,
|
||||
id: Snowflake,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Map, Value};
|
||||
#[cfg(feature = "sqlx")]
|
||||
use sqlx::{FromRow, Type};
|
||||
|
||||
use crate::types::{
|
||||
errors::Error,
|
||||
|
@ -10,7 +8,7 @@ use crate::types::{
|
|||
};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "sqlx", derive(Type))]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
pub struct UserData {
|
||||
pub valid_tokens_since: DateTime<Utc>,
|
||||
pub hash: Option<String>,
|
||||
|
@ -23,32 +21,34 @@ impl User {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct User {
|
||||
pub id: Snowflake,
|
||||
username: String,
|
||||
discriminator: String,
|
||||
avatar: Option<String>,
|
||||
bot: bool,
|
||||
system: Option<bool>,
|
||||
mfa_enabled: Option<bool>,
|
||||
accent_color: Option<u8>,
|
||||
locale: Option<String>,
|
||||
verified: Option<bool>,
|
||||
email: Option<String>,
|
||||
flags: String,
|
||||
premium_since: Option<DateTime<Utc>>,
|
||||
premium_type: u8,
|
||||
pronouns: Option<String>,
|
||||
public_flags: Option<u16>,
|
||||
banner: Option<String>,
|
||||
bio: String,
|
||||
theme_colors: Option<Vec<u8>>,
|
||||
phone: Option<String>,
|
||||
nsfw_allowed: bool,
|
||||
premium: bool,
|
||||
purchased_flags: i32,
|
||||
premium_usage_flags: i32,
|
||||
disabled: Option<bool>,
|
||||
pub username: String,
|
||||
pub discriminator: String,
|
||||
pub avatar: Option<String>,
|
||||
pub bot: bool,
|
||||
pub system: Option<bool>,
|
||||
pub mfa_enabled: Option<bool>,
|
||||
pub accent_color: Option<u8>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(default))]
|
||||
pub locale: Option<String>,
|
||||
pub verified: Option<bool>,
|
||||
pub email: Option<String>,
|
||||
pub flags: String,
|
||||
pub premium_since: Option<DateTime<Utc>>,
|
||||
pub premium_type: u8,
|
||||
pub pronouns: Option<String>,
|
||||
pub public_flags: Option<u16>,
|
||||
pub banner: Option<String>,
|
||||
pub bio: String,
|
||||
pub theme_colors: Option<Vec<u8>>,
|
||||
pub phone: Option<String>,
|
||||
pub nsfw_allowed: bool,
|
||||
pub premium: bool,
|
||||
pub purchased_flags: i32,
|
||||
pub premium_usage_flags: i32,
|
||||
pub disabled: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -92,7 +92,7 @@ const CUSTOM_USER_FLAG_OFFSET: u64 = 1 << 32;
|
|||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "sqlx", derive(Type))]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
pub struct UserFlags: u64 {
|
||||
const DISCORD_EMPLOYEE = 1 << 0;
|
||||
const PARTNERED_SERVER_OWNER = 1 << 1;
|
||||
|
|
|
@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::types::utils::Snowflake;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum UserStatus {
|
||||
#[default]
|
||||
|
@ -23,6 +24,7 @@ pub enum UserTheme {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct UserSettings {
|
||||
pub afk_timeout: u16,
|
||||
pub allow_accessibility_detection: bool,
|
||||
|
@ -30,6 +32,9 @@ pub struct UserSettings {
|
|||
pub animate_stickers: u8,
|
||||
pub contact_sync_enabled: bool,
|
||||
pub convert_emoticons: bool,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub custom_status: Option<sqlx::types::Json<CustomStatus>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub custom_status: Option<CustomStatus>,
|
||||
pub default_guilds_restricted: bool,
|
||||
pub detect_platform_accounts: bool,
|
||||
|
@ -37,10 +42,19 @@ pub struct UserSettings {
|
|||
pub disable_games_tab: bool,
|
||||
pub enable_tts_command: bool,
|
||||
pub explicit_content_filter: u8,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub friend_source_flags: sqlx::types::Json<FriendSourceFlags>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub friend_source_flags: FriendSourceFlags,
|
||||
pub gateway_connected: bool,
|
||||
pub gif_auto_play: bool,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub guild_folders: sqlx::types::Json<Vec<GuildFolder>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub guild_folders: Vec<GuildFolder>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub guild_positions: sqlx::types::Json<Vec<String>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub guild_positions: Vec<String>,
|
||||
pub inline_attachment_media: bool,
|
||||
pub inline_embed_media: bool,
|
||||
|
@ -49,6 +63,9 @@ pub struct UserSettings {
|
|||
pub native_phone_integration_enabled: bool,
|
||||
pub render_embeds: bool,
|
||||
pub render_reactions: bool,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub restricted_guilds: sqlx::types::Json<Vec<String>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub restricted_guilds: Vec<String>,
|
||||
pub show_current_game: bool,
|
||||
pub status: UserStatus,
|
||||
|
@ -73,11 +90,11 @@ impl Default for UserSettings {
|
|||
disable_games_tab: true,
|
||||
enable_tts_command: false,
|
||||
explicit_content_filter: 0,
|
||||
friend_source_flags: FriendSourceFlags::default(),
|
||||
friend_source_flags: Default::default(),
|
||||
gateway_connected: false,
|
||||
gif_auto_play: false,
|
||||
guild_folders: Vec::new(),
|
||||
guild_positions: Vec::new(),
|
||||
guild_folders: Default::default(),
|
||||
guild_positions: Default::default(),
|
||||
inline_attachment_media: true,
|
||||
inline_embed_media: true,
|
||||
locale: "en-US".to_string(),
|
||||
|
@ -85,7 +102,7 @@ impl Default for UserSettings {
|
|||
native_phone_integration_enabled: true,
|
||||
render_embeds: true,
|
||||
render_reactions: true,
|
||||
restricted_guilds: Vec::new(),
|
||||
restricted_guilds: Default::default(),
|
||||
show_current_game: true,
|
||||
status: UserStatus::Online,
|
||||
stream_notifications_enabled: false,
|
||||
|
@ -96,6 +113,7 @@ impl Default for UserSettings {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct CustomStatus {
|
||||
pub emoji_id: Option<String>,
|
||||
pub emoji_name: Option<String>,
|
||||
|
|
|
@ -7,17 +7,14 @@ use crate::types::{
|
|||
};
|
||||
|
||||
/// See https://docs.spacebar.chat/routes/#cmp--schemas-voicestate
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct VoiceState {
|
||||
pub guild_id: Snowflake,
|
||||
pub guild: Option<Guild>,
|
||||
pub channel_id: Snowflake,
|
||||
pub channel: Option<Channel>,
|
||||
pub user_id: Snowflake,
|
||||
pub user: Option<User>,
|
||||
pub member: Option<GuildMember>,
|
||||
pub session_id: Snowflake,
|
||||
pub token: String,
|
||||
pub deaf: bool,
|
||||
pub mute: bool,
|
||||
pub self_deaf: bool,
|
||||
|
@ -26,5 +23,4 @@ pub struct VoiceState {
|
|||
pub self_video: bool,
|
||||
pub suppress: bool,
|
||||
pub request_to_speak_timestamp: Option<DateTime<Utc>>,
|
||||
pub id: Snowflake,
|
||||
}
|
||||
|
|
|
@ -6,27 +6,24 @@ use crate::types::{
|
|||
};
|
||||
|
||||
/// See https://docs.spacebar.chat/routes/#cmp--schemas-webhook
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct Webhook {
|
||||
pub id: Snowflake,
|
||||
#[serde(rename = "type")]
|
||||
pub webhook_type: i32,
|
||||
pub name: String,
|
||||
pub avatar: String,
|
||||
pub token: String,
|
||||
pub guild_id: Snowflake,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub guild: Option<Guild>,
|
||||
pub channel_id: Snowflake,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub channel: Option<Channel>,
|
||||
pub application_id: Snowflake,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub application: Option<Application>,
|
||||
pub user_id: Snowflake,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub user: Option<User>,
|
||||
pub source_guild_id: Snowflake,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub source_guild: Option<Guild>,
|
||||
pub id: Snowflake,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub url: Option<String>,
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
use crate::types::utils::Snowflake;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
pub struct WelcomeScreenObject {
|
||||
pub enabled: bool,
|
||||
pub description: Option<String>,
|
||||
pub welcome_channels: Vec<WelcomeScreenChannel>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||
pub struct WelcomeScreenChannel {
|
||||
pub channel_id: Snowflake,
|
||||
pub description: String,
|
||||
|
|
Loading…
Reference in New Issue