import { Observable } from 'rxjs/Observable'; import { DeliveryClientConfig } from '../config/delivery-client.config'; import { IHeader } from '../interfaces/common/iheader.interface'; import { IQueryParameter } from '../interfaces/common/iquery-parameter.interface'; import { IQueryConfig } from '../interfaces/common/iquery.config'; import { ISdkInfo } from '../interfaces/common/isdk-info.class'; import { IContentItem } from '../interfaces/item/icontent-item.interface'; import { IItemQueryConfig } from '../interfaces/item/iitem-query.config'; import { ITaxonomyQueryConfig } from '../interfaces/taxonomy/itaxonomy-query.config'; import { IContentTypeQueryConfig } from '../interfaces/type/icontent-type-query.config'; import { ElementResponses } from '../models/element/responses'; import { ItemResponses } from '../models/item/responses'; import { TaxonomyResponses } from '../models/taxonomy/responses'; import { TypeResponses } from '../models/type/responses'; import { BaseResponse } from '../services/http/base-response.class'; import { IHttpService } from './http/ihttp.service'; import { ResponseMapService } from './response-map.service'; export declare class QueryService { /** * Delivery client configuration */ protected config: DeliveryClientConfig; /** * Http service for fetching data */ protected httpService: IHttpService; /** * Information about the SDK * This can contain information from both this & Node SDK for internal logging with 'SDKID' header */ protected sdkInfo: ISdkInfo; /** * Default number of retry attempts when user did not set any */ private readonly defaultRetryAttempts; /** * Excluded status code from retry functionality */ private readonly retryExcludedStatuses; /** * Header name for SDK usage */ private readonly sdkVersionHeader; /** * Default base Url to Kentico Delivery API */ private readonly defaultBaseDeliveryApiUrl; /** * Default preview url to Kentico Delivery API */ private readonly defaultPreviewDeliveryApiUrl; /** * Name of the header used when 'wait for loading new content' feature is used */ private readonly waitForLoadingNewContentHeader; /** * Service used to map responses (json) from Kentico cloud to strongly typed types */ protected responseMapService: ResponseMapService; constructor( /** * Delivery client configuration */ config: DeliveryClientConfig, /** * Http service for fetching data */ httpService: IHttpService, /** * Information about the SDK * This can contain information from both this & Node SDK for internal logging with 'SDKID' header */ sdkInfo: ISdkInfo); /** * Gets url based on the action, query configuration and options (parameters) * @param action Action (= url part) that will be hit * @param queryConfig Query configuration * @param options Query options */ getUrl(action: string, queryConfig: IQueryConfig, options?: IQueryParameter[]): string; /** * Gets single item from given url * @param url Url used to get single item * @param queryConfig Query configuration */ getSingleItem(url: string, queryConfig: IItemQueryConfig): Observable>; /** * Gets multiple items from given url * @param url Url used to get multiple items * @param queryConfig Query configuration */ getMultipleItems(url: string, queryConfig: IItemQueryConfig): Observable>; /** * Gets single content type from given url * @param url Url used to get single type * @param queryConfig Query configuration */ getSingleType(url: string, queryConfig: IContentTypeQueryConfig): Observable; /** * Gets multiple content types from given url * @param url Url used to get multiple types * @param queryConfig Query configuration */ getMultipleTypes(url: string, queryConfig: IContentTypeQueryConfig): Observable; /** * Gets single taxonomy from given url * @param url Url used to get single taxonomy * @param queryConfig Query configuration */ getTaxonomy(url: string, queryConfig: ITaxonomyQueryConfig): Observable; /** * Gets multiple taxonomies from given url * @param url Url used to get multiple taxonomies * @param queryConfig Query configuration */ getTaxonomies(url: string, queryConfig: ITaxonomyQueryConfig): Observable; /** * Gets single content type element from given url * @param url Url used to get single content type element * @param queryConfig Query configuration */ getElement(url: string, queryConfig: ITaxonomyQueryConfig): Observable; /** * Gets proper set of headers for given request. * @param queryConfig Query configuration */ getHeaders(queryConfig: IQueryConfig): IHeader[]; /** * Handles given error * @param error Error to be handled */ private handleError(error); /** * Indicates if current query should use preview mode * @param queryConfig Query configuration */ private isPreviewModeEnabled(queryConfig); /** * Indicates if current query should use secured mode * @param queryConfig Query configuration */ private isSecuredModeEnabled(queryConfig); /** * Gets preview or standard URL based on client and query configuration * @param queryConfig Query configuration */ private getDeliveryUrl(queryConfig); /** * Gets base URL of the request including the project Id * @param queryConfig Query configuration */ private getBaseUrl(queryConfig); /** * Adds query parameters to given url * @param url Url to which options will be added * @param options Query parameters to add */ private addOptionsToUrl(url, options?); /** * Http get response * @param url Url of request * @param queryConfig Query configuration */ protected getResponse(url: string, queryConfig: IQueryConfig): Observable; /** * Gets authorization header. This is used for 'preview' functionality */ private getAuthorizationHeader(key?); /** * Header identifying SDK type & version for internal purposes of Kentico */ private getSdkIdHeader(); }