mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
GODT-35: New pmapi client and manager using resty
This commit is contained in:
15
pkg/pmapi/paging.go
Normal file
15
pkg/pmapi/paging.go
Normal file
@ -0,0 +1,15 @@
|
||||
package pmapi
|
||||
|
||||
const defaultPageSize = 100
|
||||
|
||||
func doPaged(elements []string, pageSize int, fn func([]string) error) error {
|
||||
for len(elements) > pageSize {
|
||||
if err := fn(elements[:pageSize]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
elements = elements[pageSize:]
|
||||
}
|
||||
|
||||
return fn(elements)
|
||||
}
|
||||
Reference in New Issue
Block a user