47degrees / github4s

A GitHub API wrapper written in Scala
http://47degrees.github.io/github4s
Apache License 2.0
229 stars 75 forks source link

Pagination API is flawed #389

Open dcsobral opened 4 years ago

dcsobral commented 4 years ago

Github API documentation repeatedly emphasizes that one should not construct URLs when paginating, but use the ones provided.

Note: It's important to form calls with Link header values instead of constructing your own URLs. Link Header

Always rely on these link relations provided to you. Don't try to guess or construct your own URL. Basics of Pagination

The way I see it, GHResult should have a nextPage: Option[() => GHResponse accessor.

On a minor note, I sometimes feel limited by not having methods such as listPullRequest be part of the algebra as free monads, so that they could be passed around, and modified elsewhere. For example, I'm doing some stuff that requires extra headers, and I'd much rather do a map at the application entry point over the whole thing than change every call to include an optional map. If such an approach had been taken, then nextPage would be Option[MethodsFreeMonad]. But I digress.

kalexmills commented 4 years ago

Related to #169