2024-08-27 16:40:11 +02:00
|
|
|
import type { OpenAPIHono } from "@hono/zod-openapi";
|
2024-08-26 19:06:49 +02:00
|
|
|
import type {
|
|
|
|
|
Delete,
|
|
|
|
|
Follow,
|
|
|
|
|
FollowAccept,
|
|
|
|
|
FollowReject,
|
|
|
|
|
InstanceMetadata,
|
|
|
|
|
LikeExtension,
|
|
|
|
|
Note,
|
|
|
|
|
Unfollow,
|
|
|
|
|
User,
|
|
|
|
|
} from "@versia/federation/types";
|
2024-09-16 15:29:09 +02:00
|
|
|
import type { SocketAddress } from "bun";
|
2024-12-18 20:42:40 +01:00
|
|
|
import type { RouterRoute } from "hono/types";
|
2024-08-27 17:20:36 +02:00
|
|
|
import { z } from "zod";
|
2024-11-03 17:45:21 +01:00
|
|
|
import type { AuthData } from "~/classes/functions/user";
|
2024-08-29 20:32:04 +02:00
|
|
|
import type { Config } from "~/packages/config-manager";
|
2024-05-07 05:13:37 +02:00
|
|
|
|
|
|
|
|
export type HttpVerb = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS";
|
|
|
|
|
|
2024-08-27 17:20:36 +02:00
|
|
|
export const ErrorSchema = z.object({
|
|
|
|
|
error: z.string(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type HonoEnv = {
|
|
|
|
|
Variables: {
|
2024-08-29 20:32:04 +02:00
|
|
|
config: Config;
|
2024-11-03 17:45:21 +01:00
|
|
|
auth: AuthData;
|
2024-08-27 17:20:36 +02:00
|
|
|
};
|
2024-09-16 15:29:09 +02:00
|
|
|
Bindings: {
|
|
|
|
|
ip?: SocketAddress | null;
|
|
|
|
|
};
|
2024-08-27 17:20:36 +02:00
|
|
|
};
|
|
|
|
|
|
2024-06-13 04:26:43 +02:00
|
|
|
export interface ApiRouteExports {
|
2024-08-27 17:20:36 +02:00
|
|
|
default: (app: OpenAPIHono<HonoEnv>) => RouterRoute;
|
2024-05-07 05:13:37 +02:00
|
|
|
}
|
2024-08-26 19:06:49 +02:00
|
|
|
|
|
|
|
|
export type KnownEntity =
|
|
|
|
|
| Note
|
|
|
|
|
| InstanceMetadata
|
|
|
|
|
| User
|
|
|
|
|
| Follow
|
|
|
|
|
| FollowAccept
|
|
|
|
|
| FollowReject
|
|
|
|
|
| Unfollow
|
|
|
|
|
| Delete
|
2024-08-26 19:40:15 +02:00
|
|
|
| LikeExtension;
|