kentico-cloud-delivery
Version:
Official Kentico Cloud Delivery SDK
45 lines • 1.96 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { BaseQuery } from '../common/base-query.class';
var BaseElementQuery = /** @class */ (function (_super) {
__extends(BaseElementQuery, _super);
function BaseElementQuery(config, queryService) {
var _this = _super.call(this, config, queryService) || this;
_this.config = config;
_this.queryService = queryService;
_this._queryConfig = {};
return _this;
}
/**
* Use to configure query
* @param queryConfig Query configuration
*/
BaseElementQuery.prototype.queryConfig = function (queryConfig) {
this._queryConfig = queryConfig;
return this;
};
/**
* Gets headers used by this query
*/
BaseElementQuery.prototype.getHeaders = function () {
return this.queryService.getHeaders(this._queryConfig);
};
BaseElementQuery.prototype.getElementQueryUrl = function (typeCodename, elementCodename) {
var action = '/types/' + typeCodename + '/elements/' + elementCodename;
return _super.prototype.resolveUrlInternal.call(this, action);
};
BaseElementQuery.prototype.runElementQuery = function (typeCodename, elementCodename) {
return this.queryService.getElement(this.getElementQueryUrl(typeCodename, elementCodename), this._queryConfig);
};
return BaseElementQuery;
}(BaseQuery));
export { BaseElementQuery };
//# sourceMappingURL=base-element-query.class.js.map