From 56c7b7f5bd062bc74a34443ce1f2fe7193f90b35 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 25 Nov 2019 22:45:09 +0100 Subject: [PATCH] API docs update --- docs/backend_api/BackendScriptApi.html | 453 ++++++++++++++++-- docs/backend_api/global.html | 179 ++++--- .../services_backend_script_api.js.html | 48 +- 3 files changed, 566 insertions(+), 114 deletions(-) diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.html index bcc2ef0fb..d1cd08ae6 100644 --- a/docs/backend_api/BackendScriptApi.html +++ b/docs/backend_api/BackendScriptApi.html @@ -396,7 +396,7 @@ the backend.
Source:
@@ -534,13 +534,18 @@ the backend. -

createNote(extraOptionsopt) → {Promise.<{note: Note, branch: Branch}>}

+

createDataNote(parentNoteId, title, content) → {Promise.<{note: Note, branch: Branch}>}

+
+ Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and +JSON MIME type. See also createNote() for more options. +
+ @@ -562,12 +567,8 @@ the backend. Type - Attributes - - Default - Description @@ -578,36 +579,66 @@ the backend. - extraOptions + parentNoteId -CreateNoteParams +string - - - <optional>
- - + + + + + + + + + title + + + + - +string + + + + + - + + + + + + + + + content + + + + - {} - - +object + + + + + + + @@ -651,7 +682,170 @@ the backend.
Source:
+ + + + + + + + + + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<{note: Note, branch: Branch}> + + +
+
+ + + + + + + + + + + + + +

createNote(paramsopt) → {Promise.<{note: Note, branch: Branch}>}

+ + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +CreateNoteParams + + + + + + <optional>
+ + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -709,6 +903,207 @@ the backend. +

createTextNote(parentNoteId, title, content) → {Promise.<{note: Note, branch: Branch}>}

+ + + + + + +
+ Create text note. See also createNote() for more options. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parentNoteId + + +string + + + +
title + + +string + + + +
content + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<{note: Note, branch: Branch}> + + +
+
+ + + + + + + + + + + + +

ensureNoteIsAbsentFromParent(noteId, parentNoteId) → {Promise.<void>}

@@ -1136,7 +1531,7 @@ the backend.
Source:
@@ -1600,7 +1995,7 @@ the backend.
Source:
@@ -2368,7 +2763,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3021,7 +3416,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3199,7 +3594,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3354,7 +3749,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3504,7 +3899,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4007,7 +4402,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
Source:
@@ -4140,7 +4535,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
Source:
@@ -4515,7 +4910,7 @@ transactional by default.
Source:
diff --git a/docs/backend_api/global.html b/docs/backend_api/global.html index 542cf911b..2221a896e 100644 --- a/docs/backend_api/global.html +++ b/docs/backend_api/global.html @@ -325,12 +325,8 @@ Type - Attributes - - Default - Description @@ -341,74 +337,72 @@ - json + parentNoteId -boolean +string - - - <optional>
- - - - - - - - false - - - - should the note be JSON + MANDATORY - isProtected + title -boolean +string - - - <optional>
- + + + MANDATORY + + + + + + + content + + + + - +string +| + +buffer + + + + + - - - false - - - - should the note be protected + MANDATORY @@ -428,24 +422,10 @@ - - - <optional>
- - - - - - - - 'text' - - - - note type + text, code, file, image, search, book, relation-map - MANDATORY @@ -465,61 +445,102 @@ - - - <optional>
- - - - - - - - 'text/html' - - - - MIME type of the note + value is derived from default mimes for type - attributes + isProtected -Array.<CreateNoteAttribute> +boolean - - - <optional>
- + + + default is false + + + + + + + isExpanded + + + + - +boolean + + + + + - - - [] - - + + default is false + + + + + + + prefix - attributes to be created for this note + + + +string + + + + + + + + + + default is empty string + + + + + + + notePosition + + + + + +int + + + + + + + + + + default is last existing notePosition in a parent + 10 @@ -558,7 +579,7 @@
Source:
diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html index 0fbb86466..725fe064e 100644 --- a/docs/backend_api/services_backend_script_api.js.html +++ b/docs/backend_api/services_backend_script_api.js.html @@ -205,19 +205,55 @@ function BackendScriptApi(currentNote, apiParams) { * @property {string} [value] - attribute value */ + /** + * Create text note. See also createNote() for more options. + * + * @param {string} parentNoteId + * @param {string} title + * @param {string} content + * @return {Promise<{note: Note, branch: Branch}>} + */ + this.createTextNote = async (parentNoteId, title, content = '') => await noteService.createNewNote({ + parentNoteId, + title, + content, + type: 'text' + }); + + /** + * Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and + * JSON MIME type. See also createNote() for more options. + * + * @param {string} parentNoteId + * @param {string} title + * @param {object} content + * @return {Promise<{note: Note, branch: Branch}>} + */ + this.createDataNote = async (parentNoteId, title, content = {}) => await noteService.createNewNote({ + parentNoteId, + title, + content: JSON.stringify(content), + type: 'code', + mime: 'application/json' + }); + /** * @typedef {object} CreateNoteParams - * @property {boolean} [json=false] - should the note be JSON - * @property {boolean} [isProtected=false] - should the note be protected - * @property {string} [type='text'] - note type - * @property {string} [mime='text/html'] - MIME type of the note - * @property {CreateNoteAttribute[]} [attributes=[]] - attributes to be created for this note + * @property {string} parentNoteId - MANDATORY + * @property {string} title - MANDATORY + * @property {string|buffer} content - MANDATORY + * @property {string} type - text, code, file, image, search, book, relation-map - MANDATORY + * @property {string} mime - value is derived from default mimes for type + * @property {boolean} isProtected - default is false + * @property {boolean} isExpanded - default is false + * @property {string} prefix - default is empty string + * @property {int} notePosition - default is last existing notePosition in a parent + 10 */ /** * @method * - * @param {CreateNoteParams} [extraOptions={}] + * @param {CreateNoteParams} [params] * @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch */ this.createNote = noteService.createNewNote;