@sap-cloud-sdk/core
Version:
SAP Cloud SDK for JavaScript core
92 lines • 3.61 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.OneToManyLink = void 0;
var filter_1 = require("../filter");
var link_1 = require("./link");
/**
* Represents a one to many relation for OData v4 entities.
* For OData v2 entities the [[Link]] is used to represent one to many relation.
* See [[Link]] for more information.
*/
var OneToManyLink = /** @class */ (function (_super) {
__extends(OneToManyLink, _super);
function OneToManyLink() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._orderBy = [];
return _this;
}
OneToManyLink.prototype.clone = function () {
var clonedLink = _super.prototype.clone.call(this);
clonedLink._filters = this._filters;
clonedLink._orderBy = this._orderBy;
clonedLink._top = this._top;
clonedLink._skip = this._skip;
return clonedLink;
};
/**
* Create filter statements to be applied to the OData request based on the linked entity values.
* @param filters - Filters based on the linked entity.
* @returns Newly created `FilterLink`.
*/
OneToManyLink.prototype.filter = function () {
var expressions = [];
for (var _i = 0; _i < arguments.length; _i++) {
expressions[_i] = arguments[_i];
}
var link = this.clone();
link._filters = new filter_1.FilterLink(this, (0, filter_1.toFilterableList)(expressions));
return link;
};
/**
* Add order-by statements to the request.
** @param orderBy - OrderBy statements to order the response by.
* @returns The request builder itself, to facilitate method chaining.
*/
OneToManyLink.prototype.orderBy = function () {
var orderBy = [];
for (var _i = 0; _i < arguments.length; _i++) {
orderBy[_i] = arguments[_i];
}
var link = this.clone();
link._orderBy = orderBy;
return link;
};
/**
* Number of returned entities.
* @param top - Maximum number of entities to return in the response. Can be less, if less entities match the request.
* @returns The request builder itself, to facilitate method chaining.
*/
OneToManyLink.prototype.top = function (top) {
var link = this.clone();
link._top = top;
return link;
};
/**
* Skip number of entities.
* @param skip - Number of matching entities to skip. Useful for paging.
* @returns The request builder itself, to facilitate method chaining.
*/
OneToManyLink.prototype.skip = function (skip) {
var link = this.clone();
link._skip = skip;
return link;
};
return OneToManyLink;
}(link_1.Link));
exports.OneToManyLink = OneToManyLink;
//# sourceMappingURL=one-to-many-link.js.map
;