coloquent-test2
Version:
Library for retrieving model objects from a JSON-API, with a fluent syntax inspired by Laravel Eloquent.
51 lines • 2.55 kB
JavaScript
"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 ToOneRelation = /** @class */ (function (_super) {
__extends(ToOneRelation, _super);
function ToOneRelation() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToOneRelation.prototype.get = function (page) {
return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType(), true)
.get(page);
};
ToOneRelation.prototype.first = function () {
return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType(), true)
.first();
};
ToOneRelation.prototype.find = function (id) {
return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType(), true)
.find(id);
};
ToOneRelation.prototype.where = function (attribute, value) {
return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType(), true)
.where(attribute, value);
};
ToOneRelation.prototype.with = function (value) {
return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType(), true)
.with(value);
};
ToOneRelation.prototype.orderBy = function (attribute, direction) {
return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType(), true)
.orderBy(attribute, direction);
};
ToOneRelation.prototype.option = function (queryParameter, value) {
return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringObject().getJsonApiType(), true)
.option(queryParameter, value);
};
return ToOneRelation;
}(Relation_1.Relation));
exports.ToOneRelation = ToOneRelation;
//# sourceMappingURL=ToOneRelation.js.map