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
29
packages/sdk/entities/collection.ts
Normal file
29
packages/sdk/entities/collection.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import type { z } from "zod";
|
||||
import {
|
||||
CollectionSchema,
|
||||
URICollectionSchema,
|
||||
} from "../schemas/collection.ts";
|
||||
import type { JSONObject } from "../types.ts";
|
||||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class Collection extends Entity {
|
||||
public constructor(public data: z.infer<typeof CollectionSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Collection> {
|
||||
return CollectionSchema.parseAsync(json).then((u) => new Collection(u));
|
||||
}
|
||||
}
|
||||
|
||||
export class URICollection extends Entity {
|
||||
public constructor(public data: z.infer<typeof URICollectionSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<URICollection> {
|
||||
return URICollectionSchema.parseAsync(json).then(
|
||||
(u) => new URICollection(u),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue