@api.global/typedrequest
Version:
A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.
16 lines (15 loc) • 602 B
TypeScript
import * as plugins from './plugins.js';
export type THandlerFunction<T extends plugins.typedRequestInterfaces.ITypedRequest> = (requestArg: T['request']) => 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>;
}