OptionalCursorPaginationParams returns the "perPage" and "after" parameters from the request, without the "page" parameter, suitable for cursor-based pagination only.
(args map[string]any)
| 416 | // OptionalCursorPaginationParams returns the "perPage" and "after" parameters from the request, |
| 417 | // without the "page" parameter, suitable for cursor-based pagination only. |
| 418 | func OptionalCursorPaginationParams(args map[string]any) (CursorPaginationParams, error) { |
| 419 | perPage, err := OptionalIntParamWithDefault(args, "perPage", 30) |
| 420 | if err != nil { |
| 421 | return CursorPaginationParams{}, err |
| 422 | } |
| 423 | after, err := OptionalParam[string](args, "after") |
| 424 | if err != nil { |
| 425 | return CursorPaginationParams{}, err |
| 426 | } |
| 427 | return CursorPaginationParams{ |
| 428 | PerPage: perPage, |
| 429 | After: after, |
| 430 | }, nil |
| 431 | } |
| 432 | |
| 433 | type CursorPaginationParams struct { |
| 434 | PerPage int |
no test coverage detected