kentico-cloud-delivery
Version:
Official Kentico Cloud Delivery SDK
186 lines • 6.75 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
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 extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { Filters, Parameters, SortOrder } from '../../models';
import { BaseItemQuery } from './base-item-query.class';
var MultipleItemQuery = /** @class */ (function (_super) {
__extends(MultipleItemQuery, _super);
function MultipleItemQuery(config, queryService) {
var _this = _super.call(this, config, queryService) || this;
_this.config = config;
_this.queryService = queryService;
return _this;
}
/**
* Gets only item of given type
* @param type Codename of type to get
*/
MultipleItemQuery.prototype.type = function (type) {
this.parameters.push(new Filters.TypeFilter(type));
return this;
};
/**
* Gets items of given types (logical or)
* I.e. get items of either 'Actor' or 'Movie' type
* @param types Types to get
*/
MultipleItemQuery.prototype.types = function (types) {
this.parameters.push(new Filters.TypeFilter(types));
return this;
};
/**
* Equals filter condition
* @param element Element to filter. Example: 'elements.movie'
* @param value Value to match. Example: 'Kingsman'
*/
MultipleItemQuery.prototype.equalsFilter = function (element, value) {
this.parameters.push(new Filters.EqualsFilter(element, value));
return this;
};
/**
* All filter
* @param element Element to filter.
* @param values Values
*/
MultipleItemQuery.prototype.allFilter = function (element, values) {
this.parameters.push(new Filters.AllFilter(element, values));
return this;
};
/**
* Any filter
* @param element Element to filter.
* @param values Values
*/
MultipleItemQuery.prototype.anyFilter = function (element, values) {
this.parameters.push(new Filters.AnyFilter(element, values));
return this;
};
/**
* Contains filter
* @param element Element to filter.
* @param values Values
*/
MultipleItemQuery.prototype.containsFilter = function (element, values) {
this.parameters.push(new Filters.ContainsFilter(element, values));
return this;
};
/**
* Greater then filter
* @param element Element to filter.
* @param value Value
*/
MultipleItemQuery.prototype.greaterThanFilter = function (element, value) {
this.parameters.push(new Filters.GreaterThanFilter(element, value));
return this;
};
/**
* Greater then or equals filter
* @param element Element to filter.
* @param value Value
*/
MultipleItemQuery.prototype.greaterThanOrEqualFilter = function (element, value) {
this.parameters.push(new Filters.GreaterThanOrEqualFilter(element, value));
return this;
};
/**
* In filter
* @param element Element to filter.
* @param values Values
*/
MultipleItemQuery.prototype.inFilter = function (element, values) {
this.parameters.push(new Filters.InFilter(element, values));
return this;
};
/**
* Less then filter
* @param element Element to filter.
* @param value Value
*/
MultipleItemQuery.prototype.lessThanFilter = function (element, value) {
this.parameters.push(new Filters.LessThanFilter(element, value));
return this;
};
/**
* @param element Element to filter.
* @param value Value
*/
MultipleItemQuery.prototype.lessThanOrEqualFilter = function (element, value) {
this.parameters.push(new Filters.LessThanOrEqualFilter(element, value));
return this;
};
/**
* @param element Element to filter.
* @param lowerValue Lower value of range (e.g. 2)
* @param higherValue Higher value of range (e.g. 10)
*/
MultipleItemQuery.prototype.rangeFilter = function (element, lowerValue, higherValue) {
this.parameters.push(new Filters.RangeFilter(element, lowerValue, higherValue));
return this;
};
/**
* Limits the number of items returned by query
* @param limit Number of items to load
*/
MultipleItemQuery.prototype.limitParameter = function (limit) {
this.parameters.push(new Parameters.LimitParameter(limit));
return this;
};
/**
* Orders query based on given element and sort order
* @param element Element by which to order
* @param sortOrder Asc/Desc order type
*/
MultipleItemQuery.prototype.orderParameter = function (element, sortOrder) {
this.parameters.push(new Parameters.OrderParameter(element, sortOrder));
return this;
};
/**
* Sets descending order on given element
* @param element Element by which to order
*/
MultipleItemQuery.prototype.orderByDescending = function (element) {
this.parameters.push(new Parameters.OrderParameter(element, SortOrder.desc));
return this;
};
/**
* Sets Ascending order on given element
* @param element Element by which to order
*/
MultipleItemQuery.prototype.orderByAscending = function (element) {
this.parameters.push(new Parameters.OrderParameter(element, SortOrder.asc));
return this;
};
/**
* Skips the selected number of items
* @param skip Number of items to skip
*/
MultipleItemQuery.prototype.skipParameter = function (skip) {
this.parameters.push(new Parameters.SkipParameter(skip));
return this;
};
/**
* Gets the runnable Observable
*/
MultipleItemQuery.prototype.toObservable = function () {
return _super.prototype.runMultipleItemsQuery.call(this);
};
/**
* Gets 'Url' representation of query
*/
MultipleItemQuery.prototype.getUrl = function () {
return _super.prototype.getMultipleItemsQueryUrl.call(this);
};
return MultipleItemQuery;
}(BaseItemQuery));
export { MultipleItemQuery };
//# sourceMappingURL=multiple-item-query.class.js.map