summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/utils/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/utils/utils.go')
-rw-r--r--routers/api/v1/utils/utils.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/api/v1/utils/utils.go b/routers/api/v1/utils/utils.go
index 35f4873964..e02406d137 100644
--- a/routers/api/v1/utils/utils.go
+++ b/routers/api/v1/utils/utils.go
@@ -8,7 +8,9 @@ import (
"strings"
"time"
+ "code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
)
// UserID user ID of authenticated user, or 0 if not authenticated
@@ -44,3 +46,11 @@ func GetQueryBeforeSince(ctx *context.APIContext) (before, since int64, err erro
}
return before, since, nil
}
+
+// GetListOptions returns list options using the page and limit parameters
+func GetListOptions(ctx *context.APIContext) models.ListOptions {
+ return models.ListOptions{
+ Page: ctx.QueryInt("page"),
+ PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")),
+ }
+}