@hackmd/api 2.7.0-beta.20261120073810.060eeab → 2.7.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.js CHANGED
@@ -1,5 +1,4 @@
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';
3
2
 
4
3
  class HackMDError extends Error {
5
4
  constructor(message) {
@@ -36,42 +35,41 @@ class TooManyRequestsError extends HttpResponseError {
36
35
  }
37
36
  }
38
37
 
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
- };
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 = {}));
62
64
 
63
- /** @module @hackmd/api */
64
65
  const defaultOption = {
65
66
  unwrapData: true,
66
67
  };
67
- // Restore operations cannot safely replay after the server has changed trash state.
68
- const noRetry = { __hackmdSkipRetry: true };
69
68
  class API {
70
69
  accessToken;
71
70
  hackmdAPIEndpointURL;
72
71
  options;
73
72
  axios;
74
- generatedClient;
75
73
  constructor(accessToken, hackmdAPIEndpointURL = "https://api.hackmd.io/v1", options = {
76
74
  wrapResponseErrors: true,
77
75
  timeout: 30000,
@@ -90,10 +88,6 @@ class API {
90
88
  baseURL: hackmdAPIEndpointURL,
91
89
  timeout: options.timeout
92
90
  });
93
- this.generatedClient = createClient({
94
- axios: this.axios,
95
- baseURL: hackmdAPIEndpointURL.replace(/\/+$/, ''),
96
- });
97
91
  this.axios.interceptors.request.use((config) => {
98
92
  config.headers.set('Authorization', `Bearer ${accessToken}`);
99
93
  return config;
@@ -141,464 +135,117 @@ class API {
141
135
  error.response.status === 429);
142
136
  }
143
137
  createRetryInterceptor(axiosInstance, maxRetries, baseDelay) {
138
+ let retryCount = 0;
144
139
  axiosInstance.interceptors.response.use(response => response, async (error) => {
145
- const config = error.config;
146
- const retryCount = config?.__hackmdRetryCount ?? 0;
147
- if (config && !config.__hackmdSkipRetry && retryCount < maxRetries && this.isRetryableError(error)) {
140
+ if (retryCount < maxRetries && this.isRetryableError(error)) {
148
141
  const remainingCredits = parseInt(error.response?.headers['x-ratelimit-userremaining'], 10);
149
142
  if (isNaN(remainingCredits) || remainingCredits > 0) {
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`);
143
+ retryCount++;
144
+ const delay = this.exponentialBackoff(retryCount, baseDelay);
145
+ console.warn(`Retrying request... attempt #${retryCount} after delay of ${delay}ms`);
153
146
  await new Promise(resolve => setTimeout(resolve, delay));
154
- return axiosInstance(config);
147
+ return axiosInstance(error.config);
155
148
  }
156
149
  }
150
+ retryCount = 0; // Reset retry count after a successful request or when not retrying
157
151
  return Promise.reject(error);
158
152
  });
159
153
  }
160
154
  async getMe(options = defaultOption) {
161
- return this.unwrapData(getMe({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
155
+ return this.unwrapData(this.axios.get("me"), options.unwrapData);
162
156
  }
163
157
  async getHistory(options = defaultOption) {
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);
158
+ return this.unwrapData(this.axios.get("history"), options.unwrapData);
172
159
  }
173
- /** Alias of listNotes; kept for backward compatibility. */
174
- getNoteList(options = defaultOption) {
175
- return this.listNotes(options);
160
+ async getNoteList(options = defaultOption) {
161
+ return this.unwrapData(this.axios.get("notes"), options.unwrapData);
176
162
  }
177
163
  async getNote(noteId, options = defaultOption) {
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
- });
164
+ // Prepare request config with etag if provided in options
165
+ const config = options.etag ? {
166
+ headers: { 'If-None-Match': options.etag },
167
+ // Consider 304 responses as successful
168
+ validateStatus: (status) => (status >= 200 && status < 300) || status === 304
169
+ } : undefined;
170
+ const request = this.axios.get(`notes/${noteId}`, config);
185
171
  return this.unwrapData(request, options.unwrapData, true);
186
172
  }
187
173
  async createNote(payload, options = defaultOption) {
188
- return this.unwrapData(createNote({ client: this.generatedClient, body: payload, throwOnError: true }), options.unwrapData, true);
174
+ return this.unwrapData(this.axios.post("notes", payload), options.unwrapData, true);
189
175
  }
190
176
  async updateNoteContent(noteId, content, options = defaultOption) {
191
- return this.unwrapData(updateNote({
192
- client: this.generatedClient,
193
- path: { noteId },
194
- body: { content },
195
- throwOnError: true,
196
- }), options.unwrapData, true);
177
+ return this.unwrapData(this.axios.patch(`notes/${noteId}`, { content }), options.unwrapData, true);
197
178
  }
198
179
  async updateNote(noteId, payload, options = defaultOption) {
199
- return this.unwrapData(updateNote({
200
- client: this.generatedClient,
201
- path: { noteId },
202
- body: payload,
203
- throwOnError: true,
204
- }), options.unwrapData, true);
180
+ return this.unwrapData(this.axios.patch(`notes/${noteId}`, payload), options.unwrapData, true);
205
181
  }
206
182
  async deleteNote(noteId, options = defaultOption) {
207
- return this.unwrapData(deleteNote({
208
- client: this.generatedClient,
209
- path: { noteId },
210
- throwOnError: true,
211
- }), options.unwrapData);
183
+ return this.unwrapData(this.axios.delete(`notes/${noteId}`), options.unwrapData);
212
184
  }
213
185
  async uploadNoteImage(noteId, image, options = defaultOption) {
214
186
  const formData = new FormData();
215
187
  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);
188
+ return this.unwrapData(this.axios.post(`notes/${noteId}/images`, formData), options.unwrapData);
240
189
  }
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
+ async getTeams(options = defaultOption) {
191
+ return this.unwrapData(this.axios.get("teams"), options.unwrapData);
247
192
  }
248
- /** Alias of listTeamNotes; kept for backward compatibility. */
249
- getTeamNotes(teamPath, options = defaultOption) {
250
- return this.listTeamNotes(teamPath, options);
193
+ async getTeamNotes(teamPath, options = defaultOption) {
194
+ return this.unwrapData(this.axios.get(`teams/${teamPath}/notes`), options.unwrapData);
251
195
  }
252
- /** Returns status/etag metadata like createNote; status 207 means the note was created but folder placement failed. */
253
196
  async createTeamNote(teamPath, payload, options = defaultOption) {
254
- return this.unwrapData(createTeamNote({
255
- client: this.generatedClient,
256
- path: { teampath: teamPath },
257
- body: payload,
258
- throwOnError: true,
259
- }), options.unwrapData, true);
197
+ return this.unwrapData(this.axios.post(`teams/${teamPath}/notes`, payload), options.unwrapData);
260
198
  }
261
199
  async updateTeamNoteContent(teamPath, noteId, content) {
262
- return updateTeamNote({
263
- client: this.generatedClient,
264
- path: { teampath: teamPath, noteId },
265
- body: { content },
266
- throwOnError: true,
267
- });
200
+ return this.axios.patch(`teams/${teamPath}/notes/${noteId}`, { content });
268
201
  }
269
202
  async updateTeamNote(teamPath, noteId, options) {
270
- return updateTeamNote({
271
- client: this.generatedClient,
272
- path: { teampath: teamPath, noteId },
273
- body: options,
274
- throwOnError: true,
275
- });
203
+ return this.axios.patch(`teams/${teamPath}/notes/${noteId}`, options);
276
204
  }
277
205
  async deleteTeamNote(teamPath, 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);
206
+ return this.axios.delete(`teams/${teamPath}/notes/${noteId}`);
286
207
  }
287
- /** Alias of listFolders; kept for backward compatibility. */
288
- getFolderList(options = defaultOption) {
289
- return this.listFolders(options);
208
+ async getFolderList(options = defaultOption) {
209
+ return this.unwrapData(this.axios.get('folders'), options.unwrapData);
290
210
  }
291
211
  async createFolder(payload, options = defaultOption) {
292
- return this.unwrapData(createFolder({ client: this.generatedClient, body: payload, throwOnError: true }), options.unwrapData);
212
+ return this.unwrapData(this.axios.post('folders', payload), options.unwrapData);
293
213
  }
294
214
  async getFolder(folderId, options = defaultOption) {
295
- return this.unwrapData(getFolder({
296
- client: this.generatedClient,
297
- path: { folderId },
298
- throwOnError: true,
299
- }), options.unwrapData);
215
+ return this.unwrapData(this.axios.get(`folders/${folderId}`), options.unwrapData);
300
216
  }
301
217
  async updateFolder(folderId, payload, options = defaultOption) {
302
- return this.unwrapData(updateFolder({
303
- client: this.generatedClient,
304
- path: { folderId },
305
- body: payload,
306
- throwOnError: true,
307
- }), options.unwrapData);
218
+ return this.unwrapData(this.axios.patch(`folders/${folderId}`, payload), options.unwrapData);
308
219
  }
309
220
  async deleteFolder(folderId, options = defaultOption) {
310
- return this.unwrapData(deleteFolder({
311
- client: this.generatedClient,
312
- path: { folderId },
313
- throwOnError: true,
314
- }), options.unwrapData);
221
+ return this.unwrapData(this.axios.delete(`folders/${folderId}`), options.unwrapData);
315
222
  }
316
223
  async getFolderOrder(options = defaultOption) {
317
- return this.unwrapData(getFolderOrder({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
224
+ return this.unwrapData(this.axios.get('folders/folder-order'), options.unwrapData);
318
225
  }
319
226
  async updateFolderOrder(payload, options = defaultOption) {
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);
227
+ return this.unwrapData(this.axios.put('folders/folder-order', payload), options.unwrapData);
328
228
  }
329
- /** Alias of listTeamFolders; kept for backward compatibility. */
330
- getTeamFolderList(teamPath, options = defaultOption) {
331
- return this.listTeamFolders(teamPath, options);
229
+ async getTeamFolderList(teamPath, options = defaultOption) {
230
+ return this.unwrapData(this.axios.get(`teams/${teamPath}/folders`), options.unwrapData);
332
231
  }
333
232
  async createTeamFolder(teamPath, payload, options = defaultOption) {
334
- return this.unwrapData(createTeamFolder({
335
- client: this.generatedClient,
336
- path: { teampath: teamPath },
337
- body: payload,
338
- throwOnError: true,
339
- }), options.unwrapData);
233
+ return this.unwrapData(this.axios.post(`teams/${teamPath}/folders`, payload), options.unwrapData);
340
234
  }
341
235
  async getTeamFolder(teamPath, folderId, options = defaultOption) {
342
- return this.unwrapData(getTeamFolder({
343
- client: this.generatedClient,
344
- path: { teampath: teamPath, folderId },
345
- throwOnError: true,
346
- }), options.unwrapData);
236
+ return this.unwrapData(this.axios.get(`teams/${teamPath}/folders/${folderId}`), options.unwrapData);
347
237
  }
348
238
  async updateTeamFolder(teamPath, folderId, payload, options = defaultOption) {
349
- return this.unwrapData(updateTeamFolder({
350
- client: this.generatedClient,
351
- path: { teampath: teamPath, folderId },
352
- body: payload,
353
- throwOnError: true,
354
- }), options.unwrapData);
239
+ return this.unwrapData(this.axios.patch(`teams/${teamPath}/folders/${folderId}`, payload), options.unwrapData);
355
240
  }
356
241
  async deleteTeamFolder(teamPath, folderId, options = defaultOption) {
357
- return this.unwrapData(deleteTeamFolder({
358
- client: this.generatedClient,
359
- path: { teampath: teamPath, folderId },
360
- throwOnError: true,
361
- }), options.unwrapData);
242
+ return this.unwrapData(this.axios.delete(`teams/${teamPath}/folders/${folderId}`), options.unwrapData);
362
243
  }
363
244
  async getTeamFolderOrder(teamPath, options = defaultOption) {
364
- return this.unwrapData(getTeamFolderOrder({
365
- client: this.generatedClient,
366
- path: { teampath: teamPath },
367
- throwOnError: true,
368
- }), options.unwrapData);
245
+ return this.unwrapData(this.axios.get(`teams/${teamPath}/folders/folder-order`), options.unwrapData);
369
246
  }
370
247
  async updateTeamFolderOrder(teamPath, payload, options = defaultOption) {
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);
248
+ return this.unwrapData(this.axios.put(`teams/${teamPath}/folders/folder-order`, payload), options.unwrapData);
602
249
  }
603
250
  unwrapData(reqP, unwrap = true, includeEtag = false) {
604
251
  if (!unwrap) {