@zilfu/sdk 0.0.1 → 0.1.1
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/LICENSE +21 -0
- package/README.md +116 -20
- package/dist/index.cjs +733 -661
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +521 -382
- package/dist/index.d.ts +521 -382
- package/dist/index.js +733 -623
- package/dist/index.js.map +1 -1
- package/package.json +15 -18
- package/openapi.json +0 -3541
- package/src/client.ts +0 -38
- package/src/generated/client/client.gen.ts +0 -268
- package/src/generated/client/index.ts +0 -25
- package/src/generated/client/types.gen.ts +0 -268
- package/src/generated/client/utils.gen.ts +0 -331
- package/src/generated/client.gen.ts +0 -18
- package/src/generated/core/auth.gen.ts +0 -42
- package/src/generated/core/bodySerializer.gen.ts +0 -92
- package/src/generated/core/params.gen.ts +0 -153
- package/src/generated/core/pathSerializer.gen.ts +0 -181
- package/src/generated/core/serverSentEvents.gen.ts +0 -264
- package/src/generated/core/types.gen.ts +0 -118
- package/src/generated/core/utils.gen.ts +0 -143
- package/src/generated/index.ts +0 -4
- package/src/generated/sdk.gen.ts +0 -695
- package/src/generated/types.gen.ts +0 -2564
- package/src/index.ts +0 -5
package/dist/index.cjs
CHANGED
|
@@ -27,14 +27,11 @@ var formDataBodySerializer = {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
var jsonBodySerializer = {
|
|
30
|
-
bodySerializer: (body) => JSON.stringify(
|
|
31
|
-
body,
|
|
32
|
-
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
33
|
-
)
|
|
30
|
+
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
34
31
|
};
|
|
35
32
|
|
|
36
33
|
// src/generated/core/serverSentEvents.gen.ts
|
|
37
|
-
|
|
34
|
+
function createSseClient({
|
|
38
35
|
onRequest,
|
|
39
36
|
onSseError,
|
|
40
37
|
onSseEvent,
|
|
@@ -46,7 +43,7 @@ var createSseClient = ({
|
|
|
46
43
|
sseSleepFn,
|
|
47
44
|
url,
|
|
48
45
|
...options
|
|
49
|
-
})
|
|
46
|
+
}) {
|
|
50
47
|
let lastEventId;
|
|
51
48
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
52
49
|
const createStream = async function* () {
|
|
@@ -74,10 +71,7 @@ var createSseClient = ({
|
|
|
74
71
|
}
|
|
75
72
|
const _fetch = options.fetch ?? globalThis.fetch;
|
|
76
73
|
const response = await _fetch(request);
|
|
77
|
-
if (!response.ok)
|
|
78
|
-
throw new Error(
|
|
79
|
-
`SSE failed: ${response.status} ${response.statusText}`
|
|
80
|
-
);
|
|
74
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
81
75
|
if (!response.body) throw new Error("No body in SSE response");
|
|
82
76
|
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
83
77
|
let buffer = "";
|
|
@@ -93,6 +87,7 @@ var createSseClient = ({
|
|
|
93
87
|
const { done, value } = await reader.read();
|
|
94
88
|
if (done) break;
|
|
95
89
|
buffer += value;
|
|
90
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
96
91
|
const chunks = buffer.split("\n\n");
|
|
97
92
|
buffer = chunks.pop() ?? "";
|
|
98
93
|
for (const chunk of chunks) {
|
|
@@ -107,10 +102,7 @@ var createSseClient = ({
|
|
|
107
102
|
} else if (line.startsWith("id:")) {
|
|
108
103
|
lastEventId = line.replace(/^id:\s*/, "");
|
|
109
104
|
} else if (line.startsWith("retry:")) {
|
|
110
|
-
const parsed = Number.parseInt(
|
|
111
|
-
line.replace(/^retry:\s*/, ""),
|
|
112
|
-
10
|
|
113
|
-
);
|
|
105
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
114
106
|
if (!Number.isNaN(parsed)) {
|
|
115
107
|
retryDelay = parsed;
|
|
116
108
|
}
|
|
@@ -156,17 +148,14 @@ var createSseClient = ({
|
|
|
156
148
|
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
157
149
|
break;
|
|
158
150
|
}
|
|
159
|
-
const backoff = Math.min(
|
|
160
|
-
retryDelay * 2 ** (attempt - 1),
|
|
161
|
-
sseMaxRetryDelay ?? 3e4
|
|
162
|
-
);
|
|
151
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
163
152
|
await sleep(backoff);
|
|
164
153
|
}
|
|
165
154
|
}
|
|
166
155
|
};
|
|
167
156
|
const stream = createStream();
|
|
168
157
|
return { stream };
|
|
169
|
-
}
|
|
158
|
+
}
|
|
170
159
|
|
|
171
160
|
// src/generated/core/pathSerializer.gen.ts
|
|
172
161
|
var separatorArrayExplode = (style) => {
|
|
@@ -267,11 +256,7 @@ var serializeObjectParam = ({
|
|
|
267
256
|
if (style !== "deepObject" && !explode) {
|
|
268
257
|
let values = [];
|
|
269
258
|
Object.entries(value).forEach(([key, v]) => {
|
|
270
|
-
values = [
|
|
271
|
-
...values,
|
|
272
|
-
key,
|
|
273
|
-
allowReserved ? v : encodeURIComponent(v)
|
|
274
|
-
];
|
|
259
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
275
260
|
});
|
|
276
261
|
const joinedValues2 = values.join(",");
|
|
277
262
|
switch (style) {
|
|
@@ -322,10 +307,7 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
322
307
|
continue;
|
|
323
308
|
}
|
|
324
309
|
if (Array.isArray(value)) {
|
|
325
|
-
url = url.replace(
|
|
326
|
-
match,
|
|
327
|
-
serializeArrayParam({ explode, name, style, value })
|
|
328
|
-
);
|
|
310
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
329
311
|
continue;
|
|
330
312
|
}
|
|
331
313
|
if (typeof value === "object") {
|
|
@@ -413,9 +395,8 @@ var getAuthToken = async (auth, callback) => {
|
|
|
413
395
|
|
|
414
396
|
// src/generated/client/utils.gen.ts
|
|
415
397
|
var createQuerySerializer = ({
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
object
|
|
398
|
+
parameters = {},
|
|
399
|
+
...args
|
|
419
400
|
} = {}) => {
|
|
420
401
|
const querySerializer = (queryParams) => {
|
|
421
402
|
const search = [];
|
|
@@ -425,29 +406,30 @@ var createQuerySerializer = ({
|
|
|
425
406
|
if (value === void 0 || value === null) {
|
|
426
407
|
continue;
|
|
427
408
|
}
|
|
409
|
+
const options = parameters[name] || args;
|
|
428
410
|
if (Array.isArray(value)) {
|
|
429
411
|
const serializedArray = serializeArrayParam({
|
|
430
|
-
allowReserved,
|
|
412
|
+
allowReserved: options.allowReserved,
|
|
431
413
|
explode: true,
|
|
432
414
|
name,
|
|
433
415
|
style: "form",
|
|
434
416
|
value,
|
|
435
|
-
...array
|
|
417
|
+
...options.array
|
|
436
418
|
});
|
|
437
419
|
if (serializedArray) search.push(serializedArray);
|
|
438
420
|
} else if (typeof value === "object") {
|
|
439
421
|
const serializedObject = serializeObjectParam({
|
|
440
|
-
allowReserved,
|
|
422
|
+
allowReserved: options.allowReserved,
|
|
441
423
|
explode: true,
|
|
442
424
|
name,
|
|
443
425
|
style: "deepObject",
|
|
444
426
|
value,
|
|
445
|
-
...object
|
|
427
|
+
...options.object
|
|
446
428
|
});
|
|
447
429
|
if (serializedObject) search.push(serializedObject);
|
|
448
430
|
} else {
|
|
449
431
|
const serializedPrimitive = serializePrimitiveParam({
|
|
450
|
-
allowReserved,
|
|
432
|
+
allowReserved: options.allowReserved,
|
|
451
433
|
name,
|
|
452
434
|
value
|
|
453
435
|
});
|
|
@@ -473,9 +455,7 @@ var getParseAs = (contentType) => {
|
|
|
473
455
|
if (cleanContent === "multipart/form-data") {
|
|
474
456
|
return "formData";
|
|
475
457
|
}
|
|
476
|
-
if (["application/", "audio/", "image/", "video/"].some(
|
|
477
|
-
(type) => cleanContent.startsWith(type)
|
|
478
|
-
)) {
|
|
458
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
479
459
|
return "blob";
|
|
480
460
|
}
|
|
481
461
|
if (cleanContent.startsWith("text/")) {
|
|
@@ -661,108 +641,121 @@ var createClient = (config = {}) => {
|
|
|
661
641
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
662
642
|
opts.headers.delete("Content-Type");
|
|
663
643
|
}
|
|
664
|
-
const
|
|
665
|
-
|
|
644
|
+
const resolvedOpts = opts;
|
|
645
|
+
const url = buildUrl(resolvedOpts);
|
|
646
|
+
return { opts: resolvedOpts, url };
|
|
666
647
|
};
|
|
667
648
|
const request = async (options) => {
|
|
668
|
-
const
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
649
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
650
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
651
|
+
let request2;
|
|
652
|
+
let response;
|
|
653
|
+
try {
|
|
654
|
+
const { opts, url } = await beforeRequest(options);
|
|
655
|
+
const requestInit = {
|
|
656
|
+
redirect: "follow",
|
|
657
|
+
...opts,
|
|
658
|
+
body: getValidRequestBody(opts)
|
|
659
|
+
};
|
|
660
|
+
request2 = new Request(url, requestInit);
|
|
661
|
+
for (const fn of interceptors.request.fns) {
|
|
662
|
+
if (fn) {
|
|
663
|
+
request2 = await fn(request2, opts);
|
|
664
|
+
}
|
|
678
665
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
666
|
+
const _fetch = opts.fetch;
|
|
667
|
+
response = await _fetch(request2);
|
|
668
|
+
for (const fn of interceptors.response.fns) {
|
|
669
|
+
if (fn) {
|
|
670
|
+
response = await fn(response, request2, opts);
|
|
671
|
+
}
|
|
685
672
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
673
|
+
const result = {
|
|
674
|
+
request: request2,
|
|
675
|
+
response
|
|
676
|
+
};
|
|
677
|
+
if (response.ok) {
|
|
678
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
679
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
680
|
+
let emptyData;
|
|
681
|
+
switch (parseAs) {
|
|
682
|
+
case "arrayBuffer":
|
|
683
|
+
case "blob":
|
|
684
|
+
case "text":
|
|
685
|
+
emptyData = await response[parseAs]();
|
|
686
|
+
break;
|
|
687
|
+
case "formData":
|
|
688
|
+
emptyData = new FormData();
|
|
689
|
+
break;
|
|
690
|
+
case "stream":
|
|
691
|
+
emptyData = response.body;
|
|
692
|
+
break;
|
|
693
|
+
case "json":
|
|
694
|
+
default:
|
|
695
|
+
emptyData = {};
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
699
|
+
data: emptyData,
|
|
700
|
+
...result
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
let data;
|
|
695
704
|
switch (parseAs) {
|
|
696
705
|
case "arrayBuffer":
|
|
697
706
|
case "blob":
|
|
707
|
+
case "formData":
|
|
698
708
|
case "text":
|
|
699
|
-
|
|
709
|
+
data = await response[parseAs]();
|
|
700
710
|
break;
|
|
701
|
-
case "
|
|
702
|
-
|
|
711
|
+
case "json": {
|
|
712
|
+
const text = await response.text();
|
|
713
|
+
data = text ? JSON.parse(text) : {};
|
|
703
714
|
break;
|
|
715
|
+
}
|
|
704
716
|
case "stream":
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
717
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
718
|
+
data: response.body,
|
|
719
|
+
...result
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
if (parseAs === "json") {
|
|
723
|
+
if (opts.responseValidator) {
|
|
724
|
+
await opts.responseValidator(data);
|
|
725
|
+
}
|
|
726
|
+
if (opts.responseTransformer) {
|
|
727
|
+
data = await opts.responseTransformer(data);
|
|
728
|
+
}
|
|
711
729
|
}
|
|
712
|
-
return opts.responseStyle === "data" ?
|
|
713
|
-
data
|
|
730
|
+
return opts.responseStyle === "data" ? data : {
|
|
731
|
+
data,
|
|
714
732
|
...result
|
|
715
733
|
};
|
|
716
734
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
case "json":
|
|
723
|
-
case "text":
|
|
724
|
-
data = await response[parseAs]();
|
|
725
|
-
break;
|
|
726
|
-
case "stream":
|
|
727
|
-
return opts.responseStyle === "data" ? response.body : {
|
|
728
|
-
data: response.body,
|
|
729
|
-
...result
|
|
730
|
-
};
|
|
735
|
+
const textError = await response.text();
|
|
736
|
+
let jsonError;
|
|
737
|
+
try {
|
|
738
|
+
jsonError = JSON.parse(textError);
|
|
739
|
+
} catch {
|
|
731
740
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
if (
|
|
737
|
-
|
|
741
|
+
throw jsonError ?? textError;
|
|
742
|
+
} catch (error) {
|
|
743
|
+
let finalError = error;
|
|
744
|
+
for (const fn of interceptors.error.fns) {
|
|
745
|
+
if (fn) {
|
|
746
|
+
finalError = await fn(finalError, response, request2, options);
|
|
738
747
|
}
|
|
739
748
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
const textError = await response.text();
|
|
746
|
-
let jsonError;
|
|
747
|
-
try {
|
|
748
|
-
jsonError = JSON.parse(textError);
|
|
749
|
-
} catch {
|
|
750
|
-
}
|
|
751
|
-
const error = jsonError ?? textError;
|
|
752
|
-
let finalError = error;
|
|
753
|
-
for (const fn of interceptors.error.fns) {
|
|
754
|
-
if (fn) {
|
|
755
|
-
finalError = await fn(error, response, request2, opts);
|
|
749
|
+
finalError = finalError || {};
|
|
750
|
+
if (throwOnError) {
|
|
751
|
+
throw finalError;
|
|
756
752
|
}
|
|
753
|
+
return responseStyle === "data" ? void 0 : {
|
|
754
|
+
error: finalError,
|
|
755
|
+
request: request2,
|
|
756
|
+
response
|
|
757
|
+
};
|
|
757
758
|
}
|
|
758
|
-
finalError = finalError || {};
|
|
759
|
-
if (opts.throwOnError) {
|
|
760
|
-
throw finalError;
|
|
761
|
-
}
|
|
762
|
-
return opts.responseStyle === "data" ? void 0 : {
|
|
763
|
-
error: finalError,
|
|
764
|
-
...result
|
|
765
|
-
};
|
|
766
759
|
};
|
|
767
760
|
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
768
761
|
const makeSseFn = (method) => async (options) => {
|
|
@@ -770,7 +763,6 @@ var createClient = (config = {}) => {
|
|
|
770
763
|
return createSseClient({
|
|
771
764
|
...opts,
|
|
772
765
|
body: opts.body,
|
|
773
|
-
headers: opts.headers,
|
|
774
766
|
method,
|
|
775
767
|
onRequest: async (url2, init) => {
|
|
776
768
|
let request2 = new Request(url2, init);
|
|
@@ -781,11 +773,13 @@ var createClient = (config = {}) => {
|
|
|
781
773
|
}
|
|
782
774
|
return request2;
|
|
783
775
|
},
|
|
776
|
+
serializedBody: getValidRequestBody(opts),
|
|
784
777
|
url
|
|
785
778
|
});
|
|
786
779
|
};
|
|
780
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
787
781
|
return {
|
|
788
|
-
buildUrl,
|
|
782
|
+
buildUrl: _buildUrl,
|
|
789
783
|
connect: makeMethodFn("CONNECT"),
|
|
790
784
|
delete: makeMethodFn("DELETE"),
|
|
791
785
|
get: makeMethodFn("GET"),
|
|
@@ -814,583 +808,661 @@ var createClient = (config = {}) => {
|
|
|
814
808
|
};
|
|
815
809
|
|
|
816
810
|
// src/generated/client.gen.ts
|
|
817
|
-
var client = createClient(createConfig({
|
|
818
|
-
baseUrl: "https://zilfu.app/api"
|
|
819
|
-
}));
|
|
820
|
-
|
|
821
|
-
// src/client.ts
|
|
822
|
-
function createZilfuClient(options) {
|
|
823
|
-
const { baseUrl, token, fetch: fetchImpl } = options;
|
|
824
|
-
client.setConfig({
|
|
825
|
-
baseUrl,
|
|
826
|
-
auth: typeof token === "function" ? token : token,
|
|
827
|
-
...fetchImpl ? { fetch: fetchImpl } : {}
|
|
828
|
-
});
|
|
829
|
-
}
|
|
811
|
+
var client = createClient(createConfig({ baseUrl: "https://zilfu.app/api" }));
|
|
830
812
|
|
|
831
813
|
// src/generated/sdk.gen.ts
|
|
832
|
-
var
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
type: "http"
|
|
838
|
-
}
|
|
839
|
-
],
|
|
840
|
-
url: "/spaces/{space}/accounts",
|
|
841
|
-
...options
|
|
842
|
-
});
|
|
843
|
-
};
|
|
844
|
-
var accountsIndex = (options) => {
|
|
845
|
-
return (options.client ?? client).get({
|
|
846
|
-
security: [
|
|
847
|
-
{
|
|
848
|
-
scheme: "bearer",
|
|
849
|
-
type: "http"
|
|
850
|
-
}
|
|
851
|
-
],
|
|
852
|
-
url: "/spaces/{space}/accounts",
|
|
853
|
-
...options
|
|
854
|
-
});
|
|
855
|
-
};
|
|
856
|
-
var accountsActivate = (options) => {
|
|
857
|
-
return (options.client ?? client).patch({
|
|
858
|
-
security: [
|
|
859
|
-
{
|
|
860
|
-
scheme: "bearer",
|
|
861
|
-
type: "http"
|
|
862
|
-
}
|
|
863
|
-
],
|
|
864
|
-
url: "/spaces/{space}/accounts/{account}/activate",
|
|
865
|
-
...options
|
|
866
|
-
});
|
|
867
|
-
};
|
|
868
|
-
var accountsBoards = (options) => {
|
|
869
|
-
return (options.client ?? client).get({
|
|
870
|
-
security: [
|
|
871
|
-
{
|
|
872
|
-
scheme: "bearer",
|
|
873
|
-
type: "http"
|
|
874
|
-
}
|
|
875
|
-
],
|
|
876
|
-
url: "/spaces/{space}/accounts/{account}/boards",
|
|
877
|
-
...options
|
|
878
|
-
});
|
|
879
|
-
};
|
|
880
|
-
var accountsDestroy = (options) => {
|
|
881
|
-
return (options.client ?? client).delete({
|
|
882
|
-
security: [
|
|
883
|
-
{
|
|
884
|
-
scheme: "bearer",
|
|
885
|
-
type: "http"
|
|
886
|
-
}
|
|
887
|
-
],
|
|
888
|
-
url: "/spaces/{space}/accounts/{account}",
|
|
889
|
-
...options
|
|
890
|
-
});
|
|
891
|
-
};
|
|
892
|
-
var apiTokensStore = (options) => {
|
|
893
|
-
return (options.client ?? client).post({
|
|
894
|
-
security: [
|
|
895
|
-
{
|
|
896
|
-
scheme: "bearer",
|
|
897
|
-
type: "http"
|
|
898
|
-
}
|
|
899
|
-
],
|
|
900
|
-
url: "/api-tokens",
|
|
901
|
-
...options,
|
|
902
|
-
headers: {
|
|
903
|
-
"Content-Type": "application/json",
|
|
904
|
-
...options.headers
|
|
905
|
-
}
|
|
906
|
-
});
|
|
907
|
-
};
|
|
908
|
-
var apiTokensDestroy = (options) => {
|
|
909
|
-
return (options.client ?? client).delete({
|
|
910
|
-
security: [
|
|
911
|
-
{
|
|
912
|
-
scheme: "bearer",
|
|
913
|
-
type: "http"
|
|
914
|
-
}
|
|
915
|
-
],
|
|
916
|
-
url: "/api-tokens/{tokenId}",
|
|
917
|
-
...options
|
|
918
|
-
});
|
|
919
|
-
};
|
|
920
|
-
var bioBlocksIndex = (options) => {
|
|
921
|
-
return (options.client ?? client).get({
|
|
922
|
-
security: [
|
|
923
|
-
{
|
|
924
|
-
scheme: "bearer",
|
|
925
|
-
type: "http"
|
|
926
|
-
}
|
|
927
|
-
],
|
|
928
|
-
url: "/spaces/{space}/bio/blocks",
|
|
929
|
-
...options
|
|
930
|
-
});
|
|
931
|
-
};
|
|
932
|
-
var bioBlocksStore = (options) => {
|
|
933
|
-
return (options.client ?? client).post({
|
|
934
|
-
security: [
|
|
935
|
-
{
|
|
936
|
-
scheme: "bearer",
|
|
937
|
-
type: "http"
|
|
938
|
-
}
|
|
939
|
-
],
|
|
940
|
-
url: "/spaces/{space}/bio/blocks",
|
|
941
|
-
...options,
|
|
942
|
-
headers: {
|
|
943
|
-
"Content-Type": "application/json",
|
|
944
|
-
...options.headers
|
|
945
|
-
}
|
|
946
|
-
});
|
|
947
|
-
};
|
|
948
|
-
var bioBlocksDestroy = (options) => {
|
|
949
|
-
return (options.client ?? client).delete({
|
|
950
|
-
security: [
|
|
951
|
-
{
|
|
952
|
-
scheme: "bearer",
|
|
953
|
-
type: "http"
|
|
954
|
-
}
|
|
955
|
-
],
|
|
956
|
-
url: "/spaces/{space}/bio/blocks/{block}",
|
|
957
|
-
...options
|
|
958
|
-
});
|
|
959
|
-
};
|
|
960
|
-
var bioBlocksUpdate = (options) => {
|
|
961
|
-
return (options.client ?? client).put({
|
|
962
|
-
security: [
|
|
963
|
-
{
|
|
964
|
-
scheme: "bearer",
|
|
965
|
-
type: "http"
|
|
966
|
-
}
|
|
967
|
-
],
|
|
968
|
-
url: "/spaces/{space}/bio/blocks/{block}",
|
|
969
|
-
...options,
|
|
970
|
-
headers: {
|
|
971
|
-
"Content-Type": "application/json",
|
|
972
|
-
...options.headers
|
|
973
|
-
}
|
|
974
|
-
});
|
|
975
|
-
};
|
|
976
|
-
var bioBlocksReorder = (options) => {
|
|
977
|
-
return (options.client ?? client).post({
|
|
978
|
-
security: [
|
|
979
|
-
{
|
|
980
|
-
scheme: "bearer",
|
|
981
|
-
type: "http"
|
|
982
|
-
}
|
|
983
|
-
],
|
|
984
|
-
url: "/spaces/{space}/bio/blocks/{block}/reorder",
|
|
985
|
-
...options,
|
|
986
|
-
headers: {
|
|
987
|
-
"Content-Type": "application/json",
|
|
988
|
-
...options.headers
|
|
989
|
-
}
|
|
990
|
-
});
|
|
991
|
-
};
|
|
992
|
-
var bioShow = (options) => {
|
|
993
|
-
return (options.client ?? client).get({
|
|
994
|
-
security: [
|
|
995
|
-
{
|
|
996
|
-
scheme: "bearer",
|
|
997
|
-
type: "http"
|
|
998
|
-
}
|
|
999
|
-
],
|
|
1000
|
-
url: "/spaces/{space}/bio",
|
|
1001
|
-
...options
|
|
1002
|
-
});
|
|
1003
|
-
};
|
|
1004
|
-
var bioStore = (options) => {
|
|
1005
|
-
return (options.client ?? client).post({
|
|
1006
|
-
security: [
|
|
1007
|
-
{
|
|
1008
|
-
scheme: "bearer",
|
|
1009
|
-
type: "http"
|
|
1010
|
-
}
|
|
1011
|
-
],
|
|
1012
|
-
url: "/spaces/{space}/bio",
|
|
1013
|
-
...options,
|
|
1014
|
-
headers: {
|
|
1015
|
-
"Content-Type": "application/json",
|
|
1016
|
-
...options.headers
|
|
1017
|
-
}
|
|
1018
|
-
});
|
|
814
|
+
var HeyApiClient = class {
|
|
815
|
+
client;
|
|
816
|
+
constructor(args) {
|
|
817
|
+
this.client = args?.client ?? client;
|
|
818
|
+
}
|
|
1019
819
|
};
|
|
1020
|
-
var
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
],
|
|
1028
|
-
url: "/spaces/{space}/bio",
|
|
1029
|
-
...options,
|
|
1030
|
-
headers: {
|
|
1031
|
-
"Content-Type": "application/json",
|
|
1032
|
-
...options.headers
|
|
820
|
+
var HeyApiRegistry = class {
|
|
821
|
+
defaultKey = "default";
|
|
822
|
+
instances = /* @__PURE__ */ new Map();
|
|
823
|
+
get(key) {
|
|
824
|
+
const instance = this.instances.get(key ?? this.defaultKey);
|
|
825
|
+
if (!instance) {
|
|
826
|
+
throw new Error(`No SDK client found. Create one with "new ZilfuApi()" to fix this error.`);
|
|
1033
827
|
}
|
|
1034
|
-
|
|
828
|
+
return instance;
|
|
829
|
+
}
|
|
830
|
+
set(value, key) {
|
|
831
|
+
this.instances.set(key ?? this.defaultKey, value);
|
|
832
|
+
}
|
|
1035
833
|
};
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
834
|
+
var Accounts = class extends HeyApiClient {
|
|
835
|
+
/**
|
|
836
|
+
* Disconnect multiple accounts
|
|
837
|
+
*
|
|
838
|
+
* Removes several social account connections in a single request and dispatches a webhook event for each.
|
|
839
|
+
*/
|
|
840
|
+
deleteMany(options) {
|
|
841
|
+
return (options.client ?? this.client).delete({
|
|
842
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
843
|
+
url: "/spaces/{space}/accounts",
|
|
844
|
+
...options
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* List accounts
|
|
849
|
+
*
|
|
850
|
+
* Returns all connected social accounts for the given space.
|
|
851
|
+
*/
|
|
852
|
+
list(options) {
|
|
853
|
+
return (options.client ?? this.client).get({
|
|
854
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
855
|
+
url: "/spaces/{space}/accounts",
|
|
856
|
+
...options
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Activate an account
|
|
861
|
+
*
|
|
862
|
+
* Activates the given account and deactivates all other accounts on the same platform within the space.
|
|
863
|
+
*/
|
|
864
|
+
activate(options) {
|
|
865
|
+
return (options.client ?? this.client).patch({
|
|
866
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
867
|
+
url: "/spaces/{space}/accounts/{account}/activate",
|
|
868
|
+
...options
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* List Pinterest boards
|
|
873
|
+
*
|
|
874
|
+
* Returns the Pinterest boards available for the given account.
|
|
875
|
+
*/
|
|
876
|
+
boards(options) {
|
|
877
|
+
return (options.client ?? this.client).get({
|
|
878
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
879
|
+
url: "/spaces/{space}/accounts/{account}/boards",
|
|
880
|
+
...options
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Disconnect an account
|
|
885
|
+
*
|
|
886
|
+
* Removes the social account connection and dispatches a webhook event.
|
|
887
|
+
*/
|
|
888
|
+
delete(options) {
|
|
889
|
+
return (options.client ?? this.client).delete({
|
|
890
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
891
|
+
url: "/spaces/{space}/accounts/{account}",
|
|
892
|
+
...options
|
|
893
|
+
});
|
|
894
|
+
}
|
|
1052
895
|
};
|
|
1053
|
-
var
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
896
|
+
var ApiTokens = class extends HeyApiClient {
|
|
897
|
+
/**
|
|
898
|
+
* Create an API token
|
|
899
|
+
*
|
|
900
|
+
* Generates a new personal access token for the authenticated user.
|
|
901
|
+
*/
|
|
902
|
+
create(options) {
|
|
903
|
+
return (options.client ?? this.client).post({
|
|
904
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
905
|
+
url: "/api-tokens",
|
|
906
|
+
...options,
|
|
907
|
+
headers: {
|
|
908
|
+
"Content-Type": "application/json",
|
|
909
|
+
...options.headers
|
|
1060
910
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Revoke an API token
|
|
915
|
+
*
|
|
916
|
+
* Deletes the specified personal access token.
|
|
917
|
+
*/
|
|
918
|
+
delete(options) {
|
|
919
|
+
return (options.client ?? this.client).delete({
|
|
920
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
921
|
+
url: "/api-tokens/{tokenId}",
|
|
922
|
+
...options
|
|
923
|
+
});
|
|
924
|
+
}
|
|
1069
925
|
};
|
|
1070
|
-
var
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
{
|
|
1074
|
-
|
|
1075
|
-
|
|
926
|
+
var Blocks = class extends HeyApiClient {
|
|
927
|
+
list(options) {
|
|
928
|
+
return (options.client ?? this.client).get({
|
|
929
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
930
|
+
url: "/spaces/{space}/bio/blocks",
|
|
931
|
+
...options
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
create(options) {
|
|
935
|
+
return (options.client ?? this.client).post({
|
|
936
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
937
|
+
url: "/spaces/{space}/bio/blocks",
|
|
938
|
+
...options,
|
|
939
|
+
headers: {
|
|
940
|
+
"Content-Type": "application/json",
|
|
941
|
+
...options.headers
|
|
1076
942
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
delete(options) {
|
|
946
|
+
return (options.client ?? this.client).delete({
|
|
947
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
948
|
+
url: "/spaces/{space}/bio/blocks/{block}",
|
|
949
|
+
...options
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
update(options) {
|
|
953
|
+
return (options.client ?? this.client).put({
|
|
954
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
955
|
+
url: "/spaces/{space}/bio/blocks/{block}",
|
|
956
|
+
...options,
|
|
957
|
+
headers: {
|
|
958
|
+
"Content-Type": "application/json",
|
|
959
|
+
...options.headers
|
|
1088
960
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
type: "http"
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
reorder(options) {
|
|
964
|
+
return (options.client ?? this.client).post({
|
|
965
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
966
|
+
url: "/spaces/{space}/bio/blocks/{block}/reorder",
|
|
967
|
+
...options,
|
|
968
|
+
headers: {
|
|
969
|
+
"Content-Type": "application/json",
|
|
970
|
+
...options.headers
|
|
1100
971
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
...options,
|
|
1104
|
-
headers: {
|
|
1105
|
-
"Content-Type": "application/json",
|
|
1106
|
-
...options.headers
|
|
1107
|
-
}
|
|
1108
|
-
});
|
|
972
|
+
});
|
|
973
|
+
}
|
|
1109
974
|
};
|
|
1110
|
-
var
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
{
|
|
1114
|
-
|
|
1115
|
-
|
|
975
|
+
var Bio = class extends HeyApiClient {
|
|
976
|
+
get(options) {
|
|
977
|
+
return (options.client ?? this.client).get({
|
|
978
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
979
|
+
url: "/spaces/{space}/bio",
|
|
980
|
+
...options
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
create(options) {
|
|
984
|
+
return (options.client ?? this.client).post({
|
|
985
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
986
|
+
url: "/spaces/{space}/bio",
|
|
987
|
+
...options,
|
|
988
|
+
headers: {
|
|
989
|
+
"Content-Type": "application/json",
|
|
990
|
+
...options.headers
|
|
1116
991
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
type: "http"
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
update(options) {
|
|
995
|
+
return (options.client ?? this.client).put({
|
|
996
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
997
|
+
url: "/spaces/{space}/bio",
|
|
998
|
+
...options,
|
|
999
|
+
headers: {
|
|
1000
|
+
"Content-Type": "application/json",
|
|
1001
|
+
...options.headers
|
|
1128
1002
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
{
|
|
1138
|
-
|
|
1139
|
-
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
uploadAvatar(options) {
|
|
1006
|
+
return (options.client ?? this.client).post({
|
|
1007
|
+
...formDataBodySerializer,
|
|
1008
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1009
|
+
url: "/spaces/{space}/bio/avatar",
|
|
1010
|
+
...options,
|
|
1011
|
+
headers: {
|
|
1012
|
+
"Content-Type": null,
|
|
1013
|
+
...options.headers
|
|
1140
1014
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
_blocks;
|
|
1018
|
+
get blocks() {
|
|
1019
|
+
return this._blocks ??= new Blocks({ client: this.client });
|
|
1020
|
+
}
|
|
1149
1021
|
};
|
|
1150
|
-
var
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
{
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
url: "/spaces/{space}/clusters/{cluster_id}",
|
|
1159
|
-
...options,
|
|
1160
|
-
headers: {
|
|
1161
|
-
"Content-Type": "application/json",
|
|
1162
|
-
...options.headers
|
|
1163
|
-
}
|
|
1164
|
-
});
|
|
1022
|
+
var Health = class extends HeyApiClient {
|
|
1023
|
+
check(options) {
|
|
1024
|
+
return (options?.client ?? this.client).get({
|
|
1025
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1026
|
+
url: "/health",
|
|
1027
|
+
...options
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1165
1030
|
};
|
|
1166
|
-
var
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1031
|
+
var Media = class extends HeyApiClient {
|
|
1032
|
+
/**
|
|
1033
|
+
* Upload a media file
|
|
1034
|
+
*
|
|
1035
|
+
* Accepts images (JPEG, PNG, WebP) and videos (MP4, QuickTime). Images are auto-optimized.
|
|
1036
|
+
*/
|
|
1037
|
+
create(options) {
|
|
1038
|
+
return (options.client ?? this.client).post({
|
|
1039
|
+
...formDataBodySerializer,
|
|
1040
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1041
|
+
url: "/media",
|
|
1042
|
+
...options,
|
|
1043
|
+
headers: {
|
|
1044
|
+
"Content-Type": null,
|
|
1045
|
+
...options.headers
|
|
1172
1046
|
}
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Delete a media file
|
|
1051
|
+
*
|
|
1052
|
+
* Removes the media file from storage and deletes the record.
|
|
1053
|
+
*/
|
|
1054
|
+
delete(options) {
|
|
1055
|
+
return (options.client ?? this.client).delete({
|
|
1056
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1057
|
+
url: "/media/{media}",
|
|
1058
|
+
...options
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1177
1061
|
};
|
|
1178
|
-
var
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1062
|
+
var Posts = class extends HeyApiClient {
|
|
1063
|
+
/**
|
|
1064
|
+
* List posts
|
|
1065
|
+
*
|
|
1066
|
+
* Returns paginated posts for the space. Filterable by status, account, and date range via query parameters.
|
|
1067
|
+
*/
|
|
1068
|
+
list(options) {
|
|
1069
|
+
return (options.client ?? this.client).get({
|
|
1070
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1071
|
+
url: "/spaces/{space}/posts",
|
|
1072
|
+
...options
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Create posts
|
|
1077
|
+
*
|
|
1078
|
+
* Creates one or more posts as a cluster. Supports draft, scheduled, or immediate publishing modes.
|
|
1079
|
+
*/
|
|
1080
|
+
create(options) {
|
|
1081
|
+
return (options.client ?? this.client).post({
|
|
1082
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1083
|
+
url: "/spaces/{space}/posts",
|
|
1084
|
+
...options,
|
|
1085
|
+
headers: {
|
|
1086
|
+
"Content-Type": "application/json",
|
|
1087
|
+
...options.headers
|
|
1184
1088
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Delete a post
|
|
1093
|
+
*
|
|
1094
|
+
* Permanently deletes the given post.
|
|
1095
|
+
*/
|
|
1096
|
+
delete(options) {
|
|
1097
|
+
return (options.client ?? this.client).delete({
|
|
1098
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1099
|
+
url: "/spaces/{space}/posts/{post}",
|
|
1100
|
+
...options
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Get a post
|
|
1105
|
+
*
|
|
1106
|
+
* Returns a single post with its account, children, and media.
|
|
1107
|
+
*/
|
|
1108
|
+
get(options) {
|
|
1109
|
+
return (options.client ?? this.client).get({
|
|
1110
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1111
|
+
url: "/spaces/{space}/posts/{post}",
|
|
1112
|
+
...options
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Update a post
|
|
1117
|
+
*
|
|
1118
|
+
* Updates a single post's content, schedule, and media attachments.
|
|
1119
|
+
*/
|
|
1120
|
+
update(options) {
|
|
1121
|
+
return (options.client ?? this.client).put({
|
|
1122
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1123
|
+
url: "/spaces/{space}/posts/{post}",
|
|
1124
|
+
...options,
|
|
1125
|
+
headers: {
|
|
1126
|
+
"Content-Type": "application/json",
|
|
1127
|
+
...options.headers
|
|
1196
1128
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
...options,
|
|
1200
|
-
headers: {
|
|
1201
|
-
"Content-Type": "application/json",
|
|
1202
|
-
...options.headers
|
|
1203
|
-
}
|
|
1204
|
-
});
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1205
1131
|
};
|
|
1206
|
-
var
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1132
|
+
var Clusters = class extends HeyApiClient {
|
|
1133
|
+
/**
|
|
1134
|
+
* Update a cluster of posts
|
|
1135
|
+
*
|
|
1136
|
+
* Updates all posts sharing the given cluster ID. Handles adding/removing accounts and re-scheduling.
|
|
1137
|
+
*/
|
|
1138
|
+
update(options) {
|
|
1139
|
+
return (options.client ?? this.client).put({
|
|
1140
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1141
|
+
url: "/spaces/{space}/clusters/{cluster_id}",
|
|
1142
|
+
...options,
|
|
1143
|
+
headers: {
|
|
1144
|
+
"Content-Type": "application/json",
|
|
1145
|
+
...options.headers
|
|
1212
1146
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
...options
|
|
1216
|
-
});
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1217
1149
|
};
|
|
1218
|
-
var
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1150
|
+
var Queue = class extends HeyApiClient {
|
|
1151
|
+
/**
|
|
1152
|
+
* Get next available queue slots
|
|
1153
|
+
*
|
|
1154
|
+
* Returns up to 9 upcoming available time slots based on the space's scheduling configuration.
|
|
1155
|
+
*/
|
|
1156
|
+
list(options) {
|
|
1157
|
+
return (options.client ?? this.client).get({
|
|
1158
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1159
|
+
url: "/spaces/{space}/queue",
|
|
1160
|
+
...options
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1229
1163
|
};
|
|
1230
|
-
var
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1164
|
+
var Slots = class extends HeyApiClient {
|
|
1165
|
+
/**
|
|
1166
|
+
* List slots
|
|
1167
|
+
*
|
|
1168
|
+
* Returns all scheduling slots for the space, ordered by day and time.
|
|
1169
|
+
*/
|
|
1170
|
+
list(options) {
|
|
1171
|
+
return (options.client ?? this.client).get({
|
|
1172
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1173
|
+
url: "/spaces/{space}/slots",
|
|
1174
|
+
...options
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Create slots
|
|
1179
|
+
*
|
|
1180
|
+
* Creates scheduling slots for the given days of the week and time.
|
|
1181
|
+
*/
|
|
1182
|
+
create(options) {
|
|
1183
|
+
return (options.client ?? this.client).post({
|
|
1184
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1185
|
+
url: "/spaces/{space}/slots",
|
|
1186
|
+
...options,
|
|
1187
|
+
headers: {
|
|
1188
|
+
"Content-Type": "application/json",
|
|
1189
|
+
...options.headers
|
|
1236
1190
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Delete a slot
|
|
1195
|
+
*
|
|
1196
|
+
* Removes a scheduling slot from the space.
|
|
1197
|
+
*/
|
|
1198
|
+
delete(options) {
|
|
1199
|
+
return (options.client ?? this.client).delete({
|
|
1200
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1201
|
+
url: "/spaces/{space}/slots/{slot}",
|
|
1202
|
+
...options
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1245
1205
|
};
|
|
1246
|
-
var
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1206
|
+
var Spaces = class extends HeyApiClient {
|
|
1207
|
+
/**
|
|
1208
|
+
* List spaces
|
|
1209
|
+
*
|
|
1210
|
+
* Returns all spaces belonging to the authenticated user, ordered by most recent.
|
|
1211
|
+
*/
|
|
1212
|
+
list(options) {
|
|
1213
|
+
return (options?.client ?? this.client).get({
|
|
1214
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1215
|
+
url: "/spaces",
|
|
1216
|
+
...options
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Create a space
|
|
1221
|
+
*
|
|
1222
|
+
* Creates a new space for the authenticated user.
|
|
1223
|
+
*/
|
|
1224
|
+
create(options) {
|
|
1225
|
+
return (options.client ?? this.client).post({
|
|
1226
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1227
|
+
url: "/spaces",
|
|
1228
|
+
...options,
|
|
1229
|
+
headers: {
|
|
1230
|
+
"Content-Type": "application/json",
|
|
1231
|
+
...options.headers
|
|
1252
1232
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Delete a space
|
|
1237
|
+
*
|
|
1238
|
+
* Permanently deletes the given space and all associated data.
|
|
1239
|
+
*/
|
|
1240
|
+
delete(options) {
|
|
1241
|
+
return (options.client ?? this.client).delete({
|
|
1242
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1243
|
+
url: "/spaces/{space}",
|
|
1244
|
+
...options
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Get a space
|
|
1249
|
+
*
|
|
1250
|
+
* Returns a single space by ID.
|
|
1251
|
+
*/
|
|
1252
|
+
get(options) {
|
|
1253
|
+
return (options.client ?? this.client).get({
|
|
1254
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1255
|
+
url: "/spaces/{space}",
|
|
1256
|
+
...options
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Update a space
|
|
1261
|
+
*
|
|
1262
|
+
* Updates the given space's settings.
|
|
1263
|
+
*/
|
|
1264
|
+
update(options) {
|
|
1265
|
+
return (options.client ?? this.client).put({
|
|
1266
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1267
|
+
url: "/spaces/{space}",
|
|
1268
|
+
...options,
|
|
1269
|
+
headers: {
|
|
1270
|
+
"Content-Type": "application/json",
|
|
1271
|
+
...options.headers
|
|
1264
1272
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
...options
|
|
1268
|
-
});
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1269
1275
|
};
|
|
1270
|
-
var
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
}
|
|
1284
|
-
});
|
|
1276
|
+
var Subscription = class extends HeyApiClient {
|
|
1277
|
+
/**
|
|
1278
|
+
* Get subscription details
|
|
1279
|
+
*
|
|
1280
|
+
* Returns the current plan, usage limits, trial status, and cancellation state.
|
|
1281
|
+
*/
|
|
1282
|
+
get(options) {
|
|
1283
|
+
return (options?.client ?? this.client).get({
|
|
1284
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1285
|
+
url: "/subscription",
|
|
1286
|
+
...options
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1285
1289
|
};
|
|
1286
|
-
var
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1290
|
+
var Webhooks = class extends HeyApiClient {
|
|
1291
|
+
/**
|
|
1292
|
+
* List webhooks
|
|
1293
|
+
*
|
|
1294
|
+
* Returns all webhooks configured for the given space.
|
|
1295
|
+
*/
|
|
1296
|
+
list(options) {
|
|
1297
|
+
return (options.client ?? this.client).get({
|
|
1298
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1299
|
+
url: "/spaces/{space}/webhooks",
|
|
1300
|
+
...options
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Create a webhook
|
|
1305
|
+
*
|
|
1306
|
+
* Registers a new webhook endpoint with an auto-generated signing secret.
|
|
1307
|
+
*/
|
|
1308
|
+
create(options) {
|
|
1309
|
+
return (options.client ?? this.client).post({
|
|
1310
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1311
|
+
url: "/spaces/{space}/webhooks",
|
|
1312
|
+
...options,
|
|
1313
|
+
headers: {
|
|
1314
|
+
"Content-Type": "application/json",
|
|
1315
|
+
...options.headers
|
|
1292
1316
|
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Delete a webhook
|
|
1321
|
+
*
|
|
1322
|
+
* Permanently removes the webhook endpoint.
|
|
1323
|
+
*/
|
|
1324
|
+
delete(options) {
|
|
1325
|
+
return (options.client ?? this.client).delete({
|
|
1326
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1327
|
+
url: "/spaces/{space}/webhooks/{webhook}",
|
|
1328
|
+
...options
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Update a webhook
|
|
1333
|
+
*
|
|
1334
|
+
* Updates the webhook's URL, events, or active status.
|
|
1335
|
+
*/
|
|
1336
|
+
update(options) {
|
|
1337
|
+
return (options.client ?? this.client).put({
|
|
1338
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1339
|
+
url: "/spaces/{space}/webhooks/{webhook}",
|
|
1340
|
+
...options,
|
|
1341
|
+
headers: {
|
|
1342
|
+
"Content-Type": "application/json",
|
|
1343
|
+
...options.headers
|
|
1304
1344
|
}
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
...options
|
|
1308
|
-
});
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1309
1347
|
};
|
|
1310
|
-
var
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1348
|
+
var ZilfuApi = class _ZilfuApi extends HeyApiClient {
|
|
1349
|
+
static __registry = new HeyApiRegistry();
|
|
1350
|
+
constructor(args) {
|
|
1351
|
+
super(args);
|
|
1352
|
+
_ZilfuApi.__registry.set(this, args?.key);
|
|
1353
|
+
}
|
|
1354
|
+
_accounts;
|
|
1355
|
+
get accounts() {
|
|
1356
|
+
return this._accounts ??= new Accounts({ client: this.client });
|
|
1357
|
+
}
|
|
1358
|
+
_apiTokens;
|
|
1359
|
+
get apiTokens() {
|
|
1360
|
+
return this._apiTokens ??= new ApiTokens({ client: this.client });
|
|
1361
|
+
}
|
|
1362
|
+
_bio;
|
|
1363
|
+
get bio() {
|
|
1364
|
+
return this._bio ??= new Bio({ client: this.client });
|
|
1365
|
+
}
|
|
1366
|
+
_health;
|
|
1367
|
+
get health() {
|
|
1368
|
+
return this._health ??= new Health({ client: this.client });
|
|
1369
|
+
}
|
|
1370
|
+
_media;
|
|
1371
|
+
get media() {
|
|
1372
|
+
return this._media ??= new Media({ client: this.client });
|
|
1373
|
+
}
|
|
1374
|
+
_posts;
|
|
1375
|
+
get posts() {
|
|
1376
|
+
return this._posts ??= new Posts({ client: this.client });
|
|
1377
|
+
}
|
|
1378
|
+
_clusters;
|
|
1379
|
+
get clusters() {
|
|
1380
|
+
return this._clusters ??= new Clusters({ client: this.client });
|
|
1381
|
+
}
|
|
1382
|
+
_queue;
|
|
1383
|
+
get queue() {
|
|
1384
|
+
return this._queue ??= new Queue({ client: this.client });
|
|
1385
|
+
}
|
|
1386
|
+
_slots;
|
|
1387
|
+
get slots() {
|
|
1388
|
+
return this._slots ??= new Slots({ client: this.client });
|
|
1389
|
+
}
|
|
1390
|
+
_spaces;
|
|
1391
|
+
get spaces() {
|
|
1392
|
+
return this._spaces ??= new Spaces({ client: this.client });
|
|
1393
|
+
}
|
|
1394
|
+
_subscription;
|
|
1395
|
+
get subscription() {
|
|
1396
|
+
return this._subscription ??= new Subscription({ client: this.client });
|
|
1397
|
+
}
|
|
1398
|
+
_webhooks;
|
|
1399
|
+
get webhooks() {
|
|
1400
|
+
return this._webhooks ??= new Webhooks({ client: this.client });
|
|
1401
|
+
}
|
|
1325
1402
|
};
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1403
|
+
|
|
1404
|
+
// src/errors.ts
|
|
1405
|
+
var ZilfuApiError = class extends Error {
|
|
1406
|
+
status;
|
|
1407
|
+
statusText;
|
|
1408
|
+
url;
|
|
1409
|
+
body;
|
|
1410
|
+
errors;
|
|
1411
|
+
constructor(init) {
|
|
1412
|
+
const message = extractMessage(init);
|
|
1413
|
+
super(message);
|
|
1414
|
+
this.name = "ZilfuApiError";
|
|
1415
|
+
this.status = init.status;
|
|
1416
|
+
this.statusText = init.statusText;
|
|
1417
|
+
this.url = init.url;
|
|
1418
|
+
this.body = init.body;
|
|
1419
|
+
this.errors = extractValidationErrors(init.body);
|
|
1420
|
+
}
|
|
1337
1421
|
};
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
}
|
|
1345
|
-
],
|
|
1346
|
-
url: "/spaces/{space}/webhooks/{webhook}",
|
|
1347
|
-
...options,
|
|
1348
|
-
headers: {
|
|
1349
|
-
"Content-Type": "application/json",
|
|
1350
|
-
...options.headers
|
|
1422
|
+
function extractMessage(init) {
|
|
1423
|
+
const body = init.body;
|
|
1424
|
+
if (body && typeof body === "object" && "message" in body) {
|
|
1425
|
+
const m = body.message;
|
|
1426
|
+
if (typeof m === "string" && m.length > 0) {
|
|
1427
|
+
return m;
|
|
1351
1428
|
}
|
|
1429
|
+
}
|
|
1430
|
+
return `Zilfu API ${init.status}${init.statusText ? ` ${init.statusText}` : ""}`;
|
|
1431
|
+
}
|
|
1432
|
+
function extractValidationErrors(body) {
|
|
1433
|
+
if (!body || typeof body !== "object" || !("errors" in body)) {
|
|
1434
|
+
return void 0;
|
|
1435
|
+
}
|
|
1436
|
+
const errors = body.errors;
|
|
1437
|
+
if (!errors || typeof errors !== "object") {
|
|
1438
|
+
return void 0;
|
|
1439
|
+
}
|
|
1440
|
+
return errors;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
// src/client.ts
|
|
1444
|
+
function createZilfuClient(opts) {
|
|
1445
|
+
const client2 = createClient(
|
|
1446
|
+
createConfig({
|
|
1447
|
+
baseUrl: opts.baseUrl ?? "https://zilfu.app/api",
|
|
1448
|
+
fetch: opts.fetch,
|
|
1449
|
+
headers: { accept: "application/json", ...opts.headers },
|
|
1450
|
+
auth: opts.token,
|
|
1451
|
+
throwOnError: true
|
|
1452
|
+
})
|
|
1453
|
+
);
|
|
1454
|
+
client2.interceptors.error.use((error, response) => {
|
|
1455
|
+
return new ZilfuApiError({
|
|
1456
|
+
status: response?.status ?? 0,
|
|
1457
|
+
statusText: response?.statusText,
|
|
1458
|
+
url: response?.url,
|
|
1459
|
+
body: error
|
|
1460
|
+
});
|
|
1352
1461
|
});
|
|
1353
|
-
};
|
|
1462
|
+
return new ZilfuApi({ client: client2 });
|
|
1463
|
+
}
|
|
1354
1464
|
|
|
1355
|
-
exports.
|
|
1356
|
-
exports.accountsBoards = accountsBoards;
|
|
1357
|
-
exports.accountsDestroy = accountsDestroy;
|
|
1358
|
-
exports.accountsDestroyMany = accountsDestroyMany;
|
|
1359
|
-
exports.accountsIndex = accountsIndex;
|
|
1360
|
-
exports.apiTokensDestroy = apiTokensDestroy;
|
|
1361
|
-
exports.apiTokensStore = apiTokensStore;
|
|
1362
|
-
exports.bioAvatar = bioAvatar;
|
|
1363
|
-
exports.bioBlocksDestroy = bioBlocksDestroy;
|
|
1364
|
-
exports.bioBlocksIndex = bioBlocksIndex;
|
|
1365
|
-
exports.bioBlocksReorder = bioBlocksReorder;
|
|
1366
|
-
exports.bioBlocksStore = bioBlocksStore;
|
|
1367
|
-
exports.bioBlocksUpdate = bioBlocksUpdate;
|
|
1368
|
-
exports.bioShow = bioShow;
|
|
1369
|
-
exports.bioStore = bioStore;
|
|
1370
|
-
exports.bioUpdate = bioUpdate;
|
|
1371
|
-
exports.client = client;
|
|
1372
|
-
exports.clustersUpdate = clustersUpdate;
|
|
1465
|
+
exports.ZilfuApiError = ZilfuApiError;
|
|
1373
1466
|
exports.createZilfuClient = createZilfuClient;
|
|
1374
|
-
exports.mediaDestroy = mediaDestroy;
|
|
1375
|
-
exports.mediaStore = mediaStore;
|
|
1376
|
-
exports.postsDestroy = postsDestroy;
|
|
1377
|
-
exports.postsIndex = postsIndex;
|
|
1378
|
-
exports.postsShow = postsShow;
|
|
1379
|
-
exports.postsStore = postsStore;
|
|
1380
|
-
exports.postsUpdate = postsUpdate;
|
|
1381
|
-
exports.queueIndex = queueIndex;
|
|
1382
|
-
exports.slotsDestroy = slotsDestroy;
|
|
1383
|
-
exports.slotsIndex = slotsIndex;
|
|
1384
|
-
exports.slotsStore = slotsStore;
|
|
1385
|
-
exports.spacesDestroy = spacesDestroy;
|
|
1386
|
-
exports.spacesIndex = spacesIndex;
|
|
1387
|
-
exports.spacesShow = spacesShow;
|
|
1388
|
-
exports.spacesStore = spacesStore;
|
|
1389
|
-
exports.spacesUpdate = spacesUpdate;
|
|
1390
|
-
exports.subscriptionShow = subscriptionShow;
|
|
1391
|
-
exports.webhooksDestroy = webhooksDestroy;
|
|
1392
|
-
exports.webhooksIndex = webhooksIndex;
|
|
1393
|
-
exports.webhooksStore = webhooksStore;
|
|
1394
|
-
exports.webhooksUpdate = webhooksUpdate;
|
|
1395
1467
|
//# sourceMappingURL=index.cjs.map
|
|
1396
1468
|
//# sourceMappingURL=index.cjs.map
|