1 | import { PipeTransform } from '../../index';
|
2 | import { Type } from '../../interfaces';
|
3 | export declare type ParamData = object | string | number;
|
4 | export interface RouteParamMetadata {
|
5 | index: number;
|
6 | data?: ParamData;
|
7 | }
|
8 | export declare function assignMetadata<TParamtype = any, TArgs = any>(args: TArgs, paramtype: TParamtype, index: number, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): TArgs & {
|
9 | [x: string]: {
|
10 | index: number;
|
11 | data: ParamData;
|
12 | pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[];
|
13 | };
|
14 | };
|
15 | /**
|
16 | * Route handler parameter decorator. Extracts the `Request`
|
17 | * object from the underlying platform and populates the decorated
|
18 | * parameter with the value of `Request`.
|
19 | *
|
20 | * Example: `logout(@Request() req)`
|
21 | *
|
22 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
23 | *
|
24 | * @publicApi
|
25 | */
|
26 | export declare const Request: () => ParameterDecorator;
|
27 | /**
|
28 | * Route handler parameter decorator. Extracts the `Response`
|
29 | * object from the underlying platform and populates the decorated
|
30 | * parameter with the value of `Response`.
|
31 | *
|
32 | * Example: `logout(@Response() res)`
|
33 | *
|
34 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
35 | *
|
36 | * @publicApi
|
37 | */
|
38 | export declare const Response: () => ParameterDecorator;
|
39 | /**
|
40 | * Route handler parameter decorator. Extracts reference to the `Next` function
|
41 | * from the underlying platform and populates the decorated
|
42 | * parameter with the value of `Next`.
|
43 | *
|
44 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
45 | *
|
46 | * @publicApi
|
47 | */
|
48 | export declare const Next: () => ParameterDecorator;
|
49 | /**
|
50 | * Route handler parameter decorator. Extracts the `Ip` property
|
51 | * from the `req` object and populates the decorated
|
52 | * parameter with the value of `ip`.
|
53 | *
|
54 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
55 | *
|
56 | * @publicApi
|
57 | */
|
58 | export declare const Ip: () => ParameterDecorator;
|
59 | /**
|
60 | * Route handler parameter decorator. Extracts the `Session` object
|
61 | * from the underlying platform and populates the decorated
|
62 | * parameter with the value of `Session`.
|
63 | *
|
64 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
65 | *
|
66 | * @publicApi
|
67 | */
|
68 | export declare const Session: () => ParameterDecorator;
|
69 | /**
|
70 | * Route handler parameter decorator. Extracts the `file` object
|
71 | * and populates the decorated parameter with the value of `file`.
|
72 | * Used in conjunction with
|
73 | * [multer middleware](https://github.com/expressjs/multer).
|
74 | *
|
75 | * For example:
|
76 | * ```typescript
|
77 | * uploadFile(@UploadedFile() file) {
|
78 | * console.log(file);
|
79 | * }
|
80 | * ```
|
81 | * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
82 | *
|
83 | * @publicApi
|
84 | */
|
85 | export declare const UploadedFile: (fileKey?: string) => ParameterDecorator;
|
86 | /**
|
87 | * Route handler parameter decorator. Extracts the `files` object
|
88 | * and populates the decorated parameter with the value of `files`.
|
89 | * Used in conjunction with
|
90 | * [multer middleware](https://github.com/expressjs/multer).
|
91 | *
|
92 | * For example:
|
93 | * ```typescript
|
94 | * uploadFile(@UploadedFiles() files) {
|
95 | * console.log(files);
|
96 | * }
|
97 | * ```
|
98 | * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
99 | *
|
100 | * @publicApi
|
101 | */
|
102 | export declare const UploadedFiles: () => ParameterDecorator;
|
103 | /**
|
104 | * Route handler parameter decorator. Extracts the `headers`
|
105 | * property from the `req` object and populates the decorated
|
106 | * parameter with the value of `headers`.
|
107 | *
|
108 | * For example: `async update(@Headers('Cache-Control') cacheControl: string)`
|
109 | *
|
110 | * @param property name of single header property to extract.
|
111 | *
|
112 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
113 | *
|
114 | * @publicApi
|
115 | */
|
116 | export declare const Headers: (property?: string) => ParameterDecorator;
|
117 | /**
|
118 | * Route handler parameter decorator. Extracts the `query`
|
119 | * property from the `req` object and populates the decorated
|
120 | * parameter with the value of `query`. May also apply pipes to the bound
|
121 | * query parameter.
|
122 | *
|
123 | * For example:
|
124 | * ```typescript
|
125 | * async find(@Query('user') user: string)
|
126 | * ```
|
127 | *
|
128 | * @param property name of single property to extract from the `query` object
|
129 | * @param pipes one or more pipes to apply to the bound query parameter
|
130 | *
|
131 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
132 | *
|
133 | * @publicApi
|
134 | */
|
135 | export declare function Query(): ParameterDecorator;
|
136 | /**
|
137 | * Route handler parameter decorator. Extracts the `query`
|
138 | * property from the `req` object and populates the decorated
|
139 | * parameter with the value of `query`. May also apply pipes to the bound
|
140 | * query parameter.
|
141 | *
|
142 | * For example:
|
143 | * ```typescript
|
144 | * async find(@Query('user') user: string)
|
145 | * ```
|
146 | *
|
147 | * @param property name of single property to extract from the `query` object
|
148 | * @param pipes one or more pipes to apply to the bound query parameter
|
149 | *
|
150 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
151 | *
|
152 | * @publicApi
|
153 | */
|
154 | export declare function Query(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
155 | /**
|
156 | * Route handler parameter decorator. Extracts the `query`
|
157 | * property from the `req` object and populates the decorated
|
158 | * parameter with the value of `query`. May also apply pipes to the bound
|
159 | * query parameter.
|
160 | *
|
161 | * For example:
|
162 | * ```typescript
|
163 | * async find(@Query('user') user: string)
|
164 | * ```
|
165 | *
|
166 | * @param property name of single property to extract from the `query` object
|
167 | * @param pipes one or more pipes to apply to the bound query parameter
|
168 | *
|
169 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
170 | *
|
171 | * @publicApi
|
172 | */
|
173 | export declare function Query(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
174 | /**
|
175 | * Route handler parameter decorator. Extracts the entire `body`
|
176 | * object from the `req` object and populates the decorated
|
177 | * parameter with the value of `body`.
|
178 | *
|
179 | * For example:
|
180 | * ```typescript
|
181 | * async create(@Body() cat: CreateCatDto)
|
182 | * ```
|
183 | *
|
184 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
185 | *
|
186 | * @publicApi
|
187 | */
|
188 | export declare function Body(): ParameterDecorator;
|
189 | /**
|
190 | * Route handler parameter decorator. Extracts the entire `body`
|
191 | * object from the `req` object and populates the decorated
|
192 | * parameter with the value of `body`. Also applies the specified
|
193 | * pipes to that parameter.
|
194 | *
|
195 | * For example:
|
196 | * ```typescript
|
197 | * async create(@Body(new ValidationPipe()) cat: CreateCatDto)
|
198 | * ```
|
199 | *
|
200 | * @param pipes one or more pipes - either instances or classes - to apply to
|
201 | * the bound body parameter.
|
202 | *
|
203 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
204 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
205 | *
|
206 | * @publicApi
|
207 | */
|
208 | export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
209 | /**
|
210 | * Route handler parameter decorator. Extracts a single property from
|
211 | * the `body` object property of the `req` object and populates the decorated
|
212 | * parameter with the value of that property. Also applies pipes to the bound
|
213 | * body parameter.
|
214 | *
|
215 | * For example:
|
216 | * ```typescript
|
217 | * async create(@Body('role', new ValidationPipe()) role: string)
|
218 | * ```
|
219 | *
|
220 | * @param property name of single property to extract from the `body` object
|
221 | * @param pipes one or more pipes - either instances or classes - to apply to
|
222 | * the bound body parameter.
|
223 | *
|
224 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
225 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
226 | *
|
227 | * @publicApi
|
228 | */
|
229 | export declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
230 | /**
|
231 | * Route handler parameter decorator. Extracts the `params`
|
232 | * property from the `req` object and populates the decorated
|
233 | * parameter with the value of `params`. May also apply pipes to the bound
|
234 | * parameter.
|
235 | *
|
236 | * For example, extracting all params:
|
237 | * ```typescript
|
238 | * findOne(@Param() params: string[])
|
239 | * ```
|
240 | *
|
241 | * For example, extracting a single param:
|
242 | * ```typescript
|
243 | * findOne(@Param('id') id: string)
|
244 | * ```
|
245 | * @param property name of single property to extract from the `req` object
|
246 | * @param pipes one or more pipes - either instances or classes - to apply to
|
247 | * the bound parameter.
|
248 | *
|
249 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
250 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
251 | *
|
252 | * @publicApi
|
253 | */
|
254 | export declare function Param(): ParameterDecorator;
|
255 | /**
|
256 | * Route handler parameter decorator. Extracts the `params`
|
257 | * property from the `req` object and populates the decorated
|
258 | * parameter with the value of `params`. May also apply pipes to the bound
|
259 | * parameter.
|
260 | *
|
261 | * For example, extracting all params:
|
262 | * ```typescript
|
263 | * findOne(@Param() params: string[])
|
264 | * ```
|
265 | *
|
266 | * For example, extracting a single param:
|
267 | * ```typescript
|
268 | * findOne(@Param('id') id: string)
|
269 | * ```
|
270 | * @param property name of single property to extract from the `req` object
|
271 | * @param pipes one or more pipes - either instances or classes - to apply to
|
272 | * the bound parameter.
|
273 | *
|
274 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
275 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
276 | *
|
277 | * @publicApi
|
278 | */
|
279 | export declare function Param(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
280 | /**
|
281 | * Route handler parameter decorator. Extracts the `params`
|
282 | * property from the `req` object and populates the decorated
|
283 | * parameter with the value of `params`. May also apply pipes to the bound
|
284 | * parameter.
|
285 | *
|
286 | * For example, extracting all params:
|
287 | * ```typescript
|
288 | * findOne(@Param() params: string[])
|
289 | * ```
|
290 | *
|
291 | * For example, extracting a single param:
|
292 | * ```typescript
|
293 | * findOne(@Param('id') id: string)
|
294 | * ```
|
295 | * @param property name of single property to extract from the `req` object
|
296 | * @param pipes one or more pipes - either instances or classes - to apply to
|
297 | * the bound parameter.
|
298 | *
|
299 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
300 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
301 | *
|
302 | * @publicApi
|
303 | */
|
304 | export declare function Param(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
305 | /**
|
306 | * Route handler parameter decorator. Extracts the `hosts`
|
307 | * property from the `req` object and populates the decorated
|
308 | * parameter with the value of `hosts`. May also apply pipes to the bound
|
309 | * parameter.
|
310 | *
|
311 | * For example, extracting all params:
|
312 | * ```typescript
|
313 | * findOne(@HostParam() params: string[])
|
314 | * ```
|
315 | *
|
316 | * For example, extracting a single param:
|
317 | * ```typescript
|
318 | * findOne(@HostParam('id') id: string)
|
319 | * ```
|
320 | * @param property name of single property to extract from the `req` object
|
321 | *
|
322 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
323 | *
|
324 | * @publicApi
|
325 | */
|
326 | export declare function HostParam(): ParameterDecorator;
|
327 | /**
|
328 | * Route handler parameter decorator. Extracts the `hosts`
|
329 | * property from the `req` object and populates the decorated
|
330 | * parameter with the value of `hosts`. May also apply pipes to the bound
|
331 | * parameter.
|
332 | *
|
333 | * For example, extracting all params:
|
334 | * ```typescript
|
335 | * findOne(@HostParam() params: string[])
|
336 | * ```
|
337 | *
|
338 | * For example, extracting a single param:
|
339 | * ```typescript
|
340 | * findOne(@HostParam('id') id: string)
|
341 | * ```
|
342 | * @param property name of single property to extract from the `req` object
|
343 | *
|
344 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
345 | *
|
346 | * @publicApi
|
347 | */
|
348 | export declare function HostParam(property: string): ParameterDecorator;
|
349 | export declare const Req: () => ParameterDecorator;
|
350 | export declare const Res: () => ParameterDecorator;
|