Add an identity to a team. # Errors Returns [`TeamsError::TeamNotFound`](crate::error::TeamsError::TeamNotFound) if the team does not exist, [`TeamsError::AlreadyExists`](crate::error::TeamsError::AlreadyExists) if the identity is already a member, and [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied) if the caller lacks access.
(
client: &StorageClient,
org_slug: &str,
team_slug: &str,
identity_id: Uuid,
role: TeamRole,
)
| 48 | /// [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied) |
| 49 | /// if the caller lacks access. |
| 50 | pub async fn add_team_member( |
| 51 | client: &StorageClient, |
| 52 | org_slug: &str, |
| 53 | team_slug: &str, |
| 54 | identity_id: Uuid, |
| 55 | role: TeamRole, |
| 56 | ) -> TeamsResult<TeamMemberInfo> { |
| 57 | debug_assert_eq!(client.org_slug(), org_slug); |
| 58 | let path = format!("/teams/{team_slug}/members"); |
| 59 | let body = AddTeamMemberRequest { identity_id, role }; |
| 60 | client |
| 61 | .post(&path, &body) |
| 62 | .await |
| 63 | .map_err(|e| map_remote_error(e, format!("team {org_slug}/{team_slug}"))) |
| 64 | } |
| 65 | |
| 66 | /// Update the role of a team member. |
| 67 | /// |
no test coverage detected