diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-11-15 00:10:26 -0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-11-15 16:10:26 +0800 |
commit | d22a8dc022d51f9cbe8bfd8eb72e3a0e3245c543 (patch) | |
tree | c49b89b6e9b4084b9e1731783ebe7d1ea2451810 /routers | |
parent | a30cc637c6d9d73426022ab3eeb6ca4141232c7d (diff) | |
download | gitea-d22a8dc022d51f9cbe8bfd8eb72e3a0e3245c543.tar.gz gitea-d22a8dc022d51f9cbe8bfd8eb72e3a0e3245c543.zip |
Page parameter for repo search API (#2915)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/repo.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 36e644373c..158d373416 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -34,11 +34,15 @@ func Search(ctx *context.APIContext) { // type: string // - name: uid // in: query - // description: if provided, will return only repos owned by the user with the given id + // description: search only for repos that the user with the given id owns or contributes to + // type: integer + // - name: page + // in: query + // description: page number of results to return (1-based) // type: integer // - name: limit // in: query - // description: maximum number of repos to return + // description: page size of results, maximum page size is 50 // type: integer // - name: mode // in: query @@ -47,7 +51,7 @@ func Search(ctx *context.APIContext) { // type: string // - name: exclusive // in: query - // description: only search for repositories owned by the authenticated user + // description: if `uid` is given, search only for repos that the user owns // type: boolean // responses: // "200": @@ -57,6 +61,7 @@ func Search(ctx *context.APIContext) { opts := &models.SearchRepoOptions{ Keyword: strings.Trim(ctx.Query("q"), " "), OwnerID: ctx.QueryInt64("uid"), + Page: ctx.QueryInt("page"), PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")), Collaborate: util.OptionalBoolNone, } |