@hackmd/api 2.7.0 → 2.8.0-beta.20261120140115.031d6dc
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/README.md +125 -11
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/index.d.ts +10 -0
- package/dist/generated/client/types.gen.d.ts +87 -0
- package/dist/generated/client/utils.gen.d.ts +14 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/core/auth.gen.d.ts +25 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/types.gen.d.ts +83 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/operationRegistry.gen.d.ts +1323 -0
- package/dist/generated/sdk.gen.d.ts +274 -0
- package/dist/generated/types.gen.d.ts +2962 -0
- package/dist/index.cjs +430 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +148 -12
- package/dist/index.js +426 -73
- package/dist/index.js.map +1 -1
- package/dist/raw.cjs +132 -0
- package/dist/raw.cjs.map +1 -0
- package/dist/raw.d.ts +15 -0
- package/dist/raw.js +69 -0
- package/dist/raw.js.map +1 -0
- package/dist/sdk.gen-0nBaZJhE.js +1286 -0
- package/dist/sdk.gen-0nBaZJhE.js.map +1 -0
- package/dist/sdk.gen-COYJyg7W.cjs +1349 -0
- package/dist/sdk.gen-COYJyg7W.cjs.map +1 -0
- package/dist/type.d.ts +69 -128
- package/package.json +20 -5
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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,
|
|
@@ -88,6 +90,10 @@ class API {
|
|
|
88
90
|
baseURL: hackmdAPIEndpointURL,
|
|
89
91
|
timeout: options.timeout
|
|
90
92
|
});
|
|
93
|
+
this.generatedClient = createClient({
|
|
94
|
+
axios: this.axios,
|
|
95
|
+
baseURL: hackmdAPIEndpointURL.replace(/\/+$/, ''),
|
|
96
|
+
});
|
|
91
97
|
this.axios.interceptors.request.use((config) => {
|
|
92
98
|
config.headers.set('Authorization', `Bearer ${accessToken}`);
|
|
93
99
|
return config;
|
|
@@ -135,117 +141,464 @@ class API {
|
|
|
135
141
|
error.response.status === 429);
|
|
136
142
|
}
|
|
137
143
|
createRetryInterceptor(axiosInstance, maxRetries, baseDelay) {
|
|
138
|
-
let retryCount = 0;
|
|
139
144
|
axiosInstance.interceptors.response.use(response => response, async (error) => {
|
|
140
|
-
|
|
145
|
+
const config = error.config;
|
|
146
|
+
const retryCount = config?.__hackmdRetryCount ?? 0;
|
|
147
|
+
if (config && !config.__hackmdSkipRetry && retryCount < maxRetries && this.isRetryableError(error)) {
|
|
141
148
|
const remainingCredits = parseInt(error.response?.headers['x-ratelimit-userremaining'], 10);
|
|
142
149
|
if (isNaN(remainingCredits) || remainingCredits > 0) {
|
|
143
|
-
retryCount
|
|
144
|
-
const delay = this.exponentialBackoff(
|
|
145
|
-
console.warn(`Retrying request... attempt #${
|
|
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`);
|
|
146
153
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
147
|
-
return axiosInstance(
|
|
154
|
+
return axiosInstance(config);
|
|
148
155
|
}
|
|
149
156
|
}
|
|
150
|
-
retryCount = 0; // Reset retry count after a successful request or when not retrying
|
|
151
157
|
return Promise.reject(error);
|
|
152
158
|
});
|
|
153
159
|
}
|
|
154
160
|
async getMe(options = defaultOption) {
|
|
155
|
-
return this.unwrapData(this.
|
|
161
|
+
return this.unwrapData(getMe({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
|
|
156
162
|
}
|
|
157
163
|
async getHistory(options = defaultOption) {
|
|
158
|
-
return this.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);
|
|
159
172
|
}
|
|
160
|
-
|
|
161
|
-
|
|
173
|
+
/** Alias of listNotes; kept for backward compatibility. */
|
|
174
|
+
getNoteList(options = defaultOption) {
|
|
175
|
+
return this.listNotes(options);
|
|
162
176
|
}
|
|
163
177
|
async getNote(noteId, options = defaultOption) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
validateStatus: (status) => (status >= 200 && status < 300) || status === 304
|
|
169
|
-
|
|
170
|
-
|
|
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
|
+
});
|
|
171
185
|
return this.unwrapData(request, options.unwrapData, true);
|
|
172
186
|
}
|
|
173
187
|
async createNote(payload, options = defaultOption) {
|
|
174
|
-
return this.unwrapData(this.
|
|
188
|
+
return this.unwrapData(createNote({ client: this.generatedClient, body: payload, throwOnError: true }), options.unwrapData, true);
|
|
175
189
|
}
|
|
176
190
|
async updateNoteContent(noteId, content, options = defaultOption) {
|
|
177
|
-
return this.unwrapData(
|
|
191
|
+
return this.unwrapData(updateNote({
|
|
192
|
+
client: this.generatedClient,
|
|
193
|
+
path: { noteId },
|
|
194
|
+
body: { content },
|
|
195
|
+
throwOnError: true,
|
|
196
|
+
}), options.unwrapData, true);
|
|
178
197
|
}
|
|
179
198
|
async updateNote(noteId, payload, options = defaultOption) {
|
|
180
|
-
return this.unwrapData(
|
|
199
|
+
return this.unwrapData(updateNote({
|
|
200
|
+
client: this.generatedClient,
|
|
201
|
+
path: { noteId },
|
|
202
|
+
body: payload,
|
|
203
|
+
throwOnError: true,
|
|
204
|
+
}), options.unwrapData, true);
|
|
181
205
|
}
|
|
182
206
|
async deleteNote(noteId, options = defaultOption) {
|
|
183
|
-
return this.unwrapData(
|
|
207
|
+
return this.unwrapData(deleteNote({
|
|
208
|
+
client: this.generatedClient,
|
|
209
|
+
path: { noteId },
|
|
210
|
+
throwOnError: true,
|
|
211
|
+
}), options.unwrapData);
|
|
184
212
|
}
|
|
185
213
|
async uploadNoteImage(noteId, image, options = defaultOption) {
|
|
186
214
|
const formData = new FormData();
|
|
187
215
|
formData.append('image', image, options.filename ?? undefined);
|
|
188
|
-
return this.unwrapData(
|
|
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);
|
|
189
240
|
}
|
|
190
|
-
async
|
|
191
|
-
return this.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);
|
|
192
247
|
}
|
|
193
|
-
|
|
194
|
-
|
|
248
|
+
/** Alias of listTeamNotes; kept for backward compatibility. */
|
|
249
|
+
getTeamNotes(teamPath, options = defaultOption) {
|
|
250
|
+
return this.listTeamNotes(teamPath, options);
|
|
195
251
|
}
|
|
252
|
+
/** Returns status/etag metadata like createNote; status 207 means the note was created but folder placement failed. */
|
|
196
253
|
async createTeamNote(teamPath, payload, options = defaultOption) {
|
|
197
|
-
return this.unwrapData(
|
|
254
|
+
return this.unwrapData(createTeamNote({
|
|
255
|
+
client: this.generatedClient,
|
|
256
|
+
path: { teampath: teamPath },
|
|
257
|
+
body: payload,
|
|
258
|
+
throwOnError: true,
|
|
259
|
+
}), options.unwrapData, true);
|
|
198
260
|
}
|
|
199
261
|
async updateTeamNoteContent(teamPath, noteId, content) {
|
|
200
|
-
return
|
|
262
|
+
return updateTeamNote({
|
|
263
|
+
client: this.generatedClient,
|
|
264
|
+
path: { teampath: teamPath, noteId },
|
|
265
|
+
body: { content },
|
|
266
|
+
throwOnError: true,
|
|
267
|
+
});
|
|
201
268
|
}
|
|
202
269
|
async updateTeamNote(teamPath, noteId, options) {
|
|
203
|
-
return
|
|
270
|
+
return updateTeamNote({
|
|
271
|
+
client: this.generatedClient,
|
|
272
|
+
path: { teampath: teamPath, noteId },
|
|
273
|
+
body: options,
|
|
274
|
+
throwOnError: true,
|
|
275
|
+
});
|
|
204
276
|
}
|
|
205
277
|
async deleteTeamNote(teamPath, noteId) {
|
|
206
|
-
return
|
|
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);
|
|
207
286
|
}
|
|
208
|
-
|
|
209
|
-
|
|
287
|
+
/** Alias of listFolders; kept for backward compatibility. */
|
|
288
|
+
getFolderList(options = defaultOption) {
|
|
289
|
+
return this.listFolders(options);
|
|
210
290
|
}
|
|
211
291
|
async createFolder(payload, options = defaultOption) {
|
|
212
|
-
return this.unwrapData(this.
|
|
292
|
+
return this.unwrapData(createFolder({ client: this.generatedClient, body: payload, throwOnError: true }), options.unwrapData);
|
|
213
293
|
}
|
|
214
294
|
async getFolder(folderId, options = defaultOption) {
|
|
215
|
-
return this.unwrapData(
|
|
295
|
+
return this.unwrapData(getFolder({
|
|
296
|
+
client: this.generatedClient,
|
|
297
|
+
path: { folderId },
|
|
298
|
+
throwOnError: true,
|
|
299
|
+
}), options.unwrapData);
|
|
216
300
|
}
|
|
217
301
|
async updateFolder(folderId, payload, options = defaultOption) {
|
|
218
|
-
return this.unwrapData(
|
|
302
|
+
return this.unwrapData(updateFolder({
|
|
303
|
+
client: this.generatedClient,
|
|
304
|
+
path: { folderId },
|
|
305
|
+
body: payload,
|
|
306
|
+
throwOnError: true,
|
|
307
|
+
}), options.unwrapData);
|
|
219
308
|
}
|
|
220
309
|
async deleteFolder(folderId, options = defaultOption) {
|
|
221
|
-
return this.unwrapData(
|
|
310
|
+
return this.unwrapData(deleteFolder({
|
|
311
|
+
client: this.generatedClient,
|
|
312
|
+
path: { folderId },
|
|
313
|
+
throwOnError: true,
|
|
314
|
+
}), options.unwrapData);
|
|
222
315
|
}
|
|
223
316
|
async getFolderOrder(options = defaultOption) {
|
|
224
|
-
return this.unwrapData(this.
|
|
317
|
+
return this.unwrapData(getFolderOrder({ client: this.generatedClient, throwOnError: true }), options.unwrapData);
|
|
225
318
|
}
|
|
226
319
|
async updateFolderOrder(payload, options = defaultOption) {
|
|
227
|
-
return this.unwrapData(this.
|
|
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);
|
|
228
328
|
}
|
|
229
|
-
|
|
230
|
-
|
|
329
|
+
/** Alias of listTeamFolders; kept for backward compatibility. */
|
|
330
|
+
getTeamFolderList(teamPath, options = defaultOption) {
|
|
331
|
+
return this.listTeamFolders(teamPath, options);
|
|
231
332
|
}
|
|
232
333
|
async createTeamFolder(teamPath, payload, options = defaultOption) {
|
|
233
|
-
return this.unwrapData(
|
|
334
|
+
return this.unwrapData(createTeamFolder({
|
|
335
|
+
client: this.generatedClient,
|
|
336
|
+
path: { teampath: teamPath },
|
|
337
|
+
body: payload,
|
|
338
|
+
throwOnError: true,
|
|
339
|
+
}), options.unwrapData);
|
|
234
340
|
}
|
|
235
341
|
async getTeamFolder(teamPath, folderId, options = defaultOption) {
|
|
236
|
-
return this.unwrapData(
|
|
342
|
+
return this.unwrapData(getTeamFolder({
|
|
343
|
+
client: this.generatedClient,
|
|
344
|
+
path: { teampath: teamPath, folderId },
|
|
345
|
+
throwOnError: true,
|
|
346
|
+
}), options.unwrapData);
|
|
237
347
|
}
|
|
238
348
|
async updateTeamFolder(teamPath, folderId, payload, options = defaultOption) {
|
|
239
|
-
return this.unwrapData(
|
|
349
|
+
return this.unwrapData(updateTeamFolder({
|
|
350
|
+
client: this.generatedClient,
|
|
351
|
+
path: { teampath: teamPath, folderId },
|
|
352
|
+
body: payload,
|
|
353
|
+
throwOnError: true,
|
|
354
|
+
}), options.unwrapData);
|
|
240
355
|
}
|
|
241
356
|
async deleteTeamFolder(teamPath, folderId, options = defaultOption) {
|
|
242
|
-
return this.unwrapData(
|
|
357
|
+
return this.unwrapData(deleteTeamFolder({
|
|
358
|
+
client: this.generatedClient,
|
|
359
|
+
path: { teampath: teamPath, folderId },
|
|
360
|
+
throwOnError: true,
|
|
361
|
+
}), options.unwrapData);
|
|
243
362
|
}
|
|
244
363
|
async getTeamFolderOrder(teamPath, options = defaultOption) {
|
|
245
|
-
return this.unwrapData(
|
|
364
|
+
return this.unwrapData(getTeamFolderOrder({
|
|
365
|
+
client: this.generatedClient,
|
|
366
|
+
path: { teampath: teamPath },
|
|
367
|
+
throwOnError: true,
|
|
368
|
+
}), options.unwrapData);
|
|
246
369
|
}
|
|
247
370
|
async updateTeamFolderOrder(teamPath, payload, options = defaultOption) {
|
|
248
|
-
return this.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);
|
|
249
602
|
}
|
|
250
603
|
unwrapData(reqP, unwrap = true, includeEtag = false) {
|
|
251
604
|
if (!unwrap) {
|