fix: correct paging parameter logic and add paging options

- fix bug where `pageNumber` and `pageSize` were swapped during default
initialization in `apps.go`.
- fix bug in `pagingRequest.go` where `ToParams` mapped keys to the
incorrect struct fields.
- add `ForPageNumber` and `WithPageSize` functional options to allow
custom paging configuration.
- enhance `Apps` endpoint tests to verify that `pageNumber` and
`pageSize` query parameters are correctly passed to the API.
- add test case for verifying non-default paging options.
This commit is contained in:
Stevan Freeborn
2026-01-15 17:03:59 -06:00
parent bfa1b06a83
commit 126b027a81
3 changed files with 66 additions and 5 deletions
+2 -2
View File
@@ -21,8 +21,8 @@ type App struct {
func (p *AppsEndpoint) Get(ctx context.Context, pagingOpts ...PagingOption) (Page[App], error) {
pagingRequest := &PagingRequest{
pageSize: 1,
pageNumber: 50,
pageNumber: 1,
pageSize: 50,
}
for _, opt := range pagingOpts {