From 07532e95cba5527c9abc353fd51e092d10cc616b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Fri, 27 Sep 2024 09:10:07 +0200 Subject: [PATCH] feat: add another option to GoToSocial API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This supports a documented API option to GET only public statuses, thereby potentially reducing the bandwidth size. Signed-off-by: André Jaenisch --- megalodon/src/gotosocial.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/megalodon/src/gotosocial.ts b/megalodon/src/gotosocial.ts index b0a40cb0..69a70cd7 100644 --- a/megalodon/src/gotosocial.ts +++ b/megalodon/src/gotosocial.ts @@ -356,6 +356,7 @@ export default class Gotosocial implements MegalodonInterface { * @param options.exclude_replies Return statuses which exclude replies. * @param options.exclude_reblogs Return statuses which exclude reblogs. * @param options.only_media Show only statuses with media attached? Defaults to false. + * @param options.only_public Return statuses with public visibility only. * @return Account's statuses. */ public async getAccountStatuses( @@ -369,6 +370,7 @@ export default class Gotosocial implements MegalodonInterface { exclude_replies?: boolean exclude_reblogs?: boolean only_media: boolean + only_public?: boolean } ): Promise>> { let params = {} @@ -413,6 +415,11 @@ export default class Gotosocial implements MegalodonInterface { only_media: options.only_media }) } + if (options.only_public) { + params = Object.assign(params, { + only_public: options.only_public + }) + } } return this.client.get>(`/api/v1/accounts/${id}/statuses`, params).then(res => { return Object.assign(res, {