UNPKG

@kintone/kintone-js-sdk

Version:

The SDK of kintone REST API client on node and browser

57 lines (47 loc) 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; /** * CommentContent model */ class CommentContent { /** * constructor * @param {String} text * @param {Array<mentions>} mentions */ constructor(text, mentions) { this.text = text; this.mentions = mentions; } /** * Get JSON struct of this model * @return {integer} */ toJSON() { const data = { text: this.text, mentions: [] }; const mentionsArray = this.mentions; if (mentionsArray.length > 0 && mentionsArray[0].toJSON) { mentionsArray.forEach(mention => { data.mentions.push(mention.toJSON()); }); } else { data.mentions = mentionsArray || []; } return data; } /** * Convert this model to JSON string * @return {String} */ toJSONString() { return JSON.stringify(this.toJSON()); } } var _default = CommentContent; exports.default = _default;