@kontent-ai/delivery-sdk
Version:
Official Kontent.AI Delivery API SDK
21 lines (17 loc) • 618 B
text/typescript
import { Contracts } from '../contracts';
import { IGenericElement } from '../models';
export class GenericElementMapper {
mapElement(response: Contracts.IViewContentTypeElementContract): IGenericElement {
if (!response) {
throw Error(`Invalid response for mapping element`);
}
const element = response;
return {
codename: element.codename,
name: element.name,
type: element.type,
options: element.options ? element.options : [],
taxonomyGroup: element.taxonomy_group
};
}
}