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/)
37 lines • 1.23 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.DotApiElasticSearch = void 0;
const tslib_1 = require("tslib");
const getEsQuery_1 = require("../utils/getEsQuery");
/**
* Request content from DotCMS using the {@link https://dotcms.com/docs/latest/elasticsearch-rest-api | Elastic Search API}
*
*/
class DotApiElasticSearch {
constructor(httpClient) {
this.dotCMSHttpClient = httpClient;
}
/**
* Provide the content type and the elastic search query and get the results contentlets and elastic search information
*
*/
search(params) {
return this.dotCMSHttpClient
.request({
url: '/api/es/search',
method: 'POST',
body: (0, getEsQuery_1.getEsQuery)(params)
})
.then((response) => tslib_1.__awaiter(this, void 0, void 0, function* () {
if (response.status === 200) {
return response.json();
}
throw {
message: yield response.text(),
statusCode: response.status
};
}));
}
}
exports.DotApiElasticSearch = DotApiElasticSearch;
//# sourceMappingURL=DotApiElasticSearch.js.map
;