diff --git a/packages/pl-api/lib/client.ts b/packages/pl-api/lib/client.ts index c5a075ac8..25444e2a3 100644 --- a/packages/pl-api/lib/client.ts +++ b/packages/pl-api/lib/client.ts @@ -181,6 +181,7 @@ import type { GetJoinedEventsParams, } from './params/events'; import type { + BlockAccountParams, CreateFilterParams, GetBlocksParams, GetDomainBlocksParams, @@ -2050,9 +2051,10 @@ class PlApiClient { * Block account * Block the given account. Clients should filter statuses from this account if received (e.g. due to a boost in the Home timeline) * @see {@link https://docs.joinmastodon.org/methods/accounts/#block} + * `duration` parameter requires features{@link Features.blocksDuration}. */ - blockAccount: async (accountId: string) => { - const response = await this.request(`/api/v1/accounts/${accountId}/block`, { method: 'POST' }); + blockAccount: async (accountId: string, params?: BlockAccountParams) => { + const response = await this.request(`/api/v1/accounts/${accountId}/block`, { method: 'POST', body: params }); return v.parse(relationshipSchema, response.json); }, @@ -2461,7 +2463,7 @@ class PlApiClient { * Delete a status * Delete one of your own statuses. * - * `delete_media` parameters requires features{@link Features.deleteMedia}. + * `delete_media` parameter requires features{@link Features.deleteMedia}. * @see {@link https://docs.joinmastodon.org/methods/statuses/#delete} */ deleteStatus: async (statusId: string, deleteMedia?: boolean) => { diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index f5115cb1e..6ecbbcef1 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -420,6 +420,12 @@ const getFeatures = (instance: Instance) => { /** Whether people who blocked you are visible through the API. */ blockersVisible: instance.api_versions['blockers_visible.pleroma.pl-api'] >= 1, + /** + * Ability to specify how long the account block should last. + * @see PUT /api/v1/accounts/:id/block + */ + blocksDuration: instance.api_versions['block_expiration.pleroma.pl-api'] >= 1, + bookmarkFolderEmojis: instance.api_versions['bookmark_folders.pleroma.pl-api'] >= 1, /** diff --git a/packages/pl-api/lib/params/filtering.ts b/packages/pl-api/lib/params/filtering.ts index 599a1eab9..0cc0bc37e 100644 --- a/packages/pl-api/lib/params/filtering.ts +++ b/packages/pl-api/lib/params/filtering.ts @@ -1,5 +1,13 @@ import type { PaginationParams, WithRelationshipsParam } from './common'; +/** + * @category Request params + */ +interface BlockAccountParams { + /** Number. How long the block should last, in seconds. Defaults to 0 (indefinite). */ + duration?: number; +} + /** * @category Request params */ @@ -61,6 +69,7 @@ interface UpdateFilterParams { } export type { + BlockAccountParams, MuteAccountParams, GetMutesParams, GetBlocksParams,