@tsed/common
Version:
A TypeScript Framework on top of Express
74 lines (73 loc) • 2.28 kB
TypeScript
import { Type } from "@tsed/core";
import { IParamOptions } from "../../interfaces/IParamOptions";
/**
* QueryParams return the value from [request.query](http://expressjs.com/en/4x/api.html#req.query) object.
*
* #### Example
*
* ```typescript
* @Controller('/')
* class MyCtrl {
* @Get('/')
* get(@QueryParams() query: any) {
* console.log('Entire query', query);
* }
*
* @Get('/')
* get(@QueryParams('id') id: string) {
* console.log('ID', id);
* }
*
* @Get('/')
* get(@QueryParams('user') user: User) { // with deserialization
* console.log('user', user);
* }
*
* @Get('/')
* get(@QueryParams('users', User) users: User[]) { // with deserialization
* console.log('users', users);
* }
* }
* ```
* > For more information on deserialization see [converters](/docs/converters.md) page.
*
* @param expression The path of the property to get.
* @param useType The type of the class that to be used to deserialize the data.
* @decorator
* @operation
* @input
*/
export declare function QueryParams(expression: string, useType: Type<any>): ParameterDecorator;
export declare function QueryParams(expression: string): ParameterDecorator;
export declare function QueryParams(useType: Type<any>): ParameterDecorator;
export declare function QueryParams(options: IParamOptions<any>): ParameterDecorator;
export declare function QueryParams(): ParameterDecorator;
/**
* RawQueryParams return the value from [request.query](http://expressjs.com/en/4x/api.html#req.query) object.
*
* Any validation and transformation are performed on the value. Use [pipes](/docs/pipes.html) to validate and/or transform the value.
*
* #### Example
*
* ```typescript
* @Controller('/')
* class MyCtrl {
* @Get('/')
* get(@RawPathParams() params: any) {
* console.log('Entire params', params);
* }
*
* @Get('/')
* get(@RawPathParams('id') id: string) {
* console.log('ID', id);
* }
* }
* ```
* > For more information on deserialization see [converters](/docs/converters.md) page.
*
* @param expression The path of the property to get.
* @decorator
* @operation
* @input
*/
export declare function RawQueryParams(expression: string): ParameterDecorator;