From 5f8859a950fa123727a13545aed59bb1683d4c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicole=20Miko=C5=82ajczyk?= Date: Tue, 8 Apr 2025 18:02:48 +0200 Subject: [PATCH] pl-api: support mitra follows export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicole Mikołajczyk --- packages/pl-api/lib/client.ts | 26 ++++++++++++++++++++++++++ packages/pl-api/lib/features.ts | 12 ++++++++++++ 2 files changed, 38 insertions(+) diff --git a/packages/pl-api/lib/client.ts b/packages/pl-api/lib/client.ts index 95890c01d..28d1a0e24 100644 --- a/packages/pl-api/lib/client.ts +++ b/packages/pl-api/lib/client.ts @@ -1637,6 +1637,32 @@ class PlApiClient { return response.json; }, + /** + * Export followers to CSV file + * + * Requires features{@link Features['exportFollowers']}. + */ + exportFollowers: async () => { + const response = await this.request('/api/v1/settings/export_followers', { + method: 'GET', + }); + + return response.data; + }, + + /** + * Export follows to CSV file + * + * Requires features{@link Features['exportFollows']}. + */ + exportFollows: async () => { + const response = await this.request('/api/v1/settings/export_follows', { + method: 'GET', + }); + + return response.data; + } + /** * Updates user notification settings * diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index dbd2de626..59fae83bb 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -621,6 +621,18 @@ const getFeatures = (instance: Instance) => { /** Whether to allow exporting follows/blocks/mutes to CSV by paginating the API. */ exportData: true, + /** + * Export followers to CSV file + * @see GET /api/v1/settings/export_followers + */ + exportFollowers: v.software === MITRA && gte(v.version, '1.27.0'), + + /** + * Export follows to CSV file + * @see GET /api/v1/settings/export_follows + */ + exportFollows: v.software === MITRA && gte(v.version, '1.27.0'), + /** Whether the accounts who favourited or emoji-reacted to a status can be viewed through the API. */ exposableReactions: any([ v.software === FIREFISH,