import type { Context } from 'koa'; import type { KoaContext, Controller } from '../routes/types'; import type { ApiResponse, ApiOptions, ApiResponseBody } from '../types/api'; export interface Validator> { (params: T): { valid: boolean; error?: string; }; } export interface ControllerOptions, TApiOptions extends ApiOptions = ApiOptions> { validator?: Validator; buildApiOptions?: (ctx: KoaContext, params: T) => TApiOptions; errorMessage?: string; onError?: (ctx: KoaContext, error: unknown) => void; name?: string; } export declare function createController(apiFunction: (props: T) => Promise, options?: ControllerOptions, T>): Controller; export declare function validateRequired(fields: string[]): Validator; export declare function setApiResponse(ctx: Context, apiResponse: ApiResponse): void; export declare function withErrorHandler(handler: (ctx: KoaContext) => Promise, name?: string): (ctx: KoaContext, next: () => Promise) => Promise;