mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 20:59:15 +02:00
docs(federation): 📝 Update SDK documentation
This commit is contained in:
parent
f79b0bc999
commit
45e5460975
67 changed files with 332 additions and 65 deletions
17
packages/sdk/entities/entity.ts
Normal file
17
packages/sdk/entities/entity.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { EntitySchema } from "../schemas/entity.ts";
|
||||
import type { JSONObject } from "../types.ts";
|
||||
|
||||
export class Entity {
|
||||
public static name = "Entity";
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: This is a base class that is never instanciated directly
|
||||
public constructor(public data: any) {}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Entity> {
|
||||
return EntitySchema.parseAsync(json).then((u) => new Entity(u));
|
||||
}
|
||||
|
||||
public toJSON(): JSONObject {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue