server/types/api.ts
Jesse Wierzbinski 58342e86e1
refactor(api): ♻️ Move from @hono/zod-openapi to hono-openapi
hono-openapi is easier to work with and generates better OpenAPI definitions
2025-03-29 03:30:06 +01:00

45 lines
977 B
TypeScript

import type {
Delete,
Follow,
FollowAccept,
FollowReject,
InstanceMetadata,
LikeExtension,
Note,
Unfollow,
User,
} from "@versia/federation/types";
import type { SocketAddress } from "bun";
import type { Hono } from "hono";
import type { RouterRoute } from "hono/types";
import type { z } from "zod";
import type { ConfigSchema } from "~/classes/config/schema";
import type { AuthData } from "~/classes/functions/user";
export type HttpVerb = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS";
export type HonoEnv = {
Variables: {
config: z.infer<typeof ConfigSchema>;
auth: AuthData;
};
Bindings: {
ip?: SocketAddress | null;
};
};
export interface ApiRouteExports {
default: (app: Hono<HonoEnv>) => RouterRoute;
}
export type KnownEntity =
| Note
| InstanceMetadata
| User
| Follow
| FollowAccept
| FollowReject
| Unfollow
| Delete
| LikeExtension;