UNPKG

coloquent-test2

Version:

Library for retrieving model objects from a JSON-API, with a fluent syntax inspired by Laravel Eloquent.

51 lines 2.52 kB
"use strict"; 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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var Relation_1 = require("./Relation"); var Builder_1 = require("../Builder"); var ToManyRelation = /** @class */ (function (_super) { __extends(ToManyRelation, _super); function ToManyRelation() { return _super !== null && _super.apply(this, arguments) || this; } ToManyRelation.prototype.get = function (page) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType()) .get(page); }; ToManyRelation.prototype.first = function () { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType()) .first(); }; ToManyRelation.prototype.find = function (id) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType()) .find(id); }; ToManyRelation.prototype.where = function (attribute, value) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType()) .where(attribute, value); }; ToManyRelation.prototype.with = function (value) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType()) .with(value); }; ToManyRelation.prototype.orderBy = function (attribute, direction) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType()) .orderBy(attribute, direction); }; ToManyRelation.prototype.option = function (queryParameter, value) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType()) .option(queryParameter, value); }; return ToManyRelation; }(Relation_1.Relation)); exports.ToManyRelation = ToManyRelation; //# sourceMappingURL=ToManyRelation.js.map