From 1dbc7d4baae8f71c28f2db40183a53aa3594840c Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 24 Feb 2023 14:43:50 +0000 Subject: fix pagination more (for non-timeline) --- lib/Dakkar/Misskey.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/Dakkar/Misskey.pm b/lib/Dakkar/Misskey.pm index 484131f..a32bd5b 100644 --- a/lib/Dakkar/Misskey.pm +++ b/lib/Dakkar/Misskey.pm @@ -41,8 +41,26 @@ sub _request($self, $endpoint, $payload) { sub _paged_request($self, $endpoint, $payload, $cb) { my @all_results; + # misskey paged endpoints return results ordered differently + # depending on the presence of `sinceId`, `untilId`, `sinceDate`, + # `untilDate` + # + # sinceId untilId sinceDate untilDate order by + # x x ? ? id DESC + # x ? ? id ASC + # x ? ? id DESC + # x x createdAt DESC + # x createdAt ASC + # x createdAt DESC + # id DESC + # + # for simplicity, here we assume we'll never get `untilId`, + # `sinceDate`, or `untilDate`, and we page with `sinceId` in + # ASCending `id` order + my $page_payload = { limit => 100, + sinceId => '0', $payload->%*, }; -- cgit v1.2.3