/** * Base class for route and body parameters and */ declare abstract class RequestParameter { name: string; required: boolean; additionalTests: Array; description: string; /** * runs test functions in the additional tests Array and returns an array of errors, or an empty arrays if no errors. * @param value - parameter value */ runTests(value: any): Array; } /** * Defines a parameter expected to be present in the request's body */ export declare class BodyParameter extends RequestParameter { type: ParameterType; nullable: boolean; /** * Constructs a BodyParameter instance * @constructor * @param name - property name * @param type - the expected type of the parameter. if defined, will throw an error if the parameter's type doesn't match * @param required - if true, will throw an error when the property is missing * @param description - text that will be displayed in the rendered help output * @param additionalTests - an array of additional test functions and their description * @param nullable - is parameter value nullable. allows to make parameter required and exclude type validation when value is null */ constructor(name: string, type?: ParameterType, description?: string, required?: boolean, additionalTests?: Array, nullable?: boolean); } /** * Defines a parameter expected to be present in the request's route */ export declare class RouteParameter extends RequestParameter { /** * Constructs a BodyParameter instance * @constructor * @param name - property name * @param required - if true, will throw an error when the property is missing * @param description - text that will be displayed in the rendered help output * @param additionalTests - an array of additional test functions and their description */ constructor(name: string, description?: string, required?: boolean, additionalTests?: Array); } /** * A test function and test description for testing request parameters */ export interface RequestParameterTestFunction { /** * a test function that receives the parameter value as an argument and returns a boolean * @param value - parameter value passed by the test routine */ test(value: any): boolean; /** * an optional description of the test that will be displayed in the error output in case the function returns false */ description: string; } /** * Optional types for a body parameter */ export declare type ParameterType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'parsableDateString' | 'null' | 'any'; export {}; //# sourceMappingURL=RequestParameters.d.ts.map