@hackmd/api 2.6.0 → 2.7.0-beta.20261120073810.060eeab

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