UNPKG

@napp/api-core

Version:

Rest full api

30 lines 1.25 kB
export declare type METHOD = 'get' | 'post' | 'put' | 'delete'; export interface HttpParam { body?: any; path?: Record<string, string>; query?: Record<string, string>; } export interface IPipeHandler<REQ> { toHttp?: (param: REQ) => HttpParam; fromHttp?: (param: Required<HttpParam>) => REQ; } export interface AInterface<REQ, RES> { name: string; path?: string; url?: (param: REQ) => string; method?: METHOD; validation?: (param: REQ) => void; pipe?: IPipeHandler<REQ>; } export interface IBuilder<REQ, RES> { url: (url: (param: REQ) => string) => IBuilder<REQ, RES>; path: (path: string) => IBuilder<REQ, RES>; method: (method: METHOD) => IBuilder<REQ, RES>; validation: (handle: (param: REQ) => void) => IBuilder<REQ, RES>; pipeToHttp: (handle: (param: REQ) => HttpParam) => IBuilder<REQ, RES>; pipeFromHttp: (handle: (param: Required<HttpParam>) => REQ) => IBuilder<REQ, RES>; factory: () => AInterface<REQ, RES>; } export declare function AActionOverider<REQ, RES>(m: AInterface<REQ, RES>): IBuilder<REQ, RES>; export declare function AActionFactory<REQ, RES>(name: string, path?: string): IBuilder<REQ, RES>; //# sourceMappingURL=index.d.ts.map