From 4e51d1251bb0f69a794715cfba1af9ee2c628d0a Mon Sep 17 00:00:00 2001 From: kozabrada123 <“kozabrada123@users.noreply.github.com”> Date: Sat, 13 May 2023 21:50:36 +0200 Subject: [PATCH] Add integrations --- src/api/types.rs | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/api/types.rs b/src/api/types.rs index 833691e..582917a 100644 --- a/src/api/types.rs +++ b/src/api/types.rs @@ -620,7 +620,7 @@ pub struct MessageActivity { pub party_id: Option, } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, Clone)] pub struct Application { pub id: String, pub name: String, @@ -646,7 +646,7 @@ pub struct Application { pub role_connections_verification_url: Option, } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, Clone)] pub struct Team { pub icon: Option, pub id: u64, @@ -655,7 +655,7 @@ pub struct Team { pub owner_user_id: u64, } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, Clone)] pub struct TeamMember { pub membership_state: u8, pub permissions: Vec, @@ -670,7 +670,7 @@ pub enum MembershipState { Accepted = 2, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, Clone)] pub struct InstallParams { pub scopes: Vec, pub permissions: String, @@ -786,6 +786,35 @@ pub struct ThreadMember { pub member: Option, } +#[derive(Default, Debug, Deserialize, Serialize, Clone)] +/// See https://discord.com/developers/docs/resources/guild#integration-object-integration-structure +pub struct Integration { + pub id: String, + pub name: String, + #[serde(rename = "type")] + pub integration_type: String, + pub enabled: bool, + pub syncing: Option, + pub role_id: Option, + pub enabled_emoticons: Option, + pub expire_behaviour: Option, + pub expire_grace_period: Option, + pub user: Option, + pub account: IntegrationAccount, + pub synced_at: Option>, + pub subscriber_count: Option, + pub revoked: Option, + pub application: Option, + pub scopes: Option> +} + +#[derive(Default, Debug, Deserialize, Serialize, Clone)] +/// See https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure +pub struct IntegrationAccount { + pub id: String, + pub name: String +} + #[derive(Debug, Deserialize, Serialize, Clone)] pub struct DefaultReaction { pub emoji_id: Option,