diff options
| author | n1c00o <git.n1c00o@gmail.com> | 2021-10-02 23:00:08 +0200 |
|---|---|---|
| committer | n1c00o <git.n1c00o@gmail.com> | 2021-10-02 23:00:08 +0200 |
| commit | ca0efb3e31b48812e934b5615878a40b767f1abd (patch) | |
| tree | e89c65fbc311310f1feb28253d5ecd43524ed445 | |
| parent | 13955d7089a1f6a7a5c711533a965d9d57eed2d8 (diff) | |
Add Application-related structures
| -rw-r--r-- | common/rust/src/discord_models/application.rs | 38 | ||||
| -rw-r--r-- | common/rust/src/discord_models/mod.rs | 3 | ||||
| -rw-r--r-- | common/rust/src/discord_models/teams.rs | 28 |
3 files changed, 69 insertions, 0 deletions
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<String>, + pub description: String, + pub rpc_origins: Option<Vec<String>>, + pub bot_public: bool, + pub bot_require_code_grant: bool, + pub terms_of_service_url: Option<String>, + pub privacy_policy_url: Option<String>, + pub owner: Option<User>, + pub summary: String, + pub verify_key: String, + pub team: Option<Team>, + pub guild_id: Option<String>, + pub primary_sku_id: Option<String>, + pub slug: Option<String>, + pub cover_image: Option<String>, + pub flags: Option<BitFlags<ApplicationFlags>>, +} 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<String>, + pub team_id: String, + pub user: User, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Team { + pub icon: Option<String>, + pub id: String, + pub members: Vec<TeamMembers>, + pub name: String, + pub owner_user_id: String, +} |
