import { HttpClient } from '@angular/common/http'; import { DomSanitizer } from '@angular/platform-browser'; import { Observable, ReplaySubject } from 'rxjs'; import { MtnaLogger } from '@mtna/lib-ui'; import { Snippet, SnippetGenerator } from '@mtna/rds-packaging-ui'; import { RdsApiSnippetQueryType } from '../models/api-snippet-query-type.model'; import { RdsRawApiQuery } from '../models/raw-api-query.model'; import { SelectParameters } from '../models/select-parameters.model'; import { TabulationParameters } from '../models/tabulation-parameters.model'; import { RdsApiService } from './rds-api.service'; export declare class RdsSnippetService { protected apiService: RdsApiService; private http; protected logger: MtnaLogger; private sanitizer; /** base url for the snippet service */ get SNIPPET_URL(): string; /** url for the selected data product */ protected get DATA_PRODUCT_URL(): string; protected _snippetGeneratorsCache$: ReplaySubject; protected _snippetGeneratorsRequest$: Observable; protected _selectCache: Map; protected _tabulateCache: Map; constructor(apiService: RdsApiService, http: HttpClient, logger: MtnaLogger, sanitizer: DomSanitizer); /** * Snippet generators can be used to create calls in external libraries that * when run, will get the data set represented by a provided query. This end * point exposes the available snippet generators and their details. * @remarks This method uses caching, returns a hot observable. * @param refresh forces a cache refresh, will update all subscribers. Defaults to false. * @returns all available snippet generators */ getSnippetGenerators(refresh?: boolean): Observable; /** * Requests a snippet of code in the requested library to recreate the * provided select query. * * @remarks This method uses caching, returns a cold observable. * @param params various select parameters * @param library the name of the library for the requested code snippet * @param version the version of the library for the requested code snippet * @param refresh forces a cache refresh, will fetch a new value from the API. Defaults to false. * @returns The code snippet for the specified select query applicable to the given version of the library */ generateSelectSnippet(params: SelectParameters, library: string, version: string, refresh?: boolean): Observable; /** * Requests a snippet of code in the requested library to recreate the * provided tabulate query. * * @remarks This method uses caching, returns a cold observable. * @param params various tabulation parameters * @param library the name of the library for the requested code snippet * @param version the version of the library for the requested code snippet * @param refresh forces a cache refresh, will fetch a new value from the API. Defaults to false. * @returns The code snippet for the specified tabulate query applicable to the given version of the library */ generateTabulateSnippet(params: TabulationParameters, library: string, version: string, refresh?: boolean): Observable; /** * Create the html representation and raw query path. * * @param type the type of query, SELECT or TABULATE * @param params the query parameters * @returns an html representation and the raw RDS API path */ generateRawApiQuery(type: RdsApiSnippetQueryType, params: SelectParameters | TabulationParameters): RdsRawApiQuery; /** * Normalize the api url into the expected part for snippet api methods. * They expect the url to end with "/rds", not "/rds/api". * * @returns the normalized base url for snippet api methods */ protected _normalizeBaseUrl(): string; }