1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-10-06 22:17:10 +02:00

All: Use Lerna to manage monorepo

This commit is contained in:
Laurent Cozic
2020-11-05 16:58:23 +00:00
parent 122f20905c
commit cc07016b07
2839 changed files with 54217 additions and 16111 deletions

File diff suppressed because one or more lines are too long

View File

@@ -168,10 +168,10 @@
<pre><code class="language-typescript"><span class="hljs-comment">// Register a new commmand called &quot;testCommand1&quot;</span>
<span class="hljs-keyword">await</span> joplin.commands.register({
name: <span class="hljs-string">&#x27;testCommand1&#x27;</span>,
label: <span class="hljs-string">&#x27;My Test Command 1&#x27;</span>,
iconName: <span class="hljs-string">&#x27;fas fa-music&#x27;</span>,
execute: <span class="hljs-function">() =&gt;</span> {
<span class="hljs-attr">name</span>: <span class="hljs-string">&#x27;testCommand1&#x27;</span>,
<span class="hljs-attr">label</span>: <span class="hljs-string">&#x27;My Test Command 1&#x27;</span>,
<span class="hljs-attr">iconName</span>: <span class="hljs-string">&#x27;fas fa-music&#x27;</span>,
<span class="hljs-attr">execute</span>: <span class="hljs-function">() =&gt;</span> {
alert(<span class="hljs-string">&#x27;Testing plugin command 1&#x27;</span>);
},
});</code></pre>

View File

@@ -85,16 +85,16 @@
<p>For example:</p>
<pre><code class="language-typescript"><span class="hljs-comment">// Get a note ID, title and body</span>
<span class="hljs-keyword">const</span> noteId = <span class="hljs-string">&#x27;some_note_id&#x27;</span>;
<span class="hljs-keyword">const</span> note = <span class="hljs-keyword">await</span> joplin.data.get([<span class="hljs-string">&#x27;notes&#x27;</span>, noteId], { fields: [<span class="hljs-string">&#x27;id&#x27;</span>, <span class="hljs-string">&#x27;title&#x27;</span>, <span class="hljs-string">&#x27;body&#x27;</span>] });
<span class="hljs-keyword">const</span> note = <span class="hljs-keyword">await</span> joplin.data.get([<span class="hljs-string">&#x27;notes&#x27;</span>, noteId], { <span class="hljs-attr">fields</span>: [<span class="hljs-string">&#x27;id&#x27;</span>, <span class="hljs-string">&#x27;title&#x27;</span>, <span class="hljs-string">&#x27;body&#x27;</span>] });
<span class="hljs-comment">// Get all folders</span>
<span class="hljs-keyword">const</span> folders = <span class="hljs-keyword">await</span> joplin.data.get([<span class="hljs-string">&#x27;folders&#x27;</span>]);
<span class="hljs-comment">// Set the note body</span>
<span class="hljs-keyword">await</span> joplin.data.put([<span class="hljs-string">&#x27;notes&#x27;</span>, noteId], <span class="hljs-literal">null</span>, { body: <span class="hljs-string">&quot;New note body&quot;</span> });
<span class="hljs-keyword">await</span> joplin.data.put([<span class="hljs-string">&#x27;notes&#x27;</span>, noteId], <span class="hljs-literal">null</span>, { <span class="hljs-attr">body</span>: <span class="hljs-string">&quot;New note body&quot;</span> });
<span class="hljs-comment">// Create a new note under one of the folders</span>
<span class="hljs-keyword">await</span> joplin.data.post([<span class="hljs-string">&#x27;notes&#x27;</span>], <span class="hljs-literal">null</span>, { body: <span class="hljs-string">&quot;my new note&quot;</span>, title: <span class="hljs-string">&quot;some title&quot;</span>, parent_id: folders[<span class="hljs-number">0</span>].id });</code></pre>
<span class="hljs-keyword">await</span> joplin.data.post([<span class="hljs-string">&#x27;notes&#x27;</span>], <span class="hljs-literal">null</span>, { <span class="hljs-attr">body</span>: <span class="hljs-string">&quot;my new note&quot;</span>, <span class="hljs-attr">title</span>: <span class="hljs-string">&quot;some title&quot;</span>, <span class="hljs-attr">parent_id</span>: folders[<span class="hljs-number">0</span>].id });</code></pre>
</div>
</section>
<!--

View File

@@ -119,7 +119,7 @@
That <code>onStart</code> method will be executed as soon as the plugin is loaded.</p>
</div>
<pre><code class="language-typescript">joplin.plugins.register({
onStart: <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
<span class="hljs-attr">onStart</span>: <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
<span class="hljs-comment">// Run your plugin code here</span>
}
});</code></pre>

View File

@@ -431,6 +431,39 @@ for (let portToTest = 41184; portToTest &lt;= 41194; portToTest++) {
<p>To get the IDs only of all the tags:</p>
<pre><code>curl http://localhost:41184/tags?fields=id
</code></pre>
<p>By default API results will contain the following fields: <strong>id</strong>, <strong>parent_id</strong>, <strong>title</strong></p>
<h1>Pagination<a name="pagination" href="#pagination" class="heading-anchor">🔗</a></h1>
<p>All API calls that return multiple results will be paginated. The actual results will be under the <code>items</code> key, and if there are more results, there will also be a <code>cursor</code> key, which allows you to fetch the next results. If the <code>cursor</code> key is not present, it means you have reached the end of the data set.</p>
<p>You can specify how the results should be sorted using the <code>order_by</code> and <code>order_dir</code> query parameters, and you can specify the number of items to be returned using the <code>limit</code> parameter (the maximum being 100 items).</p>
<p>The following call for example will initiate a request to fetch all the notes, 10 at a time, and sorted by &quot;updated_time&quot; ascending:</p>
<pre><code>curl http://localhost:41184/notes?order_by=updated_time&amp;order_dir=ASC&amp;limit=10
</code></pre>
<p>This will return a result like this</p>
<pre><code>{ &quot;items&quot;: [ /* 10 notes */ ], &quot;cursor&quot;: &quot;somecursor&quot; }
</code></pre>
<p>Then you will resume fetching the results using this query:</p>
<pre><code>curl http://localhost:41184/notes?cursor=somecursor
</code></pre>
<p>Note that you only need to pass the cursor to the next request, as it will continue the fetching process using the same parameters you initially provided.</p>
<p>Eventually you will get some results that do not contain a &quot;cursor&quot; paramater, at which point you will have retrieved all the results</p>
<p>As an example the pseudo-code below could be used to fetch all the notes:</p>
<pre><code class="language-javascript">
async function fetchJson(url) {
return (await fetch(url)).json();
}
async function fetchAllNotes() {
let query = '';
const url = 'http://localhost:41184/notes';
do {
const response = await fetchJson(url + query);
console.info('Printing notes:');
console.info(response.items);
query = '?cursor' + response.cursor;
} while (response.cursor)
}
</code></pre>
<h1>Error handling<a name="error-handling" href="#error-handling" class="heading-anchor">🔗</a></h1>
<p>In case of an error, an HTTP status code &gt;= 400 will be returned along with a JSON object that provides more info about the error. The JSON object is in the format <code>{ &quot;error&quot;: &quot;description of error&quot; }</code>.</p>
<h1>About the property types<a name="about-the-property-types" href="#about-the-property-types" class="heading-anchor">🔗</a></h1>
@@ -516,6 +549,10 @@ for (let portToTest = 41184; portToTest &lt;= 41194; portToTest++) {
<td>smart_filter</td>
<td>15</td>
</tr>
<tr>
<td>command</td>
<td>16</td>
</tr>
</tbody>
</table>
<h1>Notes<a name="notes" href="#notes" class="heading-anchor">🔗</a></h1>