@bitefoundry/onenote 0.3.0 → 0.4.1

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/docs/openapi.yaml CHANGED
@@ -1,320 +1,327 @@
1
- openapi: 3.1.0
2
- info:
3
- title: OneNote CLI Local HTTP API (@bitefoundry/onenote)
4
- version: 0.1.0
5
- description: >
6
- Local HTTP JSON API exposed by `onenote serve` (default `127.0.0.1:8793`).
7
- All `/v1/onenote/*` routes are also mirrored under `/onenote/*`.
8
- servers:
9
- - url: http://127.0.0.1:8793
10
- components:
11
- securitySchemes:
12
- bearerAuth:
13
- type: http
14
- scheme: bearer
15
- schemas:
16
- ResourceDownloadResult:
17
- type: object
18
- required: [ok, path, file_name, mime_type, size_bytes, is_image]
19
- properties:
20
- ok: { type: boolean }
21
- path: { type: string }
22
- file_name: { type: string }
23
- mime_type: { type: string }
24
- size_bytes: { type: integer, format: int64 }
25
- is_image: { type: boolean }
26
- paths:
27
- /health:
28
- get:
29
- summary: Health check
30
- responses:
31
- '200':
32
- description: Service status
33
- /v1/whoami:
34
- get:
35
- summary: Return signed-in Microsoft 365 profile
36
- security:
37
- - bearerAuth: []
38
- responses:
39
- '200':
40
- description: User profile
41
- /v1/onenote/notebooks:
42
- get:
43
- summary: List OneNote notebooks
44
- security:
45
- - bearerAuth: []
46
- parameters:
47
- - name: include_teams
48
- in: query
49
- schema: { type: boolean, default: false }
50
- - name: refresh
51
- in: query
52
- schema: { type: boolean, default: false }
53
- - name: offline
54
- in: query
55
- schema: { type: boolean, default: false }
56
- responses:
57
- '200':
58
- description: Notebook list
59
- post:
60
- summary: Create a OneNote notebook
61
- security:
62
- - bearerAuth: []
63
- requestBody:
64
- required: true
65
- content:
66
- application/json:
67
- schema:
68
- type: object
69
- required: [name]
70
- properties:
71
- name: { type: string }
72
- group_id: { type: string }
73
- site_id: { type: string }
74
- responses:
75
- '201':
76
- description: Created notebook
77
- /v1/onenote/sections:
78
- get:
79
- summary: List OneNote sections
80
- security:
81
- - bearerAuth: []
82
- parameters:
83
- - name: notebook
84
- in: query
85
- schema: { type: string }
86
- - name: refresh
87
- in: query
88
- schema: { type: boolean, default: false }
89
- - name: offline
90
- in: query
91
- schema: { type: boolean, default: false }
92
- responses:
93
- '200':
94
- description: Section list
95
- post:
96
- summary: Create a OneNote section
97
- security:
98
- - bearerAuth: []
99
- requestBody:
100
- required: true
101
- content:
102
- application/json:
103
- schema:
104
- type: object
105
- required: [notebook, name]
106
- properties:
107
- notebook: { type: string }
108
- name: { type: string }
109
- responses:
110
- '201':
111
- description: Created section
112
- /v1/onenote/pages:
113
- get:
114
- summary: List OneNote pages in a section
115
- security:
116
- - bearerAuth: []
117
- parameters:
118
- - name: section
119
- in: query
120
- required: true
121
- schema: { type: string }
122
- - name: limit
123
- in: query
124
- schema: { type: integer, default: 50 }
125
- - name: refresh
126
- in: query
127
- schema: { type: boolean, default: false }
128
- - name: offline
129
- in: query
130
- schema: { type: boolean, default: false }
131
- responses:
132
- '200':
133
- description: Page summaries
134
- post:
135
- summary: Create a top-level OneNote page from Markdown
136
- security:
137
- - bearerAuth: []
138
- requestBody:
139
- required: true
140
- content:
141
- application/json:
142
- schema:
143
- type: object
144
- required: [section, title]
145
- properties:
146
- section: { type: string }
147
- title: { type: string }
148
- markdown: { type: string }
149
- level: { type: integer, minimum: 0, maximum: 0, default: 0 }
150
- image_paths:
151
- type: array
152
- items: { type: string }
153
- responses:
154
- '200':
155
- description: Created page summary
156
- '400':
157
- description: Invalid input, including a nonzero page level
158
- /v1/onenote/pages/{page}:
159
- get:
160
- summary: Read a OneNote page detail (blocks, Markdown, resources)
161
- security:
162
- - bearerAuth: []
163
- parameters:
164
- - name: page
165
- in: path
166
- required: true
167
- schema: { type: string }
168
- - name: section
169
- in: query
170
- schema: { type: string }
171
- - name: offline
172
- in: query
173
- schema: { type: boolean, default: false }
174
- responses:
175
- '200':
176
- description: Page detail
177
- patch:
178
- summary: Surgically replace a block or update page title/body
179
- security:
180
- - bearerAuth: []
181
- parameters:
182
- - name: page
183
- in: path
184
- required: true
185
- schema: { type: string }
186
- requestBody:
187
- required: true
188
- content:
189
- application/json:
190
- schema:
191
- type: object
192
- properties:
193
- block_id: { type: string }
194
- title: { type: string }
195
- markdown: { type: string }
196
- section: { type: string }
197
- responses:
198
- '200':
199
- description: Updated page detail
200
- delete:
201
- summary: Delete a OneNote page
202
- security:
203
- - bearerAuth: []
204
- parameters:
205
- - name: page
206
- in: path
207
- required: true
208
- schema: { type: string }
209
- - name: section
210
- in: query
211
- schema: { type: string }
212
- responses:
213
- '200':
214
- description: Deletion result
215
- /v1/onenote/pages/{page}/append:
216
- post:
217
- summary: Append Markdown and optional images to a page
218
- security:
219
- - bearerAuth: []
220
- parameters:
221
- - name: page
222
- in: path
223
- required: true
224
- schema: { type: string }
225
- requestBody:
226
- required: true
227
- content:
228
- application/json:
229
- schema:
230
- type: object
231
- required: [markdown]
232
- properties:
233
- markdown: { type: string }
234
- images:
235
- type: array
236
- items: { type: string }
237
- description: Alias of `image_paths` (do not send both keys in the same request).
238
- image_paths:
239
- type: array
240
- items: { type: string }
241
- section: { type: string }
242
- responses:
243
- '200':
244
- description: Updated page detail
245
- '400':
246
- description: Invalid input, including specifying both `images` and `image_paths`
247
- /v1/onenote/pages/{page}/todo:
248
- post:
249
- summary: Set or toggle a OneNote checkbox on a block (also served at `/pages/{page}/toggle-todo`)
250
- security:
251
- - bearerAuth: []
252
- parameters:
253
- - name: page
254
- in: path
255
- required: true
256
- schema: { type: string }
257
- requestBody:
258
- required: true
259
- content:
260
- application/json:
261
- schema:
262
- type: object
263
- properties:
264
- block_id: { type: string }
265
- index: { type: integer, minimum: 0 }
266
- completed: { type: boolean }
267
- expected_content: { type: string }
268
- force: { type: boolean, default: false }
269
- section: { type: string }
270
- responses:
271
- '200':
272
- description: Updated page detail
273
- /v1/onenote/search:
274
- get:
275
- summary: Full-text search across cached OneNote pages
276
- security:
277
- - bearerAuth: []
278
- parameters:
279
- - name: q
280
- in: query
281
- required: true
282
- schema: { type: string }
283
- - name: section
284
- in: query
285
- schema: { type: string }
286
- - name: limit
287
- in: query
288
- schema: { type: integer, default: 30 }
289
- - name: refresh
290
- in: query
291
- schema: { type: boolean, default: false }
292
- responses:
293
- '200':
294
- description: Search hits
295
- /v1/onenote/resources/download:
296
- post:
297
- summary: Download an embedded OneNote image or file attachment (also served at `/pages/{page}/resources/download`)
298
- security:
299
- - bearerAuth: []
300
- requestBody:
301
- required: true
302
- content:
303
- application/json:
304
- schema:
305
- type: object
306
- required: [page]
307
- properties:
308
- page: { type: string }
309
- index: { type: integer, minimum: 0 }
310
- url: { type: string }
311
- out: { type: string }
312
- out_dir: { type: string }
313
- section: { type: string }
314
- responses:
315
- '200':
316
- description: Downloaded resource metadata
317
- content:
318
- application/json:
319
- schema:
320
- $ref: '#/components/schemas/ResourceDownloadResult'
1
+ openapi: 3.1.0
2
+ info:
3
+ title: OneNote CLI Local HTTP API (@bitefoundry/onenote)
4
+ version: 0.1.0
5
+ description: >
6
+ Local HTTP JSON API exposed by `onenote serve` (default `127.0.0.1:8793`).
7
+ All `/v1/onenote/*` routes are also mirrored under `/onenote/*`.
8
+ Every route except `/health` needs the API key (`Authorization: Bearer` or
9
+ `x-api-key`); a loopback server without `--api-key` / `ONENOTE_API_KEY`
10
+ generates one and prints it on stderr. Requests with a `Host` outside the
11
+ allow-list get 421, and requests with an `Origin` not listed with
12
+ `--cors-origin` get 403.
13
+ servers:
14
+ - url: http://127.0.0.1:8793
15
+ components:
16
+ securitySchemes:
17
+ bearerAuth:
18
+ type: http
19
+ scheme: bearer
20
+ schemas:
21
+ ResourceDownloadResult:
22
+ type: object
23
+ required: [ok, path, file_name, mime_type, size_bytes, is_image]
24
+ properties:
25
+ ok: { type: boolean }
26
+ path: { type: string }
27
+ file_name: { type: string }
28
+ mime_type: { type: string }
29
+ size_bytes: { type: integer, format: int64 }
30
+ is_image: { type: boolean }
31
+ paths:
32
+ /health:
33
+ get:
34
+ summary: Health check
35
+ responses:
36
+ '200':
37
+ description: Service status
38
+ /v1/whoami:
39
+ get:
40
+ summary: Return signed-in Microsoft 365 profile
41
+ security:
42
+ - bearerAuth: []
43
+ responses:
44
+ '200':
45
+ description: User profile
46
+ /v1/onenote/notebooks:
47
+ get:
48
+ summary: List OneNote notebooks
49
+ security:
50
+ - bearerAuth: []
51
+ parameters:
52
+ - name: include_teams
53
+ in: query
54
+ schema: { type: boolean, default: false }
55
+ - name: refresh
56
+ in: query
57
+ schema: { type: boolean, default: false }
58
+ - name: offline
59
+ in: query
60
+ schema: { type: boolean, default: false }
61
+ responses:
62
+ '200':
63
+ description: Notebook list
64
+ post:
65
+ summary: Create a OneNote notebook
66
+ security:
67
+ - bearerAuth: []
68
+ requestBody:
69
+ required: true
70
+ content:
71
+ application/json:
72
+ schema:
73
+ type: object
74
+ required: [name]
75
+ properties:
76
+ name: { type: string }
77
+ group_id: { type: string }
78
+ site_id: { type: string }
79
+ responses:
80
+ '201':
81
+ description: Created notebook
82
+ /v1/onenote/sections:
83
+ get:
84
+ summary: List OneNote sections
85
+ security:
86
+ - bearerAuth: []
87
+ parameters:
88
+ - name: notebook
89
+ in: query
90
+ schema: { type: string }
91
+ - name: refresh
92
+ in: query
93
+ schema: { type: boolean, default: false }
94
+ - name: offline
95
+ in: query
96
+ schema: { type: boolean, default: false }
97
+ responses:
98
+ '200':
99
+ description: Section list
100
+ post:
101
+ summary: Create a OneNote section
102
+ security:
103
+ - bearerAuth: []
104
+ requestBody:
105
+ required: true
106
+ content:
107
+ application/json:
108
+ schema:
109
+ type: object
110
+ required: [notebook, name]
111
+ properties:
112
+ notebook: { type: string }
113
+ name: { type: string }
114
+ responses:
115
+ '201':
116
+ description: Created section
117
+ /v1/onenote/pages:
118
+ get:
119
+ summary: List OneNote pages in a section
120
+ security:
121
+ - bearerAuth: []
122
+ parameters:
123
+ - name: section
124
+ in: query
125
+ required: true
126
+ schema: { type: string }
127
+ - name: limit
128
+ in: query
129
+ schema: { type: integer, default: 50 }
130
+ - name: refresh
131
+ in: query
132
+ schema: { type: boolean, default: false }
133
+ - name: offline
134
+ in: query
135
+ schema: { type: boolean, default: false }
136
+ responses:
137
+ '200':
138
+ description: Page summaries
139
+ post:
140
+ summary: Create a top-level OneNote page from Markdown
141
+ security:
142
+ - bearerAuth: []
143
+ requestBody:
144
+ required: true
145
+ content:
146
+ application/json:
147
+ schema:
148
+ type: object
149
+ required: [section, title]
150
+ properties:
151
+ section: { type: string }
152
+ title: { type: string }
153
+ markdown: { type: string }
154
+ level: { type: integer, minimum: 0, maximum: 0, default: 0 }
155
+ image_paths:
156
+ type: array
157
+ items: { type: string }
158
+ responses:
159
+ '200':
160
+ description: Created page summary
161
+ '400':
162
+ description: Invalid input, including a nonzero page level
163
+ /v1/onenote/pages/{page}:
164
+ get:
165
+ summary: Read a OneNote page detail (blocks, Markdown, resources)
166
+ security:
167
+ - bearerAuth: []
168
+ parameters:
169
+ - name: page
170
+ in: path
171
+ required: true
172
+ schema: { type: string }
173
+ - name: section
174
+ in: query
175
+ schema: { type: string }
176
+ - name: offline
177
+ in: query
178
+ schema: { type: boolean, default: false }
179
+ responses:
180
+ '200':
181
+ description: Page detail
182
+ patch:
183
+ summary: Surgically replace a block or update page title/body
184
+ security:
185
+ - bearerAuth: []
186
+ parameters:
187
+ - name: page
188
+ in: path
189
+ required: true
190
+ schema: { type: string }
191
+ requestBody:
192
+ required: true
193
+ content:
194
+ application/json:
195
+ schema:
196
+ type: object
197
+ properties:
198
+ block_id: { type: string }
199
+ title: { type: string }
200
+ markdown: { type: string }
201
+ expected_content: { type: string }
202
+ force: { type: boolean, default: false }
203
+ section: { type: string }
204
+ responses:
205
+ '200':
206
+ description: Updated page detail
207
+ delete:
208
+ summary: Delete a OneNote page
209
+ security:
210
+ - bearerAuth: []
211
+ parameters:
212
+ - name: page
213
+ in: path
214
+ required: true
215
+ schema: { type: string }
216
+ - name: section
217
+ in: query
218
+ schema: { type: string }
219
+ responses:
220
+ '200':
221
+ description: Deletion result
222
+ /v1/onenote/pages/{page}/append:
223
+ post:
224
+ summary: Append Markdown and optional images to a page
225
+ security:
226
+ - bearerAuth: []
227
+ parameters:
228
+ - name: page
229
+ in: path
230
+ required: true
231
+ schema: { type: string }
232
+ requestBody:
233
+ required: true
234
+ content:
235
+ application/json:
236
+ schema:
237
+ type: object
238
+ required: [markdown]
239
+ properties:
240
+ markdown: { type: string }
241
+ images:
242
+ type: array
243
+ items: { type: string }
244
+ description: Alias of `image_paths` (do not send both keys in the same request).
245
+ image_paths:
246
+ type: array
247
+ items: { type: string }
248
+ section: { type: string }
249
+ responses:
250
+ '200':
251
+ description: Updated page detail
252
+ '400':
253
+ description: Invalid input, including specifying both `images` and `image_paths`
254
+ /v1/onenote/pages/{page}/todo:
255
+ post:
256
+ summary: Set or toggle a OneNote checkbox on a block (also served at `/pages/{page}/toggle-todo`)
257
+ security:
258
+ - bearerAuth: []
259
+ parameters:
260
+ - name: page
261
+ in: path
262
+ required: true
263
+ schema: { type: string }
264
+ requestBody:
265
+ required: true
266
+ content:
267
+ application/json:
268
+ schema:
269
+ type: object
270
+ properties:
271
+ block_id: { type: string }
272
+ index: { type: integer, minimum: 0 }
273
+ completed: { type: boolean }
274
+ expected_content: { type: string }
275
+ force: { type: boolean, default: false }
276
+ section: { type: string }
277
+ responses:
278
+ '200':
279
+ description: Updated page detail
280
+ /v1/onenote/search:
281
+ get:
282
+ summary: Full-text search across cached OneNote pages
283
+ security:
284
+ - bearerAuth: []
285
+ parameters:
286
+ - name: q
287
+ in: query
288
+ required: true
289
+ schema: { type: string }
290
+ - name: section
291
+ in: query
292
+ schema: { type: string }
293
+ - name: limit
294
+ in: query
295
+ schema: { type: integer, default: 30 }
296
+ - name: refresh
297
+ in: query
298
+ schema: { type: boolean, default: false }
299
+ responses:
300
+ '200':
301
+ description: Search hits
302
+ /v1/onenote/resources/download:
303
+ post:
304
+ summary: Download an embedded OneNote image or file attachment (also served at `/pages/{page}/resources/download`)
305
+ security:
306
+ - bearerAuth: []
307
+ requestBody:
308
+ required: true
309
+ content:
310
+ application/json:
311
+ schema:
312
+ type: object
313
+ required: [page]
314
+ properties:
315
+ page: { type: string }
316
+ index: { type: integer, minimum: 0 }
317
+ url: { type: string }
318
+ out: { type: string }
319
+ out_dir: { type: string }
320
+ section: { type: string }
321
+ responses:
322
+ '200':
323
+ description: Downloaded resource metadata
324
+ content:
325
+ application/json:
326
+ schema:
327
+ $ref: '#/components/schemas/ResourceDownloadResult'