reacts and custom emoji reacts

This commit is contained in:
Moon.eth
2026-07-30 17:38:23 +09:00
parent 5b7b4360d2
commit b814d79f19
7 changed files with 384 additions and 3 deletions
+20
View File
@@ -314,6 +314,26 @@ export function reblogStatus(api: ApiClient, id: string, on: boolean): Promise<S
return api.post<Status>(`/api/v1/statuses/${encodeURIComponent(id)}/${action}`)
}
/**
* Add or remove one of the reactions already present on a status.
*
* Pleroma and Akkoma share this endpoint. `emoji` can be a Unicode emoji, a
* local custom shortcode, or the server-qualified `shortcode@host` returned in
* `pleroma.emoji_reactions`.
*/
export async function setEmojiReaction(
api: ApiClient,
id: string,
emoji: string,
on: boolean,
): Promise<Status> {
const path =
`/api/v1/pleroma/statuses/${encodeURIComponent(id)}` +
`/reactions/${encodeURIComponent(emoji)}`
const { data } = await api.raw<Status>(path, { method: on ? 'PUT' : 'DELETE' })
return data
}
export function votePoll(api: ApiClient, id: string, choices: number[]): Promise<Poll> {
return api.post<Poll>(`/api/v1/polls/${encodeURIComponent(id)}/votes`, { choices })
}