diff --git a/packages/pl-api/lib/client.ts b/packages/pl-api/lib/client.ts index 1aa3e3828..60a6ef5f2 100644 --- a/packages/pl-api/lib/client.ts +++ b/packages/pl-api/lib/client.ts @@ -809,12 +809,14 @@ class PlApiClient { * * Requires features{@link Features['accountEndorsements']}. * @see {@link https://docs.pleroma.social/backend/development/API/pleroma_api/#apiv1pleromaaccountsidendorsements} + * @see {@link https://docs.joinmastodon.org/methods/accounts/endorsements} */ - getAccountEndorsements: async (accountId: string, params?: GetAccountEndorsementsParams) => { - const response = await this.request(`/api/v1/pleroma/accounts/${accountId}/endorsements`, { params }); - - return v.parse(filteredArray(accountSchema), response.json); - }, + getAccountEndorsements: async (accountId: string, params?: GetAccountEndorsementsParams) => + this.#paginatedGet( + `/api/v1/${[PLEROMA, AKKOMA].includes(this.features.version.software as string) ? 'pleroma/' : ''}accounts/${accountId}/endorsements`, + { params }, + accountSchema, + ), /** * Birthday reminders diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index 78fa99570..4f53cdf34 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -215,10 +215,12 @@ const getFeatures = (instance: Instance) => { * @see POST /api/v1/accounts/:id/pin * @see POST /api/v1/accounts/:id/unpin * @see GET /api/v1/pleroma/accounts/:id/endorsements + * @see GET /api/v1/accounts/:id/endorsements */ accountEndorsements: any([ v.software === AKKOMA, v.software === PLEROMA && gte(v.version, '2.5.0'), + instance.api_versions.mastodon >= 6, ]), accountIsCat: instance.api_versions['cats.pleroma.pl-api'] >= 1, diff --git a/packages/pl-api/lib/params/accounts.ts b/packages/pl-api/lib/params/accounts.ts index 687c885e9..b812c3b51 100644 --- a/packages/pl-api/lib/params/accounts.ts +++ b/packages/pl-api/lib/params/accounts.ts @@ -86,7 +86,7 @@ interface ReportAccountParams { /** * @category Request params */ -type GetAccountEndorsementsParams = WithRelationshipsParam; +type GetAccountEndorsementsParams = Omit & WithRelationshipsParam; /** * @category Request params