You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

team.go 615B

1234567891011121314151617181920212223242526
  1. // Copyright 2016 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package org
  5. import (
  6. api "code.gitea.io/go-sdk/gitea"
  7. "code.gitea.io/gitea/modules/context"
  8. "code.gitea.io/gitea/routers/api/v1/convert"
  9. )
  10. func ListTeams(ctx *context.APIContext) {
  11. org := ctx.Org.Organization
  12. if err := org.GetTeams(); err != nil {
  13. ctx.Error(500, "GetTeams", err)
  14. return
  15. }
  16. apiTeams := make([]*api.Team, len(org.Teams))
  17. for i := range org.Teams {
  18. apiTeams[i] = convert.ToTeam(org.Teams[i])
  19. }
  20. ctx.JSON(200, apiTeams)
  21. }