Skip to content

Commit

Permalink
update current application object struct
Browse files Browse the repository at this point in the history
  • Loading branch information
ivinjabraham committed Nov 15, 2024
1 parent 57fdc2f commit 07699f6
Showing 1 changed file with 47 additions and 12 deletions.
59 changes: 47 additions & 12 deletions src/model/application/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,39 +53,52 @@ pub struct CurrentApplicationInfo {
pub bot_public: bool,
pub bot_require_code_grant: bool,
#[serde(default)]
pub bot: User,
#[serde(default)]
pub terms_of_service_url: Option<String>,
#[serde(default)]
pub privacy_policy_url: Option<String>,
pub owner: Option<User>,
// omitted `summary` because it deprecated
#[serde(default)]
pub owner: User,
pub verify_key: String,
pub team: Option<Team>,
#[serde(default)]
pub guild_id: Option<GuildId>,
#[serde(default)]
pub guild: Option<PartialGuild>,
#[serde(default)]
pub primary_sku_id: Option<SkuId>,
#[serde(default)]
pub slug: Option<String>,
pub slug: String,
#[serde(default)]
pub cover_image: Option<String>,
pub cover_image: String,
#[serde(default)]
pub flags: Option<ApplicationFlags>,
#[serde(default)]
pub tags: Option<Vec<String>>,
pub approximate_guild_count: Option<u32>,
#[serde(default)]
pub install_params: Option<InstallParams>,
pub approximate_user_install_count: Option<u32>,
#[serde(default)]
pub redirect_uris: Vec<String>,
#[serde(default)]
pub custom_install_url: Option<String>,
pub interactions_endpoint_url: Option<String>,
/// The application's role connection verification entry point, which when configured will
/// render the app as a verification method in the guild role verification configuration.
#[serde(default)]
pub role_connections_verification_url: Option<String>,
#[serde(default)]
pub event_webhooks_url: Option<String>,
pub event_webhook_status: EventWebhookStatus,
#[serde(default)]
pub event_webhook_type: Vec<EventWebhookType>,
#[serde(default)]
pub tags: Option<Vec<String>>,
#[serde(default)]
pub install_params: Option<InstallParams>,
#[serde(default)]
pub integration_types_config: HashMap<InstallationContext, InstallationContextConfig>,
pub approximate_guild_count: Option<u32>,
pub approximate_user_install_count: Option<u32>,
pub guild: Option<PartialGuild>,
pub redirect_uris: Option<Vec<String>>,
pub interactions_endpoint_url: Option<String>,
#[serde(default)]
pub custom_install_url: String,
}

impl CurrentApplicationInfo {
Expand All @@ -99,6 +112,28 @@ impl CurrentApplicationInfo {
}
}

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
#[non_exhaustive]
pub enum EventWebhookType {
ApplicationAuthorized,
EntitlementCreate,
QuestUserEnrollment
}

enum_number! {
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(from = "u8", into = "u8")]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
#[non_exhaustive]
pub enum EventWebhookStatus {
Enabled = 1,
Disabled = 2,
DisabledByDiscord = 3,
_ => Unknown(u8),
}
}

enum_number! {
/// An enum representing the [installation contexts].
///
Expand Down

0 comments on commit 07699f6

Please sign in to comment.