UNPKG

@api.global/typedrequest

Version:

A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.

17 lines (16 loc) 684 B
import * as plugins from './plugins.js'; import { TypedTools } from './classes.typedtools.js'; export type THandlerFunction<T extends plugins.typedRequestInterfaces.ITypedRequest> = (requestArg: T['request'], typedToolsArg?: TypedTools) => Promise<T['response']>; /** * typed handler for dealing with typed requests */ export declare class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest> { method: string; private handlerFunction; constructor(methodArg: T['method'], handlerFunctionArg: THandlerFunction<T>); /** * adds a response to the typedRequest * @param typedRequestArg */ addResponse(typedRequestArg: T): Promise<T>; }