From 7f72d286631b570f550c2f41d3d44b308a91d182 Mon Sep 17 00:00:00 2001 From: Ivin Joel Abraham Date: Sun, 17 Nov 2024 19:24:03 +0530 Subject: [PATCH] add builder for install_params --- src/model/application/mod.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/model/application/mod.rs b/src/model/application/mod.rs index 84fc135fe1f..9dd763b244f 100644 --- a/src/model/application/mod.rs +++ b/src/model/application/mod.rs @@ -296,13 +296,29 @@ bitflags! { /// Settings for the application's default in-app authorization link /// /// [Discord docs](https://discord.com/developers/docs/resources/application#install-params-object-install-params-structure). -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Default, Clone, Serialize, Deserialize)] #[non_exhaustive] pub struct InstallParams { pub scopes: FixedArray, pub permissions: Permissions, } +impl InstallParams { + pub fn new() -> Self { + Self::default() + } + + pub fn scopes(mut self, scopes: Vec) -> Self { + self.scopes = FixedArray::from_vec_trunc(scopes); + self + } + + pub fn permissions(mut self, permissions: Permissions) -> Self { + self.permissions = permissions; + self + } +} + #[cfg(test)] mod team_role_ordering { use super::TeamMemberRole;