From d63156a0d6b6d9276484f93c1d658e502bbb8fc9 Mon Sep 17 00:00:00 2001 From: Rai <agentydragon@gmail.com> Date: Sat, 27 Aug 2022 13:40:01 -0700 Subject: [PATCH] Add some docs to note.js (for backend scripting docs) --- src/becca/entities/note.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/becca/entities/note.js b/src/becca/entities/note.js index 595e41052..e1ff8c227 100644 --- a/src/becca/entities/note.js +++ b/src/becca/entities/note.js @@ -1018,6 +1018,13 @@ class Note extends AbstractEntity { } /** + * Adds a new attribute to this note. The attribute is saved and returned. + * See addLabel, addRelation for more specific methods. + * + * @param {string} type - attribute type (label / relation) + * @param {string} name - name of the attribute, not including the leading ~/# + * @param {string} [value] - value of the attribute - text for labels, target note ID for relations; optional. + * * @return {Attribute} */ addAttribute(type, name, value = "", isInheritable = false, position = 1000) { @@ -1033,10 +1040,27 @@ class Note extends AbstractEntity { }).save(); } + /** + * Adds a new label to this note. The label attribute is saved and returned. + * + * @param {string} name - name of the label, not including the leading # + * @param {string} [value] - text value of the label; optional + * + * @return {Attribute} + */ addLabel(name, value = "", isInheritable = false) { return this.addAttribute(LABEL, name, value, isInheritable); } + /** + * Adds a new relation to this note. The relation attribute is saved and + * returned. + * + * @param {string} name - name of the relation, not including the leading ~ + * @param {string} value - ID of the target note of the relation + * + * @return {Attribute} + */ addRelation(name, targetNoteId, isInheritable = false) { return this.addAttribute(RELATION, name, targetNoteId, isInheritable); }