UNPKG

@whook/whook

Version:

Build strong and efficient REST web services.

14 lines (13 loc) 1.63 kB
import { type WhookOpenAPI, type WhookOpenAPIOperation } from '../types/openapi.js'; import { type WhookRequest, type WhookResponse } from '../types/http.js'; import { type WhookRouteHandler, type WhookRouteDefinition, type WhookRouteHandlerParameters } from '../types/routes.js'; import { type WhookRequestBodySpec, type WhookResponseBodySpec } from './body.js'; export declare function extractConsumableMediaTypes(API: WhookOpenAPI, operation: WhookOpenAPIOperation): Promise<string[]>; export declare function extractProduceableMediaTypes(API: WhookOpenAPI, operation: WhookOpenAPIOperation): Promise<string[]>; export declare function extractBodySpec(request: WhookRequest, consumableMediaTypes: string[], consumableCharsets: string[]): WhookRequestBodySpec; export declare function checkBodyCharset(bodySpec: WhookRequestBodySpec, consumableCharsets: string[]): void; export declare function checkBodyMediaType(bodySpec: WhookRequestBodySpec, consumableMediaTypes: string[]): void; export declare function extractResponseSpec(operation: WhookOpenAPIOperation, request: WhookRequest, supportedMediaTypes: string[], supportedCharsets: string[]): WhookResponseBodySpec; export declare function checkResponseMediaType(request: WhookRequest, responseSpec: WhookResponseBodySpec, produceableMediaTypes: string[]): void; export declare function checkResponseCharset(request: WhookRequest, responseSpec: WhookResponseBodySpec, produceableCharsets: string[]): void; export declare function executeHandler(definition: WhookRouteDefinition, handler: WhookRouteHandler, parameters: WhookRouteHandlerParameters): Promise<WhookResponse>;