From 79e358ccb1bf7b4ae1d3282da4c8ec926fa0074c Mon Sep 17 00:00:00 2001 From: Oneric Date: Thu, 19 Oct 2023 15:01:04 +0200 Subject: [PATCH] Move API request limits into the generic ApiClient Currently only affects MisskeyApiClient, as Mastodon-flavour API is constraint by a server-side hard limit of 40 replies. Prepares for implementing multi-part requests which will allow Mastodon-flavour clients to also follow the same limits. --- create-circle.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/create-circle.js b/create-circle.js index 2b4b1ce..ed90b89 100644 --- a/create-circle.js +++ b/create-circle.js @@ -152,6 +152,11 @@ class ApiClient { */ constructor(instance) { this._instance = instance; + // How many objects to max consider per type + this._CNT_NOTES = 70; + this._CNT_RENOTES = 50; + this._CNT_REPLIES = 100; + this._CNT_FAVS = 100; } /** @@ -626,7 +631,7 @@ class MisskeyApiClient extends ApiClient { }, body: { userId: user.id, - limit: 70, + limit: this._CNT_NOTES, reply: false, renote: false, } @@ -656,7 +661,7 @@ class MisskeyApiClient extends ApiClient { }, body: { noteId: note.id, - limit: 50, + limit: this._CNT_RENOTES, } }); @@ -682,7 +687,7 @@ class MisskeyApiClient extends ApiClient { }, body: { noteId: note.id, - limit: 100, + limit: this._CNT_REPLIES, } }); @@ -720,7 +725,7 @@ class MisskeyApiClient extends ApiClient { }, body: { noteId: note.id, - limit: 100, + limit: this._CNT_FAVS, } });