From ca0efb3e31b48812e934b5615878a40b767f1abd Mon Sep 17 00:00:00 2001 From: n1c00o Date: Sat, 2 Oct 2021 23:00:08 +0200 Subject: [PATCH] Add Application-related structures --- common/rust/src/discord_models/application.rs | 38 +++++++++++++++++++ common/rust/src/discord_models/mod.rs | 3 ++ common/rust/src/discord_models/teams.rs | 28 ++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 common/rust/src/discord_models/application.rs create mode 100644 common/rust/src/discord_models/teams.rs diff --git a/common/rust/src/discord_models/application.rs b/common/rust/src/discord_models/application.rs new file mode 100644 index 0000000..65707d2 --- /dev/null +++ b/common/rust/src/discord_models/application.rs @@ -0,0 +1,38 @@ +use enumflags2::{bitflags, BitFlags}; +use serde::{Deserialize, Serialize}; + +use super::{teams::Team, user::User}; + +#[bitflags] +#[repr(u64)] +#[derive(Debug, Clone, Copy)] +pub enum ApplicationFlags { + GatewayPresence = 1 << 12, + GatewayPresenceLimit = 1 << 13, + GatewayGuildMembers = 1 << 14, + GatewayGuildMembersLimited = 1 << 15, + VerificationPendingGuildLimit = 1 << 16, + Embedded = 1 << 17, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Application { + pub id: String, + pub name: String, + pub icon: Option, + pub description: String, + pub rpc_origins: Option>, + pub bot_public: bool, + pub bot_require_code_grant: bool, + pub terms_of_service_url: Option, + pub privacy_policy_url: Option, + pub owner: Option, + pub summary: String, + pub verify_key: String, + pub team: Option, + pub guild_id: Option, + pub primary_sku_id: Option, + pub slug: Option, + pub cover_image: Option, + pub flags: Option>, +} diff --git a/common/rust/src/discord_models/mod.rs b/common/rust/src/discord_models/mod.rs index 56d877f..2bcde7c 100644 --- a/common/rust/src/discord_models/mod.rs +++ b/common/rust/src/discord_models/mod.rs @@ -1,2 +1,5 @@ +pub mod application; pub mod guild; +pub mod stage_instance; +pub mod teams; pub mod user; diff --git a/common/rust/src/discord_models/teams.rs b/common/rust/src/discord_models/teams.rs new file mode 100644 index 0000000..369b3cd --- /dev/null +++ b/common/rust/src/discord_models/teams.rs @@ -0,0 +1,28 @@ +use serde::{Deserialize, Serialize}; +use serde_repr::{Deserialize_repr, Serialize_repr}; + +use super::user::User; + +#[derive(Debug, Clone, Deserialize_repr, Serialize_repr)] +#[repr(u8)] +pub enum MembershipState { + Invited = 0, + Accepted = 1, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct TeamMembers { + pub membership_state: MembershipState, + pub permissions: Vec, + pub team_id: String, + pub user: User, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Team { + pub icon: Option, + pub id: String, + pub members: Vec, + pub name: String, + pub owner_user_id: String, +} -- 2.39.5