trilium-api 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +173 -59
- package/dist/index.cjs +386 -0
- package/{src/generated/trilium.d.ts → dist/index.d.cts} +472 -5
- package/dist/index.d.ts +2225 -0
- package/dist/index.js +344 -0
- package/package.json +36 -5
- package/.github/workflows/ci.yml +0 -37
- package/.github/workflows/publish.yml +0 -84
- package/src/client.test.ts +0 -477
- package/src/client.ts +0 -91
- package/src/demo-mapper.ts +0 -166
- package/src/demo-search.ts +0 -108
- package/src/demo.ts +0 -126
- package/src/index.ts +0 -35
- package/src/mapper.test.ts +0 -638
- package/src/mapper.ts +0 -534
- package/tsconfig.json +0 -42
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2225 @@
|
|
|
1
|
+
import { Client } from 'openapi-fetch';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was auto-generated by openapi-typescript.
|
|
5
|
+
* Do not make direct changes to the file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface paths {
|
|
9
|
+
"/create-note": {
|
|
10
|
+
parameters: {
|
|
11
|
+
query?: never;
|
|
12
|
+
header?: never;
|
|
13
|
+
path?: never;
|
|
14
|
+
cookie?: never;
|
|
15
|
+
};
|
|
16
|
+
get?: never;
|
|
17
|
+
put?: never;
|
|
18
|
+
/** @description Create a note and place it into the note tree */
|
|
19
|
+
post: operations["createNote"];
|
|
20
|
+
delete?: never;
|
|
21
|
+
options?: never;
|
|
22
|
+
head?: never;
|
|
23
|
+
patch?: never;
|
|
24
|
+
trace?: never;
|
|
25
|
+
};
|
|
26
|
+
"/notes": {
|
|
27
|
+
parameters: {
|
|
28
|
+
query?: never;
|
|
29
|
+
header?: never;
|
|
30
|
+
path?: never;
|
|
31
|
+
cookie?: never;
|
|
32
|
+
};
|
|
33
|
+
/** @description Search notes */
|
|
34
|
+
get: operations["searchNotes"];
|
|
35
|
+
put?: never;
|
|
36
|
+
post?: never;
|
|
37
|
+
delete?: never;
|
|
38
|
+
options?: never;
|
|
39
|
+
head?: never;
|
|
40
|
+
patch?: never;
|
|
41
|
+
trace?: never;
|
|
42
|
+
};
|
|
43
|
+
"/notes/{noteId}": {
|
|
44
|
+
parameters: {
|
|
45
|
+
query?: never;
|
|
46
|
+
header?: never;
|
|
47
|
+
path: {
|
|
48
|
+
noteId: components["schemas"]["EntityId"];
|
|
49
|
+
};
|
|
50
|
+
cookie?: never;
|
|
51
|
+
};
|
|
52
|
+
/** @description Returns a note identified by its ID */
|
|
53
|
+
get: operations["getNoteById"];
|
|
54
|
+
put?: never;
|
|
55
|
+
post?: never;
|
|
56
|
+
/** @description deletes a single note based on the noteId supplied */
|
|
57
|
+
delete: operations["deleteNoteById"];
|
|
58
|
+
options?: never;
|
|
59
|
+
head?: never;
|
|
60
|
+
/** @description patch a note identified by the noteId with changes in the body */
|
|
61
|
+
patch: operations["patchNoteById"];
|
|
62
|
+
trace?: never;
|
|
63
|
+
};
|
|
64
|
+
"/notes/{noteId}/content": {
|
|
65
|
+
parameters: {
|
|
66
|
+
query?: never;
|
|
67
|
+
header?: never;
|
|
68
|
+
path: {
|
|
69
|
+
noteId: components["schemas"]["EntityId"];
|
|
70
|
+
};
|
|
71
|
+
cookie?: never;
|
|
72
|
+
};
|
|
73
|
+
/** @description Returns note content identified by its ID */
|
|
74
|
+
get: operations["getNoteContent"];
|
|
75
|
+
/** @description Updates note content identified by its ID */
|
|
76
|
+
put: operations["putNoteContentById"];
|
|
77
|
+
post?: never;
|
|
78
|
+
delete?: never;
|
|
79
|
+
options?: never;
|
|
80
|
+
head?: never;
|
|
81
|
+
patch?: never;
|
|
82
|
+
trace?: never;
|
|
83
|
+
};
|
|
84
|
+
"/notes/{noteId}/export": {
|
|
85
|
+
parameters: {
|
|
86
|
+
query?: {
|
|
87
|
+
format?: "html" | "markdown" | "share";
|
|
88
|
+
};
|
|
89
|
+
header?: never;
|
|
90
|
+
path: {
|
|
91
|
+
noteId: components["schemas"]["EntityId"];
|
|
92
|
+
};
|
|
93
|
+
cookie?: never;
|
|
94
|
+
};
|
|
95
|
+
/** @description Exports ZIP file export of a given note subtree. To export whole document, use "root" for noteId */
|
|
96
|
+
get: operations["exportNoteSubtree"];
|
|
97
|
+
put?: never;
|
|
98
|
+
post?: never;
|
|
99
|
+
delete?: never;
|
|
100
|
+
options?: never;
|
|
101
|
+
head?: never;
|
|
102
|
+
patch?: never;
|
|
103
|
+
trace?: never;
|
|
104
|
+
};
|
|
105
|
+
"/notes/{noteId}/import": {
|
|
106
|
+
parameters: {
|
|
107
|
+
query?: never;
|
|
108
|
+
header?: never;
|
|
109
|
+
path: {
|
|
110
|
+
noteId: components["schemas"]["EntityId"];
|
|
111
|
+
};
|
|
112
|
+
cookie?: never;
|
|
113
|
+
};
|
|
114
|
+
get?: never;
|
|
115
|
+
put?: never;
|
|
116
|
+
/** @description Imports ZIP file into a given note. */
|
|
117
|
+
post: operations["importZip"];
|
|
118
|
+
delete?: never;
|
|
119
|
+
options?: never;
|
|
120
|
+
head?: never;
|
|
121
|
+
patch?: never;
|
|
122
|
+
trace?: never;
|
|
123
|
+
};
|
|
124
|
+
"/notes/{noteId}/revision": {
|
|
125
|
+
parameters: {
|
|
126
|
+
query?: {
|
|
127
|
+
format?: "html" | "markdown";
|
|
128
|
+
};
|
|
129
|
+
header?: never;
|
|
130
|
+
path: {
|
|
131
|
+
noteId: components["schemas"]["EntityId"];
|
|
132
|
+
};
|
|
133
|
+
cookie?: never;
|
|
134
|
+
};
|
|
135
|
+
get?: never;
|
|
136
|
+
put?: never;
|
|
137
|
+
/** @description Create a note revision for the given note */
|
|
138
|
+
post: operations["createRevision"];
|
|
139
|
+
delete?: never;
|
|
140
|
+
options?: never;
|
|
141
|
+
head?: never;
|
|
142
|
+
patch?: never;
|
|
143
|
+
trace?: never;
|
|
144
|
+
};
|
|
145
|
+
"/branches": {
|
|
146
|
+
parameters: {
|
|
147
|
+
query?: never;
|
|
148
|
+
header?: never;
|
|
149
|
+
path?: never;
|
|
150
|
+
cookie?: never;
|
|
151
|
+
};
|
|
152
|
+
get?: never;
|
|
153
|
+
put?: never;
|
|
154
|
+
/** @description Create a branch (clone a note to a different location in the tree). In case there is a branch between parent note and child note already, then this will update the existing branch with prefix, notePosition and isExpanded. */
|
|
155
|
+
post: operations["postBranch"];
|
|
156
|
+
delete?: never;
|
|
157
|
+
options?: never;
|
|
158
|
+
head?: never;
|
|
159
|
+
patch?: never;
|
|
160
|
+
trace?: never;
|
|
161
|
+
};
|
|
162
|
+
"/branches/{branchId}": {
|
|
163
|
+
parameters: {
|
|
164
|
+
query?: never;
|
|
165
|
+
header?: never;
|
|
166
|
+
path: {
|
|
167
|
+
branchId: components["schemas"]["EntityId"];
|
|
168
|
+
};
|
|
169
|
+
cookie?: never;
|
|
170
|
+
};
|
|
171
|
+
/** @description Returns a branch identified by its ID */
|
|
172
|
+
get: operations["getBranchById"];
|
|
173
|
+
put?: never;
|
|
174
|
+
post?: never;
|
|
175
|
+
/** @description deletes a branch based on the branchId supplied. If this is the last branch of the (child) note, then the note is deleted as well. */
|
|
176
|
+
delete: operations["deleteBranchById"];
|
|
177
|
+
options?: never;
|
|
178
|
+
head?: never;
|
|
179
|
+
/** @description patch a branch identified by the branchId with changes in the body. Only prefix and notePosition can be updated. If you want to update other properties, you need to delete the old branch and create a new one. */
|
|
180
|
+
patch: operations["patchBranchById"];
|
|
181
|
+
trace?: never;
|
|
182
|
+
};
|
|
183
|
+
"/attachments": {
|
|
184
|
+
parameters: {
|
|
185
|
+
query?: never;
|
|
186
|
+
header?: never;
|
|
187
|
+
path?: never;
|
|
188
|
+
cookie?: never;
|
|
189
|
+
};
|
|
190
|
+
get?: never;
|
|
191
|
+
put?: never;
|
|
192
|
+
/** @description create an attachment */
|
|
193
|
+
post: operations["postAttachment"];
|
|
194
|
+
delete?: never;
|
|
195
|
+
options?: never;
|
|
196
|
+
head?: never;
|
|
197
|
+
patch?: never;
|
|
198
|
+
trace?: never;
|
|
199
|
+
};
|
|
200
|
+
"/attachments/{attachmentId}": {
|
|
201
|
+
parameters: {
|
|
202
|
+
query?: never;
|
|
203
|
+
header?: never;
|
|
204
|
+
path: {
|
|
205
|
+
attachmentId: components["schemas"]["EntityId"];
|
|
206
|
+
};
|
|
207
|
+
cookie?: never;
|
|
208
|
+
};
|
|
209
|
+
/** @description Returns an attachment identified by its ID */
|
|
210
|
+
get: operations["getAttachmentById"];
|
|
211
|
+
put?: never;
|
|
212
|
+
post?: never;
|
|
213
|
+
/** @description deletes an attachment based on the attachmentId supplied. */
|
|
214
|
+
delete: operations["deleteAttachmentById"];
|
|
215
|
+
options?: never;
|
|
216
|
+
head?: never;
|
|
217
|
+
/** @description patch an attachment identified by the attachmentId with changes in the body. Only role, mime, title, and position are patchable. */
|
|
218
|
+
patch: operations["patchAttachmentById"];
|
|
219
|
+
trace?: never;
|
|
220
|
+
};
|
|
221
|
+
"/attachments/{attachmentId}/content": {
|
|
222
|
+
parameters: {
|
|
223
|
+
query?: never;
|
|
224
|
+
header?: never;
|
|
225
|
+
path: {
|
|
226
|
+
attachmentId: components["schemas"]["EntityId"];
|
|
227
|
+
};
|
|
228
|
+
cookie?: never;
|
|
229
|
+
};
|
|
230
|
+
/** @description Returns attachment content identified by its ID */
|
|
231
|
+
get: operations["getAttachmentContent"];
|
|
232
|
+
/** @description Updates attachment content identified by its ID */
|
|
233
|
+
put: operations["putAttachmentContentById"];
|
|
234
|
+
post?: never;
|
|
235
|
+
delete?: never;
|
|
236
|
+
options?: never;
|
|
237
|
+
head?: never;
|
|
238
|
+
patch?: never;
|
|
239
|
+
trace?: never;
|
|
240
|
+
};
|
|
241
|
+
"/attributes": {
|
|
242
|
+
parameters: {
|
|
243
|
+
query?: never;
|
|
244
|
+
header?: never;
|
|
245
|
+
path?: never;
|
|
246
|
+
cookie?: never;
|
|
247
|
+
};
|
|
248
|
+
get?: never;
|
|
249
|
+
put?: never;
|
|
250
|
+
/** @description create an attribute for a given note */
|
|
251
|
+
post: operations["postAttribute"];
|
|
252
|
+
delete?: never;
|
|
253
|
+
options?: never;
|
|
254
|
+
head?: never;
|
|
255
|
+
patch?: never;
|
|
256
|
+
trace?: never;
|
|
257
|
+
};
|
|
258
|
+
"/attributes/{attributeId}": {
|
|
259
|
+
parameters: {
|
|
260
|
+
query?: never;
|
|
261
|
+
header?: never;
|
|
262
|
+
path: {
|
|
263
|
+
attributeId: components["schemas"]["EntityId"];
|
|
264
|
+
};
|
|
265
|
+
cookie?: never;
|
|
266
|
+
};
|
|
267
|
+
/** @description Returns an attribute identified by its ID */
|
|
268
|
+
get: operations["getAttributeById"];
|
|
269
|
+
put?: never;
|
|
270
|
+
post?: never;
|
|
271
|
+
/** @description deletes an attribute based on the attributeId supplied. */
|
|
272
|
+
delete: operations["deleteAttributeById"];
|
|
273
|
+
options?: never;
|
|
274
|
+
head?: never;
|
|
275
|
+
/** @description patch an attribute identified by the attributeId with changes in the body. For labels, only value and position can be updated. For relations, only position can be updated. If you want to modify other properties, you need to delete the old attribute and create a new one. */
|
|
276
|
+
patch: operations["patchAttributeById"];
|
|
277
|
+
trace?: never;
|
|
278
|
+
};
|
|
279
|
+
"/refresh-note-ordering/{parentNoteId}": {
|
|
280
|
+
parameters: {
|
|
281
|
+
query?: never;
|
|
282
|
+
header?: never;
|
|
283
|
+
path: {
|
|
284
|
+
parentNoteId: components["schemas"]["EntityId"];
|
|
285
|
+
};
|
|
286
|
+
cookie?: never;
|
|
287
|
+
};
|
|
288
|
+
get?: never;
|
|
289
|
+
put?: never;
|
|
290
|
+
/** @description notePositions in branches are not automatically pushed to connected clients and need a specific instruction. If you want your changes to be in effect immediately, call this service after setting branches' notePosition. Note that you need to supply "parentNoteId" of branch(es) with changed positions. */
|
|
291
|
+
post: operations["postRefreshNoteOrdering"];
|
|
292
|
+
delete?: never;
|
|
293
|
+
options?: never;
|
|
294
|
+
head?: never;
|
|
295
|
+
patch?: never;
|
|
296
|
+
trace?: never;
|
|
297
|
+
};
|
|
298
|
+
"/inbox/{date}": {
|
|
299
|
+
parameters: {
|
|
300
|
+
query?: never;
|
|
301
|
+
header?: never;
|
|
302
|
+
path?: never;
|
|
303
|
+
cookie?: never;
|
|
304
|
+
};
|
|
305
|
+
/** @description returns an "inbox" note, into which note can be created. Date will be used depending on whether the inbox is a fixed note (identified with #inbox label) or a day note in a journal. */
|
|
306
|
+
get: operations["getInboxNote"];
|
|
307
|
+
put?: never;
|
|
308
|
+
post?: never;
|
|
309
|
+
delete?: never;
|
|
310
|
+
options?: never;
|
|
311
|
+
head?: never;
|
|
312
|
+
patch?: never;
|
|
313
|
+
trace?: never;
|
|
314
|
+
};
|
|
315
|
+
"/calendar/days/{date}": {
|
|
316
|
+
parameters: {
|
|
317
|
+
query?: never;
|
|
318
|
+
header?: never;
|
|
319
|
+
path?: never;
|
|
320
|
+
cookie?: never;
|
|
321
|
+
};
|
|
322
|
+
/** @description returns a day note for a given date. Gets created if doesn't exist. */
|
|
323
|
+
get: operations["getDayNote"];
|
|
324
|
+
put?: never;
|
|
325
|
+
post?: never;
|
|
326
|
+
delete?: never;
|
|
327
|
+
options?: never;
|
|
328
|
+
head?: never;
|
|
329
|
+
patch?: never;
|
|
330
|
+
trace?: never;
|
|
331
|
+
};
|
|
332
|
+
"/calendar/weeks/{date}": {
|
|
333
|
+
parameters: {
|
|
334
|
+
query?: never;
|
|
335
|
+
header?: never;
|
|
336
|
+
path?: never;
|
|
337
|
+
cookie?: never;
|
|
338
|
+
};
|
|
339
|
+
/** @description returns a week note for a given date. Gets created if doesn't exist. */
|
|
340
|
+
get: operations["getWeekFirstDayNote"];
|
|
341
|
+
put?: never;
|
|
342
|
+
post?: never;
|
|
343
|
+
delete?: never;
|
|
344
|
+
options?: never;
|
|
345
|
+
head?: never;
|
|
346
|
+
patch?: never;
|
|
347
|
+
trace?: never;
|
|
348
|
+
};
|
|
349
|
+
"/calendar/months/{month}": {
|
|
350
|
+
parameters: {
|
|
351
|
+
query?: never;
|
|
352
|
+
header?: never;
|
|
353
|
+
path?: never;
|
|
354
|
+
cookie?: never;
|
|
355
|
+
};
|
|
356
|
+
/** @description returns a week note for a given date. Gets created if doesn't exist. */
|
|
357
|
+
get: operations["getMonthNote"];
|
|
358
|
+
put?: never;
|
|
359
|
+
post?: never;
|
|
360
|
+
delete?: never;
|
|
361
|
+
options?: never;
|
|
362
|
+
head?: never;
|
|
363
|
+
patch?: never;
|
|
364
|
+
trace?: never;
|
|
365
|
+
};
|
|
366
|
+
"/calendar/years/{year}": {
|
|
367
|
+
parameters: {
|
|
368
|
+
query?: never;
|
|
369
|
+
header?: never;
|
|
370
|
+
path?: never;
|
|
371
|
+
cookie?: never;
|
|
372
|
+
};
|
|
373
|
+
/** @description returns a week note for a given date. Gets created if doesn't exist. */
|
|
374
|
+
get: operations["getYearNote"];
|
|
375
|
+
put?: never;
|
|
376
|
+
post?: never;
|
|
377
|
+
delete?: never;
|
|
378
|
+
options?: never;
|
|
379
|
+
head?: never;
|
|
380
|
+
patch?: never;
|
|
381
|
+
trace?: never;
|
|
382
|
+
};
|
|
383
|
+
"/auth/login": {
|
|
384
|
+
parameters: {
|
|
385
|
+
query?: never;
|
|
386
|
+
header?: never;
|
|
387
|
+
path?: never;
|
|
388
|
+
cookie?: never;
|
|
389
|
+
};
|
|
390
|
+
get?: never;
|
|
391
|
+
put?: never;
|
|
392
|
+
/** @description get an ETAPI token based on password for further use with ETAPI */
|
|
393
|
+
post: operations["login"];
|
|
394
|
+
delete?: never;
|
|
395
|
+
options?: never;
|
|
396
|
+
head?: never;
|
|
397
|
+
patch?: never;
|
|
398
|
+
trace?: never;
|
|
399
|
+
};
|
|
400
|
+
"/auth/logout": {
|
|
401
|
+
parameters: {
|
|
402
|
+
query?: never;
|
|
403
|
+
header?: never;
|
|
404
|
+
path?: never;
|
|
405
|
+
cookie?: never;
|
|
406
|
+
};
|
|
407
|
+
get?: never;
|
|
408
|
+
put?: never;
|
|
409
|
+
/** @description logout (delete/deactivate) an ETAPI token */
|
|
410
|
+
post: operations["logout"];
|
|
411
|
+
delete?: never;
|
|
412
|
+
options?: never;
|
|
413
|
+
head?: never;
|
|
414
|
+
patch?: never;
|
|
415
|
+
trace?: never;
|
|
416
|
+
};
|
|
417
|
+
"/app-info": {
|
|
418
|
+
parameters: {
|
|
419
|
+
query?: never;
|
|
420
|
+
header?: never;
|
|
421
|
+
path?: never;
|
|
422
|
+
cookie?: never;
|
|
423
|
+
};
|
|
424
|
+
/** @description returns information about the running Trilium instance */
|
|
425
|
+
get: operations["getAppInfo"];
|
|
426
|
+
put?: never;
|
|
427
|
+
post?: never;
|
|
428
|
+
delete?: never;
|
|
429
|
+
options?: never;
|
|
430
|
+
head?: never;
|
|
431
|
+
patch?: never;
|
|
432
|
+
trace?: never;
|
|
433
|
+
};
|
|
434
|
+
"/backup/{backupName}": {
|
|
435
|
+
parameters: {
|
|
436
|
+
query?: never;
|
|
437
|
+
header?: never;
|
|
438
|
+
path: {
|
|
439
|
+
/** @description If the backupName is e.g. "now", then the backup will be written to "backup-now.db" file */
|
|
440
|
+
backupName: components["schemas"]["StringId"];
|
|
441
|
+
};
|
|
442
|
+
cookie?: never;
|
|
443
|
+
};
|
|
444
|
+
get?: never;
|
|
445
|
+
/** @description Create a database backup under a given name */
|
|
446
|
+
put: operations["createBackup"];
|
|
447
|
+
post?: never;
|
|
448
|
+
delete?: never;
|
|
449
|
+
options?: never;
|
|
450
|
+
head?: never;
|
|
451
|
+
patch?: never;
|
|
452
|
+
trace?: never;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
interface components {
|
|
456
|
+
schemas: {
|
|
457
|
+
CreateNoteDef: {
|
|
458
|
+
/** @description Note ID of the parent note in the tree */
|
|
459
|
+
parentNoteId: components["schemas"]["EntityId"];
|
|
460
|
+
title: string;
|
|
461
|
+
/** @enum {string} */
|
|
462
|
+
type: "text" | "code" | "file" | "image" | "search" | "book" | "relationMap" | "render";
|
|
463
|
+
/**
|
|
464
|
+
* @description this needs to be specified only for note types 'code', 'file', 'image'.
|
|
465
|
+
* @example application/json
|
|
466
|
+
*/
|
|
467
|
+
mime?: string;
|
|
468
|
+
content: string;
|
|
469
|
+
/** @description Position of the note in the parent. Normal ordering is 10, 20, 30 ... So if you want to create a note on the first position, use e.g. 5, for second position 15, for last e.g. 1000000 */
|
|
470
|
+
notePosition?: number;
|
|
471
|
+
/** @description Prefix is branch (placement) specific title prefix for the note. Let's say you have your note placed into two different places in the tree, but you want to change the title a bit in one of the placements. For this you can use prefix. */
|
|
472
|
+
prefix?: string;
|
|
473
|
+
/** @description true if this note (as a folder) should appear expanded */
|
|
474
|
+
isExpanded?: boolean;
|
|
475
|
+
/** @description DON'T specify unless you want to force a specific noteId */
|
|
476
|
+
noteId?: components["schemas"]["EntityId"];
|
|
477
|
+
/** @description DON'T specify unless you want to force a specific branchId */
|
|
478
|
+
branchId?: components["schemas"]["EntityId"];
|
|
479
|
+
/** @description Local timestap of the note creation. Specify only if you want to override the default (current datetime in the current timezone/offset). */
|
|
480
|
+
dateCreated?: components["schemas"]["LocalDateTime"];
|
|
481
|
+
/** @description UTC timestap of the note creation. Specify only if you want to override the default (current datetime). */
|
|
482
|
+
utcDateCreated?: components["schemas"]["UtcDateTime"];
|
|
483
|
+
};
|
|
484
|
+
Note: {
|
|
485
|
+
readonly noteId?: components["schemas"]["EntityId"];
|
|
486
|
+
title?: string;
|
|
487
|
+
/** @enum {string} */
|
|
488
|
+
type?: "text" | "code" | "render" | "file" | "image" | "search" | "relationMap" | "book" | "noteMap" | "mermaid" | "webView" | "shortcut" | "doc" | "contentWidget" | "launcher";
|
|
489
|
+
mime?: string;
|
|
490
|
+
readonly isProtected?: boolean;
|
|
491
|
+
/** @description ID of the blob object which effectively serves as a content hash */
|
|
492
|
+
blobId?: string;
|
|
493
|
+
readonly attributes?: components["schemas"]["AttributeList"];
|
|
494
|
+
readonly parentNoteIds?: components["schemas"]["EntityIdList"];
|
|
495
|
+
readonly childNoteIds?: components["schemas"]["EntityIdList"];
|
|
496
|
+
readonly parentBranchIds?: components["schemas"]["EntityIdList"];
|
|
497
|
+
readonly childBranchIds?: components["schemas"]["EntityIdList"];
|
|
498
|
+
dateCreated?: components["schemas"]["LocalDateTime"];
|
|
499
|
+
readonly dateModified?: components["schemas"]["LocalDateTime"];
|
|
500
|
+
utcDateCreated?: components["schemas"]["UtcDateTime"];
|
|
501
|
+
readonly utcDateModified?: components["schemas"]["UtcDateTime"];
|
|
502
|
+
};
|
|
503
|
+
/** @description Branch places the note into the tree, it represents the relationship between a parent note and child note */
|
|
504
|
+
Branch: {
|
|
505
|
+
branchId?: components["schemas"]["EntityId"];
|
|
506
|
+
/** @description identifies the child note */
|
|
507
|
+
readonly noteId?: components["schemas"]["EntityId"];
|
|
508
|
+
/** @description identifies the parent note */
|
|
509
|
+
readonly parentNoteId?: components["schemas"]["EntityId"];
|
|
510
|
+
prefix?: string;
|
|
511
|
+
/** Format: int32 */
|
|
512
|
+
notePosition?: number;
|
|
513
|
+
isExpanded?: boolean;
|
|
514
|
+
readonly utcDateModified?: components["schemas"]["UtcDateTime"];
|
|
515
|
+
};
|
|
516
|
+
NoteWithBranch: {
|
|
517
|
+
note?: components["schemas"]["Note"];
|
|
518
|
+
branch?: components["schemas"]["Branch"];
|
|
519
|
+
};
|
|
520
|
+
/** @description Attachment is owned by a note, has title and content */
|
|
521
|
+
Attachment: {
|
|
522
|
+
readonly attachmentId?: components["schemas"]["EntityId"];
|
|
523
|
+
/** @description identifies the owner of the attachment, is either noteId or revisionId */
|
|
524
|
+
ownerId?: components["schemas"]["EntityId"];
|
|
525
|
+
role?: string;
|
|
526
|
+
mime?: string;
|
|
527
|
+
title?: string;
|
|
528
|
+
/** Format: int32 */
|
|
529
|
+
position?: number;
|
|
530
|
+
/** @description ID of the blob object which effectively serves as a content hash */
|
|
531
|
+
blobId?: string;
|
|
532
|
+
readonly dateModified?: components["schemas"]["LocalDateTime"];
|
|
533
|
+
readonly utcDateModified?: components["schemas"]["UtcDateTime"];
|
|
534
|
+
readonly utcDateScheduledForErasureSince?: components["schemas"]["UtcDateTime"];
|
|
535
|
+
/** Format: int32 */
|
|
536
|
+
contentLength?: number;
|
|
537
|
+
};
|
|
538
|
+
CreateAttachment: {
|
|
539
|
+
/** @description identifies the owner of the attachment, is either noteId or revisionId */
|
|
540
|
+
ownerId?: components["schemas"]["EntityId"];
|
|
541
|
+
role?: string;
|
|
542
|
+
mime?: string;
|
|
543
|
+
title?: string;
|
|
544
|
+
content?: string;
|
|
545
|
+
/** Format: int32 */
|
|
546
|
+
position?: number;
|
|
547
|
+
};
|
|
548
|
+
/** @description Attribute (Label, Relation) is a key-value record attached to a note. */
|
|
549
|
+
Attribute: {
|
|
550
|
+
attributeId?: components["schemas"]["EntityId"];
|
|
551
|
+
/** @description identifies the child note */
|
|
552
|
+
readonly noteId?: components["schemas"]["EntityId"];
|
|
553
|
+
/** @enum {string} */
|
|
554
|
+
type?: "label" | "relation";
|
|
555
|
+
/** @example shareCss */
|
|
556
|
+
name?: string;
|
|
557
|
+
value?: string;
|
|
558
|
+
/** Format: int32 */
|
|
559
|
+
position?: number;
|
|
560
|
+
isInheritable?: boolean;
|
|
561
|
+
readonly utcDateModified?: components["schemas"]["UtcDateTime"];
|
|
562
|
+
};
|
|
563
|
+
AttributeList: components["schemas"]["Attribute"][];
|
|
564
|
+
SearchResponse: {
|
|
565
|
+
results: components["schemas"]["Note"][];
|
|
566
|
+
/** @description debugging info on parsing the search query enabled with &debug=true parameter */
|
|
567
|
+
debugInfo?: Record<string, never>;
|
|
568
|
+
};
|
|
569
|
+
/** @example evnnmvHTCgIn */
|
|
570
|
+
EntityId: string;
|
|
571
|
+
/** @example my_ID */
|
|
572
|
+
StringId: string;
|
|
573
|
+
EntityIdList: components["schemas"]["EntityId"][];
|
|
574
|
+
/** @example 2021-12-31 20:18:11.930+0100 */
|
|
575
|
+
LocalDateTime: string;
|
|
576
|
+
/** @example 2021-12-31 19:18:11.930Z */
|
|
577
|
+
UtcDateTime: string;
|
|
578
|
+
AppInfo: {
|
|
579
|
+
/**
|
|
580
|
+
* @description Trilium version
|
|
581
|
+
* @example 0.50.2
|
|
582
|
+
*/
|
|
583
|
+
appVersion?: string;
|
|
584
|
+
/**
|
|
585
|
+
* Format: int32
|
|
586
|
+
* @description DB version
|
|
587
|
+
* @example 194
|
|
588
|
+
*/
|
|
589
|
+
dbVersion?: number;
|
|
590
|
+
/**
|
|
591
|
+
* Format: int32
|
|
592
|
+
* @description Sync protocol version
|
|
593
|
+
* @example 25
|
|
594
|
+
*/
|
|
595
|
+
syncVersion?: number;
|
|
596
|
+
/**
|
|
597
|
+
* Format: date-time
|
|
598
|
+
* @description build date
|
|
599
|
+
* @example 2022-02-09T22:52:36+01:00
|
|
600
|
+
*/
|
|
601
|
+
buildDate?: string;
|
|
602
|
+
/**
|
|
603
|
+
* @description git build revision
|
|
604
|
+
* @example 23daaa2387a0655685377f0a541d154aeec2aae8
|
|
605
|
+
*/
|
|
606
|
+
buildRevision?: string;
|
|
607
|
+
/**
|
|
608
|
+
* @description data directory where Trilium stores files
|
|
609
|
+
* @example /home/user/data
|
|
610
|
+
*/
|
|
611
|
+
dataDirectory?: string;
|
|
612
|
+
/**
|
|
613
|
+
* @description version of the supported Trilium Web Clipper protocol
|
|
614
|
+
* @example 1
|
|
615
|
+
*/
|
|
616
|
+
clipperProtocolVersion?: string;
|
|
617
|
+
/**
|
|
618
|
+
* @description current UTC date time
|
|
619
|
+
* @example 2022-03-07T21:54:25.277Z
|
|
620
|
+
*/
|
|
621
|
+
utcDateTime?: string;
|
|
622
|
+
};
|
|
623
|
+
Error: {
|
|
624
|
+
/**
|
|
625
|
+
* Format: int32
|
|
626
|
+
* @description HTTP status, identical to the one given in HTTP response
|
|
627
|
+
* @example 400
|
|
628
|
+
*/
|
|
629
|
+
status: number;
|
|
630
|
+
/**
|
|
631
|
+
* @description stable string constant
|
|
632
|
+
* @example NOTE_IS_PROTECTED
|
|
633
|
+
*/
|
|
634
|
+
code: string;
|
|
635
|
+
/**
|
|
636
|
+
* @description Human readable error, potentially with more details,
|
|
637
|
+
* @example Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI
|
|
638
|
+
*/
|
|
639
|
+
message: string;
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
responses: never;
|
|
643
|
+
parameters: never;
|
|
644
|
+
requestBodies: never;
|
|
645
|
+
headers: never;
|
|
646
|
+
pathItems: never;
|
|
647
|
+
}
|
|
648
|
+
interface operations {
|
|
649
|
+
createNote: {
|
|
650
|
+
parameters: {
|
|
651
|
+
query?: never;
|
|
652
|
+
header?: never;
|
|
653
|
+
path?: never;
|
|
654
|
+
cookie?: never;
|
|
655
|
+
};
|
|
656
|
+
requestBody: {
|
|
657
|
+
content: {
|
|
658
|
+
"application/json": components["schemas"]["CreateNoteDef"];
|
|
659
|
+
};
|
|
660
|
+
};
|
|
661
|
+
responses: {
|
|
662
|
+
/** @description note created */
|
|
663
|
+
201: {
|
|
664
|
+
headers: {
|
|
665
|
+
[name: string]: unknown;
|
|
666
|
+
};
|
|
667
|
+
content: {
|
|
668
|
+
"application/json; charset=utf-8": components["schemas"]["NoteWithBranch"];
|
|
669
|
+
};
|
|
670
|
+
};
|
|
671
|
+
/** @description unexpected error */
|
|
672
|
+
default: {
|
|
673
|
+
headers: {
|
|
674
|
+
[name: string]: unknown;
|
|
675
|
+
};
|
|
676
|
+
content: {
|
|
677
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
searchNotes: {
|
|
683
|
+
parameters: {
|
|
684
|
+
query: {
|
|
685
|
+
/** @description search query string as described in https://triliumnext.github.io/Docs/Wiki/search.html */
|
|
686
|
+
search: string;
|
|
687
|
+
/** @description enable fast search (fulltext doesn't look into content) */
|
|
688
|
+
fastSearch?: boolean;
|
|
689
|
+
/** @description search by default ignores archived notes. Set to 'true' to includes archived notes into search results. */
|
|
690
|
+
includeArchivedNotes?: boolean;
|
|
691
|
+
/** @description search only in a subtree identified by the subtree noteId. By default whole tree is searched. */
|
|
692
|
+
ancestorNoteId?: components["schemas"]["EntityId"];
|
|
693
|
+
/** @description define how deep in the tree should the notes be searched */
|
|
694
|
+
ancestorDepth?: string;
|
|
695
|
+
/**
|
|
696
|
+
* @description name of the property/label to order search results by
|
|
697
|
+
* @example [
|
|
698
|
+
* "title",
|
|
699
|
+
* "#publicationDate",
|
|
700
|
+
* "isProtected",
|
|
701
|
+
* "isArchived",
|
|
702
|
+
* "dateCreated",
|
|
703
|
+
* "dateModified",
|
|
704
|
+
* "utcDateCreated",
|
|
705
|
+
* "utcDateModified",
|
|
706
|
+
* "parentCount",
|
|
707
|
+
* "childrenCount",
|
|
708
|
+
* "attributeCount",
|
|
709
|
+
* "labelCount",
|
|
710
|
+
* "ownedLabelCount",
|
|
711
|
+
* "relationCount",
|
|
712
|
+
* "ownedRelationCount",
|
|
713
|
+
* "relationCountIncludingLinks",
|
|
714
|
+
* "ownedRelationCountIncludingLinks",
|
|
715
|
+
* "targetRelationCount",
|
|
716
|
+
* "targetRelationCountIncludingLinks",
|
|
717
|
+
* "contentSize",
|
|
718
|
+
* "contentAndAttachmentsSize",
|
|
719
|
+
* "contentAndAttachmentsAndRevisionsSize",
|
|
720
|
+
* "revisionCount"
|
|
721
|
+
* ]
|
|
722
|
+
*/
|
|
723
|
+
orderBy?: string;
|
|
724
|
+
/** @description order direction, ascending or descending */
|
|
725
|
+
orderDirection?: "asc" | "desc";
|
|
726
|
+
/**
|
|
727
|
+
* @description limit the number of results you want to receive
|
|
728
|
+
* @example 10
|
|
729
|
+
*/
|
|
730
|
+
limit?: number;
|
|
731
|
+
/** @description set to true to get debug information in the response (search query parsing) */
|
|
732
|
+
debug?: boolean;
|
|
733
|
+
};
|
|
734
|
+
header?: never;
|
|
735
|
+
path?: never;
|
|
736
|
+
cookie?: never;
|
|
737
|
+
};
|
|
738
|
+
requestBody?: never;
|
|
739
|
+
responses: {
|
|
740
|
+
/** @description search response */
|
|
741
|
+
200: {
|
|
742
|
+
headers: {
|
|
743
|
+
[name: string]: unknown;
|
|
744
|
+
};
|
|
745
|
+
content: {
|
|
746
|
+
"application/json; charset=utf-8": components["schemas"]["SearchResponse"];
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
/** @description unexpected error */
|
|
750
|
+
default: {
|
|
751
|
+
headers: {
|
|
752
|
+
[name: string]: unknown;
|
|
753
|
+
};
|
|
754
|
+
content: {
|
|
755
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
getNoteById: {
|
|
761
|
+
parameters: {
|
|
762
|
+
query?: never;
|
|
763
|
+
header?: never;
|
|
764
|
+
path: {
|
|
765
|
+
noteId: components["schemas"]["EntityId"];
|
|
766
|
+
};
|
|
767
|
+
cookie?: never;
|
|
768
|
+
};
|
|
769
|
+
requestBody?: never;
|
|
770
|
+
responses: {
|
|
771
|
+
/** @description note response */
|
|
772
|
+
200: {
|
|
773
|
+
headers: {
|
|
774
|
+
[name: string]: unknown;
|
|
775
|
+
};
|
|
776
|
+
content: {
|
|
777
|
+
"application/json; charset=utf-8": components["schemas"]["Note"];
|
|
778
|
+
};
|
|
779
|
+
};
|
|
780
|
+
/** @description unexpected error */
|
|
781
|
+
default: {
|
|
782
|
+
headers: {
|
|
783
|
+
[name: string]: unknown;
|
|
784
|
+
};
|
|
785
|
+
content: {
|
|
786
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
787
|
+
};
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
deleteNoteById: {
|
|
792
|
+
parameters: {
|
|
793
|
+
query?: never;
|
|
794
|
+
header?: never;
|
|
795
|
+
path: {
|
|
796
|
+
noteId: components["schemas"]["EntityId"];
|
|
797
|
+
};
|
|
798
|
+
cookie?: never;
|
|
799
|
+
};
|
|
800
|
+
requestBody?: never;
|
|
801
|
+
responses: {
|
|
802
|
+
/** @description note deleted */
|
|
803
|
+
204: {
|
|
804
|
+
headers: {
|
|
805
|
+
[name: string]: unknown;
|
|
806
|
+
};
|
|
807
|
+
content?: never;
|
|
808
|
+
};
|
|
809
|
+
/** @description unexpected error */
|
|
810
|
+
default: {
|
|
811
|
+
headers: {
|
|
812
|
+
[name: string]: unknown;
|
|
813
|
+
};
|
|
814
|
+
content: {
|
|
815
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
patchNoteById: {
|
|
821
|
+
parameters: {
|
|
822
|
+
query?: never;
|
|
823
|
+
header?: never;
|
|
824
|
+
path: {
|
|
825
|
+
noteId: components["schemas"]["EntityId"];
|
|
826
|
+
};
|
|
827
|
+
cookie?: never;
|
|
828
|
+
};
|
|
829
|
+
requestBody: {
|
|
830
|
+
content: {
|
|
831
|
+
"application/json": components["schemas"]["Note"];
|
|
832
|
+
};
|
|
833
|
+
};
|
|
834
|
+
responses: {
|
|
835
|
+
/** @description note updated */
|
|
836
|
+
200: {
|
|
837
|
+
headers: {
|
|
838
|
+
[name: string]: unknown;
|
|
839
|
+
};
|
|
840
|
+
content: {
|
|
841
|
+
"application/json; charset=utf-8": components["schemas"]["Note"];
|
|
842
|
+
};
|
|
843
|
+
};
|
|
844
|
+
/** @description unexpected error */
|
|
845
|
+
default: {
|
|
846
|
+
headers: {
|
|
847
|
+
[name: string]: unknown;
|
|
848
|
+
};
|
|
849
|
+
content: {
|
|
850
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
};
|
|
855
|
+
getNoteContent: {
|
|
856
|
+
parameters: {
|
|
857
|
+
query?: never;
|
|
858
|
+
header?: never;
|
|
859
|
+
path: {
|
|
860
|
+
noteId: components["schemas"]["EntityId"];
|
|
861
|
+
};
|
|
862
|
+
cookie?: never;
|
|
863
|
+
};
|
|
864
|
+
requestBody?: never;
|
|
865
|
+
responses: {
|
|
866
|
+
/** @description note content response */
|
|
867
|
+
200: {
|
|
868
|
+
headers: {
|
|
869
|
+
[name: string]: unknown;
|
|
870
|
+
};
|
|
871
|
+
content: {
|
|
872
|
+
"text/html": string;
|
|
873
|
+
};
|
|
874
|
+
};
|
|
875
|
+
};
|
|
876
|
+
};
|
|
877
|
+
putNoteContentById: {
|
|
878
|
+
parameters: {
|
|
879
|
+
query?: never;
|
|
880
|
+
header?: never;
|
|
881
|
+
path: {
|
|
882
|
+
noteId: components["schemas"]["EntityId"];
|
|
883
|
+
};
|
|
884
|
+
cookie?: never;
|
|
885
|
+
};
|
|
886
|
+
/** @description html content of note */
|
|
887
|
+
requestBody: {
|
|
888
|
+
content: {
|
|
889
|
+
"text/plain": string;
|
|
890
|
+
};
|
|
891
|
+
};
|
|
892
|
+
responses: {
|
|
893
|
+
/** @description note content updated */
|
|
894
|
+
204: {
|
|
895
|
+
headers: {
|
|
896
|
+
[name: string]: unknown;
|
|
897
|
+
};
|
|
898
|
+
content?: never;
|
|
899
|
+
};
|
|
900
|
+
};
|
|
901
|
+
};
|
|
902
|
+
exportNoteSubtree: {
|
|
903
|
+
parameters: {
|
|
904
|
+
query?: {
|
|
905
|
+
format?: "html" | "markdown" | "share";
|
|
906
|
+
};
|
|
907
|
+
header?: never;
|
|
908
|
+
path: {
|
|
909
|
+
noteId: components["schemas"]["EntityId"];
|
|
910
|
+
};
|
|
911
|
+
cookie?: never;
|
|
912
|
+
};
|
|
913
|
+
requestBody?: never;
|
|
914
|
+
responses: {
|
|
915
|
+
/** @description export ZIP file */
|
|
916
|
+
200: {
|
|
917
|
+
headers: {
|
|
918
|
+
[name: string]: unknown;
|
|
919
|
+
};
|
|
920
|
+
content: {
|
|
921
|
+
"application/zip": string;
|
|
922
|
+
};
|
|
923
|
+
};
|
|
924
|
+
/** @description unexpected error */
|
|
925
|
+
default: {
|
|
926
|
+
headers: {
|
|
927
|
+
[name: string]: unknown;
|
|
928
|
+
};
|
|
929
|
+
content: {
|
|
930
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
931
|
+
};
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
};
|
|
935
|
+
importZip: {
|
|
936
|
+
parameters: {
|
|
937
|
+
query?: never;
|
|
938
|
+
header?: never;
|
|
939
|
+
path: {
|
|
940
|
+
noteId: components["schemas"]["EntityId"];
|
|
941
|
+
};
|
|
942
|
+
cookie?: never;
|
|
943
|
+
};
|
|
944
|
+
requestBody?: never;
|
|
945
|
+
responses: {
|
|
946
|
+
/** @description note created */
|
|
947
|
+
201: {
|
|
948
|
+
headers: {
|
|
949
|
+
[name: string]: unknown;
|
|
950
|
+
};
|
|
951
|
+
content: {
|
|
952
|
+
"application/json; charset=utf-8": components["schemas"]["NoteWithBranch"];
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
/** @description unexpected error */
|
|
956
|
+
default: {
|
|
957
|
+
headers: {
|
|
958
|
+
[name: string]: unknown;
|
|
959
|
+
};
|
|
960
|
+
content: {
|
|
961
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
962
|
+
};
|
|
963
|
+
};
|
|
964
|
+
};
|
|
965
|
+
};
|
|
966
|
+
createRevision: {
|
|
967
|
+
parameters: {
|
|
968
|
+
query?: {
|
|
969
|
+
format?: "html" | "markdown";
|
|
970
|
+
};
|
|
971
|
+
header?: never;
|
|
972
|
+
path: {
|
|
973
|
+
noteId: components["schemas"]["EntityId"];
|
|
974
|
+
};
|
|
975
|
+
cookie?: never;
|
|
976
|
+
};
|
|
977
|
+
requestBody?: never;
|
|
978
|
+
responses: {
|
|
979
|
+
/** @description revision has been created */
|
|
980
|
+
204: {
|
|
981
|
+
headers: {
|
|
982
|
+
[name: string]: unknown;
|
|
983
|
+
};
|
|
984
|
+
content?: never;
|
|
985
|
+
};
|
|
986
|
+
/** @description unexpected error */
|
|
987
|
+
default: {
|
|
988
|
+
headers: {
|
|
989
|
+
[name: string]: unknown;
|
|
990
|
+
};
|
|
991
|
+
content: {
|
|
992
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
postBranch: {
|
|
998
|
+
parameters: {
|
|
999
|
+
query?: never;
|
|
1000
|
+
header?: never;
|
|
1001
|
+
path?: never;
|
|
1002
|
+
cookie?: never;
|
|
1003
|
+
};
|
|
1004
|
+
requestBody: {
|
|
1005
|
+
content: {
|
|
1006
|
+
"application/json": components["schemas"]["Branch"];
|
|
1007
|
+
};
|
|
1008
|
+
};
|
|
1009
|
+
responses: {
|
|
1010
|
+
/** @description branch updated (branch between parent note and child note already existed) */
|
|
1011
|
+
200: {
|
|
1012
|
+
headers: {
|
|
1013
|
+
[name: string]: unknown;
|
|
1014
|
+
};
|
|
1015
|
+
content: {
|
|
1016
|
+
"application/json; charset=utf-8": components["schemas"]["Branch"];
|
|
1017
|
+
};
|
|
1018
|
+
};
|
|
1019
|
+
/** @description branch created */
|
|
1020
|
+
201: {
|
|
1021
|
+
headers: {
|
|
1022
|
+
[name: string]: unknown;
|
|
1023
|
+
};
|
|
1024
|
+
content: {
|
|
1025
|
+
"application/json; charset=utf-8": components["schemas"]["Branch"];
|
|
1026
|
+
};
|
|
1027
|
+
};
|
|
1028
|
+
/** @description unexpected error */
|
|
1029
|
+
default: {
|
|
1030
|
+
headers: {
|
|
1031
|
+
[name: string]: unknown;
|
|
1032
|
+
};
|
|
1033
|
+
content: {
|
|
1034
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1035
|
+
};
|
|
1036
|
+
};
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
1039
|
+
getBranchById: {
|
|
1040
|
+
parameters: {
|
|
1041
|
+
query?: never;
|
|
1042
|
+
header?: never;
|
|
1043
|
+
path: {
|
|
1044
|
+
branchId: components["schemas"]["EntityId"];
|
|
1045
|
+
};
|
|
1046
|
+
cookie?: never;
|
|
1047
|
+
};
|
|
1048
|
+
requestBody?: never;
|
|
1049
|
+
responses: {
|
|
1050
|
+
/** @description branch response */
|
|
1051
|
+
200: {
|
|
1052
|
+
headers: {
|
|
1053
|
+
[name: string]: unknown;
|
|
1054
|
+
};
|
|
1055
|
+
content: {
|
|
1056
|
+
"application/json; charset=utf-8": components["schemas"]["Branch"];
|
|
1057
|
+
};
|
|
1058
|
+
};
|
|
1059
|
+
/** @description unexpected error */
|
|
1060
|
+
default: {
|
|
1061
|
+
headers: {
|
|
1062
|
+
[name: string]: unknown;
|
|
1063
|
+
};
|
|
1064
|
+
content: {
|
|
1065
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1066
|
+
};
|
|
1067
|
+
};
|
|
1068
|
+
};
|
|
1069
|
+
};
|
|
1070
|
+
deleteBranchById: {
|
|
1071
|
+
parameters: {
|
|
1072
|
+
query?: never;
|
|
1073
|
+
header?: never;
|
|
1074
|
+
path: {
|
|
1075
|
+
branchId: components["schemas"]["EntityId"];
|
|
1076
|
+
};
|
|
1077
|
+
cookie?: never;
|
|
1078
|
+
};
|
|
1079
|
+
requestBody?: never;
|
|
1080
|
+
responses: {
|
|
1081
|
+
/** @description branch deleted */
|
|
1082
|
+
204: {
|
|
1083
|
+
headers: {
|
|
1084
|
+
[name: string]: unknown;
|
|
1085
|
+
};
|
|
1086
|
+
content?: never;
|
|
1087
|
+
};
|
|
1088
|
+
/** @description unexpected error */
|
|
1089
|
+
default: {
|
|
1090
|
+
headers: {
|
|
1091
|
+
[name: string]: unknown;
|
|
1092
|
+
};
|
|
1093
|
+
content: {
|
|
1094
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
};
|
|
1098
|
+
};
|
|
1099
|
+
patchBranchById: {
|
|
1100
|
+
parameters: {
|
|
1101
|
+
query?: never;
|
|
1102
|
+
header?: never;
|
|
1103
|
+
path: {
|
|
1104
|
+
branchId: components["schemas"]["EntityId"];
|
|
1105
|
+
};
|
|
1106
|
+
cookie?: never;
|
|
1107
|
+
};
|
|
1108
|
+
requestBody: {
|
|
1109
|
+
content: {
|
|
1110
|
+
"application/json": components["schemas"]["Branch"];
|
|
1111
|
+
};
|
|
1112
|
+
};
|
|
1113
|
+
responses: {
|
|
1114
|
+
/** @description branch updated */
|
|
1115
|
+
200: {
|
|
1116
|
+
headers: {
|
|
1117
|
+
[name: string]: unknown;
|
|
1118
|
+
};
|
|
1119
|
+
content: {
|
|
1120
|
+
"application/json; charset=utf-8": components["schemas"]["Branch"];
|
|
1121
|
+
};
|
|
1122
|
+
};
|
|
1123
|
+
/** @description unexpected error */
|
|
1124
|
+
default: {
|
|
1125
|
+
headers: {
|
|
1126
|
+
[name: string]: unknown;
|
|
1127
|
+
};
|
|
1128
|
+
content: {
|
|
1129
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1130
|
+
};
|
|
1131
|
+
};
|
|
1132
|
+
};
|
|
1133
|
+
};
|
|
1134
|
+
postAttachment: {
|
|
1135
|
+
parameters: {
|
|
1136
|
+
query?: never;
|
|
1137
|
+
header?: never;
|
|
1138
|
+
path?: never;
|
|
1139
|
+
cookie?: never;
|
|
1140
|
+
};
|
|
1141
|
+
requestBody: {
|
|
1142
|
+
content: {
|
|
1143
|
+
"application/json": components["schemas"]["CreateAttachment"];
|
|
1144
|
+
};
|
|
1145
|
+
};
|
|
1146
|
+
responses: {
|
|
1147
|
+
/** @description attachment created */
|
|
1148
|
+
201: {
|
|
1149
|
+
headers: {
|
|
1150
|
+
[name: string]: unknown;
|
|
1151
|
+
};
|
|
1152
|
+
content: {
|
|
1153
|
+
"application/json; charset=utf-8": components["schemas"]["Attachment"];
|
|
1154
|
+
};
|
|
1155
|
+
};
|
|
1156
|
+
/** @description unexpected error */
|
|
1157
|
+
default: {
|
|
1158
|
+
headers: {
|
|
1159
|
+
[name: string]: unknown;
|
|
1160
|
+
};
|
|
1161
|
+
content: {
|
|
1162
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1163
|
+
};
|
|
1164
|
+
};
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
getAttachmentById: {
|
|
1168
|
+
parameters: {
|
|
1169
|
+
query?: never;
|
|
1170
|
+
header?: never;
|
|
1171
|
+
path: {
|
|
1172
|
+
attachmentId: components["schemas"]["EntityId"];
|
|
1173
|
+
};
|
|
1174
|
+
cookie?: never;
|
|
1175
|
+
};
|
|
1176
|
+
requestBody?: never;
|
|
1177
|
+
responses: {
|
|
1178
|
+
/** @description attachment response */
|
|
1179
|
+
200: {
|
|
1180
|
+
headers: {
|
|
1181
|
+
[name: string]: unknown;
|
|
1182
|
+
};
|
|
1183
|
+
content: {
|
|
1184
|
+
"application/json; charset=utf-8": components["schemas"]["Attachment"];
|
|
1185
|
+
};
|
|
1186
|
+
};
|
|
1187
|
+
/** @description unexpected error */
|
|
1188
|
+
default: {
|
|
1189
|
+
headers: {
|
|
1190
|
+
[name: string]: unknown;
|
|
1191
|
+
};
|
|
1192
|
+
content: {
|
|
1193
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1194
|
+
};
|
|
1195
|
+
};
|
|
1196
|
+
};
|
|
1197
|
+
};
|
|
1198
|
+
deleteAttachmentById: {
|
|
1199
|
+
parameters: {
|
|
1200
|
+
query?: never;
|
|
1201
|
+
header?: never;
|
|
1202
|
+
path: {
|
|
1203
|
+
attachmentId: components["schemas"]["EntityId"];
|
|
1204
|
+
};
|
|
1205
|
+
cookie?: never;
|
|
1206
|
+
};
|
|
1207
|
+
requestBody?: never;
|
|
1208
|
+
responses: {
|
|
1209
|
+
/** @description attachment deleted */
|
|
1210
|
+
204: {
|
|
1211
|
+
headers: {
|
|
1212
|
+
[name: string]: unknown;
|
|
1213
|
+
};
|
|
1214
|
+
content?: never;
|
|
1215
|
+
};
|
|
1216
|
+
/** @description unexpected error */
|
|
1217
|
+
default: {
|
|
1218
|
+
headers: {
|
|
1219
|
+
[name: string]: unknown;
|
|
1220
|
+
};
|
|
1221
|
+
content: {
|
|
1222
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1223
|
+
};
|
|
1224
|
+
};
|
|
1225
|
+
};
|
|
1226
|
+
};
|
|
1227
|
+
patchAttachmentById: {
|
|
1228
|
+
parameters: {
|
|
1229
|
+
query?: never;
|
|
1230
|
+
header?: never;
|
|
1231
|
+
path: {
|
|
1232
|
+
attachmentId: components["schemas"]["EntityId"];
|
|
1233
|
+
};
|
|
1234
|
+
cookie?: never;
|
|
1235
|
+
};
|
|
1236
|
+
requestBody: {
|
|
1237
|
+
content: {
|
|
1238
|
+
"application/json": components["schemas"]["Attachment"];
|
|
1239
|
+
};
|
|
1240
|
+
};
|
|
1241
|
+
responses: {
|
|
1242
|
+
/** @description attribute updated */
|
|
1243
|
+
200: {
|
|
1244
|
+
headers: {
|
|
1245
|
+
[name: string]: unknown;
|
|
1246
|
+
};
|
|
1247
|
+
content: {
|
|
1248
|
+
"application/json; charset=utf-8": components["schemas"]["Attachment"];
|
|
1249
|
+
};
|
|
1250
|
+
};
|
|
1251
|
+
/** @description unexpected error */
|
|
1252
|
+
default: {
|
|
1253
|
+
headers: {
|
|
1254
|
+
[name: string]: unknown;
|
|
1255
|
+
};
|
|
1256
|
+
content: {
|
|
1257
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1258
|
+
};
|
|
1259
|
+
};
|
|
1260
|
+
};
|
|
1261
|
+
};
|
|
1262
|
+
getAttachmentContent: {
|
|
1263
|
+
parameters: {
|
|
1264
|
+
query?: never;
|
|
1265
|
+
header?: never;
|
|
1266
|
+
path: {
|
|
1267
|
+
attachmentId: components["schemas"]["EntityId"];
|
|
1268
|
+
};
|
|
1269
|
+
cookie?: never;
|
|
1270
|
+
};
|
|
1271
|
+
requestBody?: never;
|
|
1272
|
+
responses: {
|
|
1273
|
+
/** @description attachment content response */
|
|
1274
|
+
200: {
|
|
1275
|
+
headers: {
|
|
1276
|
+
[name: string]: unknown;
|
|
1277
|
+
};
|
|
1278
|
+
content: {
|
|
1279
|
+
"text/html": string;
|
|
1280
|
+
};
|
|
1281
|
+
};
|
|
1282
|
+
};
|
|
1283
|
+
};
|
|
1284
|
+
putAttachmentContentById: {
|
|
1285
|
+
parameters: {
|
|
1286
|
+
query?: never;
|
|
1287
|
+
header?: never;
|
|
1288
|
+
path: {
|
|
1289
|
+
attachmentId: components["schemas"]["EntityId"];
|
|
1290
|
+
};
|
|
1291
|
+
cookie?: never;
|
|
1292
|
+
};
|
|
1293
|
+
/** @description html content of attachment */
|
|
1294
|
+
requestBody: {
|
|
1295
|
+
content: {
|
|
1296
|
+
"text/plain": string;
|
|
1297
|
+
};
|
|
1298
|
+
};
|
|
1299
|
+
responses: {
|
|
1300
|
+
/** @description attachment content updated */
|
|
1301
|
+
204: {
|
|
1302
|
+
headers: {
|
|
1303
|
+
[name: string]: unknown;
|
|
1304
|
+
};
|
|
1305
|
+
content?: never;
|
|
1306
|
+
};
|
|
1307
|
+
};
|
|
1308
|
+
};
|
|
1309
|
+
postAttribute: {
|
|
1310
|
+
parameters: {
|
|
1311
|
+
query?: never;
|
|
1312
|
+
header?: never;
|
|
1313
|
+
path?: never;
|
|
1314
|
+
cookie?: never;
|
|
1315
|
+
};
|
|
1316
|
+
requestBody: {
|
|
1317
|
+
content: {
|
|
1318
|
+
"application/json": components["schemas"]["Attribute"];
|
|
1319
|
+
};
|
|
1320
|
+
};
|
|
1321
|
+
responses: {
|
|
1322
|
+
/** @description attribute created */
|
|
1323
|
+
201: {
|
|
1324
|
+
headers: {
|
|
1325
|
+
[name: string]: unknown;
|
|
1326
|
+
};
|
|
1327
|
+
content: {
|
|
1328
|
+
"application/json; charset=utf-8": components["schemas"]["Attribute"];
|
|
1329
|
+
};
|
|
1330
|
+
};
|
|
1331
|
+
/** @description unexpected error */
|
|
1332
|
+
default: {
|
|
1333
|
+
headers: {
|
|
1334
|
+
[name: string]: unknown;
|
|
1335
|
+
};
|
|
1336
|
+
content: {
|
|
1337
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1338
|
+
};
|
|
1339
|
+
};
|
|
1340
|
+
};
|
|
1341
|
+
};
|
|
1342
|
+
getAttributeById: {
|
|
1343
|
+
parameters: {
|
|
1344
|
+
query?: never;
|
|
1345
|
+
header?: never;
|
|
1346
|
+
path: {
|
|
1347
|
+
attributeId: components["schemas"]["EntityId"];
|
|
1348
|
+
};
|
|
1349
|
+
cookie?: never;
|
|
1350
|
+
};
|
|
1351
|
+
requestBody?: never;
|
|
1352
|
+
responses: {
|
|
1353
|
+
/** @description attribute response */
|
|
1354
|
+
200: {
|
|
1355
|
+
headers: {
|
|
1356
|
+
[name: string]: unknown;
|
|
1357
|
+
};
|
|
1358
|
+
content: {
|
|
1359
|
+
"application/json; charset=utf-8": components["schemas"]["Attribute"];
|
|
1360
|
+
};
|
|
1361
|
+
};
|
|
1362
|
+
/** @description unexpected error */
|
|
1363
|
+
default: {
|
|
1364
|
+
headers: {
|
|
1365
|
+
[name: string]: unknown;
|
|
1366
|
+
};
|
|
1367
|
+
content: {
|
|
1368
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1369
|
+
};
|
|
1370
|
+
};
|
|
1371
|
+
};
|
|
1372
|
+
};
|
|
1373
|
+
deleteAttributeById: {
|
|
1374
|
+
parameters: {
|
|
1375
|
+
query?: never;
|
|
1376
|
+
header?: never;
|
|
1377
|
+
path: {
|
|
1378
|
+
attributeId: components["schemas"]["EntityId"];
|
|
1379
|
+
};
|
|
1380
|
+
cookie?: never;
|
|
1381
|
+
};
|
|
1382
|
+
requestBody?: never;
|
|
1383
|
+
responses: {
|
|
1384
|
+
/** @description attribute deleted */
|
|
1385
|
+
204: {
|
|
1386
|
+
headers: {
|
|
1387
|
+
[name: string]: unknown;
|
|
1388
|
+
};
|
|
1389
|
+
content?: never;
|
|
1390
|
+
};
|
|
1391
|
+
/** @description unexpected error */
|
|
1392
|
+
default: {
|
|
1393
|
+
headers: {
|
|
1394
|
+
[name: string]: unknown;
|
|
1395
|
+
};
|
|
1396
|
+
content: {
|
|
1397
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1398
|
+
};
|
|
1399
|
+
};
|
|
1400
|
+
};
|
|
1401
|
+
};
|
|
1402
|
+
patchAttributeById: {
|
|
1403
|
+
parameters: {
|
|
1404
|
+
query?: never;
|
|
1405
|
+
header?: never;
|
|
1406
|
+
path: {
|
|
1407
|
+
attributeId: components["schemas"]["EntityId"];
|
|
1408
|
+
};
|
|
1409
|
+
cookie?: never;
|
|
1410
|
+
};
|
|
1411
|
+
requestBody: {
|
|
1412
|
+
content: {
|
|
1413
|
+
"application/json": components["schemas"]["Attribute"];
|
|
1414
|
+
};
|
|
1415
|
+
};
|
|
1416
|
+
responses: {
|
|
1417
|
+
/** @description attribute updated */
|
|
1418
|
+
200: {
|
|
1419
|
+
headers: {
|
|
1420
|
+
[name: string]: unknown;
|
|
1421
|
+
};
|
|
1422
|
+
content: {
|
|
1423
|
+
"application/json; charset=utf-8": components["schemas"]["Attribute"];
|
|
1424
|
+
};
|
|
1425
|
+
};
|
|
1426
|
+
/** @description unexpected error */
|
|
1427
|
+
default: {
|
|
1428
|
+
headers: {
|
|
1429
|
+
[name: string]: unknown;
|
|
1430
|
+
};
|
|
1431
|
+
content: {
|
|
1432
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1433
|
+
};
|
|
1434
|
+
};
|
|
1435
|
+
};
|
|
1436
|
+
};
|
|
1437
|
+
postRefreshNoteOrdering: {
|
|
1438
|
+
parameters: {
|
|
1439
|
+
query?: never;
|
|
1440
|
+
header?: never;
|
|
1441
|
+
path: {
|
|
1442
|
+
parentNoteId: components["schemas"]["EntityId"];
|
|
1443
|
+
};
|
|
1444
|
+
cookie?: never;
|
|
1445
|
+
};
|
|
1446
|
+
requestBody?: never;
|
|
1447
|
+
responses: {
|
|
1448
|
+
/** @description note ordering will be asynchronously updated in all connected clients */
|
|
1449
|
+
204: {
|
|
1450
|
+
headers: {
|
|
1451
|
+
[name: string]: unknown;
|
|
1452
|
+
};
|
|
1453
|
+
content?: never;
|
|
1454
|
+
};
|
|
1455
|
+
/** @description unexpected error */
|
|
1456
|
+
default: {
|
|
1457
|
+
headers: {
|
|
1458
|
+
[name: string]: unknown;
|
|
1459
|
+
};
|
|
1460
|
+
content: {
|
|
1461
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1462
|
+
};
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
};
|
|
1466
|
+
getInboxNote: {
|
|
1467
|
+
parameters: {
|
|
1468
|
+
query?: never;
|
|
1469
|
+
header?: never;
|
|
1470
|
+
path: {
|
|
1471
|
+
/** @example 2022-02-22 */
|
|
1472
|
+
date: string;
|
|
1473
|
+
};
|
|
1474
|
+
cookie?: never;
|
|
1475
|
+
};
|
|
1476
|
+
requestBody?: never;
|
|
1477
|
+
responses: {
|
|
1478
|
+
/** @description inbox note */
|
|
1479
|
+
200: {
|
|
1480
|
+
headers: {
|
|
1481
|
+
[name: string]: unknown;
|
|
1482
|
+
};
|
|
1483
|
+
content: {
|
|
1484
|
+
"application/json; charset=utf-8": components["schemas"]["Note"];
|
|
1485
|
+
};
|
|
1486
|
+
};
|
|
1487
|
+
/** @description unexpected error */
|
|
1488
|
+
default: {
|
|
1489
|
+
headers: {
|
|
1490
|
+
[name: string]: unknown;
|
|
1491
|
+
};
|
|
1492
|
+
content: {
|
|
1493
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1494
|
+
};
|
|
1495
|
+
};
|
|
1496
|
+
};
|
|
1497
|
+
};
|
|
1498
|
+
getDayNote: {
|
|
1499
|
+
parameters: {
|
|
1500
|
+
query?: never;
|
|
1501
|
+
header?: never;
|
|
1502
|
+
path: {
|
|
1503
|
+
/** @example 2022-02-22 */
|
|
1504
|
+
date: string;
|
|
1505
|
+
};
|
|
1506
|
+
cookie?: never;
|
|
1507
|
+
};
|
|
1508
|
+
requestBody?: never;
|
|
1509
|
+
responses: {
|
|
1510
|
+
/** @description day note */
|
|
1511
|
+
200: {
|
|
1512
|
+
headers: {
|
|
1513
|
+
[name: string]: unknown;
|
|
1514
|
+
};
|
|
1515
|
+
content: {
|
|
1516
|
+
"application/json; charset=utf-8": components["schemas"]["Note"];
|
|
1517
|
+
};
|
|
1518
|
+
};
|
|
1519
|
+
/** @description unexpected error */
|
|
1520
|
+
default: {
|
|
1521
|
+
headers: {
|
|
1522
|
+
[name: string]: unknown;
|
|
1523
|
+
};
|
|
1524
|
+
content: {
|
|
1525
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1526
|
+
};
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
};
|
|
1530
|
+
getWeekFirstDayNote: {
|
|
1531
|
+
parameters: {
|
|
1532
|
+
query?: never;
|
|
1533
|
+
header?: never;
|
|
1534
|
+
path: {
|
|
1535
|
+
/** @example 2022-02-22 */
|
|
1536
|
+
date: string;
|
|
1537
|
+
};
|
|
1538
|
+
cookie?: never;
|
|
1539
|
+
};
|
|
1540
|
+
requestBody?: never;
|
|
1541
|
+
responses: {
|
|
1542
|
+
/** @description week note */
|
|
1543
|
+
200: {
|
|
1544
|
+
headers: {
|
|
1545
|
+
[name: string]: unknown;
|
|
1546
|
+
};
|
|
1547
|
+
content: {
|
|
1548
|
+
"application/json; charset=utf-8": components["schemas"]["Note"];
|
|
1549
|
+
};
|
|
1550
|
+
};
|
|
1551
|
+
/** @description unexpected error */
|
|
1552
|
+
default: {
|
|
1553
|
+
headers: {
|
|
1554
|
+
[name: string]: unknown;
|
|
1555
|
+
};
|
|
1556
|
+
content: {
|
|
1557
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1558
|
+
};
|
|
1559
|
+
};
|
|
1560
|
+
};
|
|
1561
|
+
};
|
|
1562
|
+
getMonthNote: {
|
|
1563
|
+
parameters: {
|
|
1564
|
+
query?: never;
|
|
1565
|
+
header?: never;
|
|
1566
|
+
path: {
|
|
1567
|
+
/** @example 2022-02 */
|
|
1568
|
+
month: string;
|
|
1569
|
+
};
|
|
1570
|
+
cookie?: never;
|
|
1571
|
+
};
|
|
1572
|
+
requestBody?: never;
|
|
1573
|
+
responses: {
|
|
1574
|
+
/** @description month note */
|
|
1575
|
+
200: {
|
|
1576
|
+
headers: {
|
|
1577
|
+
[name: string]: unknown;
|
|
1578
|
+
};
|
|
1579
|
+
content: {
|
|
1580
|
+
"application/json; charset=utf-8": components["schemas"]["Note"];
|
|
1581
|
+
};
|
|
1582
|
+
};
|
|
1583
|
+
/** @description unexpected error */
|
|
1584
|
+
default: {
|
|
1585
|
+
headers: {
|
|
1586
|
+
[name: string]: unknown;
|
|
1587
|
+
};
|
|
1588
|
+
content: {
|
|
1589
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1590
|
+
};
|
|
1591
|
+
};
|
|
1592
|
+
};
|
|
1593
|
+
};
|
|
1594
|
+
getYearNote: {
|
|
1595
|
+
parameters: {
|
|
1596
|
+
query?: never;
|
|
1597
|
+
header?: never;
|
|
1598
|
+
path: {
|
|
1599
|
+
/** @example 2022-02 */
|
|
1600
|
+
year: string;
|
|
1601
|
+
};
|
|
1602
|
+
cookie?: never;
|
|
1603
|
+
};
|
|
1604
|
+
requestBody?: never;
|
|
1605
|
+
responses: {
|
|
1606
|
+
/** @description year note */
|
|
1607
|
+
200: {
|
|
1608
|
+
headers: {
|
|
1609
|
+
[name: string]: unknown;
|
|
1610
|
+
};
|
|
1611
|
+
content: {
|
|
1612
|
+
"application/json; charset=utf-8": components["schemas"]["Note"];
|
|
1613
|
+
};
|
|
1614
|
+
};
|
|
1615
|
+
/** @description unexpected error */
|
|
1616
|
+
default: {
|
|
1617
|
+
headers: {
|
|
1618
|
+
[name: string]: unknown;
|
|
1619
|
+
};
|
|
1620
|
+
content: {
|
|
1621
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1622
|
+
};
|
|
1623
|
+
};
|
|
1624
|
+
};
|
|
1625
|
+
};
|
|
1626
|
+
login: {
|
|
1627
|
+
parameters: {
|
|
1628
|
+
query?: never;
|
|
1629
|
+
header?: never;
|
|
1630
|
+
path?: never;
|
|
1631
|
+
cookie?: never;
|
|
1632
|
+
};
|
|
1633
|
+
requestBody: {
|
|
1634
|
+
content: {
|
|
1635
|
+
"application/json": {
|
|
1636
|
+
/** @description user's password used to e.g. login to Trilium server and/or protect notes */
|
|
1637
|
+
password?: string;
|
|
1638
|
+
};
|
|
1639
|
+
};
|
|
1640
|
+
};
|
|
1641
|
+
responses: {
|
|
1642
|
+
/** @description auth token */
|
|
1643
|
+
201: {
|
|
1644
|
+
headers: {
|
|
1645
|
+
[name: string]: unknown;
|
|
1646
|
+
};
|
|
1647
|
+
content: {
|
|
1648
|
+
"application/json; charset=utf-8": {
|
|
1649
|
+
/** @example Bc4bFn0Ffiok_4NpbVCDnFz7B2WU+pdhW8B5Ne3DiR5wXrEyqdjgRIsk= */
|
|
1650
|
+
authToken?: string;
|
|
1651
|
+
};
|
|
1652
|
+
};
|
|
1653
|
+
};
|
|
1654
|
+
/** @description Client IP has been blacklisted because too many requests (possibly failed authentications) were made within a short time frame, try again later */
|
|
1655
|
+
429: {
|
|
1656
|
+
headers: {
|
|
1657
|
+
[name: string]: unknown;
|
|
1658
|
+
};
|
|
1659
|
+
content?: never;
|
|
1660
|
+
};
|
|
1661
|
+
/** @description unexpected error */
|
|
1662
|
+
default: {
|
|
1663
|
+
headers: {
|
|
1664
|
+
[name: string]: unknown;
|
|
1665
|
+
};
|
|
1666
|
+
content: {
|
|
1667
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1668
|
+
};
|
|
1669
|
+
};
|
|
1670
|
+
};
|
|
1671
|
+
};
|
|
1672
|
+
logout: {
|
|
1673
|
+
parameters: {
|
|
1674
|
+
query?: never;
|
|
1675
|
+
header?: never;
|
|
1676
|
+
path?: never;
|
|
1677
|
+
cookie?: never;
|
|
1678
|
+
};
|
|
1679
|
+
requestBody?: never;
|
|
1680
|
+
responses: {
|
|
1681
|
+
/** @description logout successful */
|
|
1682
|
+
204: {
|
|
1683
|
+
headers: {
|
|
1684
|
+
[name: string]: unknown;
|
|
1685
|
+
};
|
|
1686
|
+
content?: never;
|
|
1687
|
+
};
|
|
1688
|
+
/** @description unexpected error */
|
|
1689
|
+
default: {
|
|
1690
|
+
headers: {
|
|
1691
|
+
[name: string]: unknown;
|
|
1692
|
+
};
|
|
1693
|
+
content: {
|
|
1694
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1695
|
+
};
|
|
1696
|
+
};
|
|
1697
|
+
};
|
|
1698
|
+
};
|
|
1699
|
+
getAppInfo: {
|
|
1700
|
+
parameters: {
|
|
1701
|
+
query?: never;
|
|
1702
|
+
header?: never;
|
|
1703
|
+
path?: never;
|
|
1704
|
+
cookie?: never;
|
|
1705
|
+
};
|
|
1706
|
+
requestBody?: never;
|
|
1707
|
+
responses: {
|
|
1708
|
+
/** @description app info */
|
|
1709
|
+
200: {
|
|
1710
|
+
headers: {
|
|
1711
|
+
[name: string]: unknown;
|
|
1712
|
+
};
|
|
1713
|
+
content: {
|
|
1714
|
+
"application/json; charset=utf-8": components["schemas"]["AppInfo"];
|
|
1715
|
+
};
|
|
1716
|
+
};
|
|
1717
|
+
/** @description unexpected error */
|
|
1718
|
+
default: {
|
|
1719
|
+
headers: {
|
|
1720
|
+
[name: string]: unknown;
|
|
1721
|
+
};
|
|
1722
|
+
content: {
|
|
1723
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1724
|
+
};
|
|
1725
|
+
};
|
|
1726
|
+
};
|
|
1727
|
+
};
|
|
1728
|
+
createBackup: {
|
|
1729
|
+
parameters: {
|
|
1730
|
+
query?: never;
|
|
1731
|
+
header?: never;
|
|
1732
|
+
path: {
|
|
1733
|
+
/** @description If the backupName is e.g. "now", then the backup will be written to "backup-now.db" file */
|
|
1734
|
+
backupName: components["schemas"]["StringId"];
|
|
1735
|
+
};
|
|
1736
|
+
cookie?: never;
|
|
1737
|
+
};
|
|
1738
|
+
requestBody?: never;
|
|
1739
|
+
responses: {
|
|
1740
|
+
/** @description backup has been created */
|
|
1741
|
+
204: {
|
|
1742
|
+
headers: {
|
|
1743
|
+
[name: string]: unknown;
|
|
1744
|
+
};
|
|
1745
|
+
content?: never;
|
|
1746
|
+
};
|
|
1747
|
+
/** @description unexpected error */
|
|
1748
|
+
default: {
|
|
1749
|
+
headers: {
|
|
1750
|
+
[name: string]: unknown;
|
|
1751
|
+
};
|
|
1752
|
+
content: {
|
|
1753
|
+
"application/json; charset=utf-8": components["schemas"]["Error"];
|
|
1754
|
+
};
|
|
1755
|
+
};
|
|
1756
|
+
};
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
/**
|
|
1761
|
+
* Trilium Note Mapper and Search Query Builder
|
|
1762
|
+
*
|
|
1763
|
+
* Provides utilities for mapping Trilium notes to strongly-typed objects
|
|
1764
|
+
* and building type-safe search queries.
|
|
1765
|
+
*/
|
|
1766
|
+
|
|
1767
|
+
/**
|
|
1768
|
+
* Comparison operators for search conditions
|
|
1769
|
+
*/
|
|
1770
|
+
type ComparisonOperator = '=' | '!=' | '<' | '<=' | '>' | '>=' | '*=' | '=*' | '*=*';
|
|
1771
|
+
/**
|
|
1772
|
+
* A value with an optional comparison operator
|
|
1773
|
+
*/
|
|
1774
|
+
interface ConditionValue<T = string | number | boolean> {
|
|
1775
|
+
value: T;
|
|
1776
|
+
operator?: ComparisonOperator;
|
|
1777
|
+
}
|
|
1778
|
+
/**
|
|
1779
|
+
* Simple value or condition with operator
|
|
1780
|
+
*/
|
|
1781
|
+
type SearchValue = string | number | boolean | ConditionValue;
|
|
1782
|
+
/**
|
|
1783
|
+
* Base search conditions for labels, relations, and note properties.
|
|
1784
|
+
* Use template literal keys for labels (#) and relations (~).
|
|
1785
|
+
* Regular string keys are treated as note properties.
|
|
1786
|
+
*/
|
|
1787
|
+
type TriliumSearchConditions = {
|
|
1788
|
+
/** Labels: use #labelName as key */
|
|
1789
|
+
[key: `#${string}`]: SearchValue | undefined;
|
|
1790
|
+
} & {
|
|
1791
|
+
/** Relations: use ~relationName as key */
|
|
1792
|
+
[key: `~${string}`]: SearchValue | undefined;
|
|
1793
|
+
} & {
|
|
1794
|
+
/** Note properties: use note.property as key or just property name */
|
|
1795
|
+
[key: string]: SearchValue | undefined;
|
|
1796
|
+
};
|
|
1797
|
+
/**
|
|
1798
|
+
* Logical operators for combining search conditions
|
|
1799
|
+
*/
|
|
1800
|
+
interface TriliumSearchLogical {
|
|
1801
|
+
/** Combine multiple conditions with AND */
|
|
1802
|
+
AND?: TriliumSearchHelpers[];
|
|
1803
|
+
/** Combine multiple conditions with OR */
|
|
1804
|
+
OR?: TriliumSearchHelpers[];
|
|
1805
|
+
/** Negate a condition */
|
|
1806
|
+
NOT?: TriliumSearchHelpers;
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* Complete search helpers combining conditions and logical operators.
|
|
1810
|
+
* Can contain field conditions AND/OR logical operators.
|
|
1811
|
+
*/
|
|
1812
|
+
type TriliumSearchHelpers = TriliumSearchLogical | (TriliumSearchConditions & Partial<TriliumSearchLogical>);
|
|
1813
|
+
/**
|
|
1814
|
+
* Builds a Trilium search query string from a structured helper object
|
|
1815
|
+
*
|
|
1816
|
+
* @param helpers - The search conditions and logical operators
|
|
1817
|
+
* @returns A properly formatted Trilium search query string
|
|
1818
|
+
*
|
|
1819
|
+
* @example
|
|
1820
|
+
* // Simple label search
|
|
1821
|
+
* buildSearchQuery({ '#blog': true })
|
|
1822
|
+
* // => '#blog'
|
|
1823
|
+
*
|
|
1824
|
+
* @example
|
|
1825
|
+
* // Label with value
|
|
1826
|
+
* buildSearchQuery({ '#status': 'published' })
|
|
1827
|
+
* // => "#status = 'published'"
|
|
1828
|
+
*
|
|
1829
|
+
* @example
|
|
1830
|
+
* // Complex AND/OR conditions
|
|
1831
|
+
* buildSearchQuery({
|
|
1832
|
+
* AND: [
|
|
1833
|
+
* { '#blog': true },
|
|
1834
|
+
* { OR: [
|
|
1835
|
+
* { '#status': 'published' },
|
|
1836
|
+
* { '#status': 'featured' }
|
|
1837
|
+
* ]}
|
|
1838
|
+
* ]
|
|
1839
|
+
* })
|
|
1840
|
+
* // => "#blog AND (#status = 'published' OR #status = 'featured')"
|
|
1841
|
+
*
|
|
1842
|
+
* @example
|
|
1843
|
+
* // Note properties with operators
|
|
1844
|
+
* buildSearchQuery({
|
|
1845
|
+
* 'note.type': 'text',
|
|
1846
|
+
* '#wordCount': { value: 1000, operator: '>=' }
|
|
1847
|
+
* })
|
|
1848
|
+
* // => "note.type = 'text' AND #wordCount >= 1000"
|
|
1849
|
+
*/
|
|
1850
|
+
declare function buildSearchQuery(helpers: TriliumSearchHelpers): string;
|
|
1851
|
+
/**
|
|
1852
|
+
* Computed function that calculates a value from the partially mapped object
|
|
1853
|
+
* @template T - The target object type
|
|
1854
|
+
* @template K - The specific key in the target type
|
|
1855
|
+
*/
|
|
1856
|
+
type ComputedFunction<T, K extends keyof T> = (partial: Partial<T>, note: TriliumNote) => T[K] | undefined;
|
|
1857
|
+
/**
|
|
1858
|
+
* Field mapping configuration for a single property
|
|
1859
|
+
* Can be a simple string path, a detailed configuration object, or a computed value
|
|
1860
|
+
*
|
|
1861
|
+
* @template T - The target object type
|
|
1862
|
+
* @template K - The specific key in the target type
|
|
1863
|
+
*
|
|
1864
|
+
* @example
|
|
1865
|
+
* // Shorthand string path
|
|
1866
|
+
* title: 'note.title'
|
|
1867
|
+
*
|
|
1868
|
+
* @example
|
|
1869
|
+
* // Full configuration
|
|
1870
|
+
* tags: {
|
|
1871
|
+
* from: '#tags',
|
|
1872
|
+
* transform: transforms.commaSeparated,
|
|
1873
|
+
* default: [],
|
|
1874
|
+
* required: false
|
|
1875
|
+
* }
|
|
1876
|
+
*
|
|
1877
|
+
* @example
|
|
1878
|
+
* // Computed value
|
|
1879
|
+
* readTimeMinutes: {
|
|
1880
|
+
* computed: (partial) => Math.ceil((partial.wordCount || 0) / 200)
|
|
1881
|
+
* }
|
|
1882
|
+
*/
|
|
1883
|
+
type FieldMapping<T, K extends keyof T = keyof T> = string | {
|
|
1884
|
+
/** Source path (string) or extractor function */
|
|
1885
|
+
from: string | ((note: TriliumNote) => unknown);
|
|
1886
|
+
/** Optional transform function to convert the raw value - accepts any input type */
|
|
1887
|
+
transform?: (value: any, note: TriliumNote) => T[K] | undefined;
|
|
1888
|
+
/** Default value if extraction returns undefined */
|
|
1889
|
+
default?: T[K];
|
|
1890
|
+
/** Whether this field is required (throws if missing) */
|
|
1891
|
+
required?: boolean;
|
|
1892
|
+
} | {
|
|
1893
|
+
/** Computed function that calculates value from other mapped fields */
|
|
1894
|
+
computed: ComputedFunction<T, K>;
|
|
1895
|
+
/** Default value if computed returns undefined */
|
|
1896
|
+
default?: T[K];
|
|
1897
|
+
};
|
|
1898
|
+
/**
|
|
1899
|
+
* Complete mapping configuration for a type
|
|
1900
|
+
* Maps each property key to its field mapping configuration
|
|
1901
|
+
*
|
|
1902
|
+
* @template T - The target object type to map to
|
|
1903
|
+
*/
|
|
1904
|
+
type MappingConfig<T> = {
|
|
1905
|
+
[K in keyof T]?: FieldMapping<T, K>;
|
|
1906
|
+
};
|
|
1907
|
+
/**
|
|
1908
|
+
* Maps Trilium notes to strongly-typed objects using declarative field mappings
|
|
1909
|
+
*
|
|
1910
|
+
* Supports:
|
|
1911
|
+
* - Direct property paths (note.title, note.noteId)
|
|
1912
|
+
* - Label attributes (#labelName)
|
|
1913
|
+
* - Relation attributes (~relationName)
|
|
1914
|
+
* - Custom extractor functions
|
|
1915
|
+
* - Transform functions
|
|
1916
|
+
* - Computed values from other fields
|
|
1917
|
+
* - Default values
|
|
1918
|
+
* - Required field validation
|
|
1919
|
+
*
|
|
1920
|
+
* @template T - The target type to map notes to
|
|
1921
|
+
*
|
|
1922
|
+
* @example
|
|
1923
|
+
* const mapper = new TriliumMapper<BlogPost>({
|
|
1924
|
+
* title: 'note.title',
|
|
1925
|
+
* slug: { from: '#slug', required: true },
|
|
1926
|
+
* wordCount: { from: '#wordCount', transform: transforms.number, default: 0 },
|
|
1927
|
+
* readTimeMinutes: {
|
|
1928
|
+
* computed: (partial) => Math.ceil((partial.wordCount || 0) / 200)
|
|
1929
|
+
* }
|
|
1930
|
+
* });
|
|
1931
|
+
*
|
|
1932
|
+
* const posts = mapper.map(notes);
|
|
1933
|
+
*/
|
|
1934
|
+
declare class TriliumMapper<T> {
|
|
1935
|
+
/** The mapping configuration for this mapper */
|
|
1936
|
+
readonly config: MappingConfig<T>;
|
|
1937
|
+
/**
|
|
1938
|
+
* Creates a new TriliumMapper instance
|
|
1939
|
+
* @param config - The mapping configuration defining how to map note fields to the target type
|
|
1940
|
+
*/
|
|
1941
|
+
constructor(config: MappingConfig<T>);
|
|
1942
|
+
/**
|
|
1943
|
+
* Merges multiple mapping configurations into a single configuration
|
|
1944
|
+
* Later configs override earlier ones for the same keys
|
|
1945
|
+
* Supports merging configs from base types into derived types
|
|
1946
|
+
*
|
|
1947
|
+
* @template T - The target type for the merged configuration
|
|
1948
|
+
* @param configs - One or more mapping configurations to merge
|
|
1949
|
+
* @returns A new merged mapping configuration
|
|
1950
|
+
*
|
|
1951
|
+
* @example
|
|
1952
|
+
* const merged = TriliumMapper.merge<BlogPost>(
|
|
1953
|
+
* StandardNoteMapping,
|
|
1954
|
+
* BlogSpecificMapping,
|
|
1955
|
+
* OverrideMapping
|
|
1956
|
+
* );
|
|
1957
|
+
*/
|
|
1958
|
+
static merge<T>(...configs: (Partial<MappingConfig<T>> | MappingConfig<unknown>)[]): MappingConfig<T>;
|
|
1959
|
+
/**
|
|
1960
|
+
* Maps a single note to the target type
|
|
1961
|
+
* @param note - The Trilium note to map
|
|
1962
|
+
* @returns The mapped object of type T
|
|
1963
|
+
*/
|
|
1964
|
+
map(note: TriliumNote): T;
|
|
1965
|
+
/**
|
|
1966
|
+
* Maps an array of notes to the target type
|
|
1967
|
+
* @param notes - The Trilium notes to map
|
|
1968
|
+
* @returns An array of mapped objects of type T
|
|
1969
|
+
*/
|
|
1970
|
+
map(notes: TriliumNote[]): T[];
|
|
1971
|
+
/**
|
|
1972
|
+
* Maps a single note to the target type using the configured field mappings
|
|
1973
|
+
* Processes in two passes: first regular fields, then computed fields
|
|
1974
|
+
* @param note - The Trilium note to map
|
|
1975
|
+
* @returns The mapped object
|
|
1976
|
+
* @throws Error if a required field is missing
|
|
1977
|
+
* @private
|
|
1978
|
+
*/
|
|
1979
|
+
private mapSingle;
|
|
1980
|
+
/**
|
|
1981
|
+
* Extracts a value from a note using a string path
|
|
1982
|
+
*
|
|
1983
|
+
* Supports:
|
|
1984
|
+
* - Label attributes: #labelName
|
|
1985
|
+
* - Relation attributes: ~relationName
|
|
1986
|
+
* - Note properties: note.property.path
|
|
1987
|
+
*
|
|
1988
|
+
* @param note - The Trilium note to extract from
|
|
1989
|
+
* @param path - The path string indicating where to extract the value
|
|
1990
|
+
* @returns The extracted value or undefined if not found
|
|
1991
|
+
* @private
|
|
1992
|
+
*
|
|
1993
|
+
* @example
|
|
1994
|
+
* extractValue(note, 'note.title') // => note.title
|
|
1995
|
+
* extractValue(note, '#slug') // => label attribute 'slug'
|
|
1996
|
+
* extractValue(note, '~template') // => relation attribute 'template'
|
|
1997
|
+
*/
|
|
1998
|
+
private extractValue;
|
|
1999
|
+
}
|
|
2000
|
+
/**
|
|
2001
|
+
* Common transform functions for use with TriliumMapper
|
|
2002
|
+
*/
|
|
2003
|
+
declare const transforms: {
|
|
2004
|
+
/** Convert to number */
|
|
2005
|
+
number: (value: unknown) => number | undefined;
|
|
2006
|
+
/** Convert to boolean */
|
|
2007
|
+
boolean: (value: unknown) => boolean | undefined;
|
|
2008
|
+
/** Split comma-separated string into array */
|
|
2009
|
+
commaSeparated: (value: unknown) => string[] | undefined;
|
|
2010
|
+
/** Parse JSON string */
|
|
2011
|
+
json: <T>(value: unknown) => T | undefined;
|
|
2012
|
+
/** Parse date string */
|
|
2013
|
+
date: (value: unknown) => Date | undefined;
|
|
2014
|
+
/** Trim whitespace from string */
|
|
2015
|
+
trim: (value: unknown) => string | undefined;
|
|
2016
|
+
};
|
|
2017
|
+
/**
|
|
2018
|
+
* Standard note fields that all mapped types must include.
|
|
2019
|
+
* Extend this interface when creating your own mapped types.
|
|
2020
|
+
*
|
|
2021
|
+
* @example
|
|
2022
|
+
* ```ts
|
|
2023
|
+
* interface BlogPost extends StandardNote {
|
|
2024
|
+
* slug: string;
|
|
2025
|
+
* published: boolean;
|
|
2026
|
+
* }
|
|
2027
|
+
* ```
|
|
2028
|
+
*/
|
|
2029
|
+
interface StandardNote {
|
|
2030
|
+
/** The unique note ID */
|
|
2031
|
+
id: string;
|
|
2032
|
+
/** The note title */
|
|
2033
|
+
title: string;
|
|
2034
|
+
/** UTC date when the note was created */
|
|
2035
|
+
dateCreatedUtc: Date;
|
|
2036
|
+
/** UTC date when the note was last modified */
|
|
2037
|
+
dateLastModifiedUtc: Date;
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Standard mapping configuration for StandardNote fields.
|
|
2041
|
+
* Use with TriliumMapper.merge() to create mappings for types extending StandardNote.
|
|
2042
|
+
*
|
|
2043
|
+
* @example
|
|
2044
|
+
* ```ts
|
|
2045
|
+
* interface BlogPost extends StandardNote {
|
|
2046
|
+
* slug: string;
|
|
2047
|
+
* published: boolean;
|
|
2048
|
+
* }
|
|
2049
|
+
*
|
|
2050
|
+
* const blogMapping = TriliumMapper.merge<BlogPost>(
|
|
2051
|
+
* StandardNoteMapping,
|
|
2052
|
+
* {
|
|
2053
|
+
* slug: '#slug',
|
|
2054
|
+
* published: { from: '#published', transform: transforms.boolean, default: false },
|
|
2055
|
+
* }
|
|
2056
|
+
* );
|
|
2057
|
+
* ```
|
|
2058
|
+
*/
|
|
2059
|
+
declare const StandardNoteMapping: MappingConfig<StandardNote>;
|
|
2060
|
+
/**
|
|
2061
|
+
* Helper type for defining custom field mappings.
|
|
2062
|
+
* Use this when defining mappings for types that extend StandardNote.
|
|
2063
|
+
* It automatically excludes StandardNote fields since they're auto-merged.
|
|
2064
|
+
*
|
|
2065
|
+
* @template T - Your custom type that extends StandardNote
|
|
2066
|
+
*
|
|
2067
|
+
* @example
|
|
2068
|
+
* ```ts
|
|
2069
|
+
* interface BlogPost extends StandardNote {
|
|
2070
|
+
* slug: string;
|
|
2071
|
+
* published: boolean;
|
|
2072
|
+
* }
|
|
2073
|
+
*
|
|
2074
|
+
* // Clean type - no need for verbose Omit<>
|
|
2075
|
+
* const blogMapping: CustomMapping<BlogPost> = {
|
|
2076
|
+
* slug: '#slug',
|
|
2077
|
+
* published: { from: '#published', transform: transforms.boolean, default: false },
|
|
2078
|
+
* };
|
|
2079
|
+
*
|
|
2080
|
+
* const { data } = await client.searchAndMap<BlogPost>({
|
|
2081
|
+
* query: '#blog',
|
|
2082
|
+
* mapping: blogMapping,
|
|
2083
|
+
* });
|
|
2084
|
+
* ```
|
|
2085
|
+
*/
|
|
2086
|
+
type CustomMapping<T extends StandardNote> = MappingConfig<Omit<T, keyof StandardNote>>;
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* Trilium API Client using openapi-fetch
|
|
2090
|
+
*
|
|
2091
|
+
* This provides a type-safe client for the Trilium ETAPI.
|
|
2092
|
+
* Types are auto-generated from the OpenAPI specification.
|
|
2093
|
+
*/
|
|
2094
|
+
|
|
2095
|
+
type TriliumNote = components['schemas']['Note'];
|
|
2096
|
+
type TriliumBranch = components['schemas']['Branch'];
|
|
2097
|
+
type TriliumAttribute = components['schemas']['Attribute'];
|
|
2098
|
+
type TriliumAttachment = components['schemas']['Attachment'];
|
|
2099
|
+
type TriliumAppInfo = components['schemas']['AppInfo'];
|
|
2100
|
+
|
|
2101
|
+
interface TriliumClientConfig {
|
|
2102
|
+
baseUrl: string;
|
|
2103
|
+
apiKey: string;
|
|
2104
|
+
}
|
|
2105
|
+
interface SearchAndMapOptions<T extends StandardNote> {
|
|
2106
|
+
/** Search query - either a string or structured search helpers */
|
|
2107
|
+
query: string | TriliumSearchHelpers;
|
|
2108
|
+
/**
|
|
2109
|
+
* Mapping configuration for your custom fields only.
|
|
2110
|
+
* StandardNoteMapping (id, title, dates) is automatically merged.
|
|
2111
|
+
*/
|
|
2112
|
+
mapping: CustomMapping<T>;
|
|
2113
|
+
/** Optional: limit number of results */
|
|
2114
|
+
limit?: number;
|
|
2115
|
+
/** Optional: order by field (e.g., 'dateModified', 'title') */
|
|
2116
|
+
orderBy?: string;
|
|
2117
|
+
/** Optional: order direction */
|
|
2118
|
+
orderDirection?: 'asc' | 'desc';
|
|
2119
|
+
/** Optional: fast search mode (less accurate but faster) */
|
|
2120
|
+
fastSearch?: boolean;
|
|
2121
|
+
}
|
|
2122
|
+
/** Details about a note that failed to map */
|
|
2123
|
+
interface MappingFailure {
|
|
2124
|
+
/** The note ID that failed to map */
|
|
2125
|
+
noteId: string;
|
|
2126
|
+
/** The note title for easier identification */
|
|
2127
|
+
noteTitle: string;
|
|
2128
|
+
/** The error message explaining why mapping failed */
|
|
2129
|
+
reason: string;
|
|
2130
|
+
/** The original note object */
|
|
2131
|
+
note: TriliumNote;
|
|
2132
|
+
}
|
|
2133
|
+
interface SearchAndMapResult<T extends StandardNote> {
|
|
2134
|
+
/** Mapped results as typed objects */
|
|
2135
|
+
data: T[];
|
|
2136
|
+
/** Notes that failed to map (e.g., missing required fields) */
|
|
2137
|
+
failures: MappingFailure[];
|
|
2138
|
+
}
|
|
2139
|
+
/** Extended Trilium client with search and map helper */
|
|
2140
|
+
interface TriliumClient extends Client<paths> {
|
|
2141
|
+
/**
|
|
2142
|
+
* Search notes and automatically map results to typed objects.
|
|
2143
|
+
* Type T must extend StandardNote to ensure consistent base fields.
|
|
2144
|
+
* StandardNoteMapping is automatically included - just define your custom fields!
|
|
2145
|
+
* Throws on API/network errors.
|
|
2146
|
+
*
|
|
2147
|
+
* @see {@link https://triliumnext.github.io/Docs/Wiki/search.html} for Trilium search syntax
|
|
2148
|
+
*
|
|
2149
|
+
* @example
|
|
2150
|
+
* ```ts
|
|
2151
|
+
* interface BlogPost extends StandardNote {
|
|
2152
|
+
* slug: string;
|
|
2153
|
+
* published: boolean;
|
|
2154
|
+
* }
|
|
2155
|
+
*
|
|
2156
|
+
* // Just define your custom fields - StandardNoteMapping is auto-merged!
|
|
2157
|
+
* const { data: posts, failures } = await client.searchAndMap<BlogPost>({
|
|
2158
|
+
* query: { '#blog': true, '#published': true },
|
|
2159
|
+
* mapping: {
|
|
2160
|
+
* slug: '#slug',
|
|
2161
|
+
* published: { from: '#published', transform: transforms.boolean, default: false },
|
|
2162
|
+
* },
|
|
2163
|
+
* limit: 10,
|
|
2164
|
+
* orderBy: 'dateModified',
|
|
2165
|
+
* orderDirection: 'desc',
|
|
2166
|
+
* });
|
|
2167
|
+
*
|
|
2168
|
+
* // Each post has id, title, dateCreatedUtc, dateLastModifiedUtc + your custom fields
|
|
2169
|
+
* posts.forEach(post => {
|
|
2170
|
+
* console.log(`${post.title} (${post.slug}) - ${post.id}`);
|
|
2171
|
+
* });
|
|
2172
|
+
*
|
|
2173
|
+
* if (failures.length > 0) {
|
|
2174
|
+
* console.warn(`${failures.length} notes failed to map`);
|
|
2175
|
+
* }
|
|
2176
|
+
* ```
|
|
2177
|
+
*/
|
|
2178
|
+
searchAndMap<T extends StandardNote>(options: SearchAndMapOptions<T>): Promise<SearchAndMapResult<T>>;
|
|
2179
|
+
}
|
|
2180
|
+
/**
|
|
2181
|
+
* Create a type-safe Trilium API client
|
|
2182
|
+
*
|
|
2183
|
+
* @example
|
|
2184
|
+
* ```ts
|
|
2185
|
+
* const client = createTriliumClient({
|
|
2186
|
+
* baseUrl: 'http://localhost:8080',
|
|
2187
|
+
* apiKey: 'your-etapi-token'
|
|
2188
|
+
* });
|
|
2189
|
+
*
|
|
2190
|
+
* // Get app info
|
|
2191
|
+
* const { data, error } = await client.GET('/app-info');
|
|
2192
|
+
*
|
|
2193
|
+
* // Get a note by ID
|
|
2194
|
+
* const { data: note } = await client.GET('/notes/{noteId}', {
|
|
2195
|
+
* params: { path: { noteId: 'root' } }
|
|
2196
|
+
* });
|
|
2197
|
+
*
|
|
2198
|
+
* // Create a note
|
|
2199
|
+
* const { data: newNote } = await client.POST('/notes', {
|
|
2200
|
+
* body: {
|
|
2201
|
+
* parentNoteId: 'root',
|
|
2202
|
+
* title: 'My Note',
|
|
2203
|
+
* type: 'text',
|
|
2204
|
+
* content: '<p>Hello World</p>'
|
|
2205
|
+
* }
|
|
2206
|
+
* });
|
|
2207
|
+
*
|
|
2208
|
+
* // Search notes
|
|
2209
|
+
* const { data: searchResults } = await client.GET('/notes', {
|
|
2210
|
+
* params: { query: { search: '#blog' } }
|
|
2211
|
+
* });
|
|
2212
|
+
*
|
|
2213
|
+
* // Search and map to typed objects
|
|
2214
|
+
* const { data: posts } = await client.searchAndMap<BlogPost>({
|
|
2215
|
+
* query: { '#blog': true },
|
|
2216
|
+
* mapping: {
|
|
2217
|
+
* title: 'note.title',
|
|
2218
|
+
* slug: '#slug',
|
|
2219
|
+
* },
|
|
2220
|
+
* });
|
|
2221
|
+
* ```
|
|
2222
|
+
*/
|
|
2223
|
+
declare function createTriliumClient(config: TriliumClientConfig): TriliumClient;
|
|
2224
|
+
|
|
2225
|
+
export { type CustomMapping, type MappingConfig, type MappingFailure, type StandardNote, StandardNoteMapping, type TriliumAppInfo, type TriliumAttachment, type TriliumAttribute, type TriliumBranch, type TriliumClientConfig, TriliumMapper, type TriliumNote, type TriliumSearchHelpers, buildSearchQuery, type components, createTriliumClient as createClient, createTriliumClient, type operations, type paths, transforms };
|