// Copyright 2015 - Present, The Gogs Authors. All rights reserved. // Copyright 2018 - Present, Gitote. All rights reserved. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. package org import ( "gitote/gitote/pkg/context" "gitote/gitote/routes/api/v1/convert" api "gitlab.com/gitote/go-gitote-client" ) // ListTeams list all the teams of an organization func ListTeams(c *context.APIContext) { org := c.Org.Organization if err := org.GetTeams(); err != nil { c.Error(500, "GetTeams", err) return } apiTeams := make([]*api.Team, len(org.Teams)) for i := range org.Teams { apiTeams[i] = convert.ToTeam(org.Teams[i]) } c.JSON(200, apiTeams) }