@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.
@@ -0,0 +1,1286 @@
1
+ import axios from 'axios';
2
+
3
+ // This file is auto-generated by @hey-api/openapi-ts
4
+ const serializeFormDataPair = (data, key, value) => {
5
+ if (typeof value === 'string' || value instanceof Blob) {
6
+ data.append(key, value);
7
+ }
8
+ else if (value instanceof Date) {
9
+ data.append(key, value.toISOString());
10
+ }
11
+ else {
12
+ data.append(key, JSON.stringify(value));
13
+ }
14
+ };
15
+ const formDataBodySerializer = {
16
+ bodySerializer: (body) => {
17
+ const data = new FormData();
18
+ Object.entries(body).forEach(([key, value]) => {
19
+ if (value === undefined || value === null) {
20
+ return;
21
+ }
22
+ if (Array.isArray(value)) {
23
+ value.forEach((v) => serializeFormDataPair(data, key, v));
24
+ }
25
+ else {
26
+ serializeFormDataPair(data, key, value);
27
+ }
28
+ });
29
+ return data;
30
+ },
31
+ };
32
+
33
+ // This file is auto-generated by @hey-api/openapi-ts
34
+ function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
35
+ let lastEventId;
36
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
37
+ const createStream = async function* () {
38
+ let retryDelay = sseDefaultRetryDelay ?? 3000;
39
+ let attempt = 0;
40
+ const signal = options.signal ?? new AbortController().signal;
41
+ while (true) {
42
+ if (signal.aborted)
43
+ break;
44
+ attempt++;
45
+ const headers = options.headers instanceof Headers
46
+ ? options.headers
47
+ : new Headers(options.headers);
48
+ if (lastEventId !== undefined) {
49
+ headers.set('Last-Event-ID', lastEventId);
50
+ }
51
+ try {
52
+ const requestInit = {
53
+ redirect: 'follow',
54
+ ...options,
55
+ body: options.serializedBody,
56
+ headers,
57
+ signal,
58
+ };
59
+ let request = new Request(url, requestInit);
60
+ if (onRequest) {
61
+ request = await onRequest(url, requestInit);
62
+ }
63
+ // fetch must be assigned here, otherwise it would throw the error:
64
+ // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
65
+ const _fetch = options.fetch ?? globalThis.fetch;
66
+ const response = await _fetch(request);
67
+ if (!response.ok)
68
+ throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
69
+ if (!response.body)
70
+ throw new Error('No body in SSE response');
71
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
72
+ let buffer = '';
73
+ const abortHandler = () => {
74
+ try {
75
+ reader.cancel();
76
+ }
77
+ catch {
78
+ // noop
79
+ }
80
+ };
81
+ signal.addEventListener('abort', abortHandler);
82
+ try {
83
+ while (true) {
84
+ const { done, value } = await reader.read();
85
+ if (done)
86
+ break;
87
+ buffer += value;
88
+ buffer = buffer.replace(/\r\n?/g, '\n'); // normalize line endings
89
+ const chunks = buffer.split('\n\n');
90
+ buffer = chunks.pop() ?? '';
91
+ for (const chunk of chunks) {
92
+ const lines = chunk.split('\n');
93
+ const dataLines = [];
94
+ let eventName;
95
+ for (const line of lines) {
96
+ if (line.startsWith('data:')) {
97
+ dataLines.push(line.replace(/^data:\s*/, ''));
98
+ }
99
+ else if (line.startsWith('event:')) {
100
+ eventName = line.replace(/^event:\s*/, '');
101
+ }
102
+ else if (line.startsWith('id:')) {
103
+ lastEventId = line.replace(/^id:\s*/, '');
104
+ }
105
+ else if (line.startsWith('retry:')) {
106
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10);
107
+ if (!Number.isNaN(parsed)) {
108
+ retryDelay = parsed;
109
+ }
110
+ }
111
+ }
112
+ let data;
113
+ let parsedJson = false;
114
+ if (dataLines.length) {
115
+ const rawData = dataLines.join('\n');
116
+ try {
117
+ data = JSON.parse(rawData);
118
+ parsedJson = true;
119
+ }
120
+ catch {
121
+ data = rawData;
122
+ }
123
+ }
124
+ if (parsedJson) {
125
+ if (responseValidator) {
126
+ await responseValidator(data);
127
+ }
128
+ if (responseTransformer) {
129
+ data = await responseTransformer(data);
130
+ }
131
+ }
132
+ onSseEvent?.({
133
+ data,
134
+ event: eventName,
135
+ id: lastEventId,
136
+ retry: retryDelay,
137
+ });
138
+ if (dataLines.length) {
139
+ yield data;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ finally {
145
+ signal.removeEventListener('abort', abortHandler);
146
+ reader.releaseLock();
147
+ }
148
+ break; // exit loop on normal completion
149
+ }
150
+ catch (error) {
151
+ // connection failed or aborted; retry after delay
152
+ onSseError?.(error);
153
+ if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
154
+ break; // stop after firing error
155
+ }
156
+ // exponential backoff: double retry each attempt, cap at 30s
157
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
158
+ await sleep(backoff);
159
+ }
160
+ }
161
+ };
162
+ const stream = createStream();
163
+ return { stream };
164
+ }
165
+
166
+ // This file is auto-generated by @hey-api/openapi-ts
167
+ const separatorArrayExplode = (style) => {
168
+ switch (style) {
169
+ case 'label':
170
+ return '.';
171
+ case 'matrix':
172
+ return ';';
173
+ case 'simple':
174
+ return ',';
175
+ default:
176
+ return '&';
177
+ }
178
+ };
179
+ const separatorArrayNoExplode = (style) => {
180
+ switch (style) {
181
+ case 'form':
182
+ return ',';
183
+ case 'pipeDelimited':
184
+ return '|';
185
+ case 'spaceDelimited':
186
+ return '%20';
187
+ default:
188
+ return ',';
189
+ }
190
+ };
191
+ const separatorObjectExplode = (style) => {
192
+ switch (style) {
193
+ case 'label':
194
+ return '.';
195
+ case 'matrix':
196
+ return ';';
197
+ case 'simple':
198
+ return ',';
199
+ default:
200
+ return '&';
201
+ }
202
+ };
203
+ const serializeArrayParam = ({ allowReserved, explode, name, style, value, }) => {
204
+ if (!explode) {
205
+ const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
206
+ switch (style) {
207
+ case 'label':
208
+ return `.${joinedValues}`;
209
+ case 'matrix':
210
+ return `;${name}=${joinedValues}`;
211
+ case 'simple':
212
+ return joinedValues;
213
+ default:
214
+ return `${name}=${joinedValues}`;
215
+ }
216
+ }
217
+ const separator = separatorArrayExplode(style);
218
+ const joinedValues = value
219
+ .map((v) => {
220
+ if (style === 'label' || style === 'simple') {
221
+ return allowReserved ? v : encodeURIComponent(v);
222
+ }
223
+ return serializePrimitiveParam({
224
+ allowReserved,
225
+ name,
226
+ value: v,
227
+ });
228
+ })
229
+ .join(separator);
230
+ return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;
231
+ };
232
+ const serializePrimitiveParam = ({ allowReserved, name, value, }) => {
233
+ if (value === undefined || value === null) {
234
+ return '';
235
+ }
236
+ if (typeof value === 'object') {
237
+ throw new Error('Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.');
238
+ }
239
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
240
+ };
241
+ const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly, }) => {
242
+ if (value instanceof Date) {
243
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
244
+ }
245
+ if (style !== 'deepObject' && !explode) {
246
+ let values = [];
247
+ Object.entries(value).forEach(([key, v]) => {
248
+ values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
249
+ });
250
+ const joinedValues = values.join(',');
251
+ switch (style) {
252
+ case 'form':
253
+ return `${name}=${joinedValues}`;
254
+ case 'label':
255
+ return `.${joinedValues}`;
256
+ case 'matrix':
257
+ return `;${name}=${joinedValues}`;
258
+ default:
259
+ return joinedValues;
260
+ }
261
+ }
262
+ const separator = separatorObjectExplode(style);
263
+ const joinedValues = Object.entries(value)
264
+ .map(([key, v]) => serializePrimitiveParam({
265
+ allowReserved,
266
+ name: style === 'deepObject' ? `${name}[${key}]` : key,
267
+ value: v,
268
+ }))
269
+ .join(separator);
270
+ return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;
271
+ };
272
+
273
+ // This file is auto-generated by @hey-api/openapi-ts
274
+ const PATH_PARAM_RE = /\{[^{}]+\}/g;
275
+ const defaultPathSerializer = ({ path, url: _url }) => {
276
+ let url = _url;
277
+ const matches = _url.match(PATH_PARAM_RE);
278
+ if (matches) {
279
+ for (const match of matches) {
280
+ let explode = false;
281
+ let name = match.substring(1, match.length - 1);
282
+ let style = 'simple';
283
+ if (name.endsWith('*')) {
284
+ explode = true;
285
+ name = name.substring(0, name.length - 1);
286
+ }
287
+ if (name.startsWith('.')) {
288
+ name = name.substring(1);
289
+ style = 'label';
290
+ }
291
+ else if (name.startsWith(';')) {
292
+ name = name.substring(1);
293
+ style = 'matrix';
294
+ }
295
+ const value = path[name];
296
+ if (value === undefined || value === null) {
297
+ continue;
298
+ }
299
+ if (Array.isArray(value)) {
300
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
301
+ continue;
302
+ }
303
+ if (typeof value === 'object') {
304
+ url = url.replace(match, serializeObjectParam({
305
+ explode,
306
+ name,
307
+ style,
308
+ value: value,
309
+ valueOnly: true,
310
+ }));
311
+ continue;
312
+ }
313
+ if (style === 'matrix') {
314
+ url = url.replace(match, `;${serializePrimitiveParam({
315
+ name,
316
+ value: value,
317
+ })}`);
318
+ continue;
319
+ }
320
+ const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
321
+ url = url.replace(match, replaceValue);
322
+ }
323
+ }
324
+ return url;
325
+ };
326
+ const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
327
+ const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
328
+ let url = (baseUrl ?? '') + pathUrl;
329
+ if (path) {
330
+ url = defaultPathSerializer({ path, url });
331
+ }
332
+ let search = query ? querySerializer(query) : '';
333
+ if (search.startsWith('?')) {
334
+ search = search.substring(1);
335
+ }
336
+ if (search) {
337
+ url += `?${search}`;
338
+ }
339
+ return url;
340
+ };
341
+ function getValidRequestBody(options) {
342
+ const hasBody = options.body !== undefined;
343
+ const isSerializedBody = hasBody && options.bodySerializer;
344
+ if (isSerializedBody) {
345
+ if ('serializedBody' in options) {
346
+ const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== '';
347
+ return hasSerializedBody ? options.serializedBody : null;
348
+ }
349
+ // not all clients implement a serializedBody property (i.e., client-axios)
350
+ return options.body !== '' ? options.body : null;
351
+ }
352
+ // plain/text body
353
+ if (hasBody) {
354
+ return options.body;
355
+ }
356
+ // no body was provided
357
+ return undefined;
358
+ }
359
+
360
+ // This file is auto-generated by @hey-api/openapi-ts
361
+ const getAuthToken = async (auth, callback) => {
362
+ const token = typeof callback === 'function' ? await callback(auth) : callback;
363
+ if (!token) {
364
+ return;
365
+ }
366
+ if (auth.scheme === 'bearer') {
367
+ return `Bearer ${token}`;
368
+ }
369
+ if (auth.scheme === 'basic') {
370
+ return `Basic ${btoa(token)}`;
371
+ }
372
+ return token;
373
+ };
374
+
375
+ // This file is auto-generated by @hey-api/openapi-ts
376
+ const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
377
+ const querySerializer = (queryParams) => {
378
+ const search = [];
379
+ if (queryParams && typeof queryParams === 'object') {
380
+ for (const name in queryParams) {
381
+ const value = queryParams[name];
382
+ if (value === undefined || value === null) {
383
+ continue;
384
+ }
385
+ const options = parameters[name] || args;
386
+ if (Array.isArray(value)) {
387
+ const serializedArray = serializeArrayParam({
388
+ allowReserved: options.allowReserved,
389
+ explode: true,
390
+ name,
391
+ style: 'form',
392
+ value,
393
+ ...options.array,
394
+ });
395
+ if (serializedArray)
396
+ search.push(serializedArray);
397
+ }
398
+ else if (typeof value === 'object') {
399
+ const serializedObject = serializeObjectParam({
400
+ allowReserved: options.allowReserved,
401
+ explode: true,
402
+ name,
403
+ style: 'deepObject',
404
+ value: value,
405
+ ...options.object,
406
+ });
407
+ if (serializedObject)
408
+ search.push(serializedObject);
409
+ }
410
+ else {
411
+ const serializedPrimitive = serializePrimitiveParam({
412
+ allowReserved: options.allowReserved,
413
+ name,
414
+ value: value,
415
+ });
416
+ if (serializedPrimitive)
417
+ search.push(serializedPrimitive);
418
+ }
419
+ }
420
+ }
421
+ return search.join('&');
422
+ };
423
+ return querySerializer;
424
+ };
425
+ const checkForExistence = (options, name) => {
426
+ if (!name) {
427
+ return false;
428
+ }
429
+ if (name in options.headers || options.query?.[name]) {
430
+ return true;
431
+ }
432
+ if ('Cookie' in options.headers &&
433
+ options.headers['Cookie'] &&
434
+ typeof options.headers['Cookie'] === 'string') {
435
+ return options.headers['Cookie'].includes(`${name}=`);
436
+ }
437
+ return false;
438
+ };
439
+ async function setAuthParams(options) {
440
+ for (const auth of options.security ?? []) {
441
+ if (checkForExistence(options, auth.name)) {
442
+ continue;
443
+ }
444
+ const token = await getAuthToken(auth, options.auth);
445
+ if (!token) {
446
+ continue;
447
+ }
448
+ const name = auth.name ?? 'Authorization';
449
+ switch (auth.in) {
450
+ case 'query':
451
+ if (!options.query) {
452
+ options.query = {};
453
+ }
454
+ options.query[name] = token;
455
+ break;
456
+ case 'cookie': {
457
+ const value = `${name}=${token}`;
458
+ if ('Cookie' in options.headers && options.headers['Cookie']) {
459
+ options.headers['Cookie'] = `${options.headers['Cookie']}; ${value}`;
460
+ }
461
+ else {
462
+ options.headers['Cookie'] = value;
463
+ }
464
+ break;
465
+ }
466
+ case 'header':
467
+ default:
468
+ options.headers[name] = token;
469
+ break;
470
+ }
471
+ }
472
+ }
473
+ const buildUrl = (options) => {
474
+ const instanceBaseUrl = options.axios?.defaults?.baseURL;
475
+ const baseUrl = options.baseURL && typeof options.baseURL === 'string' ? options.baseURL : instanceBaseUrl;
476
+ return getUrl({
477
+ baseUrl: baseUrl,
478
+ path: options.path,
479
+ // let `paramsSerializer()` handle query params if it exists
480
+ query: !options.paramsSerializer ? options.query : undefined,
481
+ querySerializer: typeof options.querySerializer === 'function'
482
+ ? options.querySerializer
483
+ : createQuerySerializer(options.querySerializer),
484
+ url: options.url,
485
+ });
486
+ };
487
+ const mergeConfigs = (a, b) => {
488
+ const config = { ...a, ...b };
489
+ config.headers = mergeHeaders(a.headers, b.headers);
490
+ return config;
491
+ };
492
+ /**
493
+ * Special Axios headers keywords allowing to set headers by request method.
494
+ */
495
+ const axiosHeadersKeywords = [
496
+ 'common',
497
+ 'delete',
498
+ 'get',
499
+ 'head',
500
+ 'patch',
501
+ 'post',
502
+ 'put',
503
+ ];
504
+ const mergeHeaders = (...headers) => {
505
+ const mergedHeaders = {};
506
+ for (const header of headers) {
507
+ if (!header || typeof header !== 'object') {
508
+ continue;
509
+ }
510
+ const iterator = Object.entries(header);
511
+ for (const [key, value] of iterator) {
512
+ if (axiosHeadersKeywords.includes(key) &&
513
+ typeof value === 'object') {
514
+ mergedHeaders[key] = {
515
+ ...mergedHeaders[key],
516
+ ...value,
517
+ };
518
+ }
519
+ else if (value === null) {
520
+ delete mergedHeaders[key];
521
+ }
522
+ else if (Array.isArray(value)) {
523
+ for (const v of value) {
524
+ // @ts-expect-error
525
+ mergedHeaders[key] = [...(mergedHeaders[key] ?? []), v];
526
+ }
527
+ }
528
+ else if (value !== undefined) {
529
+ // assume object headers are meant to be JSON stringified, i.e., their
530
+ // content value in OpenAPI specification is 'application/json'
531
+ mergedHeaders[key] = typeof value === 'object' ? JSON.stringify(value) : value;
532
+ }
533
+ }
534
+ }
535
+ return mergedHeaders;
536
+ };
537
+ const createConfig = (override = {}) => ({
538
+ ...override,
539
+ });
540
+
541
+ // This file is auto-generated by @hey-api/openapi-ts
542
+ const createClient = (config = {}) => {
543
+ let _config = mergeConfigs(createConfig(), config);
544
+ let instance;
545
+ if (_config.axios && !('Axios' in _config.axios)) {
546
+ instance = _config.axios;
547
+ }
548
+ else {
549
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
550
+ const { auth, ...configWithoutAuth } = _config;
551
+ instance = axios.create(configWithoutAuth);
552
+ }
553
+ const getConfig = () => ({ ..._config });
554
+ const setConfig = (config) => {
555
+ _config = mergeConfigs(_config, config);
556
+ instance.defaults = {
557
+ ...instance.defaults,
558
+ ..._config,
559
+ // @ts-expect-error
560
+ headers: mergeHeaders(instance.defaults.headers, _config.headers),
561
+ };
562
+ return getConfig();
563
+ };
564
+ const beforeRequest = async (options) => {
565
+ const opts = {
566
+ ..._config,
567
+ ...options,
568
+ axios: options.axios ?? _config.axios ?? instance,
569
+ headers: mergeHeaders(_config.headers, options.headers),
570
+ };
571
+ if (opts.security) {
572
+ await setAuthParams(opts);
573
+ }
574
+ if (opts.requestValidator) {
575
+ await opts.requestValidator(opts);
576
+ }
577
+ if (opts.body !== undefined && opts.bodySerializer) {
578
+ opts.body = opts.bodySerializer(opts.body);
579
+ }
580
+ const url = buildUrl(opts);
581
+ return { opts, url };
582
+ };
583
+ // @ts-expect-error
584
+ const request = async (options) => {
585
+ const { opts, url } = await beforeRequest(options);
586
+ try {
587
+ // assign Axios here for consistency with fetch
588
+ const _axios = opts.axios;
589
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
590
+ const { auth, ...optsWithoutAuth } = opts;
591
+ const response = await _axios({
592
+ ...optsWithoutAuth,
593
+ baseURL: '', // the baseURL is already included in `url`
594
+ data: getValidRequestBody(opts),
595
+ headers: opts.headers,
596
+ // let `paramsSerializer()` handle query params if it exists
597
+ params: opts.paramsSerializer ? opts.query : undefined,
598
+ url,
599
+ });
600
+ let { data } = response;
601
+ if (opts.responseType === 'json') {
602
+ if (opts.responseValidator) {
603
+ await opts.responseValidator(data);
604
+ }
605
+ if (opts.responseTransformer) {
606
+ data = await opts.responseTransformer(data);
607
+ }
608
+ }
609
+ return {
610
+ ...response,
611
+ data: data ?? {},
612
+ };
613
+ }
614
+ catch (error) {
615
+ const e = error;
616
+ if (opts.throwOnError) {
617
+ throw e;
618
+ }
619
+ // @ts-expect-error
620
+ e.error = e.response?.data ?? {};
621
+ return e;
622
+ }
623
+ };
624
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
625
+ const makeSseFn = (method) => async (options) => {
626
+ const { opts, url } = await beforeRequest(options);
627
+ return createSseClient({
628
+ ...opts,
629
+ body: opts.body,
630
+ headers: opts.headers,
631
+ method,
632
+ serializedBody: getValidRequestBody(opts),
633
+ // @ts-expect-error
634
+ signal: opts.signal,
635
+ url,
636
+ });
637
+ };
638
+ const _buildUrl = (options) => buildUrl({ axios: instance, ..._config, ...options });
639
+ return {
640
+ buildUrl: _buildUrl,
641
+ connect: makeMethodFn('CONNECT'),
642
+ delete: makeMethodFn('DELETE'),
643
+ get: makeMethodFn('GET'),
644
+ getConfig,
645
+ head: makeMethodFn('HEAD'),
646
+ instance,
647
+ options: makeMethodFn('OPTIONS'),
648
+ patch: makeMethodFn('PATCH'),
649
+ post: makeMethodFn('POST'),
650
+ put: makeMethodFn('PUT'),
651
+ request,
652
+ setConfig,
653
+ sse: {
654
+ connect: makeSseFn('CONNECT'),
655
+ delete: makeSseFn('DELETE'),
656
+ get: makeSseFn('GET'),
657
+ head: makeSseFn('HEAD'),
658
+ options: makeSseFn('OPTIONS'),
659
+ patch: makeSseFn('PATCH'),
660
+ post: makeSseFn('POST'),
661
+ put: makeSseFn('PUT'),
662
+ trace: makeSseFn('TRACE'),
663
+ },
664
+ trace: makeMethodFn('TRACE'),
665
+ };
666
+ };
667
+
668
+ // This file is auto-generated by @hey-api/openapi-ts
669
+ const client = createClient(createConfig({ baseURL: 'https://api.hackmd.io/v1' }));
670
+
671
+ // This file is auto-generated by @hey-api/openapi-ts
672
+ /**
673
+ * List webhooks in the current user's workspace.
674
+ */
675
+ const listWebhooks = (options) => (options?.client ?? client).get({
676
+ responseType: 'json',
677
+ security: [{ scheme: 'bearer', type: 'http' }],
678
+ url: '/webhooks',
679
+ ...options
680
+ });
681
+ /**
682
+ * Create a webhook in the current user's workspace.
683
+ * The signing secret is returned only once and cannot be retrieved later.
684
+ */
685
+ const createWebhook = (options) => (options.client ?? client).post({
686
+ responseType: 'json',
687
+ security: [{ scheme: 'bearer', type: 'http' }],
688
+ url: '/webhooks',
689
+ ...options,
690
+ headers: {
691
+ 'Content-Type': 'application/json',
692
+ ...options.headers
693
+ }
694
+ });
695
+ /**
696
+ * Delete a webhook.
697
+ */
698
+ const deleteWebhook = (options) => (options.client ?? client).delete({
699
+ security: [{ scheme: 'bearer', type: 'http' }],
700
+ url: '/webhooks/{hookId}',
701
+ ...options
702
+ });
703
+ /**
704
+ * Get a webhook in the current user's workspace.
705
+ */
706
+ const getWebhook = (options) => (options.client ?? client).get({
707
+ responseType: 'json',
708
+ security: [{ scheme: 'bearer', type: 'http' }],
709
+ url: '/webhooks/{hookId}',
710
+ ...options
711
+ });
712
+ /**
713
+ * Update a webhook. At least one of name, url, or active is required.
714
+ * Scope and event selection cannot be changed.
715
+ */
716
+ const updateWebhook = (options) => (options.client ?? client).patch({
717
+ responseType: 'json',
718
+ security: [{ scheme: 'bearer', type: 'http' }],
719
+ url: '/webhooks/{hookId}',
720
+ ...options,
721
+ headers: {
722
+ 'Content-Type': 'application/json',
723
+ ...options.headers
724
+ }
725
+ });
726
+ /**
727
+ * Send a test delivery. Read the result from the deliveries endpoint.
728
+ */
729
+ const pingWebhook = (options) => (options.client ?? client).post({
730
+ security: [{ scheme: 'bearer', type: 'http' }],
731
+ url: '/webhooks/{hookId}/ping',
732
+ ...options
733
+ });
734
+ /**
735
+ * List webhook deliveries within the workspace plan's retention window.
736
+ */
737
+ const listWebhookDeliveries = (options) => (options.client ?? client).get({
738
+ responseType: 'json',
739
+ security: [{ scheme: 'bearer', type: 'http' }],
740
+ url: '/webhooks/{hookId}/deliveries',
741
+ ...options
742
+ });
743
+ /**
744
+ * Download webhook deliveries as newline-delimited JSON.
745
+ */
746
+ const exportWebhookDeliveries = (options) => (options.client ?? client).get({
747
+ responseType: 'blob',
748
+ security: [{ scheme: 'bearer', type: 'http' }],
749
+ url: '/webhooks/{hookId}/deliveries/export',
750
+ ...options
751
+ });
752
+ /**
753
+ * Get a webhook delivery within the workspace plan's retention window.
754
+ */
755
+ const getWebhookDelivery = (options) => (options.client ?? client).get({
756
+ responseType: 'json',
757
+ security: [{ scheme: 'bearer', type: 'http' }],
758
+ url: '/webhooks/{hookId}/deliveries/{deliveryId}',
759
+ ...options
760
+ });
761
+ /**
762
+ * List webhooks in a team workspace.
763
+ */
764
+ const listTeamWebhooks = (options) => (options.client ?? client).get({
765
+ responseType: 'json',
766
+ security: [{ scheme: 'bearer', type: 'http' }],
767
+ url: '/teams/{teampath}/webhooks',
768
+ ...options
769
+ });
770
+ /**
771
+ * Create a webhook in a team workspace.
772
+ * The signing secret is returned only once and cannot be retrieved later.
773
+ */
774
+ const createTeamWebhook = (options) => (options.client ?? client).post({
775
+ responseType: 'json',
776
+ security: [{ scheme: 'bearer', type: 'http' }],
777
+ url: '/teams/{teampath}/webhooks',
778
+ ...options,
779
+ headers: {
780
+ 'Content-Type': 'application/json',
781
+ ...options.headers
782
+ }
783
+ });
784
+ /**
785
+ * Delete a team webhook.
786
+ */
787
+ const deleteTeamWebhook = (options) => (options.client ?? client).delete({
788
+ security: [{ scheme: 'bearer', type: 'http' }],
789
+ url: '/teams/{teampath}/webhooks/{hookId}',
790
+ ...options
791
+ });
792
+ /**
793
+ * Get a webhook in a team workspace.
794
+ */
795
+ const getTeamWebhook = (options) => (options.client ?? client).get({
796
+ responseType: 'json',
797
+ security: [{ scheme: 'bearer', type: 'http' }],
798
+ url: '/teams/{teampath}/webhooks/{hookId}',
799
+ ...options
800
+ });
801
+ /**
802
+ * Update a team webhook. At least one of name, url, or active is required.
803
+ * Scope and event selection cannot be changed.
804
+ */
805
+ const updateTeamWebhook = (options) => (options.client ?? client).patch({
806
+ responseType: 'json',
807
+ security: [{ scheme: 'bearer', type: 'http' }],
808
+ url: '/teams/{teampath}/webhooks/{hookId}',
809
+ ...options,
810
+ headers: {
811
+ 'Content-Type': 'application/json',
812
+ ...options.headers
813
+ }
814
+ });
815
+ /**
816
+ * Send a test delivery for a team webhook.
817
+ */
818
+ const pingTeamWebhook = (options) => (options.client ?? client).post({
819
+ security: [{ scheme: 'bearer', type: 'http' }],
820
+ url: '/teams/{teampath}/webhooks/{hookId}/ping',
821
+ ...options
822
+ });
823
+ /**
824
+ * List team webhook deliveries within the plan's retention window.
825
+ */
826
+ const listTeamWebhookDeliveries = (options) => (options.client ?? client).get({
827
+ responseType: 'json',
828
+ security: [{ scheme: 'bearer', type: 'http' }],
829
+ url: '/teams/{teampath}/webhooks/{hookId}/deliveries',
830
+ ...options
831
+ });
832
+ /**
833
+ * Download team webhook deliveries as newline-delimited JSON.
834
+ */
835
+ const exportTeamWebhookDeliveries = (options) => (options.client ?? client).get({
836
+ responseType: 'blob',
837
+ security: [{ scheme: 'bearer', type: 'http' }],
838
+ url: '/teams/{teampath}/webhooks/{hookId}/deliveries/export',
839
+ ...options
840
+ });
841
+ /**
842
+ * Get a team webhook delivery within the plan's retention window.
843
+ */
844
+ const getTeamWebhookDelivery = (options) => (options.client ?? client).get({
845
+ responseType: 'json',
846
+ security: [{ scheme: 'bearer', type: 'http' }],
847
+ url: '/teams/{teampath}/webhooks/{hookId}/deliveries/{deliveryId}',
848
+ ...options
849
+ });
850
+ /**
851
+ * List all notes for the current user
852
+ */
853
+ const listNotes = (options) => (options?.client ?? client).get({
854
+ responseType: 'json',
855
+ security: [{ scheme: 'bearer', type: 'http' }],
856
+ url: '/notes',
857
+ ...options
858
+ });
859
+ /**
860
+ * Create a new note for the current user
861
+ */
862
+ const createNote = (options) => (options?.client ?? client).post({
863
+ responseType: 'json',
864
+ security: [{ scheme: 'bearer', type: 'http' }],
865
+ url: '/notes',
866
+ ...options,
867
+ headers: {
868
+ 'Content-Type': 'application/json',
869
+ ...options?.headers
870
+ }
871
+ });
872
+ /**
873
+ * Delete a note for the current user
874
+ */
875
+ const deleteNote = (options) => (options.client ?? client).delete({
876
+ security: [{ scheme: 'bearer', type: 'http' }],
877
+ url: '/notes/{noteId}',
878
+ ...options
879
+ });
880
+ /**
881
+ * Get a single note for the current user (or team note if accessible)
882
+ */
883
+ const getNote = (options) => (options.client ?? client).get({
884
+ responseType: 'json',
885
+ security: [{ scheme: 'bearer', type: 'http' }],
886
+ url: '/notes/{noteId}',
887
+ ...options
888
+ });
889
+ /**
890
+ * Update a note's content or permissions for the current user
891
+ */
892
+ const updateNote = (options) => (options.client ?? client).patch({
893
+ security: [{ scheme: 'bearer', type: 'http' }],
894
+ url: '/notes/{noteId}',
895
+ ...options,
896
+ headers: {
897
+ 'Content-Type': 'application/json',
898
+ ...options.headers
899
+ }
900
+ });
901
+ /**
902
+ * List all folders in the current user's workspace
903
+ */
904
+ const listFolders = (options) => (options?.client ?? client).get({
905
+ responseType: 'json',
906
+ security: [{ scheme: 'bearer', type: 'http' }],
907
+ url: '/folders',
908
+ ...options
909
+ });
910
+ /**
911
+ * Create a new folder in the current user's workspace
912
+ */
913
+ const createFolder = (options) => (options?.client ?? client).post({
914
+ responseType: 'json',
915
+ security: [{ scheme: 'bearer', type: 'http' }],
916
+ url: '/folders',
917
+ ...options,
918
+ headers: {
919
+ 'Content-Type': 'application/json',
920
+ ...options?.headers
921
+ }
922
+ });
923
+ /**
924
+ * Get your personal folder ordering for this workspace (parent folder id or `root` → ordered child folder ids).
925
+ * Uses the same folder UUIDs as (not internal Yjs clientIds).
926
+ */
927
+ const getFolderOrder = (options) => (options?.client ?? client).get({
928
+ responseType: 'json',
929
+ security: [{ scheme: 'bearer', type: 'http' }],
930
+ url: '/folders/folder-order',
931
+ ...options
932
+ });
933
+ /**
934
+ * Replace your personal folder ordering for this workspace.
935
+ */
936
+ const updateFolderOrder = (options) => (options?.client ?? client).put({
937
+ security: [{ scheme: 'bearer', type: 'http' }],
938
+ url: '/folders/folder-order',
939
+ ...options,
940
+ headers: {
941
+ 'Content-Type': 'application/json',
942
+ ...options?.headers
943
+ }
944
+ });
945
+ /**
946
+ * Delete a folder in the current user's workspace
947
+ */
948
+ const deleteFolder = (options) => (options.client ?? client).delete({
949
+ security: [{ scheme: 'bearer', type: 'http' }],
950
+ url: '/folders/{folderId}',
951
+ ...options
952
+ });
953
+ /**
954
+ * Get a single folder in the current user's workspace
955
+ */
956
+ const getFolder = (options) => (options.client ?? client).get({
957
+ responseType: 'json',
958
+ security: [{ scheme: 'bearer', type: 'http' }],
959
+ url: '/folders/{folderId}',
960
+ ...options
961
+ });
962
+ /**
963
+ * Update a folder in the current user's workspace
964
+ */
965
+ const updateFolder = (options) => (options.client ?? client).patch({
966
+ security: [{ scheme: 'bearer', type: 'http' }],
967
+ url: '/folders/{folderId}',
968
+ ...options,
969
+ headers: {
970
+ 'Content-Type': 'application/json',
971
+ ...options.headers
972
+ }
973
+ });
974
+ /**
975
+ * List trashed notes in your personal workspace (same data as the internal trash API).
976
+ */
977
+ const listTrash = (options) => (options?.client ?? client).get({
978
+ responseType: 'json',
979
+ security: [{ scheme: 'bearer', type: 'http' }],
980
+ url: '/trash',
981
+ ...options
982
+ });
983
+ /**
984
+ * Restore multiple notes from trash in one request.
985
+ */
986
+ const batchRestore = (options) => (options.client ?? client).put({
987
+ responseType: 'json',
988
+ security: [{ scheme: 'bearer', type: 'http' }],
989
+ url: '/trash/batch-restore',
990
+ ...options,
991
+ headers: {
992
+ 'Content-Type': 'application/json',
993
+ ...options.headers
994
+ }
995
+ });
996
+ /**
997
+ * Restore a single note from trash.
998
+ */
999
+ const restoreNote = (options) => (options.client ?? client).put({
1000
+ security: [{ scheme: 'bearer', type: 'http' }],
1001
+ url: '/trash/{noteId}/restore',
1002
+ ...options
1003
+ });
1004
+ /**
1005
+ * List trashed notes in a team workspace (team admin only; same rules as the internal API).
1006
+ */
1007
+ const listTeamTrash = (options) => (options.client ?? client).get({
1008
+ responseType: 'json',
1009
+ security: [{ scheme: 'bearer', type: 'http' }],
1010
+ url: '/teams/{teampath}/trash',
1011
+ ...options
1012
+ });
1013
+ /**
1014
+ * List the teams for the current user
1015
+ */
1016
+ const listTeams = (options) => (options?.client ?? client).get({
1017
+ responseType: 'json',
1018
+ security: [{ scheme: 'bearer', type: 'http' }],
1019
+ url: '/teams',
1020
+ ...options
1021
+ });
1022
+ /**
1023
+ * List all notes for a team
1024
+ */
1025
+ const listTeamNotes = (options) => (options.client ?? client).get({
1026
+ responseType: 'json',
1027
+ security: [{ scheme: 'bearer', type: 'http' }],
1028
+ url: '/teams/{teampath}/notes',
1029
+ ...options
1030
+ });
1031
+ /**
1032
+ * Create a new note for a team
1033
+ */
1034
+ const createTeamNote = (options) => (options.client ?? client).post({
1035
+ responseType: 'json',
1036
+ security: [{ scheme: 'bearer', type: 'http' }],
1037
+ url: '/teams/{teampath}/notes',
1038
+ ...options,
1039
+ headers: {
1040
+ 'Content-Type': 'application/json',
1041
+ ...options.headers
1042
+ }
1043
+ });
1044
+ /**
1045
+ * Delete a team note
1046
+ */
1047
+ const deleteTeamNote = (options) => (options.client ?? client).delete({
1048
+ security: [{ scheme: 'bearer', type: 'http' }],
1049
+ url: '/teams/{teampath}/notes/{noteId}',
1050
+ ...options
1051
+ });
1052
+ /**
1053
+ * Get a single note for a team
1054
+ */
1055
+ const getTeamNote = (options) => (options.client ?? client).get({
1056
+ responseType: 'json',
1057
+ security: [{ scheme: 'bearer', type: 'http' }],
1058
+ url: '/teams/{teampath}/notes/{noteId}',
1059
+ ...options
1060
+ });
1061
+ /**
1062
+ * Update a team note
1063
+ */
1064
+ const updateTeamNote = (options) => (options.client ?? client).patch({
1065
+ security: [{ scheme: 'bearer', type: 'http' }],
1066
+ url: '/teams/{teampath}/notes/{noteId}',
1067
+ ...options,
1068
+ headers: {
1069
+ 'Content-Type': 'application/json',
1070
+ ...options.headers
1071
+ }
1072
+ });
1073
+ /**
1074
+ * List all folders in a team workspace
1075
+ */
1076
+ const listTeamFolders = (options) => (options.client ?? client).get({
1077
+ responseType: 'json',
1078
+ security: [{ scheme: 'bearer', type: 'http' }],
1079
+ url: '/teams/{teampath}/folders',
1080
+ ...options
1081
+ });
1082
+ /**
1083
+ * Create a new folder in a team workspace
1084
+ */
1085
+ const createTeamFolder = (options) => (options.client ?? client).post({
1086
+ responseType: 'json',
1087
+ security: [{ scheme: 'bearer', type: 'http' }],
1088
+ url: '/teams/{teampath}/folders',
1089
+ ...options,
1090
+ headers: {
1091
+ 'Content-Type': 'application/json',
1092
+ ...options.headers
1093
+ }
1094
+ });
1095
+ /**
1096
+ * Get your personal folder ordering for this team workspace (parent folder id or `root` → ordered child folder ids).
1097
+ * Uses the same folder UUIDs as (not internal Yjs clientIds).
1098
+ */
1099
+ const getTeamFolderOrder = (options) => (options.client ?? client).get({
1100
+ responseType: 'json',
1101
+ security: [{ scheme: 'bearer', type: 'http' }],
1102
+ url: '/teams/{teampath}/folders/folder-order',
1103
+ ...options
1104
+ });
1105
+ /**
1106
+ * Replace your personal folder ordering for this team workspace.
1107
+ */
1108
+ const updateTeamFolderOrder = (options) => (options.client ?? client).put({
1109
+ security: [{ scheme: 'bearer', type: 'http' }],
1110
+ url: '/teams/{teampath}/folders/folder-order',
1111
+ ...options,
1112
+ headers: {
1113
+ 'Content-Type': 'application/json',
1114
+ ...options.headers
1115
+ }
1116
+ });
1117
+ /**
1118
+ * Delete a folder in a team workspace
1119
+ */
1120
+ const deleteTeamFolder = (options) => (options.client ?? client).delete({
1121
+ security: [{ scheme: 'bearer', type: 'http' }],
1122
+ url: '/teams/{teampath}/folders/{folderId}',
1123
+ ...options
1124
+ });
1125
+ /**
1126
+ * Get a single folder in a team workspace
1127
+ */
1128
+ const getTeamFolder = (options) => (options.client ?? client).get({
1129
+ responseType: 'json',
1130
+ security: [{ scheme: 'bearer', type: 'http' }],
1131
+ url: '/teams/{teampath}/folders/{folderId}',
1132
+ ...options
1133
+ });
1134
+ /**
1135
+ * Update a folder in a team workspace
1136
+ */
1137
+ const updateTeamFolder = (options) => (options.client ?? client).patch({
1138
+ security: [{ scheme: 'bearer', type: 'http' }],
1139
+ url: '/teams/{teampath}/folders/{folderId}',
1140
+ ...options,
1141
+ headers: {
1142
+ 'Content-Type': 'application/json',
1143
+ ...options.headers
1144
+ }
1145
+ });
1146
+ /**
1147
+ * List note versions
1148
+ *
1149
+ * List saved versions for a note.
1150
+ */
1151
+ const listVersions = (options) => (options.client ?? client).get({
1152
+ responseType: 'json',
1153
+ security: [{ scheme: 'bearer', type: 'http' }],
1154
+ url: '/notes/{noteId}/versions',
1155
+ ...options
1156
+ });
1157
+ /**
1158
+ * Update named version metadata
1159
+ *
1160
+ * Update an existing named version's metadata with `PATCH /notes/{noteId}/versions`
1161
+ * and a `base` body field formatted as `version:{id}`. The item path
1162
+ * `/notes/{noteId}/versions/{versionId}` does not support PATCH.
1163
+ */
1164
+ const updateVersion = (options) => (options.client ?? client).patch({
1165
+ responseType: 'json',
1166
+ security: [{ scheme: 'bearer', type: 'http' }],
1167
+ url: '/notes/{noteId}/versions',
1168
+ ...options,
1169
+ headers: {
1170
+ 'Content-Type': 'application/json',
1171
+ ...options.headers
1172
+ }
1173
+ });
1174
+ /**
1175
+ * Create a named note version
1176
+ *
1177
+ * Create a named version from live note content or an existing saved version. When
1178
+ * live note content has changed, this creates and names a new saved version. When
1179
+ * live content matches the latest system version, that version is named in place and
1180
+ * returned with 201. When it matches the latest user-named version, the response is
1181
+ * 409 `no_content_change`. Naming an already named `version:{id}` returns 409
1182
+ * `version_already_named`.
1183
+ */
1184
+ const createVersion = (options) => (options.client ?? client).post({
1185
+ responseType: 'json',
1186
+ security: [{ scheme: 'bearer', type: 'http' }],
1187
+ url: '/notes/{noteId}/versions',
1188
+ ...options,
1189
+ headers: {
1190
+ 'Content-Type': 'application/json',
1191
+ ...options.headers
1192
+ }
1193
+ });
1194
+ /**
1195
+ * Compare note versions
1196
+ *
1197
+ * Compare two saved versions or a saved version with live note content.
1198
+ */
1199
+ const compareVersions = (options) => (options.client ?? client).get({
1200
+ responseType: 'json',
1201
+ security: [{ scheme: 'bearer', type: 'http' }],
1202
+ url: '/notes/{noteId}/versions/compare',
1203
+ ...options
1204
+ });
1205
+ /**
1206
+ * Get a note version
1207
+ *
1208
+ * Get one saved version with reconstructed content when available.
1209
+ */
1210
+ const getVersion = (options) => (options.client ?? client).get({
1211
+ responseType: 'json',
1212
+ security: [{ scheme: 'bearer', type: 'http' }],
1213
+ url: '/notes/{noteId}/versions/{versionId}',
1214
+ ...options
1215
+ });
1216
+ /**
1217
+ * Upload an image for a note.
1218
+ */
1219
+ const uploadNoteImage = (options) => (options.client ?? client).post({
1220
+ ...formDataBodySerializer,
1221
+ responseType: 'json',
1222
+ security: [{ scheme: 'bearer', type: 'http' }],
1223
+ url: '/notes/{noteId}/images',
1224
+ ...options,
1225
+ headers: {
1226
+ 'Content-Type': null,
1227
+ ...options.headers
1228
+ }
1229
+ });
1230
+ /**
1231
+ * List comments and replies visible on a note.
1232
+ */
1233
+ const listNoteComments = (options) => (options.client ?? client).get({
1234
+ responseType: 'json',
1235
+ security: [{ scheme: 'bearer', type: 'http' }],
1236
+ url: '/notes/{noteId}/comments',
1237
+ ...options
1238
+ });
1239
+ /**
1240
+ * Get one comment or reply from a note.
1241
+ */
1242
+ const getNoteComment = (options) => (options.client ?? client).get({
1243
+ responseType: 'json',
1244
+ security: [{ scheme: 'bearer', type: 'http' }],
1245
+ url: '/notes/{noteId}/comments/{commentId}',
1246
+ ...options
1247
+ });
1248
+ /**
1249
+ * Unresolve a comment or thread.
1250
+ */
1251
+ const unresolveNoteComment = (options) => (options.client ?? client).delete({
1252
+ responseType: 'json',
1253
+ security: [{ scheme: 'bearer', type: 'http' }],
1254
+ url: '/notes/{noteId}/comments/{commentId}/resolution',
1255
+ ...options
1256
+ });
1257
+ /**
1258
+ * Resolve a comment or thread.
1259
+ */
1260
+ const resolveNoteComment = (options) => (options.client ?? client).put({
1261
+ responseType: 'json',
1262
+ security: [{ scheme: 'bearer', type: 'http' }],
1263
+ url: '/notes/{noteId}/comments/{commentId}/resolution',
1264
+ ...options
1265
+ });
1266
+ /**
1267
+ * Get the current user's profile
1268
+ */
1269
+ const getMe = (options) => (options?.client ?? client).get({
1270
+ responseType: 'json',
1271
+ security: [{ scheme: 'bearer', type: 'http' }],
1272
+ url: '/me',
1273
+ ...options
1274
+ });
1275
+ /**
1276
+ * Get note history for the current user
1277
+ */
1278
+ const getHistory = (options) => (options?.client ?? client).get({
1279
+ responseType: 'json',
1280
+ security: [{ scheme: 'bearer', type: 'http' }],
1281
+ url: '/history',
1282
+ ...options
1283
+ });
1284
+
1285
+ export { createVersion as $, deleteTeamFolder as A, getTeamFolderOrder as B, updateTeamFolderOrder as C, listWebhooks as D, getWebhook as E, createWebhook as F, updateWebhook as G, deleteWebhook as H, listTeamWebhooks as I, getTeamWebhook as J, createTeamWebhook as K, updateTeamWebhook as L, deleteTeamWebhook as M, pingWebhook as N, listWebhookDeliveries as O, getWebhookDelivery as P, exportWebhookDeliveries as Q, pingTeamWebhook as R, listTeamWebhookDeliveries as S, getTeamWebhookDelivery as T, exportTeamWebhookDeliveries as U, listTrash as V, batchRestore as W, restoreNote as X, listTeamTrash as Y, listVersions as Z, getVersion as _, getHistory as a, updateVersion as a0, compareVersions as a1, listNoteComments as a2, getNoteComment as a3, resolveNoteComment as a4, unresolveNoteComment as a5, client as a6, createConfig as a7, getNote as b, createClient as c, createNote as d, deleteNote as e, uploadNoteImage as f, getMe as g, listTeams as h, getTeamNote as i, listTeamNotes as j, createTeamNote as k, listNotes as l, updateTeamNote as m, deleteTeamNote as n, listFolders as o, createFolder as p, getFolder as q, updateFolder as r, deleteFolder as s, getFolderOrder as t, updateNote as u, updateFolderOrder as v, listTeamFolders as w, createTeamFolder as x, getTeamFolder as y, updateTeamFolder as z };
1286
+ //# sourceMappingURL=sdk.gen-0nBaZJhE.js.map