aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/org/team.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/org/team.go')
-rw-r--r--routers/api/v1/org/team.go59
1 files changed, 49 insertions, 10 deletions
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go
index 446287a343..1bf984b17f 100644
--- a/routers/api/v1/org/team.go
+++ b/routers/api/v1/org/team.go
@@ -15,6 +15,7 @@ import (
"code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/routers/api/v1/user"
+ "code.gitea.io/gitea/routers/api/v1/utils"
)
// ListTeams list all the teams of an organization
@@ -30,12 +31,22 @@ func ListTeams(ctx *context.APIContext) {
// description: name of the organization
// type: string
// required: true
+ // - name: page
+ // in: query
+ // description: page number of results to return (1-based)
+ // type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results, maximum page size is 50
+ // type: integer
// responses:
// "200":
// "$ref": "#/responses/TeamList"
org := ctx.Org.Organization
- if err := org.GetTeams(); err != nil {
+ if err := org.GetTeams(&models.SearchTeamOptions{
+ ListOptions: utils.GetListOptions(ctx),
+ }); err != nil {
ctx.Error(http.StatusInternalServerError, "GetTeams", err)
return
}
@@ -59,11 +70,20 @@ func ListUserTeams(ctx *context.APIContext) {
// summary: List all the teams a user belongs to
// produces:
// - application/json
+ // parameters:
+ // - name: page
+ // in: query
+ // description: page number of results to return (1-based)
+ // type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results, maximum page size is 50
+ // type: integer
// responses:
// "200":
// "$ref": "#/responses/TeamList"
- teams, err := models.GetUserTeams(ctx.User.ID)
+ teams, err := models.GetUserTeams(ctx.User.ID, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserTeams", err)
return
@@ -284,6 +304,14 @@ func GetTeamMembers(ctx *context.APIContext) {
// type: integer
// format: int64
// required: true
+ // - name: page
+ // in: query
+ // description: page number of results to return (1-based)
+ // type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results, maximum page size is 50
+ // type: integer
// responses:
// "200":
// "$ref": "#/responses/UserList"
@@ -297,7 +325,9 @@ func GetTeamMembers(ctx *context.APIContext) {
return
}
team := ctx.Org.Team
- if err := team.GetMembers(); err != nil {
+ if err := team.GetMembers(&models.SearchMembersOptions{
+ ListOptions: utils.GetListOptions(ctx),
+ }); err != nil {
ctx.Error(http.StatusInternalServerError, "GetTeamMembers", err)
return
}
@@ -436,12 +466,22 @@ func GetTeamRepos(ctx *context.APIContext) {
// type: integer
// format: int64
// required: true
+ // - name: page
+ // in: query
+ // description: page number of results to return (1-based)
+ // type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results, maximum page size is 50
+ // type: integer
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
team := ctx.Org.Team
- if err := team.GetRepositories(); err != nil {
+ if err := team.GetRepositories(&models.SearchTeamOptions{
+ ListOptions: utils.GetListOptions(ctx),
+ }); err != nil {
ctx.Error(http.StatusInternalServerError, "GetTeamRepos", err)
}
repos := make([]*api.Repository, len(team.Repos))
@@ -589,14 +629,14 @@ func SearchTeam(ctx *context.APIContext) {
// in: query
// description: include search within team description (defaults to true)
// type: boolean
- // - name: limit
- // in: query
- // description: limit size of results
- // type: integer
// - name: page
// in: query
// description: page number of results to return (1-based)
// type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results, maximum page size is 50
+ // type: integer
// responses:
// "200":
// description: "SearchResults of a successful search"
@@ -615,8 +655,7 @@ func SearchTeam(ctx *context.APIContext) {
Keyword: strings.TrimSpace(ctx.Query("q")),
OrgID: ctx.Org.Organization.ID,
IncludeDesc: (ctx.Query("include_desc") == "" || ctx.QueryBool("include_desc")),
- PageSize: ctx.QueryInt("limit"),
- Page: ctx.QueryInt("page"),
+ ListOptions: utils.GetListOptions(ctx),
}
teams, _, err := models.SearchTeam(opts)