diff options
Diffstat (limited to 'routers/api/v1/user/watch.go')
-rw-r--r-- | routers/api/v1/user/watch.go | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go index ec8543dcf0..e54709b599 100644 --- a/routers/api/v1/user/watch.go +++ b/routers/api/v1/user/watch.go @@ -11,12 +11,13 @@ import ( "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/routers/api/v1/utils" ) // getWatchedRepos returns the repos that the user with the specified userID is // watching -func getWatchedRepos(user *models.User, private bool) ([]*api.Repository, error) { - watchedRepos, err := models.GetWatchedRepos(user.ID, private) +func getWatchedRepos(user *models.User, private bool, listOptions models.ListOptions) ([]*api.Repository, error) { + watchedRepos, err := models.GetWatchedRepos(user.ID, private, listOptions) if err != nil { return nil, err } @@ -45,13 +46,21 @@ func GetWatchedRepos(ctx *context.APIContext) { // in: path // description: username of the user // 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" user := GetUserByParams(ctx) private := user.ID == ctx.User.ID - repos, err := getWatchedRepos(user, private) + repos, err := getWatchedRepos(user, private, utils.GetListOptions(ctx)) if err != nil { ctx.Error(http.StatusInternalServerError, "getWatchedRepos", err) } @@ -65,11 +74,20 @@ func GetMyWatchedRepos(ctx *context.APIContext) { // summary: List repositories watched by the authenticated user // 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/RepositoryList" - repos, err := getWatchedRepos(ctx.User, true) + repos, err := getWatchedRepos(ctx.User, true, utils.GetListOptions(ctx)) if err != nil { ctx.Error(http.StatusInternalServerError, "getWatchedRepos", err) } |