MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / add_team_member

Function add_team_member

atomic-teams/src/team_member.rs:50–64  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

48/// [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied)
49/// if the caller lacks access.
50pub 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///

Callers 1

executeMethod · 0.85

Calls 2

map_remote_errorFunction · 0.85
postMethod · 0.80

Tested by

no test coverage detected