2025-04-08 16:01:10 +02:00
|
|
|
import type { z } from "zod";
|
|
|
|
|
import { ReactionSchema } from "../../schemas/extensions/reactions.ts";
|
|
|
|
|
import type { JSONObject } from "../../types.ts";
|
|
|
|
|
import { Entity } from "../entity.ts";
|
|
|
|
|
|
|
|
|
|
export class Reaction extends Entity {
|
2025-05-23 17:29:27 +02:00
|
|
|
public static override name = "pub.versia:reactions/Reaction";
|
2025-04-08 16:01:10 +02:00
|
|
|
|
2025-05-23 17:29:27 +02:00
|
|
|
public constructor(public override data: z.infer<typeof ReactionSchema>) {
|
2025-04-08 16:01:10 +02:00
|
|
|
super(data);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 17:29:27 +02:00
|
|
|
public static override fromJSON(json: JSONObject): Promise<Reaction> {
|
2025-04-08 16:01:10 +02:00
|
|
|
return ReactionSchema.parseAsync(json).then((u) => new Reaction(u));
|
|
|
|
|
}
|
|
|
|
|
}
|