@hackmd/api 2.7.0 → 2.8.0

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/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var axios = require('axios');
6
+ var sdk_gen = require('./sdk.gen-COYJyg7W.cjs');
6
7
 
7
8
  class HackMDError extends Error {
8
9
  constructor(message) {
@@ -39,41 +40,42 @@ class TooManyRequestsError extends HttpResponseError {
39
40
  }
40
41
  }
41
42
 
42
- exports.TeamVisibilityType = void 0;
43
- (function (TeamVisibilityType) {
44
- TeamVisibilityType["PUBLIC"] = "public";
45
- TeamVisibilityType["PRIVATE"] = "private";
46
- })(exports.TeamVisibilityType || (exports.TeamVisibilityType = {}));
47
- exports.NotePublishType = void 0;
48
- (function (NotePublishType) {
49
- NotePublishType["EDIT"] = "edit";
50
- NotePublishType["VIEW"] = "view";
51
- NotePublishType["SLIDE"] = "slide";
52
- NotePublishType["BOOK"] = "book";
53
- })(exports.NotePublishType || (exports.NotePublishType = {}));
54
- exports.CommentPermissionType = void 0;
55
- (function (CommentPermissionType) {
56
- CommentPermissionType["DISABLED"] = "disabled";
57
- CommentPermissionType["FORBIDDEN"] = "forbidden";
58
- CommentPermissionType["OWNERS"] = "owners";
59
- CommentPermissionType["SIGNED_IN_USERS"] = "signed_in_users";
60
- CommentPermissionType["EVERYONE"] = "everyone";
61
- })(exports.CommentPermissionType || (exports.CommentPermissionType = {}));
62
- exports.NotePermissionRole = void 0;
63
- (function (NotePermissionRole) {
64
- NotePermissionRole["OWNER"] = "owner";
65
- NotePermissionRole["SIGNED_IN"] = "signed_in";
66
- NotePermissionRole["GUEST"] = "guest";
67
- })(exports.NotePermissionRole || (exports.NotePermissionRole = {}));
43
+ /** Preserve the runtime enum-like values while deriving their types from OpenAPI. */
44
+ const TeamVisibilityType = {
45
+ PUBLIC: 'public',
46
+ PRIVATE: 'private',
47
+ };
48
+ const NotePublishType = {
49
+ EDIT: 'edit',
50
+ VIEW: 'view',
51
+ SLIDE: 'slide',
52
+ BOOK: 'book',
53
+ };
54
+ const CommentPermissionType = {
55
+ DISABLED: 'disabled',
56
+ FORBIDDEN: 'forbidden',
57
+ OWNERS: 'owners',
58
+ SIGNED_IN_USERS: 'signed_in_users',
59
+ EVERYONE: 'everyone',
60
+ };
61
+ const NotePermissionRole = {
62
+ OWNER: 'owner',
63
+ SIGNED_IN: 'signed_in',
64
+ GUEST: 'guest',
65
+ };
68
66
 
67
+ /** @module @hackmd/api */
69
68
  const defaultOption = {
70
69
  unwrapData: true,
71
70
  };
71
+ // Restore operations cannot safely replay after the server has changed trash state.
72
+ const noRetry = { __hackmdSkipRetry: true };
72
73
  class API {
73
74
  accessToken;
74
75
  hackmdAPIEndpointURL;
75
76
  options;
76
77
  axios;
78
+ generatedClient;
77
79
  constructor(accessToken, hackmdAPIEndpointURL = "https://api.hackmd.io/v1", options = {
78
80
  wrapResponseErrors: true,
79
81
  timeout: 30000,
@@ -92,6 +94,10 @@ class API {
92
94
  baseURL: hackmdAPIEndpointURL,
93
95
  timeout: options.timeout
94
96
  });
97
+ this.generatedClient = sdk_gen.createClient({
98
+ axios: this.axios,
99
+ baseURL: hackmdAPIEndpointURL.replace(/\/+$/, ''),
100
+ });
95
101
  this.axios.interceptors.request.use((config) => {
96
102
  config.headers.set('Authorization', `Bearer ${accessToken}`);
97
103
  return config;
@@ -139,117 +145,464 @@ class API {
139
145
  error.response.status === 429);
140
146
  }
141
147
  createRetryInterceptor(axiosInstance, maxRetries, baseDelay) {
142
- let retryCount = 0;
143
148
  axiosInstance.interceptors.response.use(response => response, async (error) => {
144
- if (retryCount < maxRetries && this.isRetryableError(error)) {
149
+ const config = error.config;
150
+ const retryCount = config?.__hackmdRetryCount ?? 0;
151
+ if (config && !config.__hackmdSkipRetry && retryCount < maxRetries && this.isRetryableError(error)) {
145
152
  const remainingCredits = parseInt(error.response?.headers['x-ratelimit-userremaining'], 10);
146
153
  if (isNaN(remainingCredits) || remainingCredits > 0) {
147
- retryCount++;
148
- const delay = this.exponentialBackoff(retryCount, baseDelay);
149
- console.warn(`Retrying request... attempt #${retryCount} after delay of ${delay}ms`);
154
+ config.__hackmdRetryCount = retryCount + 1;
155
+ const delay = this.exponentialBackoff(config.__hackmdRetryCount, baseDelay);
156
+ console.warn(`Retrying request... attempt #${config.__hackmdRetryCount} after delay of ${delay}ms`);
150
157
  await new Promise(resolve => setTimeout(resolve, delay));
151
- return axiosInstance(error.config);
158
+ return axiosInstance(config);
152
159
  }
153
160
  }
154
- retryCount = 0; // Reset retry count after a successful request or when not retrying
155
161
  return Promise.reject(error);
156
162
  });
157
163
  }
158
164
  async getMe(options = defaultOption) {
159
- return this.unwrapData(this.axios.get("me"), options.unwrapData);
165
+ return this.unwrapData(sdk_gen.getMe({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
160
166
  }
161
167
  async getHistory(options = defaultOption) {
162
- return this.unwrapData(this.axios.get("history"), options.unwrapData);
168
+ return this.unwrapData(sdk_gen.getHistory({
169
+ client: this.generatedClient,
170
+ query: options.limit === undefined ? undefined : { limit: options.limit },
171
+ throwOnError: true,
172
+ }), options.unwrapData);
173
+ }
174
+ async listNotes(options = defaultOption) {
175
+ return this.unwrapData(sdk_gen.listNotes({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
163
176
  }
164
- async getNoteList(options = defaultOption) {
165
- return this.unwrapData(this.axios.get("notes"), options.unwrapData);
177
+ /** Alias of listNotes; kept for backward compatibility. */
178
+ getNoteList(options = defaultOption) {
179
+ return this.listNotes(options);
166
180
  }
167
181
  async getNote(noteId, options = defaultOption) {
168
- // Prepare request config with etag if provided in options
169
- const config = options.etag ? {
170
- headers: { 'If-None-Match': options.etag },
171
- // Consider 304 responses as successful
172
- validateStatus: (status) => (status >= 200 && status < 300) || status === 304
173
- } : undefined;
174
- const request = this.axios.get(`notes/${noteId}`, config);
182
+ const request = sdk_gen.getNote({
183
+ client: this.generatedClient,
184
+ path: { noteId },
185
+ headers: options.etag ? { 'If-None-Match': options.etag } : undefined,
186
+ validateStatus: (status) => (status >= 200 && status < 300) || Boolean(options.etag && status === 304),
187
+ throwOnError: true,
188
+ });
175
189
  return this.unwrapData(request, options.unwrapData, true);
176
190
  }
177
191
  async createNote(payload, options = defaultOption) {
178
- return this.unwrapData(this.axios.post("notes", payload), options.unwrapData, true);
192
+ return this.unwrapData(sdk_gen.createNote({ client: this.generatedClient, body: payload, throwOnError: true }), options.unwrapData, true);
179
193
  }
180
194
  async updateNoteContent(noteId, content, options = defaultOption) {
181
- return this.unwrapData(this.axios.patch(`notes/${noteId}`, { content }), options.unwrapData, true);
195
+ return this.unwrapData(sdk_gen.updateNote({
196
+ client: this.generatedClient,
197
+ path: { noteId },
198
+ body: { content },
199
+ throwOnError: true,
200
+ }), options.unwrapData, true);
182
201
  }
183
202
  async updateNote(noteId, payload, options = defaultOption) {
184
- return this.unwrapData(this.axios.patch(`notes/${noteId}`, payload), options.unwrapData, true);
203
+ return this.unwrapData(sdk_gen.updateNote({
204
+ client: this.generatedClient,
205
+ path: { noteId },
206
+ body: payload,
207
+ throwOnError: true,
208
+ }), options.unwrapData, true);
185
209
  }
186
210
  async deleteNote(noteId, options = defaultOption) {
187
- return this.unwrapData(this.axios.delete(`notes/${noteId}`), options.unwrapData);
211
+ return this.unwrapData(sdk_gen.deleteNote({
212
+ client: this.generatedClient,
213
+ path: { noteId },
214
+ throwOnError: true,
215
+ }), options.unwrapData);
188
216
  }
189
217
  async uploadNoteImage(noteId, image, options = defaultOption) {
190
218
  const formData = new FormData();
191
219
  formData.append('image', image, options.filename ?? undefined);
192
- return this.unwrapData(this.axios.post(`notes/${noteId}/images`, formData), options.unwrapData);
220
+ return this.unwrapData(sdk_gen.uploadNoteImage({
221
+ client: this.generatedClient,
222
+ path: { noteId },
223
+ body: { image },
224
+ bodySerializer: () => formData,
225
+ throwOnError: true,
226
+ }), options.unwrapData);
227
+ }
228
+ async listTeams(options = defaultOption) {
229
+ return this.unwrapData(sdk_gen.listTeams({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
230
+ }
231
+ /** Alias of listTeams; kept for backward compatibility. */
232
+ getTeams(options = defaultOption) {
233
+ return this.listTeams(options);
234
+ }
235
+ async getTeamNote(teamPath, noteId, options = defaultOption) {
236
+ const request = sdk_gen.getTeamNote({
237
+ client: this.generatedClient,
238
+ path: { teampath: teamPath, noteId },
239
+ headers: options.etag ? { 'If-None-Match': options.etag } : undefined,
240
+ validateStatus: (status) => (status >= 200 && status < 300) || Boolean(options.etag && status === 304),
241
+ throwOnError: true,
242
+ });
243
+ return this.unwrapData(request, options.unwrapData, true);
193
244
  }
194
- async getTeams(options = defaultOption) {
195
- return this.unwrapData(this.axios.get("teams"), options.unwrapData);
245
+ async listTeamNotes(teamPath, options = defaultOption) {
246
+ return this.unwrapData(sdk_gen.listTeamNotes({
247
+ client: this.generatedClient,
248
+ path: { teampath: teamPath },
249
+ throwOnError: true,
250
+ }), options.unwrapData);
196
251
  }
197
- async getTeamNotes(teamPath, options = defaultOption) {
198
- return this.unwrapData(this.axios.get(`teams/${teamPath}/notes`), options.unwrapData);
252
+ /** Alias of listTeamNotes; kept for backward compatibility. */
253
+ getTeamNotes(teamPath, options = defaultOption) {
254
+ return this.listTeamNotes(teamPath, options);
199
255
  }
256
+ /** Returns status/etag metadata like createNote; status 207 means the note was created but folder placement failed. */
200
257
  async createTeamNote(teamPath, payload, options = defaultOption) {
201
- return this.unwrapData(this.axios.post(`teams/${teamPath}/notes`, payload), options.unwrapData);
258
+ return this.unwrapData(sdk_gen.createTeamNote({
259
+ client: this.generatedClient,
260
+ path: { teampath: teamPath },
261
+ body: payload,
262
+ throwOnError: true,
263
+ }), options.unwrapData, true);
202
264
  }
203
265
  async updateTeamNoteContent(teamPath, noteId, content) {
204
- return this.axios.patch(`teams/${teamPath}/notes/${noteId}`, { content });
266
+ return sdk_gen.updateTeamNote({
267
+ client: this.generatedClient,
268
+ path: { teampath: teamPath, noteId },
269
+ body: { content },
270
+ throwOnError: true,
271
+ });
205
272
  }
206
273
  async updateTeamNote(teamPath, noteId, options) {
207
- return this.axios.patch(`teams/${teamPath}/notes/${noteId}`, options);
274
+ return sdk_gen.updateTeamNote({
275
+ client: this.generatedClient,
276
+ path: { teampath: teamPath, noteId },
277
+ body: options,
278
+ throwOnError: true,
279
+ });
208
280
  }
209
281
  async deleteTeamNote(teamPath, noteId) {
210
- return this.axios.delete(`teams/${teamPath}/notes/${noteId}`);
282
+ return sdk_gen.deleteTeamNote({
283
+ client: this.generatedClient,
284
+ path: { teampath: teamPath, noteId },
285
+ throwOnError: true,
286
+ });
287
+ }
288
+ async listFolders(options = defaultOption) {
289
+ return this.unwrapData(sdk_gen.listFolders({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
211
290
  }
212
- async getFolderList(options = defaultOption) {
213
- return this.unwrapData(this.axios.get('folders'), options.unwrapData);
291
+ /** Alias of listFolders; kept for backward compatibility. */
292
+ getFolderList(options = defaultOption) {
293
+ return this.listFolders(options);
214
294
  }
215
295
  async createFolder(payload, options = defaultOption) {
216
- return this.unwrapData(this.axios.post('folders', payload), options.unwrapData);
296
+ return this.unwrapData(sdk_gen.createFolder({ client: this.generatedClient, body: payload, throwOnError: true }), options.unwrapData);
217
297
  }
218
298
  async getFolder(folderId, options = defaultOption) {
219
- return this.unwrapData(this.axios.get(`folders/${folderId}`), options.unwrapData);
299
+ return this.unwrapData(sdk_gen.getFolder({
300
+ client: this.generatedClient,
301
+ path: { folderId },
302
+ throwOnError: true,
303
+ }), options.unwrapData);
220
304
  }
221
305
  async updateFolder(folderId, payload, options = defaultOption) {
222
- return this.unwrapData(this.axios.patch(`folders/${folderId}`, payload), options.unwrapData);
306
+ return this.unwrapData(sdk_gen.updateFolder({
307
+ client: this.generatedClient,
308
+ path: { folderId },
309
+ body: payload,
310
+ throwOnError: true,
311
+ }), options.unwrapData);
223
312
  }
224
313
  async deleteFolder(folderId, options = defaultOption) {
225
- return this.unwrapData(this.axios.delete(`folders/${folderId}`), options.unwrapData);
314
+ return this.unwrapData(sdk_gen.deleteFolder({
315
+ client: this.generatedClient,
316
+ path: { folderId },
317
+ throwOnError: true,
318
+ }), options.unwrapData);
226
319
  }
227
320
  async getFolderOrder(options = defaultOption) {
228
- return this.unwrapData(this.axios.get('folders/folder-order'), options.unwrapData);
321
+ return this.unwrapData(sdk_gen.getFolderOrder({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
229
322
  }
230
323
  async updateFolderOrder(payload, options = defaultOption) {
231
- return this.unwrapData(this.axios.put('folders/folder-order', payload), options.unwrapData);
324
+ return this.unwrapData(sdk_gen.updateFolderOrder({ client: this.generatedClient, body: payload, throwOnError: true }), options.unwrapData);
325
+ }
326
+ async listTeamFolders(teamPath, options = defaultOption) {
327
+ return this.unwrapData(sdk_gen.listTeamFolders({
328
+ client: this.generatedClient,
329
+ path: { teampath: teamPath },
330
+ throwOnError: true,
331
+ }), options.unwrapData);
232
332
  }
233
- async getTeamFolderList(teamPath, options = defaultOption) {
234
- return this.unwrapData(this.axios.get(`teams/${teamPath}/folders`), options.unwrapData);
333
+ /** Alias of listTeamFolders; kept for backward compatibility. */
334
+ getTeamFolderList(teamPath, options = defaultOption) {
335
+ return this.listTeamFolders(teamPath, options);
235
336
  }
236
337
  async createTeamFolder(teamPath, payload, options = defaultOption) {
237
- return this.unwrapData(this.axios.post(`teams/${teamPath}/folders`, payload), options.unwrapData);
338
+ return this.unwrapData(sdk_gen.createTeamFolder({
339
+ client: this.generatedClient,
340
+ path: { teampath: teamPath },
341
+ body: payload,
342
+ throwOnError: true,
343
+ }), options.unwrapData);
238
344
  }
239
345
  async getTeamFolder(teamPath, folderId, options = defaultOption) {
240
- return this.unwrapData(this.axios.get(`teams/${teamPath}/folders/${folderId}`), options.unwrapData);
346
+ return this.unwrapData(sdk_gen.getTeamFolder({
347
+ client: this.generatedClient,
348
+ path: { teampath: teamPath, folderId },
349
+ throwOnError: true,
350
+ }), options.unwrapData);
241
351
  }
242
352
  async updateTeamFolder(teamPath, folderId, payload, options = defaultOption) {
243
- return this.unwrapData(this.axios.patch(`teams/${teamPath}/folders/${folderId}`, payload), options.unwrapData);
353
+ return this.unwrapData(sdk_gen.updateTeamFolder({
354
+ client: this.generatedClient,
355
+ path: { teampath: teamPath, folderId },
356
+ body: payload,
357
+ throwOnError: true,
358
+ }), options.unwrapData);
244
359
  }
245
360
  async deleteTeamFolder(teamPath, folderId, options = defaultOption) {
246
- return this.unwrapData(this.axios.delete(`teams/${teamPath}/folders/${folderId}`), options.unwrapData);
361
+ return this.unwrapData(sdk_gen.deleteTeamFolder({
362
+ client: this.generatedClient,
363
+ path: { teampath: teamPath, folderId },
364
+ throwOnError: true,
365
+ }), options.unwrapData);
247
366
  }
248
367
  async getTeamFolderOrder(teamPath, options = defaultOption) {
249
- return this.unwrapData(this.axios.get(`teams/${teamPath}/folders/folder-order`), options.unwrapData);
368
+ return this.unwrapData(sdk_gen.getTeamFolderOrder({
369
+ client: this.generatedClient,
370
+ path: { teampath: teamPath },
371
+ throwOnError: true,
372
+ }), options.unwrapData);
250
373
  }
251
374
  async updateTeamFolderOrder(teamPath, payload, options = defaultOption) {
252
- return this.unwrapData(this.axios.put(`teams/${teamPath}/folders/folder-order`, payload), options.unwrapData);
375
+ return this.unwrapData(sdk_gen.updateTeamFolderOrder({
376
+ client: this.generatedClient,
377
+ path: { teampath: teamPath },
378
+ body: payload,
379
+ throwOnError: true,
380
+ }), options.unwrapData);
381
+ }
382
+ async listWebhooks(options = defaultOption) {
383
+ return this.unwrapData(sdk_gen.listWebhooks({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
384
+ }
385
+ async getWebhook(hookId, options = defaultOption) {
386
+ return this.unwrapData(sdk_gen.getWebhook({
387
+ client: this.generatedClient,
388
+ path: { hookId },
389
+ throwOnError: true,
390
+ }), options.unwrapData);
391
+ }
392
+ async createWebhook(body, options = defaultOption) {
393
+ return this.unwrapData(sdk_gen.createWebhook({
394
+ client: this.generatedClient,
395
+ body,
396
+ throwOnError: true,
397
+ }), options.unwrapData);
398
+ }
399
+ async updateWebhook(hookId, body, options = defaultOption) {
400
+ return this.unwrapData(sdk_gen.updateWebhook({
401
+ client: this.generatedClient,
402
+ path: { hookId },
403
+ body,
404
+ throwOnError: true,
405
+ }), options.unwrapData);
406
+ }
407
+ async deleteWebhook(hookId, options = defaultOption) {
408
+ return this.unwrapData(sdk_gen.deleteWebhook({
409
+ client: this.generatedClient,
410
+ path: { hookId },
411
+ throwOnError: true,
412
+ }), options.unwrapData);
413
+ }
414
+ async listTeamWebhooks(teamPath, options = defaultOption) {
415
+ return this.unwrapData(sdk_gen.listTeamWebhooks({
416
+ client: this.generatedClient,
417
+ path: { teampath: teamPath },
418
+ throwOnError: true,
419
+ }), options.unwrapData);
420
+ }
421
+ async getTeamWebhook(teamPath, hookId, options = defaultOption) {
422
+ return this.unwrapData(sdk_gen.getTeamWebhook({
423
+ client: this.generatedClient,
424
+ path: { teampath: teamPath, hookId },
425
+ throwOnError: true,
426
+ }), options.unwrapData);
427
+ }
428
+ async createTeamWebhook(teamPath, body, options = defaultOption) {
429
+ return this.unwrapData(sdk_gen.createTeamWebhook({
430
+ client: this.generatedClient,
431
+ path: { teampath: teamPath },
432
+ body,
433
+ throwOnError: true,
434
+ }), options.unwrapData);
435
+ }
436
+ async updateTeamWebhook(teamPath, hookId, body, options = defaultOption) {
437
+ return this.unwrapData(sdk_gen.updateTeamWebhook({
438
+ client: this.generatedClient,
439
+ path: { teampath: teamPath, hookId },
440
+ body,
441
+ throwOnError: true,
442
+ }), options.unwrapData);
443
+ }
444
+ async deleteTeamWebhook(teamPath, hookId, options = defaultOption) {
445
+ return this.unwrapData(sdk_gen.deleteTeamWebhook({
446
+ client: this.generatedClient,
447
+ path: { teampath: teamPath, hookId },
448
+ throwOnError: true,
449
+ }), options.unwrapData);
450
+ }
451
+ async pingWebhook(hookId, options = defaultOption) {
452
+ return this.unwrapData(sdk_gen.pingWebhook({
453
+ client: this.generatedClient,
454
+ path: { hookId },
455
+ throwOnError: true,
456
+ }), options.unwrapData);
457
+ }
458
+ async listWebhookDeliveries(hookId, options = defaultOption) {
459
+ return this.unwrapData(sdk_gen.listWebhookDeliveries({
460
+ client: this.generatedClient,
461
+ path: { hookId },
462
+ query: { page: options.page, limit: options.limit },
463
+ throwOnError: true,
464
+ }), options.unwrapData);
465
+ }
466
+ async getWebhookDelivery(hookId, deliveryId, options = defaultOption) {
467
+ return this.unwrapData(sdk_gen.getWebhookDelivery({
468
+ client: this.generatedClient,
469
+ path: { hookId, deliveryId },
470
+ throwOnError: true,
471
+ }), options.unwrapData);
472
+ }
473
+ async exportWebhookDeliveries(hookId, options = defaultOption) {
474
+ return this.unwrapData(sdk_gen.exportWebhookDeliveries({
475
+ client: this.generatedClient,
476
+ path: { hookId },
477
+ responseType: 'text',
478
+ throwOnError: true,
479
+ }), options.unwrapData);
480
+ }
481
+ async pingTeamWebhook(teamPath, hookId, options = defaultOption) {
482
+ return this.unwrapData(sdk_gen.pingTeamWebhook({
483
+ client: this.generatedClient,
484
+ path: { teampath: teamPath, hookId },
485
+ throwOnError: true,
486
+ }), options.unwrapData);
487
+ }
488
+ async listTeamWebhookDeliveries(teamPath, hookId, options = defaultOption) {
489
+ return this.unwrapData(sdk_gen.listTeamWebhookDeliveries({
490
+ client: this.generatedClient,
491
+ path: { teampath: teamPath, hookId },
492
+ query: { page: options.page, limit: options.limit },
493
+ throwOnError: true,
494
+ }), options.unwrapData);
495
+ }
496
+ async getTeamWebhookDelivery(teamPath, hookId, deliveryId, options = defaultOption) {
497
+ return this.unwrapData(sdk_gen.getTeamWebhookDelivery({
498
+ client: this.generatedClient,
499
+ path: { teampath: teamPath, hookId, deliveryId },
500
+ throwOnError: true,
501
+ }), options.unwrapData);
502
+ }
503
+ async exportTeamWebhookDeliveries(teamPath, hookId, options = defaultOption) {
504
+ return this.unwrapData(sdk_gen.exportTeamWebhookDeliveries({
505
+ client: this.generatedClient,
506
+ path: { teampath: teamPath, hookId },
507
+ responseType: 'text',
508
+ throwOnError: true,
509
+ }), options.unwrapData);
510
+ }
511
+ async listTrash(options = defaultOption) {
512
+ return this.unwrapData(sdk_gen.listTrash({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
513
+ }
514
+ async batchRestore(body, options = defaultOption) {
515
+ return this.unwrapData(sdk_gen.batchRestore({
516
+ ...noRetry,
517
+ client: this.generatedClient,
518
+ body,
519
+ throwOnError: true,
520
+ }), options.unwrapData);
521
+ }
522
+ async restoreNote(noteId, options = defaultOption) {
523
+ return this.unwrapData(sdk_gen.restoreNote({
524
+ ...noRetry,
525
+ client: this.generatedClient,
526
+ path: { noteId },
527
+ throwOnError: true,
528
+ }), options.unwrapData);
529
+ }
530
+ async listTeamTrash(teamPath, options = defaultOption) {
531
+ return this.unwrapData(sdk_gen.listTeamTrash({
532
+ client: this.generatedClient,
533
+ path: { teampath: teamPath },
534
+ throwOnError: true,
535
+ }), options.unwrapData);
536
+ }
537
+ async listVersions(noteId, options = defaultOption) {
538
+ const { named_only, q, created_by, created_after, created_before, page, limit } = options;
539
+ return this.unwrapData(sdk_gen.listVersions({
540
+ client: this.generatedClient,
541
+ path: { noteId },
542
+ query: { named_only, q, created_by, created_after, created_before, page, limit },
543
+ throwOnError: true,
544
+ }), options.unwrapData);
545
+ }
546
+ async getVersion(noteId, versionId, options = defaultOption) {
547
+ return this.unwrapData(sdk_gen.getVersion({
548
+ client: this.generatedClient,
549
+ path: { noteId, versionId },
550
+ throwOnError: true,
551
+ }), options.unwrapData);
552
+ }
553
+ async createVersion(noteId, body, options = defaultOption) {
554
+ return this.unwrapData(sdk_gen.createVersion({
555
+ client: this.generatedClient,
556
+ path: { noteId },
557
+ body,
558
+ throwOnError: true,
559
+ }), options.unwrapData);
560
+ }
561
+ async updateVersion(noteId, body, options = defaultOption) {
562
+ return this.unwrapData(sdk_gen.updateVersion({
563
+ client: this.generatedClient,
564
+ path: { noteId },
565
+ body,
566
+ throwOnError: true,
567
+ }), options.unwrapData);
568
+ }
569
+ async compareVersions(noteId, query, options = defaultOption) {
570
+ return this.unwrapData(sdk_gen.compareVersions({
571
+ client: this.generatedClient,
572
+ path: { noteId },
573
+ query,
574
+ throwOnError: true,
575
+ }), options.unwrapData);
576
+ }
577
+ async listNoteComments(noteId, options = defaultOption) {
578
+ const { page, limit, sort, threadId, commentStatus, threadStatus, isThreadHead } = options;
579
+ return this.unwrapData(sdk_gen.listNoteComments({
580
+ client: this.generatedClient,
581
+ path: { noteId },
582
+ query: { page, limit, sort, threadId, commentStatus, threadStatus, isThreadHead },
583
+ throwOnError: true,
584
+ }), options.unwrapData);
585
+ }
586
+ async getNoteComment(noteId, commentId, options = defaultOption) {
587
+ return this.unwrapData(sdk_gen.getNoteComment({
588
+ client: this.generatedClient,
589
+ path: { noteId, commentId },
590
+ throwOnError: true,
591
+ }), options.unwrapData);
592
+ }
593
+ async resolveNoteComment(noteId, commentId, options = defaultOption) {
594
+ return this.unwrapData(sdk_gen.resolveNoteComment({
595
+ client: this.generatedClient,
596
+ path: { noteId, commentId },
597
+ throwOnError: true,
598
+ }), options.unwrapData);
599
+ }
600
+ async unresolveNoteComment(noteId, commentId, options = defaultOption) {
601
+ return this.unwrapData(sdk_gen.unresolveNoteComment({
602
+ client: this.generatedClient,
603
+ path: { noteId, commentId },
604
+ throwOnError: true,
605
+ }), options.unwrapData);
253
606
  }
254
607
  unwrapData(reqP, unwrap = true, includeEtag = false) {
255
608
  if (!unwrap) {
@@ -267,5 +620,9 @@ class API {
267
620
  }
268
621
 
269
622
  exports.API = API;
623
+ exports.CommentPermissionType = CommentPermissionType;
624
+ exports.NotePermissionRole = NotePermissionRole;
625
+ exports.NotePublishType = NotePublishType;
626
+ exports.TeamVisibilityType = TeamVisibilityType;
270
627
  exports.default = API;
271
628
  //# sourceMappingURL=index.cjs.map