import { z } from 'zod'; import type { RouteMethod, SchemaDefinition, RouteSettings, RouteRatelimits } from './core-types'; declare class RouteManager { items: Map; server: any; init(): void; mergeSchemas(schemas: Map): void; resolveUrl(url: string): { route: any; params: Record; path: string; } | null; } declare class SchemaManager { items: Map; server: any; init(): void; } declare class ConnectionManager { init(): Promise; } declare class RatelimitManager { items: Map; check(api: any): boolean; increase(api: any): void; cleanup(): void; } declare class Server { routes: RouteManager; schemas: SchemaManager; connections: ConnectionManager; ratelimits: RatelimitManager; config: { port: number; hostname: string; responseDetailLevel: 'full' | 'mid' | 'low' | 'blank'; defaults: any; ratelimits: any; }; services: TServices; authenticationMethod: (token: string) => Promise | TAuth; routesBasePath: string; init(): Promise; start(): Promise; } declare class API { method: RouteMethod; body: TBody; params: TParams; query: TQuery; headers: any; ip: string; rawPath: string; authentication: TAuth; services: TServices; server: Server; header(key: string, value: string): void; status(code: number): void; throw(status: number, options?: { data?: any; }): never; send(data?: any, options?: { error?: boolean; status?: number; code?: string; message?: string; }): never; sendTyped(data: TResponse, options?: { error?: boolean; status?: number; code?: string; message?: string; }): never; } export interface APIBase { method: RouteMethod; body: unknown; params: unknown; query: unknown; headers: any; ip: string; rawPath: string; header(key: string, value: string): void; status(code: number): void; throw(status: number, options?: { data?: any; }): never; } export type APISendMethod = { send(data?: any, options?: { error?: boolean; status?: number; code?: string; message?: string; }): never; }; export type APISendTypedMethod = { sendTyped(data: TResponse, options?: { error?: boolean; status?: number; code?: string; message?: string; }): never; }; type ExtractParams = V extends { params: infer T; } ? T extends z.ZodTypeAny ? z.infer : unknown : unknown; type ExtractBody = M extends 'GET' ? unknown : V extends { [K in M]: { body: infer T; }; } ? T extends z.ZodTypeAny ? z.infer : unknown : unknown; type ExtractQuery = V extends { [K in M]: { query: infer T; }; } ? T extends z.ZodTypeAny ? z.infer : unknown : unknown; type ExtractResponse = V extends { [K in M]: { response: infer T; }; } ? T extends z.ZodTypeAny ? z.infer : unknown : unknown; export type GetSchemaType = V extends object ? K extends 'params' ? ExtractParams : K extends 'body' ? ExtractBody : K extends 'query' ? ExtractQuery : K extends 'response' ? ExtractResponse : unknown : unknown; type HasResponseSchema = V extends { [K in M]: { response: z.ZodTypeAny; }; } ? true : false; export type BaseAPI = APIBase & { authentication: TAuth; services: TServices; }; export type APIWithSend = BaseAPI & APISendMethod; export type APIWithSendTyped = BaseAPI & APISendMethod & APISendTypedMethod; export type APIDeprecatedSend = Omit, 'send'> & { /** * @deprecated Use sendTyped instead for type-safe responses when a response schema is defined */ send(data?: any, options?: { error?: boolean; status?: number; code?: string; message?: string; }): never; sendTyped(data: TResponse, options?: { error?: boolean; status?: number; code?: string; message?: string; }): never; }; export type ConditionalAPI = HasResponseSchema extends true ? APIDeprecatedSend, GetSchemaType, GetSchemaType, GetSchemaType, TAuth, TServices> : Omit, GetSchemaType, GetSchemaType, GetSchemaType, TAuth, TServices>, 'sendTyped'>; export type RouteDefinition = Partial<{ [M in RouteMethod]: (api: ConditionalAPI) => void; }> & { schema?: V; settings?: Partial> & { [M in RouteMethod]?: Partial>; }; ratelimits?: Partial & { [M in RouteMethod]?: Partial; }; }; export type { RouteMethod, SchemaDefinition, Config, Request, Response, RouteRatelimits, RouteSettings, } from './core-types';