UNPKG

ngx-restful-client

Version:

The ultimate Angular library to exquisitely declare and implement the REST APIs you'll use in your application.

45 lines (44 loc) 1.3 kB
/** * Tipo utilizado para retornar um objeto que servirá para a montagem dos parâmetros de consulta da URL. * Para tanto, basta que a objeto a ser transformado em params seja uma instância que implemente * a interface QueryParams. * Ex.: * ```ts * interface SearchFilter extends QueryParams { * productId?: number; * productName?: string; * categoryName?: string; * } * * class ProductsSearchComponent { * readonly form = this._formBuilder.group( * { * productId: this._fb.control(null), * productName: this._fb.control(null), * categoryName: this._fb.control(null), * } * ); * ... * productsSearch(): void{ * const searchFilter: SearchFilter = this.form.value; * * this.api.products.get<Product[]>(() => searchFilter) * .submit().pipe(take(1)) * .subscribe((next: Product[]) => this.productDataSource = next); * } * } * * ``` * @see QueryParams */ export declare type QueryParamsSupplier = () => QueryParams; /** * Define um contrato a ser implementado por objetos que representem os parâmetros de uma URL. * Cada atributo definido será considerado um 'queryParam' da URL. * * @see QueryParamsSupplier * @see HttpMethodDispatcher */ export interface QueryParams { query?: string | number; }