@iotile/iotile-cloud
Version:
A typescript library for interfacing with the IOTile Cloud API
36 lines • 1.01 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Property = /** @class */ (function () {
function Property(data) {
this.name = data.name;
this.value = data.value;
this.type = data.type;
this.isSystem = data.is_system;
this.rawData = data;
if ('id' in data) {
this.id = data.id;
}
else {
delete this.id;
}
if ('target' in data) {
this.target = data.target;
}
}
Property.prototype.toJson = function () {
return this.rawData;
};
Property.prototype.getPostPayload = function () {
var payload = {};
var type = this.type.toLowerCase() + '_value';
if ('id' in this) {
payload['id'] = this.id;
}
payload['name'] = this.name;
payload[type] = this.value;
return payload;
};
return Property;
}());
exports.Property = Property;
//# sourceMappingURL=property.js.map