Skip to content

Teams

Read teams and their members. A team is a shared workspace that owns projects and members. Accessed via snaptrude.workspace.teams.

Read-only in v1

Teams are read-only here — there is no create/invite/delete in v1 (a deliberate safety decision). Reads never throw for a miss (get returns null).

Types

PluginTeamRef

A conservative projection of a team — never the raw backend payload.

PropertyTypeDescription
idstringStable team id
namestringDisplay name
rolestring?The user's role in the team when known

PluginTeamMemberRef

A conservative projection of a team member.

PropertyTypeDescription
idstringStable user id
namestringDisplay name
emailstring?Email address when known
rolestring?The member's role in the team when known

Functions

list()

List the teams the user belongs to.

  • Returns: { teams: PluginTeamRef[] } — the user's teams (empty when the user belongs to none)
ts
const { teams } = await snaptrude.workspace.teams.list();
for (const t of teams) console.log(t.id, t.name);

get(teamId)

Get a single team by id.

  • Parameters:
    • teamId: string — The id of the team to read
  • Returns: PluginTeamRef | null — the team, or null if no team has that id / the user is not a member
ts
const team = await snaptrude.workspace.teams.get("team_1");
if (team) console.log(team.name);

listMembers(teamId)

List the members of a team.

  • Parameters:
    • teamId: string — The id of the team whose members to list
  • Returns: { members: PluginTeamMemberRef[] } — the team's members (empty when the team has none / is missing)
ts
const { members } = await snaptrude.workspace.teams.listMembers("team_1");
for (const m of members) console.log(m.name, m.email);

Errors

Failed calls reject with a typed PluginError — see Error Handling. All three methods are reads and never throw for a miss — get returns null, list / listMembers return [].