kentico-cloud-delivery
Version:
Official Kentico Cloud Delivery SDK
74 lines • 2.89 kB
JavaScript
exports.__esModule = true;
var query_1 = require("../query");
var sdk_info_generated_1 = require("../sdk-info.generated");
var services_1 = require("../services");
var parser_adapter_1 = require("../parser/parser-adapter");
var DeliveryClient = /** @class */ (function () {
/**
* Delivery client used to fetch data from Kentico Cloud
* @constructor
* @param {IDeliveryClientConfig} config - The client configuration
*/
function DeliveryClient(config) {
this.config = config;
if (!config) {
throw Error("Please provide Delivery client configuration");
}
this.queryService = new services_1.QueryService(config, new services_1.DeliveryHttpService(), parser_adapter_1.getParserAdapter(), {
host: sdk_info_generated_1.sdkInfo.host,
name: sdk_info_generated_1.sdkInfo.name,
version: sdk_info_generated_1.sdkInfo.version
});
}
/**
* Gets query for multiple types
*/
DeliveryClient.prototype.types = function () {
return new query_1.MultipleTypeQuery(this.config, this.queryService);
};
/**
* Gets query for single type
* @param {string} typeCodename - Codename of the type to fetch
*/
DeliveryClient.prototype.type = function (typeCodename) {
return new query_1.SingleTypeQuery(this.config, this.queryService, typeCodename);
};
/**
* Gets query for multiple items
*/
DeliveryClient.prototype.items = function () {
return new query_1.MultipleItemQuery(this.config, this.queryService);
};
/**
* Gets query for single item
* @param {string} codename - Codename of item to fetch
*/
DeliveryClient.prototype.item = function (codename) {
return new query_1.SingleItemQuery(this.config, this.queryService, codename);
};
/**
* Gets query for single taxonomy
* @param {string} codename - Codename of taxonomy to fetch
*/
DeliveryClient.prototype.taxonomy = function (codename) {
return new query_1.TaxonomyQuery(this.config, this.queryService, codename);
};
/**
* Gets query for multiple taxonomies
*/
DeliveryClient.prototype.taxonomies = function () {
return new query_1.TaxonomiesQuery(this.config, this.queryService);
};
/**
* Gets query for an element within a type
* @param {string} typeCodename - Codename of the type
* @param {string} elementCodename - Codename of the element
*/
DeliveryClient.prototype.element = function (typeCodename, elementCodename) {
return new query_1.ElementQuery(this.config, this.queryService, typeCodename, elementCodename);
};
return DeliveryClient;
}());
exports.DeliveryClient = DeliveryClient;
//# sourceMappingURL=delivery-client.js.map
;