feat(api): Add Emoji Reactions

This commit is contained in:
Jesse Wierzbinski 2025-05-25 16:11:56 +02:00
parent 70974d3c35
commit 9722b94eae
No known key found for this signature in database
17 changed files with 755 additions and 7 deletions

View file

@ -27,7 +27,11 @@ import type {
import type { Tag } from "../schemas/tag.ts";
import type { Token } from "../schemas/token.ts";
import type { TermsOfService } from "../schemas/tos.ts";
import type { Challenge, Role } from "../schemas/versia.ts";
import type {
Challenge,
NoteReactionWithAccounts,
Role,
} from "../schemas/versia.ts";
import { BaseClient, type Output } from "./base.ts";
import { DEFAULT_SCOPE, NO_REDIRECT } from "./constants.ts";
@ -217,7 +221,7 @@ export class Client extends BaseClient {
emoji: string,
extra?: RequestInit,
): Promise<Output<z.infer<typeof Status>>> {
return this.post<z.infer<typeof Status>>(
return this.put<z.infer<typeof Status>>(
`/api/v1/statuses/${id}/reactions/${emoji}`,
undefined,
extra,
@ -2090,6 +2094,22 @@ export class Client extends BaseClient {
);
}
/**
* GET /api/v1/statuses/:id/reactions
*
* @param id The target status id.
* @return Array of reactions with accounts.
*/
public getStatusReactions(
id: string,
extra?: RequestInit,
): Promise<Output<z.infer<typeof NoteReactionWithAccounts>[]>> {
return this.get<z.infer<typeof NoteReactionWithAccounts>[]>(
`/api/v1/statuses/${id}/reactions`,
extra,
);
}
/**
* GET /api/v1/featured_tags/suggestions
*