UNPKG

dotcms

Version:

This library allows you to interact with DotCMS API's easily from the browser, nodejs and React Native. [Full Documentation](https://dotcms.github.io/core-web/dotcms/)

33 lines 952 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DotApiWidget = void 0; const tslib_1 = require("tslib"); /** * DotCMS {@link https://dotcms.com/docs/latest/widgets | widgets handler} */ class DotApiWidget { constructor(httpClient) { this.dotCMSHttpClient = httpClient; } /** * Get the widght HTML strong with it identifier * */ getHtml(widgetId) { return this.dotCMSHttpClient .request({ url: `/api/widget/id/${widgetId}` }) .then((response) => tslib_1.__awaiter(this, void 0, void 0, function* () { if (response.status === 200) { return response.text(); } throw { message: yield response.text(), statusCode: response.status }; })); } } exports.DotApiWidget = DotApiWidget; //# sourceMappingURL=DotApiWidget.js.map