team.go 614 B

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 "github.com/gogits/go-gogs-client"
  7. "github.com/gogits/gogs/pkg/context"
  8. "github.com/gogits/gogs/routes/api/v1/convert"
  9. )
  10. func ListTeams(c *context.APIContext) {
  11. org := c.Org.Organization
  12. if err := org.GetTeams(); err != nil {
  13. c.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. c.JSON(200, apiTeams)
  21. }