@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/README.md +11 -125
- package/dist/index.cjs +73 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -148
- package/dist/index.js +73 -426
- package/dist/index.js.map +1 -1
- package/dist/type.d.ts +128 -69
- package/package.json +5 -20
- package/dist/generated/client/client.gen.d.ts +0 -2
- package/dist/generated/client/index.d.ts +0 -10
- package/dist/generated/client/types.gen.d.ts +0 -87
- package/dist/generated/client/utils.gen.d.ts +0 -14
- package/dist/generated/client.gen.d.ts +0 -12
- package/dist/generated/core/auth.gen.d.ts +0 -25
- package/dist/generated/core/bodySerializer.gen.d.ts +0 -25
- package/dist/generated/core/params.gen.d.ts +0 -43
- package/dist/generated/core/pathSerializer.gen.d.ts +0 -33
- package/dist/generated/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/generated/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/generated/core/types.gen.d.ts +0 -83
- package/dist/generated/core/utils.gen.d.ts +0 -19
- package/dist/generated/index.d.ts +0 -2
- package/dist/generated/operationRegistry.gen.d.ts +0 -1323
- package/dist/generated/sdk.gen.d.ts +0 -274
- package/dist/generated/types.gen.d.ts +0 -2962
- package/dist/raw.cjs +0 -132
- package/dist/raw.cjs.map +0 -1
- package/dist/raw.d.ts +0 -15
- package/dist/raw.js +0 -69
- package/dist/raw.js.map +0 -1
- package/dist/sdk.gen-0nBaZJhE.js +0 -1286
- package/dist/sdk.gen-0nBaZJhE.js.map +0 -1
- package/dist/sdk.gen-COYJyg7W.cjs +0 -1349
- package/dist/sdk.gen-COYJyg7W.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
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');
|
|
7
6
|
|
|
8
7
|
class HackMDError extends Error {
|
|
9
8
|
constructor(message) {
|
|
@@ -40,42 +39,41 @@ class TooManyRequestsError extends HttpResponseError {
|
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
PUBLIC
|
|
46
|
-
PRIVATE
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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 = {}));
|
|
66
68
|
|
|
67
|
-
/** @module @hackmd/api */
|
|
68
69
|
const defaultOption = {
|
|
69
70
|
unwrapData: true,
|
|
70
71
|
};
|
|
71
|
-
// Restore operations cannot safely replay after the server has changed trash state.
|
|
72
|
-
const noRetry = { __hackmdSkipRetry: true };
|
|
73
72
|
class API {
|
|
74
73
|
accessToken;
|
|
75
74
|
hackmdAPIEndpointURL;
|
|
76
75
|
options;
|
|
77
76
|
axios;
|
|
78
|
-
generatedClient;
|
|
79
77
|
constructor(accessToken, hackmdAPIEndpointURL = "https://api.hackmd.io/v1", options = {
|
|
80
78
|
wrapResponseErrors: true,
|
|
81
79
|
timeout: 30000,
|
|
@@ -94,10 +92,6 @@ class API {
|
|
|
94
92
|
baseURL: hackmdAPIEndpointURL,
|
|
95
93
|
timeout: options.timeout
|
|
96
94
|
});
|
|
97
|
-
this.generatedClient = sdk_gen.createClient({
|
|
98
|
-
axios: this.axios,
|
|
99
|
-
baseURL: hackmdAPIEndpointURL.replace(/\/+$/, ''),
|
|
100
|
-
});
|
|
101
95
|
this.axios.interceptors.request.use((config) => {
|
|
102
96
|
config.headers.set('Authorization', `Bearer ${accessToken}`);
|
|
103
97
|
return config;
|
|
@@ -145,464 +139,117 @@ class API {
|
|
|
145
139
|
error.response.status === 429);
|
|
146
140
|
}
|
|
147
141
|
createRetryInterceptor(axiosInstance, maxRetries, baseDelay) {
|
|
142
|
+
let retryCount = 0;
|
|
148
143
|
axiosInstance.interceptors.response.use(response => response, async (error) => {
|
|
149
|
-
|
|
150
|
-
const retryCount = config?.__hackmdRetryCount ?? 0;
|
|
151
|
-
if (config && !config.__hackmdSkipRetry && retryCount < maxRetries && this.isRetryableError(error)) {
|
|
144
|
+
if (retryCount < maxRetries && this.isRetryableError(error)) {
|
|
152
145
|
const remainingCredits = parseInt(error.response?.headers['x-ratelimit-userremaining'], 10);
|
|
153
146
|
if (isNaN(remainingCredits) || remainingCredits > 0) {
|
|
154
|
-
|
|
155
|
-
const delay = this.exponentialBackoff(
|
|
156
|
-
console.warn(`Retrying request... attempt #${
|
|
147
|
+
retryCount++;
|
|
148
|
+
const delay = this.exponentialBackoff(retryCount, baseDelay);
|
|
149
|
+
console.warn(`Retrying request... attempt #${retryCount} after delay of ${delay}ms`);
|
|
157
150
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
158
|
-
return axiosInstance(config);
|
|
151
|
+
return axiosInstance(error.config);
|
|
159
152
|
}
|
|
160
153
|
}
|
|
154
|
+
retryCount = 0; // Reset retry count after a successful request or when not retrying
|
|
161
155
|
return Promise.reject(error);
|
|
162
156
|
});
|
|
163
157
|
}
|
|
164
158
|
async getMe(options = defaultOption) {
|
|
165
|
-
return this.unwrapData(
|
|
159
|
+
return this.unwrapData(this.axios.get("me"), options.unwrapData);
|
|
166
160
|
}
|
|
167
161
|
async getHistory(options = defaultOption) {
|
|
168
|
-
return this.unwrapData(
|
|
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);
|
|
162
|
+
return this.unwrapData(this.axios.get("history"), options.unwrapData);
|
|
176
163
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return this.listNotes(options);
|
|
164
|
+
async getNoteList(options = defaultOption) {
|
|
165
|
+
return this.unwrapData(this.axios.get("notes"), options.unwrapData);
|
|
180
166
|
}
|
|
181
167
|
async getNote(noteId, options = defaultOption) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
validateStatus: (status) => (status >= 200 && status < 300) ||
|
|
187
|
-
|
|
188
|
-
});
|
|
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);
|
|
189
175
|
return this.unwrapData(request, options.unwrapData, true);
|
|
190
176
|
}
|
|
191
177
|
async createNote(payload, options = defaultOption) {
|
|
192
|
-
return this.unwrapData(
|
|
178
|
+
return this.unwrapData(this.axios.post("notes", payload), options.unwrapData, true);
|
|
193
179
|
}
|
|
194
180
|
async updateNoteContent(noteId, content, options = defaultOption) {
|
|
195
|
-
return this.unwrapData(
|
|
196
|
-
client: this.generatedClient,
|
|
197
|
-
path: { noteId },
|
|
198
|
-
body: { content },
|
|
199
|
-
throwOnError: true,
|
|
200
|
-
}), options.unwrapData, true);
|
|
181
|
+
return this.unwrapData(this.axios.patch(`notes/${noteId}`, { content }), options.unwrapData, true);
|
|
201
182
|
}
|
|
202
183
|
async updateNote(noteId, payload, options = defaultOption) {
|
|
203
|
-
return this.unwrapData(
|
|
204
|
-
client: this.generatedClient,
|
|
205
|
-
path: { noteId },
|
|
206
|
-
body: payload,
|
|
207
|
-
throwOnError: true,
|
|
208
|
-
}), options.unwrapData, true);
|
|
184
|
+
return this.unwrapData(this.axios.patch(`notes/${noteId}`, payload), options.unwrapData, true);
|
|
209
185
|
}
|
|
210
186
|
async deleteNote(noteId, options = defaultOption) {
|
|
211
|
-
return this.unwrapData(
|
|
212
|
-
client: this.generatedClient,
|
|
213
|
-
path: { noteId },
|
|
214
|
-
throwOnError: true,
|
|
215
|
-
}), options.unwrapData);
|
|
187
|
+
return this.unwrapData(this.axios.delete(`notes/${noteId}`), options.unwrapData);
|
|
216
188
|
}
|
|
217
189
|
async uploadNoteImage(noteId, image, options = defaultOption) {
|
|
218
190
|
const formData = new FormData();
|
|
219
191
|
formData.append('image', image, options.filename ?? undefined);
|
|
220
|
-
return this.unwrapData(
|
|
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);
|
|
192
|
+
return this.unwrapData(this.axios.post(`notes/${noteId}/images`, formData), options.unwrapData);
|
|
244
193
|
}
|
|
245
|
-
async
|
|
246
|
-
return this.unwrapData(
|
|
247
|
-
client: this.generatedClient,
|
|
248
|
-
path: { teampath: teamPath },
|
|
249
|
-
throwOnError: true,
|
|
250
|
-
}), options.unwrapData);
|
|
194
|
+
async getTeams(options = defaultOption) {
|
|
195
|
+
return this.unwrapData(this.axios.get("teams"), options.unwrapData);
|
|
251
196
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return this.listTeamNotes(teamPath, options);
|
|
197
|
+
async getTeamNotes(teamPath, options = defaultOption) {
|
|
198
|
+
return this.unwrapData(this.axios.get(`teams/${teamPath}/notes`), options.unwrapData);
|
|
255
199
|
}
|
|
256
|
-
/** Returns status/etag metadata like createNote; status 207 means the note was created but folder placement failed. */
|
|
257
200
|
async createTeamNote(teamPath, payload, options = defaultOption) {
|
|
258
|
-
return this.unwrapData(
|
|
259
|
-
client: this.generatedClient,
|
|
260
|
-
path: { teampath: teamPath },
|
|
261
|
-
body: payload,
|
|
262
|
-
throwOnError: true,
|
|
263
|
-
}), options.unwrapData, true);
|
|
201
|
+
return this.unwrapData(this.axios.post(`teams/${teamPath}/notes`, payload), options.unwrapData);
|
|
264
202
|
}
|
|
265
203
|
async updateTeamNoteContent(teamPath, noteId, content) {
|
|
266
|
-
return
|
|
267
|
-
client: this.generatedClient,
|
|
268
|
-
path: { teampath: teamPath, noteId },
|
|
269
|
-
body: { content },
|
|
270
|
-
throwOnError: true,
|
|
271
|
-
});
|
|
204
|
+
return this.axios.patch(`teams/${teamPath}/notes/${noteId}`, { content });
|
|
272
205
|
}
|
|
273
206
|
async updateTeamNote(teamPath, noteId, options) {
|
|
274
|
-
return
|
|
275
|
-
client: this.generatedClient,
|
|
276
|
-
path: { teampath: teamPath, noteId },
|
|
277
|
-
body: options,
|
|
278
|
-
throwOnError: true,
|
|
279
|
-
});
|
|
207
|
+
return this.axios.patch(`teams/${teamPath}/notes/${noteId}`, options);
|
|
280
208
|
}
|
|
281
209
|
async deleteTeamNote(teamPath, noteId) {
|
|
282
|
-
return
|
|
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);
|
|
210
|
+
return this.axios.delete(`teams/${teamPath}/notes/${noteId}`);
|
|
290
211
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
return this.listFolders(options);
|
|
212
|
+
async getFolderList(options = defaultOption) {
|
|
213
|
+
return this.unwrapData(this.axios.get('folders'), options.unwrapData);
|
|
294
214
|
}
|
|
295
215
|
async createFolder(payload, options = defaultOption) {
|
|
296
|
-
return this.unwrapData(
|
|
216
|
+
return this.unwrapData(this.axios.post('folders', payload), options.unwrapData);
|
|
297
217
|
}
|
|
298
218
|
async getFolder(folderId, options = defaultOption) {
|
|
299
|
-
return this.unwrapData(
|
|
300
|
-
client: this.generatedClient,
|
|
301
|
-
path: { folderId },
|
|
302
|
-
throwOnError: true,
|
|
303
|
-
}), options.unwrapData);
|
|
219
|
+
return this.unwrapData(this.axios.get(`folders/${folderId}`), options.unwrapData);
|
|
304
220
|
}
|
|
305
221
|
async updateFolder(folderId, payload, options = defaultOption) {
|
|
306
|
-
return this.unwrapData(
|
|
307
|
-
client: this.generatedClient,
|
|
308
|
-
path: { folderId },
|
|
309
|
-
body: payload,
|
|
310
|
-
throwOnError: true,
|
|
311
|
-
}), options.unwrapData);
|
|
222
|
+
return this.unwrapData(this.axios.patch(`folders/${folderId}`, payload), options.unwrapData);
|
|
312
223
|
}
|
|
313
224
|
async deleteFolder(folderId, options = defaultOption) {
|
|
314
|
-
return this.unwrapData(
|
|
315
|
-
client: this.generatedClient,
|
|
316
|
-
path: { folderId },
|
|
317
|
-
throwOnError: true,
|
|
318
|
-
}), options.unwrapData);
|
|
225
|
+
return this.unwrapData(this.axios.delete(`folders/${folderId}`), options.unwrapData);
|
|
319
226
|
}
|
|
320
227
|
async getFolderOrder(options = defaultOption) {
|
|
321
|
-
return this.unwrapData(
|
|
228
|
+
return this.unwrapData(this.axios.get('folders/folder-order'), options.unwrapData);
|
|
322
229
|
}
|
|
323
230
|
async updateFolderOrder(payload, options = defaultOption) {
|
|
324
|
-
return this.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);
|
|
231
|
+
return this.unwrapData(this.axios.put('folders/folder-order', payload), options.unwrapData);
|
|
332
232
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
return this.listTeamFolders(teamPath, options);
|
|
233
|
+
async getTeamFolderList(teamPath, options = defaultOption) {
|
|
234
|
+
return this.unwrapData(this.axios.get(`teams/${teamPath}/folders`), options.unwrapData);
|
|
336
235
|
}
|
|
337
236
|
async createTeamFolder(teamPath, payload, options = defaultOption) {
|
|
338
|
-
return this.unwrapData(
|
|
339
|
-
client: this.generatedClient,
|
|
340
|
-
path: { teampath: teamPath },
|
|
341
|
-
body: payload,
|
|
342
|
-
throwOnError: true,
|
|
343
|
-
}), options.unwrapData);
|
|
237
|
+
return this.unwrapData(this.axios.post(`teams/${teamPath}/folders`, payload), options.unwrapData);
|
|
344
238
|
}
|
|
345
239
|
async getTeamFolder(teamPath, folderId, options = defaultOption) {
|
|
346
|
-
return this.unwrapData(
|
|
347
|
-
client: this.generatedClient,
|
|
348
|
-
path: { teampath: teamPath, folderId },
|
|
349
|
-
throwOnError: true,
|
|
350
|
-
}), options.unwrapData);
|
|
240
|
+
return this.unwrapData(this.axios.get(`teams/${teamPath}/folders/${folderId}`), options.unwrapData);
|
|
351
241
|
}
|
|
352
242
|
async updateTeamFolder(teamPath, folderId, payload, options = defaultOption) {
|
|
353
|
-
return this.unwrapData(
|
|
354
|
-
client: this.generatedClient,
|
|
355
|
-
path: { teampath: teamPath, folderId },
|
|
356
|
-
body: payload,
|
|
357
|
-
throwOnError: true,
|
|
358
|
-
}), options.unwrapData);
|
|
243
|
+
return this.unwrapData(this.axios.patch(`teams/${teamPath}/folders/${folderId}`, payload), options.unwrapData);
|
|
359
244
|
}
|
|
360
245
|
async deleteTeamFolder(teamPath, folderId, options = defaultOption) {
|
|
361
|
-
return this.unwrapData(
|
|
362
|
-
client: this.generatedClient,
|
|
363
|
-
path: { teampath: teamPath, folderId },
|
|
364
|
-
throwOnError: true,
|
|
365
|
-
}), options.unwrapData);
|
|
246
|
+
return this.unwrapData(this.axios.delete(`teams/${teamPath}/folders/${folderId}`), options.unwrapData);
|
|
366
247
|
}
|
|
367
248
|
async getTeamFolderOrder(teamPath, options = defaultOption) {
|
|
368
|
-
return this.unwrapData(
|
|
369
|
-
client: this.generatedClient,
|
|
370
|
-
path: { teampath: teamPath },
|
|
371
|
-
throwOnError: true,
|
|
372
|
-
}), options.unwrapData);
|
|
249
|
+
return this.unwrapData(this.axios.get(`teams/${teamPath}/folders/folder-order`), options.unwrapData);
|
|
373
250
|
}
|
|
374
251
|
async updateTeamFolderOrder(teamPath, payload, options = defaultOption) {
|
|
375
|
-
return this.unwrapData(
|
|
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);
|
|
252
|
+
return this.unwrapData(this.axios.put(`teams/${teamPath}/folders/folder-order`, payload), options.unwrapData);
|
|
606
253
|
}
|
|
607
254
|
unwrapData(reqP, unwrap = true, includeEtag = false) {
|
|
608
255
|
if (!unwrap) {
|
|
@@ -620,9 +267,5 @@ class API {
|
|
|
620
267
|
}
|
|
621
268
|
|
|
622
269
|
exports.API = API;
|
|
623
|
-
exports.CommentPermissionType = CommentPermissionType;
|
|
624
|
-
exports.NotePermissionRole = NotePermissionRole;
|
|
625
|
-
exports.NotePublishType = NotePublishType;
|
|
626
|
-
exports.TeamVisibilityType = TeamVisibilityType;
|
|
627
270
|
exports.default = API;
|
|
628
271
|
//# sourceMappingURL=index.cjs.map
|