UNPKG

@maicol07/coloquent

Version:

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

37 lines 1.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToOneRelation = void 0; const Relation_1 = require("./Relation"); const Builder_1 = require("../Builder"); class ToOneRelation extends Relation_1.Relation { get(page) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringType().effectiveJsonApiType, this.getReferringObject().getApiId(), true) .get(page); } first() { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringType().effectiveJsonApiType, this.getReferringObject().getApiId(), true) .first(); } find(id) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringType().effectiveJsonApiType, this.getReferringObject().getApiId(), true) .find(id); } where(attribute, value) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringType().effectiveJsonApiType, this.getReferringObject().getApiId(), true) .where(attribute, value); } with(value) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringType().effectiveJsonApiType, this.getReferringObject().getApiId(), true) .with(value); } orderBy(attribute, direction) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringType().effectiveJsonApiType, this.getReferringObject().getApiId(), true) .orderBy(attribute, direction); } option(queryParameter, value) { return new Builder_1.Builder(this.getType(), this.getName(), this.getReferringType().effectiveJsonApiType, this.getReferringObject().getApiId(), true) .option(queryParameter, value); } } exports.ToOneRelation = ToOneRelation; //# sourceMappingURL=ToOneRelation.js.map