Generalized concept of "data"/pagination in Pagure API?
by Tim Landscheidt
Hi,
I'd like to interact with Pagure from within Emacs (Lisp)
and therefore am adding support to Ghub
(https://github.com/magit/ghub/).
Ghub has a nice unpagination feature that automatically col-
lects all queried data in consecutive requests and builds
one structure from that. For GitHub and some other forges,
this is easy: For example
https://api.github.com/orgs/microsoft/repos returns a JSON
array and has an HTTP header "link" (RFC 8288) that refers
to the next (and the last) page, so a program can mindlessly
request each page, concatenate the arrays, et voilà!
Looking at Pagure's API, there does not seem to exist such
an overarching idea. Therefore (?), the "pagure" command
line utility (https://github.com/juhp/pagure-cli) has a sep-
arate Haskell command for each API call, and the "libpagure"
Python library (https://pagure.io/libpagure/) does the same.
Is there a way that a Pagure API client library can be
"clever" with regard to pagination at a low level and pre-
sent the consumer with a DWIM data structure?
(My most-head-scratching problem is
https://src.fedoraproject.org/api/0/user/scfc where there
are two dimensions of pagination, and keys ("forks",
"repos") whose values should be concatenated and another key
("user") whose values should not be.)
TIA,
Tim
3 years, 1 month