up
up copied to clipboard
Handle pagination in APIs that support it
What problem are you facing?
Currently, a few of the APIs that up interacts with (primarily up ctp list when UP_MCP_EXPERIMENTAL=true) support pagination with relatively small default values (e.g. 10). If the number of items exceeds that default, we don't support any way for a user to see the items beyond the limit.
How could Upbound help solve your problem?
The following are all options for addressing this, each with varying levels of complexity / functionality trade-off:
- Use the maximum size supported by the API by default in the CLI, which provides more breathing room, but users could still hit the limit eventually.
- Fetch the maximum size supported by the API and if the total exceeds that automatically use pagination to fetch the rest. Always give the user full results.
- Do (2) by default but allow the user to supply a
--limitor--countflag to limit the total amount they want to see.
(2) would likely be sufficient for the time-being, and it would not prohibit us from supporting (3) in the future if requested.