timols / java-gitlab-api

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

Proposal, use specialized query objects instead of parameters #349

Closed tristanlins closed 5 years ago

tristanlins commented 5 years ago

The gitlab api provides numerous parameters. Most are currently not offered by java-gitlab-api.

The current design provides API parameters individually as method parameters. This is not very future proof and clumsy.

Instead, one could directly accept a query object. In order to get at least a certain abstraction, one simply derives sub-classes for the respective use cases. Because I did not "hide" the query (as implemented in the old pagination class), it is also possible to add parameters that may be added to the API in the future. This would basically make the methods forward-compatible.

I made the whole example of the GitlabAPI#getProjects() (GitlabAPI, ProjectsQuery) and the newly added GitlabAPI#getProjectPipelines() (GitlabAPI, PipelinesQuery).

timols commented 5 years ago

@tristanlins I like it! Definitely on board. Happy to merge what you have so far after fixing merge conflicts?

tristanlins commented 5 years ago

I am glad to hear that :-) Give me one to two days and I will update the PR.