import { Api } from './api'; import { Content } from './content'; import { HttpClient } from '@angular/common/http'; import { HttpParams } from '@angular/common/http'; import { Observable } from 'rxjs'; import { Query } from './query'; import { QueryConstruction } from './query-construction'; /** * 2sxc data provider * gives you access to content and query streams using the content$ and query$ commands * you can also use the content and query managers, but these are currently not so useful. * * @export * @class Data */ export declare class Data { private http; constructor(http: HttpClient); /** * Cet a content manager object for a specific ContentType * usually you will prefer the the observable stream content$ * this manager is currently included for consistency, and will later also offer write commands * @param contentType name of the content-type */ content(contentType: string): Content; /** * get a stream of content items or (if ID is provided) a stream containing one item * @param contentType name of the content-type * @param id optional id of a single item * @returns an observable containing a single item (if ID is provided) or an array of these items */ content$(contentType: string, id?: number): Observable; /** * get a query object to then start queries * usually you'll be better off using the observable stream query$, this is included primarily for consistency in the api * @param name the query name * @returns a query object with a .get() */ query(name: string): Query; /** * retrieve a query stream from the server * @param name the query name * @param params optional parameters-object * @returns a typed observable which will give you the query */ query$(name: string, params?: HttpParams): Observable; query$({ name, params, streams }: QueryConstruction): Observable; /** * get an api object to then start api-calls * usually you'll be better off using the quick observable stream api$, this is included primarily for consistency in the api * @param controller the api controller * @returns an API object with a .get() method */ api(controller: string): Api; /** * retrieve a api stream from the server * @param apiName controller/method * @param params optional parameters-object * @returns a typed observable which will give you the query */ api$(apiName: string, params?: HttpParams): Observable; }