import * as tm from "type-mapping"; import { Path } from "../path"; import { SetQuery, SetMethod, Append, AssertCanAppendParam, AppendParam, AssertCanSetParam, SetParam, UnsetParam, SetBody, SetHeader, SetResponse, DeepMergeQuery, AppendParamField, AssertValidParamField } from "./operation"; import { MethodOf } from "./query"; import { IsValid } from "./predicate"; /** TODO Does the "CONNECT" method make sense? */ export declare enum Method { GET = "GET", POST = "POST", PUT = "PUT", DELETE = "DELETE", PATCH = "PATCH", HEAD = "HEAD", OPTIONS = "OPTIONS", CONNECT = "CONNECT", /** If a route's method is "Contextual", then it is "GET" if there is no body mapper, and "POST" if there is. */ Contextual = "Contextual" } export declare type MethodStr = keyof (typeof Method); export interface RouteData { readonly method: MethodStr; readonly path: Path; readonly param: undefined | tm.AnySafeMapper; readonly query: undefined | tm.AnySafeMapper; readonly body: undefined | tm.AnySafeMapper; readonly header: undefined | tm.AnySafeMapper; readonly response: undefined | tm.AnySafeMapper; } export interface DefaultRouteData { readonly method: Method.Contextual; readonly path: Path; readonly param: undefined; readonly query: undefined; readonly body: undefined; readonly header: undefined; readonly response: undefined; } export declare class Route { readonly method: DataT["method"]; readonly path: DataT["path"]; readonly param: DataT["param"]; readonly query: DataT["query"]; readonly body: DataT["body"]; readonly header: DataT["header"]; readonly response: DataT["response"]; setMethod(method: MethodT): SetMethod; getMethod(): MethodOf; constructor(data: DataT); static Create(): Route; append(part: string): Append; appendParam(this: AssertCanAppendParam, name: NameT, regex?: RegExp): AppendParam; appendParam(this: this, field: AssertValidParamField, regex?: RegExp): AppendParamField; setParam(f: AssertCanSetParam): SetParam; unsetParam(): UnsetParam; /** Your query mapper should handle the following types, `string|(string[])|undefined` */ setQuery(f: F): SetQuery; setBody(f: F): SetBody; /** Your header mapper should handle the following types, `string|(string[])|undefined` Your header key will probably be lowercased. */ setHeader(f: F): SetHeader; setResponse(f: F): SetResponse; deepMergeQuery(f: F): DeepMergeQuery; isValid(): IsValid; assertValid(): void; } /** Synonym for `Route.Create()` */ export declare function route(): Route; //# sourceMappingURL=route.d.ts.map