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/)
35 lines • 1.09 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.DotApiContentType = void 0;
const tslib_1 = require("tslib");
/**
* Get the information of DotCMS contentTypes
*
*/
class DotApiContentType {
constructor(httpClient) {
this.dotCMSHttpClient = httpClient;
}
get(contentTypeId) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const response = yield this.dotCMSHttpClient.request({
url: `/api/v1/contenttype/id/${contentTypeId}`
});
if (response.status !== 200) {
throw {
message: yield response.text(),
statusCode: response.status
};
}
const data = yield response.json();
return data.entity;
});
}
getLayout(contentTypeId) {
return this.get(contentTypeId).then((contentType) => {
return contentType.layout;
});
}
}
exports.DotApiContentType = DotApiContentType;
//# sourceMappingURL=DotApiContentType.js.map
;