UNPKG

coloquent-test2

Version:

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

33 lines 1.45 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 Response_1 = require("./Response"); var SaveResponse = /** @class */ (function (_super) { __extends(SaveResponse, _super); function SaveResponse(httpClientResponse, modelType, responseBody) { var _this = _super.call(this, httpClientResponse) || this; var modelTypeUntyped = modelType; // Do this to shut IDE up about not being able to instantiate // abstract classes _this.model = new modelType(); _this.model.populateFromJsonApiDoc(responseBody.data); return _this; } SaveResponse.prototype.getModel = function () { return this.model; }; SaveResponse.prototype.getModelId = function () { return this.model.getApiId(); }; return SaveResponse; }(Response_1.Response)); exports.SaveResponse = SaveResponse; //# sourceMappingURL=SaveResponse.js.map