timols / java-gitlab-api

A wrapper for the Gitlab API written in Java
Apache License 2.0
387 stars 316 forks source link

Pagination API is confusing and possibly buggy. #320

Open novalis opened 6 years ago

novalis commented 6 years ago
  1. https://github.com/timols/java-gitlab-api/blob/27eb69ba671be2da8e1a5fe75fac6be2bf035e4c/src/main/java/org/gitlab/api/Pagination.java#L15 this calls "append", so if you call setPage twice, you'll get ?page=4&page=5. If one is lucky, gitlab would choose the latter of these, but I have no idea what it actually does.

  2. perPage can be changed, but this doesn't affect the page number. This is a little funny, because if I get 20 items on the first page, and then a second page of 100 items, I'll miss items 21-80. It seems more sensible to have Pagination take perPage as a constructor argument.

  3. One must manually increment the page number when querying. Instead, methods that take a pagination could increment the page number before returning, allowing the method to be called multiple times without any additional steps. Or, as another option, methods wanting pagination could be moved into the Pagination object and do the increment internally.

timols commented 6 years ago

Thanks for mentioning this. I'll happily accept any PRs you submit that address this.