Skip to content

Commit d22a8dc

Browse files
ethantkoeniglunny
authored andcommitted
Page parameter for repo search API (#2915)
1 parent a30cc63 commit d22a8dc

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

public/swagger.v1.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,13 +849,19 @@
849849
},
850850
{
851851
"type": "integer",
852-
"description": "if provided, will return only repos owned by the user with the given id",
852+
"description": "search only for repos that the user with the given id owns or contributes to",
853853
"name": "uid",
854854
"in": "query"
855855
},
856856
{
857857
"type": "integer",
858-
"description": "maximum number of repos to return",
858+
"description": "page number of results to return (1-based)",
859+
"name": "page",
860+
"in": "query"
861+
},
862+
{
863+
"type": "integer",
864+
"description": "page size of results, maximum page size is 50",
859865
"name": "limit",
860866
"in": "query"
861867
},
@@ -867,7 +873,7 @@
867873
},
868874
{
869875
"type": "boolean",
870-
"description": "only search for repositories owned by the authenticated user",
876+
"description": "if `uid` is given, search only for repos that the user owns",
871877
"name": "exclusive",
872878
"in": "query"
873879
}

routers/api/v1/repo/repo.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ func Search(ctx *context.APIContext) {
3434
// type: string
3535
// - name: uid
3636
// in: query
37-
// description: if provided, will return only repos owned by the user with the given id
37+
// description: search only for repos that the user with the given id owns or contributes to
38+
// type: integer
39+
// - name: page
40+
// in: query
41+
// description: page number of results to return (1-based)
3842
// type: integer
3943
// - name: limit
4044
// in: query
41-
// description: maximum number of repos to return
45+
// description: page size of results, maximum page size is 50
4246
// type: integer
4347
// - name: mode
4448
// in: query
@@ -47,7 +51,7 @@ func Search(ctx *context.APIContext) {
4751
// type: string
4852
// - name: exclusive
4953
// in: query
50-
// description: only search for repositories owned by the authenticated user
54+
// description: if `uid` is given, search only for repos that the user owns
5155
// type: boolean
5256
// responses:
5357
// "200":
@@ -57,6 +61,7 @@ func Search(ctx *context.APIContext) {
5761
opts := &models.SearchRepoOptions{
5862
Keyword: strings.Trim(ctx.Query("q"), " "),
5963
OwnerID: ctx.QueryInt64("uid"),
64+
Page: ctx.QueryInt("page"),
6065
PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")),
6166
Collaborate: util.OptionalBoolNone,
6267
}

0 commit comments

Comments
 (0)