summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user/gpg_key.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/user/gpg_key.go')
-rw-r--r--routers/api/v1/user/gpg_key.go26
1 files changed, 22 insertions, 4 deletions
diff --git a/routers/api/v1/user/gpg_key.go b/routers/api/v1/user/gpg_key.go
index b6133ca7be..a4f6d0e924 100644
--- a/routers/api/v1/user/gpg_key.go
+++ b/routers/api/v1/user/gpg_key.go
@@ -11,10 +11,11 @@ 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"
)
-func listGPGKeys(ctx *context.APIContext, uid int64) {
- keys, err := models.ListGPGKeys(uid)
+func listGPGKeys(ctx *context.APIContext, uid int64, listOptions models.ListOptions) {
+ keys, err := models.ListGPGKeys(uid, listOptions)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ListGPGKeys", err)
return
@@ -41,6 +42,14 @@ func ListGPGKeys(ctx *context.APIContext) {
// description: username of user
// 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/GPGKeyList"
@@ -49,7 +58,7 @@ func ListGPGKeys(ctx *context.APIContext) {
if ctx.Written() {
return
}
- listGPGKeys(ctx, user.ID)
+ listGPGKeys(ctx, user.ID, utils.GetListOptions(ctx))
}
//ListMyGPGKeys get the GPG key list of the authenticated user
@@ -57,13 +66,22 @@ func ListMyGPGKeys(ctx *context.APIContext) {
// swagger:operation GET /user/gpg_keys user userCurrentListGPGKeys
// ---
// summary: List the authenticated user's GPG keys
+ // 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
// produces:
// - application/json
// responses:
// "200":
// "$ref": "#/responses/GPGKeyList"
- listGPGKeys(ctx, ctx.User.ID)
+ listGPGKeys(ctx, ctx.User.ID, utils.GetListOptions(ctx))
}
//GetGPGKey get the GPG key based on a id