Skip to content

Commit

Permalink
add builder for install_params
Browse files Browse the repository at this point in the history
  • Loading branch information
ivinjabraham committed Nov 17, 2024
1 parent 11f558e commit 71ab298
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/model/application/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,32 @@ 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<Scope>,
pub permissions: Permissions,
}

impl InstallParams {
#[must_use]
pub fn new() -> Self {
Self::default()
}

#[must_use]
pub fn scopes(mut self, scopes: Vec<Scope>) -> Self {
self.scopes = FixedArray::from_vec_trunc(scopes);
self
}

#[must_use]
pub fn permissions(mut self, permissions: Permissions) -> Self {
self.permissions = permissions;
self
}
}

#[cfg(test)]
mod team_role_ordering {
use super::TeamMemberRole;
Expand Down

0 comments on commit 71ab298

Please sign in to comment.