pub struct Team {
pub id: u64,
pub org_id: u64,
pub name: String,
pub description: Option<String>,
pub members: HashSet<String>,
pub permission: Permission,
pub repos: HashSet<String>,
pub created_at: u64,
pub updated_at: u64,
pub created_by: String,
}Expand description
A team within an organization.
Teams allow grouping users for easier permission management. A team can have access to multiple repositories with a specific permission level.
Fields§
§id: u64Unique team ID.
org_id: u64Organization ID this team belongs to.
name: StringTeam name (URL-safe, unique within org).
description: Option<String>Optional description.
members: HashSet<String>Team members (public keys).
permission: PermissionDefault permission level for team repositories.
repos: HashSet<String>Repository keys this team has access to.
created_at: u64When the team was created (Unix timestamp).
updated_at: u64When the team was last updated (Unix timestamp).
created_by: StringWho created this team (public key).
Implementations§
Source§impl Team
impl Team
Sourcepub fn new(
id: u64,
org_id: u64,
name: String,
permission: Permission,
created_by: String,
) -> Self
pub fn new( id: u64, org_id: u64, name: String, permission: Permission, created_by: String, ) -> Self
Create a new team.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the team description.
Sourcepub fn add_member(&mut self, user: String) -> bool
pub fn add_member(&mut self, user: String) -> bool
Add a member to the team.
Sourcepub fn remove_member(&mut self, user: &str) -> bool
pub fn remove_member(&mut self, user: &str) -> bool
Remove a member from the team.
Sourcepub fn remove_repo(&mut self, repo_key: &str) -> bool
pub fn remove_repo(&mut self, repo_key: &str) -> bool
Remove a repository from the team.
Sourcepub fn get_repo_permission(&self, repo_key: &str) -> Option<Permission>
pub fn get_repo_permission(&self, repo_key: &str) -> Option<Permission>
Get the permission level for a specific repository. Returns the team’s permission if the repo is in the team, None otherwise.
Sourcepub fn set_permission(&mut self, permission: Permission)
pub fn set_permission(&mut self, permission: Permission)
Update the team’s default permission level.