aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-02-25 20:07:07 +0100
committerGitHub <noreply@github.com>2020-02-25 14:07:07 -0500
commit4427a936b4c7bd07908ccbe96104928dd29cf59d (patch)
treed5eb9406613c6262a44b21985cebf31cde2b5e5d /routers/api
parentb098cc24c5d93ca96ff72faf3093f45c30c974f0 (diff)
downloadgitea-4427a936b4c7bd07908ccbe96104928dd29cf59d.tar.gz
gitea-4427a936b4c7bd07908ccbe96104928dd29cf59d.zip
[API] enable paggination for ListRepoTags (#10454)
* enable paggination for repoTags * precalculate first, cut slice second * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/tag.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/routers/api/v1/repo/tag.go b/routers/api/v1/repo/tag.go
index eb99895c64..76c612bea4 100644
--- a/routers/api/v1/repo/tag.go
+++ b/routers/api/v1/repo/tag.go
@@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/routers/api/v1/utils"
)
// ListTags list all the tags of a repository
@@ -30,11 +31,21 @@ func ListTags(ctx *context.APIContext) {
// description: name of the repo
// 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, default maximum page size is 50
+ // type: integer
// responses:
// "200":
// "$ref": "#/responses/TagList"
- tags, err := ctx.Repo.GitRepo.GetTagInfos()
+ listOpts := utils.GetListOptions(ctx)
+
+ tags, err := ctx.Repo.GitRepo.GetTagInfos(listOpts.Page, listOpts.PageSize)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetTags", err)
return