mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-23 09:36:11 +00:00
Allow gitea dev version (#914)
* update gitea sdk to latest * As before try to autodetect gitea version, if this does not work, assume it's latest version (v1.17.0 atm)
This commit is contained in:
18
vendor/code.gitea.io/sdk/gitea/list_options.go
generated
vendored
18
vendor/code.gitea.io/sdk/gitea/list_options.go
generated
vendored
@@ -9,12 +9,13 @@ import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
const defaultPageSize = 10
|
||||
const maxPageSize = 50
|
||||
|
||||
// ListOptions options for using Gitea's API pagination
|
||||
type ListOptions struct {
|
||||
Page int
|
||||
// Setting Page to -1 disables pagination on endpoints that support it.
|
||||
// Page numbering starts at 1.
|
||||
Page int
|
||||
// The default value depends on the server config DEFAULT_PAGING_NUM
|
||||
// The highest valid value depends on the server config MAX_RESPONSE_ITEMS
|
||||
PageSize int
|
||||
}
|
||||
|
||||
@@ -26,8 +27,9 @@ func (o ListOptions) getURLQuery() url.Values {
|
||||
return query
|
||||
}
|
||||
|
||||
// setDefaults set default pagination options if none or wrong are set
|
||||
// if you set -1 as page it will set all to 0
|
||||
// setDefaults applies default pagination options.
|
||||
// If .Page is set to -1, it will disable pagination.
|
||||
// WARNING: This function is not idempotent, make sure to never call this method twice!
|
||||
func (o *ListOptions) setDefaults() {
|
||||
if o.Page < 0 {
|
||||
o.Page, o.PageSize = 0, 0
|
||||
@@ -35,8 +37,4 @@ func (o *ListOptions) setDefaults() {
|
||||
} else if o.Page == 0 {
|
||||
o.Page = 1
|
||||
}
|
||||
|
||||
if o.PageSize < 0 || o.PageSize > maxPageSize {
|
||||
o.PageSize = defaultPageSize
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user