benjivers/notes Public Public: anyone can read this; nobody can change it.

Files 2b2f00dc243e6583e6d8719a8b99fe2335f1e03a
578 lines · 14.0 KB · ~4.8k tok Raw History
1
{
2
  "openapi": "3.1.0",
3
  "info": {
4
    "title": "notes",
5
    "version": "0.1.0",
6
    "description": "A personal linked-notes vault — markdown, [[wikilinks]], backlinks, tags, graph."
7
  },
8
  "paths": {
9
    "/api/notes": {
10
      "get": {
11
        "summary": "The notes, newest first.",
12
        "operationId": "getApiNotes",
13
        "parameters": [
14
          {
15
            "name": "limit",
16
            "in": "query",
17
            "schema": {
18
              "type": "integer",
19
              "minimum": 1,
20
              "maximum": 500,
21
              "default": 100
22
            }
23
          }
24
        ],
25
        "responses": {
26
          "200": {
27
            "description": "The notes, newest first.",
28
            "content": {
29
              "application/json": {
30
                "schema": {
31
                  "type": "array",
32
                  "items": {
33
                    "$ref": "#/components/schemas/Note"
34
                  }
35
                }
36
              }
37
            }
38
          },
39
          "default": {
40
            "description": "{ error, message }: why not",
41
            "content": {
42
              "application/json": {
43
                "schema": {
44
                  "$ref": "#/components/schemas/Error"
45
                }
46
              }
47
            }
48
          }
49
        },
50
        "x-contract": {
51
          "resource": "note",
52
          "verb": "list",
53
          "least": "anon"
54
        }
55
      },
56
      "post": {
57
        "summary": "Add a note as the person asking.",
58
        "operationId": "postApiNotes",
59
        "requestBody": {
60
          "required": true,
61
          "content": {
62
            "application/json": {
63
              "schema": {
64
                "type": "object",
65
                "properties": {
66
                  "body": {
67
                    "type": "string",
68
                    "minLength": 1,
69
                    "maxLength": 500
70
                  }
71
                },
72
                "required": [
73
                  "body"
74
                ]
75
              }
76
            }
77
          }
78
        },
79
        "responses": {
80
          "201": {
81
            "description": "Add a note as the person asking.",
82
            "content": {
83
              "application/json": {
84
                "schema": {
85
                  "$ref": "#/components/schemas/Note"
86
                }
87
              }
88
            }
89
          },
90
          "default": {
91
            "description": "{ error, message }: why not",
92
            "content": {
93
              "application/json": {
94
                "schema": {
95
                  "$ref": "#/components/schemas/Error"
96
                }
97
              }
98
            }
99
          }
100
        },
101
        "x-contract": {
102
          "resource": "note",
103
          "verb": "create",
104
          "least": "user"
105
        }
106
      }
107
    },
108
    "/api/notes/{id}": {
109
      "get": {
110
        "summary": "One note.",
111
        "operationId": "getApiNotesId",
112
        "parameters": [
113
          {
114
            "name": "id",
115
            "in": "path",
116
            "required": true,
117
            "schema": {
118
              "type": "integer"
119
            }
120
          }
121
        ],
122
        "responses": {
123
          "200": {
124
            "description": "One note.",
125
            "content": {
126
              "application/json": {
127
                "schema": {
128
                  "$ref": "#/components/schemas/Note"
129
                }
130
              }
131
            }
132
          },
133
          "default": {
134
            "description": "{ error, message }: why not",
135
            "content": {
136
              "application/json": {
137
                "schema": {
138
                  "$ref": "#/components/schemas/Error"
139
                }
140
              }
141
            }
142
          }
143
        },
144
        "x-contract": {
145
          "resource": "note",
146
          "verb": "read",
147
          "least": "anon"
148
        }
149
      },
150
      "patch": {
151
        "summary": "Change a note's words.",
152
        "operationId": "patchApiNotesId",
153
        "parameters": [
154
          {
155
            "name": "id",
156
            "in": "path",
157
            "required": true,
158
            "schema": {
159
              "type": "integer"
160
            }
161
          }
162
        ],
163
        "requestBody": {
164
          "required": true,
165
          "content": {
166
            "application/json": {
167
              "schema": {
168
                "type": "object",
169
                "properties": {
170
                  "body": {
171
                    "type": "string",
172
                    "minLength": 1,
173
                    "maxLength": 500
174
                  }
175
                },
176
                "required": [
177
                  "body"
178
                ]
179
              }
180
            }
181
          }
182
        },
183
        "responses": {
184
          "200": {
185
            "description": "Change a note's words.",
186
            "content": {
187
              "application/json": {
188
                "schema": {
189
                  "$ref": "#/components/schemas/Note"
190
                }
191
              }
192
            }
193
          },
194
          "default": {
195
            "description": "{ error, message }: why not",
196
            "content": {
197
              "application/json": {
198
                "schema": {
199
                  "$ref": "#/components/schemas/Error"
200
                }
201
              }
202
            }
203
          }
204
        },
205
        "x-contract": {
206
          "resource": "note",
207
          "verb": "update",
208
          "least": "author"
209
        }
210
      },
211
      "delete": {
212
        "summary": "Remove a note.",
213
        "operationId": "deleteApiNotesId",
214
        "parameters": [
215
          {
216
            "name": "id",
217
            "in": "path",
218
            "required": true,
219
            "schema": {
220
              "type": "integer"
221
            }
222
          }
223
        ],
224
        "responses": {
225
          "200": {
226
            "description": "Remove a note.",
227
            "content": {
228
              "application/json": {
229
                "schema": {
230
                  "type": "object",
231
                  "properties": {
232
                    "id": {
233
                      "type": "integer"
234
                    }
235
                  },
236
                  "required": [
237
                    "id"
238
                  ]
239
                }
240
              }
241
            }
242
          },
243
          "default": {
244
            "description": "{ error, message }: why not",
245
            "content": {
246
              "application/json": {
247
                "schema": {
248
                  "$ref": "#/components/schemas/Error"
249
                }
250
              }
251
            }
252
          }
253
        },
254
        "x-contract": {
255
          "resource": "note",
256
          "verb": "delete",
257
          "least": "author"
258
        }
259
      }
260
    },
261
    "/api/audit": {
262
      "get": {
263
        "summary": "The audit trail, newest first; `before` pages back by id.",
264
        "operationId": "getApiAudit",
265
        "parameters": [
266
          {
267
            "name": "limit",
268
            "in": "query",
269
            "schema": {
270
              "type": "integer",
271
              "minimum": 1,
272
              "maximum": 500,
273
              "default": 100
274
            }
275
          },
276
          {
277
            "name": "before",
278
            "in": "query",
279
            "schema": {
280
              "type": "integer"
281
            }
282
          }
283
        ],
284
        "responses": {
285
          "200": {
286
            "description": "The audit trail, newest first; `before` pages back by id.",
287
            "content": {
288
              "application/json": {
289
                "schema": {
290
                  "type": "array",
291
                  "items": {
292
                    "$ref": "#/components/schemas/AuditRow"
293
                  }
294
                }
295
              }
296
            }
297
          },
298
          "default": {
299
            "description": "{ error, message }: why not",
300
            "content": {
301
              "application/json": {
302
                "schema": {
303
                  "$ref": "#/components/schemas/Error"
304
                }
305
              }
306
            }
307
          }
308
        },
309
        "x-contract": {
310
          "resource": "audit",
311
          "verb": "list",
312
          "least": "admin"
313
        }
314
      }
315
    },
316
    "/api/audit/{id}": {
317
      "get": {
318
        "summary": "One row of the audit trail.",
319
        "operationId": "getApiAuditId",
320
        "parameters": [
321
          {
322
            "name": "id",
323
            "in": "path",
324
            "required": true,
325
            "schema": {
326
              "type": "integer"
327
            }
328
          }
329
        ],
330
        "responses": {
331
          "200": {
332
            "description": "One row of the audit trail.",
333
            "content": {
334
              "application/json": {
335
                "schema": {
336
                  "$ref": "#/components/schemas/AuditRow"
337
                }
338
              }
339
            }
340
          },
341
          "default": {
342
            "description": "{ error, message }: why not",
343
            "content": {
344
              "application/json": {
345
                "schema": {
346
                  "$ref": "#/components/schemas/Error"
347
                }
348
              }
349
            }
350
          }
351
        },
352
        "x-contract": {
353
          "resource": "audit",
354
          "verb": "read",
355
          "least": "admin"
356
        }
357
      }
358
    },
359
    "/mcp": {
360
      "post": {
361
        "summary": "One JSON-RPC 2.0 message to the MCP server; its tools are the actions.",
362
        "operationId": "postMcp",
363
        "requestBody": {
364
          "required": true,
365
          "content": {
366
            "application/json": {
367
              "schema": {
368
                "type": "object",
369
                "properties": {
370
                  "jsonrpc": {
371
                    "const": "2.0"
372
                  },
373
                  "id": {},
374
                  "method": {
375
                    "type": "string"
376
                  },
377
                  "params": {
378
                    "type": "object"
379
                  }
380
                },
381
                "required": [
382
                  "jsonrpc",
383
                  "method"
384
                ]
385
              }
386
            }
387
          }
388
        },
389
        "responses": {
390
          "200": {
391
            "description": "One JSON-RPC 2.0 message to the MCP server; its tools are the actions.",
392
            "content": {
393
              "application/json": {
394
                "schema": {
395
                  "type": "object"
396
                }
397
              }
398
            }
399
          },
400
          "default": {
401
            "description": "{ error, message }: why not",
402
            "content": {
403
              "application/json": {
404
                "schema": {
405
                  "$ref": "#/components/schemas/Error"
406
                }
407
              }
408
            }
409
          }
410
        }
411
      }
412
    },
413
    "/healthz": {
414
      "get": {
415
        "summary": "Whether the app is up: its version, commit, environment and seconds since it started.",
416
        "operationId": "getHealthz",
417
        "responses": {
418
          "200": {
419
            "description": "Whether the app is up: its version, commit, environment and seconds since it started.",
420
            "content": {
421
              "application/json": {
422
                "schema": {
423
                  "type": "object",
424
                  "properties": {
425
                    "ok": {
426
                      "type": "boolean"
427
                    },
428
                    "version": {
429
                      "type": "string"
430
                    },
431
                    "commit": {
432
                      "type": "string"
433
                    },
434
                    "env": {
435
                      "type": "string"
436
                    },
437
                    "uptime": {
438
                      "type": "integer"
439
                    }
440
                  },
441
                  "required": [
442
                    "ok",
443
                    "version",
444
                    "uptime"
445
                  ]
446
                }
447
              }
448
            }
449
          },
450
          "default": {
451
            "description": "{ error, message }: why not",
452
            "content": {
453
              "application/json": {
454
                "schema": {
455
                  "$ref": "#/components/schemas/Error"
456
                }
457
              }
458
            }
459
          }
460
        }
461
      }
462
    }
463
  },
464
  "components": {
465
    "schemas": {
466
      "Note": {
467
        "type": "object",
468
        "properties": {
469
          "id": {
470
            "type": "integer"
471
          },
472
          "body": {
473
            "type": "string",
474
            "minLength": 1,
475
            "maxLength": 500
476
          },
477
          "author_id": {
478
            "type": "string"
479
          },
480
          "author_name": {
481
            "type": "string"
482
          },
483
          "created_at": {
484
            "type": "string",
485
            "format": "date-time"
486
          },
487
          "updated_at": {
488
            "type": "string",
489
            "format": "date-time"
490
          }
491
        },
492
        "required": [
493
          "id",
494
          "body",
495
          "author_id",
496
          "author_name",
497
          "created_at",
498
          "updated_at"
499
        ]
500
      },
501
      "AuditRow": {
502
        "type": "object",
503
        "properties": {
504
          "id": {
505
            "type": "integer"
506
          },
507
          "at": {
508
            "type": "string",
509
            "format": "date-time"
510
          },
511
          "who_id": {
512
            "type": [
513
              "string",
514
              "null"
515
            ]
516
          },
517
          "who_name": {
518
            "type": [
519
              "string",
520
              "null"
521
            ]
522
          },
523
          "role": {
524
            "enum": [
525
              "anon",
526
              "user",
527
              "admin"
528
            ]
529
          },
530
          "resource": {
531
            "type": "string"
532
          },
533
          "verb": {
534
            "type": "string"
535
          },
536
          "target": {
537
            "type": [
538
              "string",
539
              "null"
540
            ]
541
          },
542
          "allowed": {
543
            "enum": [
544
              0,
545
              1
546
            ]
547
          },
548
          "outcome": {
549
            "type": "string"
550
          }
551
        },
552
        "required": [
553
          "id",
554
          "at",
555
          "role",
556
          "resource",
557
          "verb",
558
          "allowed",
559
          "outcome"
560
        ]
561
      },
562
      "Error": {
563
        "type": "object",
564
        "properties": {
565
          "error": {
566
            "type": "string"
567
          },
568
          "message": {
569
            "type": "string"
570
          }
571
        },
572
        "required": [
573
          "error"
574
        ]
575
      }
576
    }
577
  }
578
}
↑↓ navigate ↵ open esc close
↑↓ navigate ↵ open esc close

Keyboard shortcuts