Pagination

Stephen Finucane stephen at that.guru
Fri Jan 6 22:26:32 AEDT 2017


On Fri, 2017-01-06 at 18:19 +1100, Andrew Donnellan wrote:
> On 12/12/16 23:34, Stephen Finucane wrote:
> > I don't think we support this yet but it would be easily added. I'm
> > not
> > sure how well cursor pagination would map to of our endpoints,
> > seeing
> > as we use simple, integer-based indexing for all ID fields. My
> > personal
> > preference would be a 'direction=(asc|desc)' parameter, assuming we
> > don't really need to sort on different fields. If we did need to
> > sort
> > then I'd opt for a combination of a 'sort=(date|name|submitter)'
> > parameter (for '/patches' - different values for other endpoints)
> > and
> > 'direction', but I'd also be fine with just 'sort' and a '-' prefix
> > to
> > reverse things. Happy to take patches for any solution :)
> > 
> > While we're on the matter, would it be possible to take a look at
> > the
> > patches in the 'series-api' work? There are a couple that still
> > need at
> > least one reviewer before I'd be happy letting them in:
> > 
> >   https://patchwork.ozlabs.org/bundle/stephenfin/series-api/
> 
> We'll need to use something other than page-number based pagination,
> but 
> something based on the default LimitOffsetPagination class might be
> good 
> enough for our purposes?

Hmm, I don't see a practical difference between LimitOffsetPagination
and PageNumberPagination. For example, aren't these two the same thing?

  ?page=2&per_page=100
  ?offset=100&limit=100

and I'd also guess that both would be "reversed" the same way, once [1]
is merged:

  ?page=2&per_page=100&order=-id
  ?offset=100&limit=100&order=-id

Perhaps I've missed some subtle (or unsubtle :)) difference? Would you
need more than this?

[1] https://patchwork.ozlabs.org/patch/710290/

> Alas I didn't get to the series API patches before you merged them, 
> sorry! Am reviewing/testing v3 of the filter series currently.

No problem - I would have held off for more reviews but I'm supposed to
be presenting on Patchwork 2.0 at FOSDEM in four weeks :) Pedal to the
metal, to say the least.

Stephen


More information about the Patchwork mailing list