Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination in Queries #48

Open
dshanske opened this issue Jul 5, 2022 · 3 comments
Open

Pagination in Queries #48

dshanske opened this issue Jul 5, 2022 · 3 comments

Comments

@dshanske
Copy link
Member

dshanske commented Jul 5, 2022

This covers the concept of adding pagination to queries. This would be an alternative to the simpler offset #36 parameter.

Pagination was originally noted in #4 as part of multiple suggestions and is based on the Microsub spec https://indieweb.org/Microsub-spec#Paging for paging. A summary adapted from there is noted below.

For queries that paginate their results, there is an additional object returned with the values needed to page through those results.

"paging": {
"before": "xxxxx",
"after": "xxxxx"
}

The "before" and "after" values are arbitrary strings. This allows the server to internally use whatever specific implementation is most appropriate for its backend technology. (Often this will be either a timestamp or a unique ID identifying the first and last items in the returned list.)

  • If there are any items returned in the response, the server MUST return a "before" value that will retrieve items before all the returned items in the list.
  • If there are no items returned in the response, the server MUST NOT return a "before" value.
  • If there are additional items available that were not returned in the response, the server MUST return an "after" value that will retrieve the next page of items.
  • If there are no more items available, the server MUST NOT return an "after" value.
@jalcine
Copy link

jalcine commented Jul 5, 2022

I think this is missing one more case that Koype handles, if there's no more preceding items in the list, there should be no expectation of a before. Unless this is some way to always get the “newest” thing by sending the same before value over and over.

(Originally published at: https://jacky.wtf/2022/7/_TEm)

@dshanske
Copy link
Member Author

dshanske commented Jul 5, 2022

@jalcine I think that's exactly what Microsub describes as how to poll for new content

@jalcine
Copy link

jalcine commented Jul 8, 2022

Noted!

(Originally published at: https://jacky.wtf/2022/7/QXZe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants