Skip to content

Commit

Permalink
Add endpoint to list Grid teams
Browse files Browse the repository at this point in the history
  • Loading branch information
kelseymills committed Nov 25, 2024
1 parent bc58940 commit 15ca001
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,34 @@ func (api *Client) ConversationsConvertToPublicContext(ctx context.Context, chan

return nil
}

type AdminTeam struct {
ID string `json:"id"`
Name string `json:"name"`
Discoverability string `json:"discoverability"`
TeamURL string `json:"team_url"`
}

type adminListTeamsResponse struct {
Teams []AdminTeam `json:"teams"`
SlackResponse
}

// AdminListTeamsContext lists all teams on an Enterprise Grid organization.
// https://api.slack.com/methods/admin.teams.list
func (api *Client) AdminListTeamsContext(ctx context.Context) ([]AdminTeam, error) {
values := url.Values{
"token": {api.token},
}

response := &adminListTeamsResponse{}
err := api.postMethod(ctx, "admin.teams.list", values, response)
if err != nil {
return nil, err
}
if err := response.Err(); err != nil {
return nil, err
}

return response.Teams, nil
}

0 comments on commit 15ca001

Please sign in to comment.