mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
feat(api): ✨ Add Emoji Reactions
This commit is contained in:
parent
70974d3c35
commit
9722b94eae
17 changed files with 755 additions and 7 deletions
|
|
@ -44,6 +44,7 @@ export { TermsOfService } from "./schemas/tos.ts";
|
|||
export {
|
||||
Challenge,
|
||||
NoteReaction,
|
||||
NoteReactionWithAccounts,
|
||||
Role,
|
||||
SSOConfig,
|
||||
} from "./schemas/versia.ts";
|
||||
|
|
|
|||
|
|
@ -73,6 +73,21 @@ export const NoteReaction = z
|
|||
ref: "NoteReaction",
|
||||
});
|
||||
|
||||
/* Versia Server API extension */
|
||||
export const NoteReactionWithAccounts = NoteReaction.extend({
|
||||
account_ids: z.array(Id).openapi({
|
||||
description: "Array of user IDs who reacted with this emoji.",
|
||||
example: [
|
||||
"1d0185bc-d949-4ff5-8a15-1d691b256489",
|
||||
"d9de4aeb-4591-424d-94ec-659f958aa23d",
|
||||
"1f0c4eb9-a742-4c82-96c9-697a39831cd1",
|
||||
],
|
||||
}),
|
||||
}).openapi({
|
||||
description: "Information about a reaction to a note with account IDs.",
|
||||
ref: "NoteReactionWithAccounts",
|
||||
});
|
||||
|
||||
/* Versia Server API extension */
|
||||
export const SSOConfig = z.object({
|
||||
forced: z.boolean().openapi({
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue