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.

26 lines
627 B

  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/modules/context"
  8. "github.com/gogits/gogs/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. }