unioslo / harborapi

Python async client for the Harbor REST API v2.0.
https://unioslo.github.io/harborapi/
MIT License
28 stars 6 forks source link

Add `limit` parameter for methods fetching paginated content #16

Closed pederhan closed 1 year ago

pederhan commented 1 year ago

This functionality would be especially useful for harbor-cli, which has several commands, such as auditlog list, where it's natural to have a --limit option to set a limit for how many resources to fetch/print.

Furthermore, limit is a more intuitive interface than the current parameter retrieve_all, which is just a bad name for "follow pagination".

This change should affect all methods that fetch multiple resources, such as get_repositories, get_projects, get_audit_logs, etc. Basically any methods that have page and page_size parameters.

A limit of None and/or 0 should disable the limit and behave as the current retrieve_all.