kentico-cloud-delivery
Version:
Official Kentico Cloud Delivery SDK
59 lines • 2.47 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 BaseTaxonomyQuery = /** @class */ (function (_super) {
__extends(BaseTaxonomyQuery, _super);
function BaseTaxonomyQuery(config, queryService) {
var _this = _super.call(this, config, queryService) || this;
_this.config = config;
_this.queryService = queryService;
/**
* Taxonomies endpoint URL action
*/
_this.taxonomiesEndpoint = 'taxonomies';
/**
* Query configuration
*/
_this._queryConfig = {};
return _this;
}
/**
* Used to configure query
* @param queryConfig Query configuration
*/
BaseTaxonomyQuery.prototype.queryConfig = function (queryConfig) {
this._queryConfig = queryConfig;
return this;
};
/**
* Gets headers used by this query
*/
BaseTaxonomyQuery.prototype.getHeaders = function () {
return this.queryService.getHeaders(this._queryConfig);
};
BaseTaxonomyQuery.prototype.getTaxonomyQueryUrl = function (taxonomyCodename) {
var action = '/' + this.taxonomiesEndpoint + '/' + taxonomyCodename;
return _super.prototype.resolveUrlInternal.call(this, action);
};
BaseTaxonomyQuery.prototype.getTaxonomiesQueryUrl = function () {
var action = '/' + this.taxonomiesEndpoint;
return _super.prototype.resolveUrlInternal.call(this, action);
};
BaseTaxonomyQuery.prototype.runTaxonomyQuery = function (codename) {
return this.queryService.getTaxonomy(this.getTaxonomyQueryUrl(codename), this._queryConfig);
};
BaseTaxonomyQuery.prototype.runTaxonomiesQuery = function () {
return this.queryService.getTaxonomies(this.getTaxonomiesQueryUrl(), this._queryConfig);
};
return BaseTaxonomyQuery;
}(BaseQuery));
export { BaseTaxonomyQuery };
//# sourceMappingURL=base-taxonomy-query.class.js.map