UNPKG

@iotile/iotile-cloud

Version:

A typescript library for interfacing with the IOTile Cloud API

113 lines 3.92 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 RPCArgs = /** @class */ (function () { function RPCArgs(data) { if (data === void 0) { data = {}; } if (data) { this.addr = data.addr || null; this.rpcId = Number(data.rpc_id) || null; this.callFmt = data.call_fmt || ""; this.respFmt = data.resp_fmt || ""; this.args = data.args || []; this.timeout = data.timeout || null; } } return RPCArgs; }()); exports.RPCArgs = RPCArgs; var StatefulRPCArgs = /** @class */ (function (_super) { __extends(StatefulRPCArgs, _super); function StatefulRPCArgs(data) { if (data === void 0) { data = {}; } var _this = _super.call(this, data) || this; _this.currentState = data.cur_state || false; _this.transitionStates = data.trans_states || []; _this.auto = data.auto || false; return _this; } return StatefulRPCArgs; }(RPCArgs)); exports.StatefulRPCArgs = StatefulRPCArgs; var StatefulSwitchArgs = /** @class */ (function () { function StatefulSwitchArgs(data) { if (data === void 0) { data = {}; } this.currentState = false; this.transitionStates = []; this.rpcs = []; if (data) { for (var rpc in data.rpcs) { this.rpcs.push(new StatefulRPCArgs(rpc)); } this.currentState = data.cur_state || false; this.transitionStates = data.trans_states || []; } } return StatefulSwitchArgs; }()); exports.StatefulSwitchArgs = StatefulSwitchArgs; // export class WebArgs { // public options: WebOptions | any; // constructor(data: any = {}){ // this.options = new WebOptions(data.options) || data.options; // } // } // export class WebOptions { // public tabViewId: string; // public ngComponent: string; // public seriesGroup: string; // public downloadable: boolean; // public chart?: any; // public ngComponentInputs?: any; // constructor(data: any = {}){ // this.tabViewId = data.tabViewId; // this.ngComponent = data.ngComponent; // this.seriesGroup = data.seriesGroup; // this.downloadable = data.downloadable || false; // if ('chart' in data){ // this.chart = data.chart; // } // if ('ngComponentInputs' in data){ // this.ngComponentInputs = data.ngComponentInputs; // } // } // } var DisplayWidget = /** @class */ (function () { function DisplayWidget(data) { if (data === void 0) { data = {}; } this.label = data.label; this.lid = data.lid_hex; this.type = data.type; this.varType = data.var_type; this.derivedType = data.derived_unit_type; this.showInApp = data.show_in_app || false; this.showInWeb = data.show_in_web || false; if (!data.args) { this.args = null; } else if ('auto' in data.args) { this.args = new StatefulRPCArgs(data.args); } else if ('rpcs' in data.args) { this.args = new StatefulSwitchArgs(data.args); } else if (this.showInWeb) { this.args = data.args; } else { this.args = new RPCArgs(data.args); } } return DisplayWidget; }()); exports.DisplayWidget = DisplayWidget; //# sourceMappingURL=displaywidget.js.map