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
31
packages/sdk/entities/instancemetadata.ts
Normal file
31
packages/sdk/entities/instancemetadata.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import type { z } from "zod";
|
||||
import { InstanceMetadataSchema } from "../schemas/instance.ts";
|
||||
import type { JSONObject } from "../types.ts";
|
||||
import { ImageContentFormat } from "./contentformat.ts";
|
||||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class InstanceMetadata extends Entity {
|
||||
public static name = "InstanceMetadata";
|
||||
|
||||
public constructor(public data: z.infer<typeof InstanceMetadataSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public get logo(): ImageContentFormat | undefined {
|
||||
return this.data.logo
|
||||
? new ImageContentFormat(this.data.logo)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
public get banner(): ImageContentFormat | undefined {
|
||||
return this.data.banner
|
||||
? new ImageContentFormat(this.data.banner)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<InstanceMetadata> {
|
||||
return InstanceMetadataSchema.parseAsync(json).then(
|
||||
(u) => new InstanceMetadata(u),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue