diff --git a/packages/pl-api/lib/client.ts b/packages/pl-api/lib/client.ts index e47c18dc9..11e9824c6 100644 --- a/packages/pl-api/lib/client.ts +++ b/packages/pl-api/lib/client.ts @@ -1537,6 +1537,12 @@ class PlApiClient { contentType: '', }); break; + case MITRA: + response = await this.request('/api/v1/settings/import_follows', { + method: 'POST', + body: { follows_csv: typeof list === 'string' ? list : await list.text() }, + }); + break; default: response = await this.request('/api/pleroma/follow_import', { method: 'POST', @@ -1548,6 +1554,20 @@ class PlApiClient { return response.json; }, + /** + * Move followers from remote alias. (experimental?) + * + * Requires features{@link Features['importFollowers']}. + */ + importFollowers: async (list: File | string, actorId: string) => { + const response = await this.request('/api/v1/settings/import_followers', { + method: 'POST', + body: { from_actor_id: actorId, followers_csv: typeof list === 'string' ? list : await list.text() }, + }); + + return response.json; + }, + /** * Imports your blocks. * diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index 3e7f231c0..a7e8d5231 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -832,15 +832,24 @@ const getFeatures = (instance: Instance) => { v.software === PLEROMA, ]), + /** + * Move followers from remote alias. + * @see POST /api/v1/settings/import_followers + */ + importFollowers: any([ + v.software === MITRA && gte(v.version, '2.18.0'), + ]), + /** * Import a .csv file with a list of followed users. * @see POST /api/pleroma/follow_import + * @see POST /api/v1/settings/import_follows * @see POST /api/v1/import - */ importFollows: any([ v.software === AKKOMA, v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), + v.software === MITRA && gte(v.version, '1.10.0'), v.software === PLEROMA, ]),