@iotile/iotile-cloud
Version:
A typescript library for interfacing with the IOTile Cloud API
42 lines • 1.29 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Note = /** @class */ (function () {
function Note(data) {
if (data === void 0) { data = {}; }
this.id = 0;
this.type = 'ui';
this.target = data.target;
this.timestamp = data.timestamp || new Date().toISOString();
this.note = data.note;
this.type = data.type;
if ('id' in data) {
this.id = data.id;
}
if ('user_info' in data) {
this.userInfo = {
username: data.user_info.username,
slug: data.user_info.slug,
tinyAvatar: data.user_info.tiny_avatar
};
}
if ('attachment' in data && data.attachment != null) {
this.attachment = {
title: data.attachment.title,
url: data.attachment.url,
fileType: data.attachment.file_type
};
}
}
Note.prototype.postPayload = function () {
var payload = {
target: this.target,
timestamp: this.timestamp,
note: this.note,
type: this.type
};
return payload;
};
return Note;
}());
exports.Note = Note;
//# sourceMappingURL=note.js.map