UNPKG

@creamapi/cream

Version:

Concise REST API Maker - An extension library for express to create REST APIs faster

45 lines (44 loc) 2.08 kB
import { ExtendedRequest } from '../ExpressMiddleware/ExpressMiddleware'; import { MiddlewareParameterProps } from '../ExpressMiddleware/MiddlewareData'; import { ParameterProps } from './ParameterProp'; /** * This class is used to prepare the arguments to use in a call for a express * method */ export declare class ArgsBuilder { private req; private args; /** * @param req the request is used to prepare the arguments for the express call */ constructor(req: ExtendedRequest); /** * Maps the arguments that are body related to body data * @param bodyAssociations The association information that relates the body and its data with the correct parameter index * @returns a self reference to the ArgsBuilder */ addBodyAssociations(bodyAssociations: ParameterProps): ArgsBuilder; /** * Maps the arguments that are URL parameter related to URL data * @param paramsAssociations The association information that relates the URL parameters with the correct parameter index * @returns a self reference to the ArgsBuilder */ addParametersAssociations(paramsAssociations: ParameterProps): ArgsBuilder; /** * Maps the arguments that are headers related to header data * @param headerAssociations The association information that relates the headers with the correct parameter index * @returns a self reference to the ArgsBuilder */ addHeaderAssociations(headerAssociations: ParameterProps): ArgsBuilder; /** * Maps the arguments that are middleware related to middleware data * @param headerAssociations The association information that relates the middleware collections (and collection data) with the correct parameter index * @returns a self reference to the ArgsBuilder */ addMiddlewareAssociations(middlewareAssociations: MiddlewareParameterProps): ArgsBuilder; /** * This metod complese the building process of the args builder * @returns the array of arguments that will be passed to the method */ finalize(): any[]; }