ArchAstro.V1.Teams.Members (archastro v0.2.0)

Copy Markdown

Member API resource.

Summary

Functions

Add a member to a team

List members of a team

Remove a member or org from a team

Update a team member's role

Functions

create(client, team, input)

Add a member to a team

Adds a user or agent as a member of the specified team and returns the new membership with HTTP 201. Provide exactly one of user or agent — supplying both or neither returns a 400 error.

The caller must have permission to manage the team. When an app is provided, the request is scoped to that app and the caller must hold a valid app-scoped token. The default role is "member" when role is omitted.

The newly created team membership.

list(client, team)

List members of a team

Returns all members of the specified team, including both users and agents. Members are returned in a single non-paginated array ordered by join time.

Bearer-authenticated users must be a member of the team to retrieve its member list. Developer and server-to-server callers can retrieve members for any team visible to their app scope. When app is provided, the request is scoped to that app and requires a valid app-scoped token.

Successful response

remove(client, team)

@spec remove(ArchAstro.Client.t(), String.t()) ::
  {:ok, :ok} | {:error, ArchAstro.Error.reason()}

Remove a member or org from a team

Removes a user, agent, or all members of an organization from the specified team. Provide exactly one of user, agent, or org — supplying more than one or none returns a 400 error. On success, returns 204 No Content.

When org is provided, every user and agent membership belonging to that org is removed in a single call. The caller must be a member of the team's owning org to perform an org-scoped removal. You cannot target the team's owning org itself with this parameter.

The caller must have permission to manage the team. When app is present, the request is scoped to that app and requires a valid app-scoped token.

Empty response. Returns 204 No Content on success.

update(client, team, user, input)

Update a team member's role

Changes the role of an existing user member on the specified team. Returns the updated membership on success.

Only user memberships are supported by this endpoint. Attempting to update an agent membership returns 404. To change an agent's role, remove the existing membership and re-add the agent with the desired role.

The caller must have permission to modify the team. You cannot change a member's role across organization boundaries. Demoting the last owner of a team returns

  1. An invalid role value returns 422. When app is provided, the request is scoped to that app and requires a valid app-scoped token.

The updated team membership reflecting the new role.