ListFunctions: option to disable pagination (#509)
the sdk enforce pagination, but most list endpoints dont require it ... close #507 fully Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/509 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-committed-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
0599915e88
commit
7de882b744
1 changed files with 5 additions and 1 deletions
|
@ -27,8 +27,12 @@ func (o ListOptions) getURLQuery() url.Values {
|
|||
}
|
||||
|
||||
// setDefaults set default pagination options if none or wrong are set
|
||||
// if you set -1 as page it will set all to 0
|
||||
func (o *ListOptions) setDefaults() {
|
||||
if o.Page < 1 {
|
||||
if o.Page < 0 {
|
||||
o.Page, o.PageSize = 0, 0
|
||||
return
|
||||
} else if o.Page == 0 {
|
||||
o.Page = 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue