pl-api: support account endorsements on mastodon
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -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
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -86,7 +86,7 @@ interface ReportAccountParams {
|
||||
/**
|
||||
* @category Request params
|
||||
*/
|
||||
type GetAccountEndorsementsParams = WithRelationshipsParam;
|
||||
type GetAccountEndorsementsParams = Omit<PaginationParams, 'min_id'> & WithRelationshipsParam;
|
||||
|
||||
/**
|
||||
* @category Request params
|
||||
|
||||
Reference in New Issue
Block a user