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