UNPKG

kentico-cloud-delivery

Version:

Official Kentico Cloud Delivery SDK

25 lines (24 loc) 1.24 kB
import { IDeliveryClientConfig } from '../config'; import { ItemContracts } from '../data-contracts'; import { IItemQueryConfig } from '../interfaces'; import { ContentItem } from '../models'; import { IRichTextHtmlParser } from '../parser'; export declare class ItemMapper { private readonly config; private readonly richTextHtmlParser; private readonly fieldMapper; constructor(config: IDeliveryClientConfig, richTextHtmlParser: IRichTextHtmlParser); /** * Maps single item to its proper strongly typed model from the given Cloud response * @param response Cloud response used to map the item * @param queryConfig Query configuration */ mapSingleItem<TItem extends ContentItem>(response: ItemContracts.IItemResponseContract, queryConfig: IItemQueryConfig): TItem; /** * Maps multiple items to their strongly typed model from the given Cloud response * @param response Cloud response used to map the item * @param queryConfig Query configuration */ mapMultipleItems<TItem extends ContentItem>(response: ItemContracts.IItemsResponseContract, queryConfig: IItemQueryConfig): TItem[]; private mapItem<TItem>(item, modularContent, queryConfig); }