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
61
packages/sdk/entities/follow.ts
Normal file
61
packages/sdk/entities/follow.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import type { z } from "zod";
|
||||
import {
|
||||
FollowAcceptSchema,
|
||||
FollowRejectSchema,
|
||||
FollowSchema,
|
||||
UnfollowSchema,
|
||||
} from "../schemas/follow.ts";
|
||||
import type { JSONObject } from "../types.ts";
|
||||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class Follow extends Entity {
|
||||
public static name = "Follow";
|
||||
|
||||
public constructor(public data: z.infer<typeof FollowSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Follow> {
|
||||
return FollowSchema.parseAsync(json).then((u) => new Follow(u));
|
||||
}
|
||||
}
|
||||
|
||||
export class FollowAccept extends Entity {
|
||||
public static name = "FollowAccept";
|
||||
|
||||
public constructor(public data: z.infer<typeof FollowAcceptSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<FollowAccept> {
|
||||
return FollowAcceptSchema.parseAsync(json).then(
|
||||
(u) => new FollowAccept(u),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class FollowReject extends Entity {
|
||||
public static name = "FollowReject";
|
||||
|
||||
public constructor(public data: z.infer<typeof FollowRejectSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<FollowReject> {
|
||||
return FollowRejectSchema.parseAsync(json).then(
|
||||
(u) => new FollowReject(u),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class Unfollow extends Entity {
|
||||
public static name = "Unfollow";
|
||||
|
||||
public constructor(public data: z.infer<typeof UnfollowSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Unfollow> {
|
||||
return UnfollowSchema.parseAsync(json).then((u) => new Unfollow(u));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue