@gpt-core/client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,1986 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // ../../node_modules/@hey-api/client-fetch/dist/index.js
6
+ var A = async (s, r) => {
7
+ let e = typeof r == "function" ? await r(s) : r;
8
+ if (e) return s.scheme === "bearer" ? `Bearer ${e}` : s.scheme === "basic" ? `Basic ${btoa(e)}` : e;
9
+ };
10
+ var O = { bodySerializer: (s) => JSON.stringify(s, (r, e) => typeof e == "bigint" ? e.toString() : e) };
11
+ var U = { $body_: "body", $headers_: "headers", $path_: "path", $query_: "query" };
12
+ var D = Object.entries(U);
13
+ var B = (s) => {
14
+ switch (s) {
15
+ case "label":
16
+ return ".";
17
+ case "matrix":
18
+ return ";";
19
+ case "simple":
20
+ return ",";
21
+ default:
22
+ return "&";
23
+ }
24
+ };
25
+ var N = (s) => {
26
+ switch (s) {
27
+ case "form":
28
+ return ",";
29
+ case "pipeDelimited":
30
+ return "|";
31
+ case "spaceDelimited":
32
+ return "%20";
33
+ default:
34
+ return ",";
35
+ }
36
+ };
37
+ var Q = (s) => {
38
+ switch (s) {
39
+ case "label":
40
+ return ".";
41
+ case "matrix":
42
+ return ";";
43
+ case "simple":
44
+ return ",";
45
+ default:
46
+ return "&";
47
+ }
48
+ };
49
+ var S = ({ allowReserved: s, explode: r, name: e, style: a, value: i }) => {
50
+ if (!r) {
51
+ let t = (s ? i : i.map((l) => encodeURIComponent(l))).join(N(a));
52
+ switch (a) {
53
+ case "label":
54
+ return `.${t}`;
55
+ case "matrix":
56
+ return `;${e}=${t}`;
57
+ case "simple":
58
+ return t;
59
+ default:
60
+ return `${e}=${t}`;
61
+ }
62
+ }
63
+ let o = B(a), n = i.map((t) => a === "label" || a === "simple" ? s ? t : encodeURIComponent(t) : m({ allowReserved: s, name: e, value: t })).join(o);
64
+ return a === "label" || a === "matrix" ? o + n : n;
65
+ };
66
+ var m = ({ allowReserved: s, name: r, value: e }) => {
67
+ if (e == null) return "";
68
+ if (typeof e == "object") throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
69
+ return `${r}=${s ? e : encodeURIComponent(e)}`;
70
+ };
71
+ var q = ({ allowReserved: s, explode: r, name: e, style: a, value: i, valueOnly: o }) => {
72
+ if (i instanceof Date) return o ? i.toISOString() : `${e}=${i.toISOString()}`;
73
+ if (a !== "deepObject" && !r) {
74
+ let l = [];
75
+ Object.entries(i).forEach(([p, d]) => {
76
+ l = [...l, p, s ? d : encodeURIComponent(d)];
77
+ });
78
+ let u = l.join(",");
79
+ switch (a) {
80
+ case "form":
81
+ return `${e}=${u}`;
82
+ case "label":
83
+ return `.${u}`;
84
+ case "matrix":
85
+ return `;${e}=${u}`;
86
+ default:
87
+ return u;
88
+ }
89
+ }
90
+ let n = Q(a), t = Object.entries(i).map(([l, u]) => m({ allowReserved: s, name: a === "deepObject" ? `${e}[${l}]` : l, value: u })).join(n);
91
+ return a === "label" || a === "matrix" ? n + t : t;
92
+ };
93
+ var J = /\{[^{}]+\}/g;
94
+ var M = ({ path: s, url: r }) => {
95
+ let e = r, a = r.match(J);
96
+ if (a) for (let i of a) {
97
+ let o = false, n = i.substring(1, i.length - 1), t = "simple";
98
+ n.endsWith("*") && (o = true, n = n.substring(0, n.length - 1)), n.startsWith(".") ? (n = n.substring(1), t = "label") : n.startsWith(";") && (n = n.substring(1), t = "matrix");
99
+ let l = s[n];
100
+ if (l == null) continue;
101
+ if (Array.isArray(l)) {
102
+ e = e.replace(i, S({ explode: o, name: n, style: t, value: l }));
103
+ continue;
104
+ }
105
+ if (typeof l == "object") {
106
+ e = e.replace(i, q({ explode: o, name: n, style: t, value: l, valueOnly: true }));
107
+ continue;
108
+ }
109
+ if (t === "matrix") {
110
+ e = e.replace(i, `;${m({ name: n, value: l })}`);
111
+ continue;
112
+ }
113
+ let u = encodeURIComponent(t === "label" ? `.${l}` : l);
114
+ e = e.replace(i, u);
115
+ }
116
+ return e;
117
+ };
118
+ var k = ({ allowReserved: s, array: r, object: e } = {}) => (i) => {
119
+ let o = [];
120
+ if (i && typeof i == "object") for (let n in i) {
121
+ let t = i[n];
122
+ if (t != null) if (Array.isArray(t)) {
123
+ let l = S({ allowReserved: s, explode: true, name: n, style: "form", value: t, ...r });
124
+ l && o.push(l);
125
+ } else if (typeof t == "object") {
126
+ let l = q({ allowReserved: s, explode: true, name: n, style: "deepObject", value: t, ...e });
127
+ l && o.push(l);
128
+ } else {
129
+ let l = m({ allowReserved: s, name: n, value: t });
130
+ l && o.push(l);
131
+ }
132
+ }
133
+ return o.join("&");
134
+ };
135
+ var E = (s) => {
136
+ if (!s) return "stream";
137
+ let r = s.split(";")[0]?.trim();
138
+ if (r) {
139
+ if (r.startsWith("application/json") || r.endsWith("+json")) return "json";
140
+ if (r === "multipart/form-data") return "formData";
141
+ if (["application/", "audio/", "image/", "video/"].some((e) => r.startsWith(e))) return "blob";
142
+ if (r.startsWith("text/")) return "text";
143
+ }
144
+ };
145
+ var $ = async ({ security: s, ...r }) => {
146
+ for (let e of s) {
147
+ let a = await A(e, r.auth);
148
+ if (!a) continue;
149
+ let i = e.name ?? "Authorization";
150
+ switch (e.in) {
151
+ case "query":
152
+ r.query || (r.query = {}), r.query[i] = a;
153
+ break;
154
+ case "cookie":
155
+ r.headers.append("Cookie", `${i}=${a}`);
156
+ break;
157
+ case "header":
158
+ default:
159
+ r.headers.set(i, a);
160
+ break;
161
+ }
162
+ return;
163
+ }
164
+ };
165
+ var C = (s) => L({ baseUrl: s.baseUrl, path: s.path, query: s.query, querySerializer: typeof s.querySerializer == "function" ? s.querySerializer : k(s.querySerializer), url: s.url });
166
+ var L = ({ baseUrl: s, path: r, query: e, querySerializer: a, url: i }) => {
167
+ let o = i.startsWith("/") ? i : `/${i}`, n = (s ?? "") + o;
168
+ r && (n = M({ path: r, url: n }));
169
+ let t = e ? a(e) : "";
170
+ return t.startsWith("?") && (t = t.substring(1)), t && (n += `?${t}`), n;
171
+ };
172
+ var x = (s, r) => {
173
+ let e = { ...s, ...r };
174
+ return e.baseUrl?.endsWith("/") && (e.baseUrl = e.baseUrl.substring(0, e.baseUrl.length - 1)), e.headers = j(s.headers, r.headers), e;
175
+ };
176
+ var j = (...s) => {
177
+ let r = new Headers();
178
+ for (let e of s) {
179
+ if (!e || typeof e != "object") continue;
180
+ let a = e instanceof Headers ? e.entries() : Object.entries(e);
181
+ for (let [i, o] of a) if (o === null) r.delete(i);
182
+ else if (Array.isArray(o)) for (let n of o) r.append(i, n);
183
+ else o !== void 0 && r.set(i, typeof o == "object" ? JSON.stringify(o) : o);
184
+ }
185
+ return r;
186
+ };
187
+ var g = class {
188
+ constructor() {
189
+ __publicField(this, "_fns");
190
+ this._fns = [];
191
+ }
192
+ clear() {
193
+ this._fns = [];
194
+ }
195
+ getInterceptorIndex(r) {
196
+ return typeof r == "number" ? this._fns[r] ? r : -1 : this._fns.indexOf(r);
197
+ }
198
+ exists(r) {
199
+ let e = this.getInterceptorIndex(r);
200
+ return !!this._fns[e];
201
+ }
202
+ eject(r) {
203
+ let e = this.getInterceptorIndex(r);
204
+ this._fns[e] && (this._fns[e] = null);
205
+ }
206
+ update(r, e) {
207
+ let a = this.getInterceptorIndex(r);
208
+ return this._fns[a] ? (this._fns[a] = e, r) : false;
209
+ }
210
+ use(r) {
211
+ return this._fns = [...this._fns, r], this._fns.length - 1;
212
+ }
213
+ };
214
+ var v = () => ({ error: new g(), request: new g(), response: new g() });
215
+ var V = k({ allowReserved: false, array: { explode: true, style: "form" }, object: { explode: true, style: "deepObject" } });
216
+ var F = { "Content-Type": "application/json" };
217
+ var w = (s = {}) => ({ ...O, headers: F, parseAs: "auto", querySerializer: V, ...s });
218
+ var G = (s = {}) => {
219
+ let r = x(w(), s), e = () => ({ ...r }), a = (n) => (r = x(r, n), e()), i = v(), o = async (n) => {
220
+ let t = { ...r, ...n, fetch: n.fetch ?? r.fetch ?? globalThis.fetch, headers: j(r.headers, n.headers) };
221
+ t.security && await $({ ...t, security: t.security }), t.body && t.bodySerializer && (t.body = t.bodySerializer(t.body)), (t.body === void 0 || t.body === "") && t.headers.delete("Content-Type");
222
+ let l = C(t), u = { redirect: "follow", ...t }, p = new Request(l, u);
223
+ for (let f of i.request._fns) f && (p = await f(p, t));
224
+ let d = t.fetch, c = await d(p);
225
+ for (let f of i.response._fns) f && (c = await f(c, p, t));
226
+ let b = { request: p, response: c };
227
+ if (c.ok) {
228
+ if (c.status === 204 || c.headers.get("Content-Length") === "0") return t.responseStyle === "data" ? {} : { data: {}, ...b };
229
+ let f = (t.parseAs === "auto" ? E(c.headers.get("Content-Type")) : t.parseAs) ?? "json";
230
+ if (f === "stream") return t.responseStyle === "data" ? c.body : { data: c.body, ...b };
231
+ let h = await c[f]();
232
+ return f === "json" && (t.responseValidator && await t.responseValidator(h), t.responseTransformer && (h = await t.responseTransformer(h))), t.responseStyle === "data" ? h : { data: h, ...b };
233
+ }
234
+ let R = await c.text();
235
+ try {
236
+ R = JSON.parse(R);
237
+ } catch {
238
+ }
239
+ let y = R;
240
+ for (let f of i.error._fns) f && (y = await f(R, c, p, t));
241
+ if (y = y || {}, t.throwOnError) throw y;
242
+ return t.responseStyle === "data" ? void 0 : { error: y, ...b };
243
+ };
244
+ return { buildUrl: C, connect: (n) => o({ ...n, method: "CONNECT" }), delete: (n) => o({ ...n, method: "DELETE" }), get: (n) => o({ ...n, method: "GET" }), getConfig: e, head: (n) => o({ ...n, method: "HEAD" }), interceptors: i, options: (n) => o({ ...n, method: "OPTIONS" }), patch: (n) => o({ ...n, method: "PATCH" }), post: (n) => o({ ...n, method: "POST" }), put: (n) => o({ ...n, method: "PUT" }), request: o, setConfig: a, trace: (n) => o({ ...n, method: "TRACE" }) };
245
+ };
246
+
247
+ // src/_internal/services.gen.ts
248
+ var client = G(w());
249
+ var SearchService = class {
250
+ /**
251
+ * /ai/search/advanced operation on search resource
252
+ */
253
+ static postAiSearchAdvanced(options) {
254
+ return (options?.client ?? client).post({
255
+ ...options,
256
+ url: "/ai/search/advanced"
257
+ });
258
+ }
259
+ /**
260
+ * /search/indexes operation on search resource
261
+ */
262
+ static getSearchIndexes(options) {
263
+ return (options?.client ?? client).get({
264
+ ...options,
265
+ url: "/search/indexes"
266
+ });
267
+ }
268
+ /**
269
+ * /search operation on search resource
270
+ */
271
+ static getSearch(options) {
272
+ return (options?.client ?? client).get({
273
+ ...options,
274
+ url: "/search"
275
+ });
276
+ }
277
+ /**
278
+ * /search/semantic operation on search resource
279
+ */
280
+ static getSearchSemantic(options) {
281
+ return (options?.client ?? client).get({
282
+ ...options,
283
+ url: "/search/semantic"
284
+ });
285
+ }
286
+ /**
287
+ * /ai/search operation on search resource
288
+ */
289
+ static postAiSearch(options) {
290
+ return (options?.client ?? client).post({
291
+ ...options,
292
+ url: "/ai/search"
293
+ });
294
+ }
295
+ /**
296
+ * /search/health operation on search resource
297
+ */
298
+ static getSearchHealth(options) {
299
+ return (options?.client ?? client).get({
300
+ ...options,
301
+ url: "/search/health"
302
+ });
303
+ }
304
+ /**
305
+ * /search/status operation on search resource
306
+ */
307
+ static getSearchStatus(options) {
308
+ return (options?.client ?? client).get({
309
+ ...options,
310
+ url: "/search/status"
311
+ });
312
+ }
313
+ /**
314
+ * /search/reindex operation on search resource
315
+ */
316
+ static postSearchReindex(options) {
317
+ return (options?.client ?? client).post({
318
+ ...options,
319
+ url: "/search/reindex"
320
+ });
321
+ }
322
+ /**
323
+ * /search/stats operation on search resource
324
+ */
325
+ static getSearchStats(options) {
326
+ return (options?.client ?? client).get({
327
+ ...options,
328
+ url: "/search/stats"
329
+ });
330
+ }
331
+ };
332
+ var ThreadService = class {
333
+ /**
334
+ * /threads operation on thread resource
335
+ */
336
+ static getThreads(options) {
337
+ return (options?.client ?? client).get({
338
+ ...options,
339
+ url: "/threads"
340
+ });
341
+ }
342
+ /**
343
+ * /threads operation on thread resource
344
+ */
345
+ static postThreads(options) {
346
+ return (options?.client ?? client).post({
347
+ ...options,
348
+ url: "/threads"
349
+ });
350
+ }
351
+ /**
352
+ * /threads/active operation on thread resource
353
+ */
354
+ static postThreadsActive(options) {
355
+ return (options?.client ?? client).post({
356
+ ...options,
357
+ url: "/threads/active"
358
+ });
359
+ }
360
+ /**
361
+ * /threads/:id/messages operation on thread resource
362
+ */
363
+ static postThreadsByIdMessages(options) {
364
+ return (options?.client ?? client).post({
365
+ ...options,
366
+ url: "/threads/{id}/messages"
367
+ });
368
+ }
369
+ /**
370
+ * /threads/:id operation on thread resource
371
+ */
372
+ static deleteThreadsById(options) {
373
+ return (options?.client ?? client).delete({
374
+ ...options,
375
+ url: "/threads/{id}"
376
+ });
377
+ }
378
+ /**
379
+ * /threads/:id operation on thread resource
380
+ */
381
+ static getThreadsById(options) {
382
+ return (options?.client ?? client).get({
383
+ ...options,
384
+ url: "/threads/{id}"
385
+ });
386
+ }
387
+ /**
388
+ * /threads/:id operation on thread resource
389
+ */
390
+ static patchThreadsById(options) {
391
+ return (options?.client ?? client).patch({
392
+ ...options,
393
+ url: "/threads/{id}"
394
+ });
395
+ }
396
+ /**
397
+ * /threads/search operation on thread resource
398
+ */
399
+ static getThreadsSearch(options) {
400
+ return (options?.client ?? client).get({
401
+ ...options,
402
+ url: "/threads/search"
403
+ });
404
+ }
405
+ /**
406
+ * /threads/:id/summarize operation on thread resource
407
+ */
408
+ static postThreadsByIdSummarize(options) {
409
+ return (options?.client ?? client).post({
410
+ ...options,
411
+ url: "/threads/{id}/summarize"
412
+ });
413
+ }
414
+ };
415
+ var ExtractionResultService = class {
416
+ /**
417
+ * /extraction_results/:id operation on extraction_result resource
418
+ */
419
+ static deleteExtractionResultsById(options) {
420
+ return (options?.client ?? client).delete({
421
+ ...options,
422
+ url: "/extraction_results/{id}"
423
+ });
424
+ }
425
+ /**
426
+ * /extraction_results/:id operation on extraction_result resource
427
+ */
428
+ static getExtractionResultsById(options) {
429
+ return (options?.client ?? client).get({
430
+ ...options,
431
+ url: "/extraction_results/{id}"
432
+ });
433
+ }
434
+ /**
435
+ * /extraction_results/:id operation on extraction_result resource
436
+ */
437
+ static patchExtractionResultsById(options) {
438
+ return (options?.client ?? client).patch({
439
+ ...options,
440
+ url: "/extraction_results/{id}"
441
+ });
442
+ }
443
+ /**
444
+ * /extraction_results operation on extraction_result resource
445
+ */
446
+ static getExtractionResults(options) {
447
+ return (options?.client ?? client).get({
448
+ ...options,
449
+ url: "/extraction_results"
450
+ });
451
+ }
452
+ /**
453
+ * /documents/:id/extraction_results operation on extraction_result resource
454
+ */
455
+ static getDocumentsByIdExtractionResults(options) {
456
+ return (options?.client ?? client).get({
457
+ ...options,
458
+ url: "/documents/{id}/extraction_results"
459
+ });
460
+ }
461
+ };
462
+ var WorkspaceService = class {
463
+ /**
464
+ * /workspaces operation on workspace resource
465
+ */
466
+ static getWorkspaces(options) {
467
+ return (options?.client ?? client).get({
468
+ ...options,
469
+ url: "/workspaces"
470
+ });
471
+ }
472
+ /**
473
+ * /workspaces operation on workspace resource
474
+ */
475
+ static postWorkspaces(options) {
476
+ return (options?.client ?? client).post({
477
+ ...options,
478
+ url: "/workspaces"
479
+ });
480
+ }
481
+ /**
482
+ * /workspaces/:id/allocate operation on workspace resource
483
+ */
484
+ static patchWorkspacesByIdAllocate(options) {
485
+ return (options?.client ?? client).patch({
486
+ ...options,
487
+ url: "/workspaces/{id}/allocate"
488
+ });
489
+ }
490
+ /**
491
+ * /workspaces/:id operation on workspace resource
492
+ */
493
+ static deleteWorkspacesById(options) {
494
+ return (options?.client ?? client).delete({
495
+ ...options,
496
+ url: "/workspaces/{id}"
497
+ });
498
+ }
499
+ /**
500
+ * /workspaces/:id operation on workspace resource
501
+ */
502
+ static getWorkspacesById(options) {
503
+ return (options?.client ?? client).get({
504
+ ...options,
505
+ url: "/workspaces/{id}"
506
+ });
507
+ }
508
+ /**
509
+ * /workspaces/:id operation on workspace resource
510
+ */
511
+ static patchWorkspacesById(options) {
512
+ return (options?.client ?? client).patch({
513
+ ...options,
514
+ url: "/workspaces/{id}"
515
+ });
516
+ }
517
+ /**
518
+ * /workspaces/mine operation on workspace resource
519
+ */
520
+ static getWorkspacesMine(options) {
521
+ return (options?.client ?? client).get({
522
+ ...options,
523
+ url: "/workspaces/mine"
524
+ });
525
+ }
526
+ };
527
+ var ApiKeyService = class {
528
+ /**
529
+ * /api_keys/:id/revoke operation on api_key resource
530
+ */
531
+ static patchApiKeysByIdRevoke(options) {
532
+ return (options?.client ?? client).patch({
533
+ ...options,
534
+ url: "/api_keys/{id}/revoke"
535
+ });
536
+ }
537
+ /**
538
+ * /api_keys operation on api_key resource
539
+ */
540
+ static getApiKeys(options) {
541
+ return (options?.client ?? client).get({
542
+ ...options,
543
+ url: "/api_keys"
544
+ });
545
+ }
546
+ /**
547
+ * /api_keys operation on api_key resource
548
+ */
549
+ static postApiKeys(options) {
550
+ return (options?.client ?? client).post({
551
+ ...options,
552
+ url: "/api_keys"
553
+ });
554
+ }
555
+ /**
556
+ * /api_keys/:id operation on api_key resource
557
+ */
558
+ static deleteApiKeysById(options) {
559
+ return (options?.client ?? client).delete({
560
+ ...options,
561
+ url: "/api_keys/{id}"
562
+ });
563
+ }
564
+ /**
565
+ * /api_keys/:id operation on api_key resource
566
+ */
567
+ static getApiKeysById(options) {
568
+ return (options?.client ?? client).get({
569
+ ...options,
570
+ url: "/api_keys/{id}"
571
+ });
572
+ }
573
+ /**
574
+ * /api_keys/:id operation on api_key resource
575
+ */
576
+ static patchApiKeysById(options) {
577
+ return (options?.client ?? client).patch({
578
+ ...options,
579
+ url: "/api_keys/{id}"
580
+ });
581
+ }
582
+ /**
583
+ * Allocate credits to the account associated with this API Key
584
+ */
585
+ static patchApiKeysByIdAllocate(options) {
586
+ return (options?.client ?? client).patch({
587
+ ...options,
588
+ url: "/api_keys/{id}/allocate"
589
+ });
590
+ }
591
+ /**
592
+ * /api_keys/:id/rotate operation on api_key resource
593
+ */
594
+ static patchApiKeysByIdRotate(options) {
595
+ return (options?.client ?? client).patch({
596
+ ...options,
597
+ url: "/api_keys/{id}/rotate"
598
+ });
599
+ }
600
+ };
601
+ var InvitationService = class {
602
+ /**
603
+ * /invitations/consume/:token operation on invitation resource
604
+ */
605
+ static getInvitationsConsumeByToken(options) {
606
+ return (options?.client ?? client).get({
607
+ ...options,
608
+ url: "/invitations/consume/{token}"
609
+ });
610
+ }
611
+ /**
612
+ * /invitations/:id/revoke operation on invitation resource
613
+ */
614
+ static patchInvitationsByIdRevoke(options) {
615
+ return (options?.client ?? client).patch({
616
+ ...options,
617
+ url: "/invitations/{id}/revoke"
618
+ });
619
+ }
620
+ /**
621
+ * /invitations/:id/resend operation on invitation resource
622
+ */
623
+ static patchInvitationsByIdResend(options) {
624
+ return (options?.client ?? client).patch({
625
+ ...options,
626
+ url: "/invitations/{id}/resend"
627
+ });
628
+ }
629
+ /**
630
+ * /invitations/invite operation on invitation resource
631
+ */
632
+ static postInvitationsInvite(options) {
633
+ return (options?.client ?? client).post({
634
+ ...options,
635
+ url: "/invitations/invite"
636
+ });
637
+ }
638
+ /**
639
+ * Accept an invitation using only the token
640
+ */
641
+ static postInvitationsAcceptByToken(options) {
642
+ return (options?.client ?? client).post({
643
+ ...options,
644
+ url: "/invitations/accept_by_token"
645
+ });
646
+ }
647
+ /**
648
+ * /invitations/:id/accept operation on invitation resource
649
+ */
650
+ static patchInvitationsByIdAccept(options) {
651
+ return (options?.client ?? client).patch({
652
+ ...options,
653
+ url: "/invitations/{id}/accept"
654
+ });
655
+ }
656
+ /**
657
+ * /invitations operation on invitation resource
658
+ */
659
+ static getInvitations(options) {
660
+ return (options?.client ?? client).get({
661
+ ...options,
662
+ url: "/invitations"
663
+ });
664
+ }
665
+ };
666
+ var UserService = class {
667
+ /**
668
+ * Reset password using admin-issued reset token
669
+ */
670
+ static patchUsersAuthResetPassword(options) {
671
+ return (options?.client ?? client).patch({
672
+ ...options,
673
+ url: "/users/auth/reset-password"
674
+ });
675
+ }
676
+ /**
677
+ * /users/:id operation on user resource
678
+ */
679
+ static getUsersById(options) {
680
+ return (options?.client ?? client).get({
681
+ ...options,
682
+ url: "/users/{id}"
683
+ });
684
+ }
685
+ /**
686
+ * Admin-only user management (platform admins) - promotes/demotes admin status
687
+ */
688
+ static patchUsersById(options) {
689
+ return (options?.client ?? client).patch({
690
+ ...options,
691
+ url: "/users/{id}"
692
+ });
693
+ }
694
+ /**
695
+ * Get the currently authenticated user
696
+ */
697
+ static getUsersMe(options) {
698
+ return (options?.client ?? client).get({
699
+ ...options,
700
+ url: "/users/me"
701
+ });
702
+ }
703
+ /**
704
+ * /users/auth/register_with_oidc operation on user resource
705
+ */
706
+ static postUsersAuthRegisterWithOidc(options) {
707
+ return (options?.client ?? client).post({
708
+ ...options,
709
+ url: "/users/auth/register_with_oidc"
710
+ });
711
+ }
712
+ /**
713
+ * Admin triggers password reset email for user
714
+ */
715
+ static patchUsersByIdResetPassword(options) {
716
+ return (options?.client ?? client).patch({
717
+ ...options,
718
+ url: "/users/{id}/reset-password"
719
+ });
720
+ }
721
+ /**
722
+ * /users/auth/magic_link/login operation on user resource
723
+ */
724
+ static postUsersAuthMagicLinkLogin(options) {
725
+ return (options?.client ?? client).post({
726
+ ...options,
727
+ url: "/users/auth/magic_link/login"
728
+ });
729
+ }
730
+ /**
731
+ * Admin manually confirms user's email
732
+ */
733
+ static patchUsersByIdConfirmEmail(options) {
734
+ return (options?.client ?? client).patch({
735
+ ...options,
736
+ url: "/users/{id}/confirm-email"
737
+ });
738
+ }
739
+ /**
740
+ * Attempt to sign in using a username and password.
741
+ */
742
+ static postUsersAuthLogin(options) {
743
+ return (options?.client ?? client).post({
744
+ ...options,
745
+ url: "/users/auth/login"
746
+ });
747
+ }
748
+ /**
749
+ * /users/auth/confirm operation on user resource
750
+ */
751
+ static postUsersAuthConfirm(options) {
752
+ return (options?.client ?? client).post({
753
+ ...options,
754
+ url: "/users/auth/confirm"
755
+ });
756
+ }
757
+ /**
758
+ * /users/auth/magic_link/request operation on user resource
759
+ */
760
+ static postUsersAuthMagicLinkRequest(options) {
761
+ return (options?.client ?? client).post({
762
+ ...options,
763
+ url: "/users/auth/magic_link/request"
764
+ });
765
+ }
766
+ /**
767
+ * /users/auth/register operation on user resource
768
+ */
769
+ static postUsersAuthRegister(options) {
770
+ return (options?.client ?? client).post({
771
+ ...options,
772
+ url: "/users/auth/register"
773
+ });
774
+ }
775
+ /**
776
+ * Platform Admin action to register a new ISV (User + Tenant + App)
777
+ */
778
+ static postUsersRegisterIsv(options) {
779
+ return (options?.client ?? client).post({
780
+ ...options,
781
+ url: "/users/register_isv"
782
+ });
783
+ }
784
+ /**
785
+ * /users operation on user resource
786
+ */
787
+ static getUsers(options) {
788
+ return (options?.client ?? client).get({
789
+ ...options,
790
+ url: "/users"
791
+ });
792
+ }
793
+ };
794
+ var BucketService = class {
795
+ /**
796
+ * /buckets/:id/stats operation on bucket resource
797
+ */
798
+ static getBucketsByIdStats(options) {
799
+ return (options?.client ?? client).get({
800
+ ...options,
801
+ url: "/buckets/{id}/stats"
802
+ });
803
+ }
804
+ /**
805
+ * /buckets operation on bucket resource
806
+ */
807
+ static getBuckets(options) {
808
+ return (options?.client ?? client).get({
809
+ ...options,
810
+ url: "/buckets"
811
+ });
812
+ }
813
+ /**
814
+ * /buckets operation on bucket resource
815
+ */
816
+ static postBuckets(options) {
817
+ return (options?.client ?? client).post({
818
+ ...options,
819
+ url: "/buckets"
820
+ });
821
+ }
822
+ /**
823
+ * /buckets/:id operation on bucket resource
824
+ */
825
+ static deleteBucketsById(options) {
826
+ return (options?.client ?? client).delete({
827
+ ...options,
828
+ url: "/buckets/{id}"
829
+ });
830
+ }
831
+ /**
832
+ * /buckets/:id operation on bucket resource
833
+ */
834
+ static getBucketsById(options) {
835
+ return (options?.client ?? client).get({
836
+ ...options,
837
+ url: "/buckets/{id}"
838
+ });
839
+ }
840
+ /**
841
+ * /buckets/:id operation on bucket resource
842
+ */
843
+ static patchBucketsById(options) {
844
+ return (options?.client ?? client).patch({
845
+ ...options,
846
+ url: "/buckets/{id}"
847
+ });
848
+ }
849
+ };
850
+ var DocumentService = class {
851
+ /**
852
+ * /documents/search operation on document resource
853
+ */
854
+ static getDocumentsSearch(options) {
855
+ return (options?.client ?? client).get({
856
+ ...options,
857
+ url: "/documents/search"
858
+ });
859
+ }
860
+ /**
861
+ * /documents operation on document resource
862
+ */
863
+ static getDocuments(options) {
864
+ return (options?.client ?? client).get({
865
+ ...options,
866
+ url: "/documents"
867
+ });
868
+ }
869
+ /**
870
+ * /documents operation on document resource
871
+ */
872
+ static postDocuments(options) {
873
+ return (options?.client ?? client).post({
874
+ ...options,
875
+ url: "/documents"
876
+ });
877
+ }
878
+ /**
879
+ * /documents/:id operation on document resource
880
+ */
881
+ static deleteDocumentsById(options) {
882
+ return (options?.client ?? client).delete({
883
+ ...options,
884
+ url: "/documents/{id}"
885
+ });
886
+ }
887
+ /**
888
+ * /documents/:id operation on document resource
889
+ */
890
+ static getDocumentsById(options) {
891
+ return (options?.client ?? client).get({
892
+ ...options,
893
+ url: "/documents/{id}"
894
+ });
895
+ }
896
+ /**
897
+ * /documents/:id operation on document resource
898
+ */
899
+ static patchDocumentsById(options) {
900
+ return (options?.client ?? client).patch({
901
+ ...options,
902
+ url: "/documents/{id}"
903
+ });
904
+ }
905
+ /**
906
+ * /documents/:id/analyze operation on document resource
907
+ */
908
+ static postDocumentsByIdAnalyze(options) {
909
+ return (options?.client ?? client).post({
910
+ ...options,
911
+ url: "/documents/{id}/analyze"
912
+ });
913
+ }
914
+ /**
915
+ * /documents/:id/reprocess operation on document resource
916
+ */
917
+ static postDocumentsByIdReprocess(options) {
918
+ return (options?.client ?? client).post({
919
+ ...options,
920
+ url: "/documents/{id}/reprocess"
921
+ });
922
+ }
923
+ /**
924
+ * /documents/bulk_reprocess operation on document resource
925
+ */
926
+ static postDocumentsBulkReprocess(options) {
927
+ return (options?.client ?? client).post({
928
+ ...options,
929
+ url: "/documents/bulk_reprocess"
930
+ });
931
+ }
932
+ /**
933
+ * Export documents (placeholder - returns mock url)
934
+ */
935
+ static postDocumentsExport(options) {
936
+ return (options?.client ?? client).post({
937
+ ...options,
938
+ url: "/documents/export"
939
+ });
940
+ }
941
+ /**
942
+ * Import documents from external URL
943
+ */
944
+ static postDocumentsImport(options) {
945
+ return (options?.client ?? client).post({
946
+ ...options,
947
+ url: "/documents/import"
948
+ });
949
+ }
950
+ /**
951
+ * Returns documents with pending or processing status
952
+ */
953
+ static getDocumentsProcessingQueue(options) {
954
+ return (options?.client ?? client).get({
955
+ ...options,
956
+ url: "/documents/processing_queue"
957
+ });
958
+ }
959
+ };
960
+ var UserProfileService = class {
961
+ /**
962
+ * Get the current user's profile
963
+ */
964
+ static getUserProfilesMe(options) {
965
+ return (options?.client ?? client).get({
966
+ ...options,
967
+ url: "/user_profiles/me"
968
+ });
969
+ }
970
+ /**
971
+ * /user_profiles operation on user_profile resource
972
+ */
973
+ static getUserProfiles(options) {
974
+ return (options?.client ?? client).get({
975
+ ...options,
976
+ url: "/user_profiles"
977
+ });
978
+ }
979
+ /**
980
+ * /user_profiles operation on user_profile resource
981
+ */
982
+ static postUserProfiles(options) {
983
+ return (options?.client ?? client).post({
984
+ ...options,
985
+ url: "/user_profiles"
986
+ });
987
+ }
988
+ /**
989
+ * /user_profiles/:id operation on user_profile resource
990
+ */
991
+ static deleteUserProfilesById(options) {
992
+ return (options?.client ?? client).delete({
993
+ ...options,
994
+ url: "/user_profiles/{id}"
995
+ });
996
+ }
997
+ /**
998
+ * /user_profiles/:id operation on user_profile resource
999
+ */
1000
+ static getUserProfilesById(options) {
1001
+ return (options?.client ?? client).get({
1002
+ ...options,
1003
+ url: "/user_profiles/{id}"
1004
+ });
1005
+ }
1006
+ /**
1007
+ * /user_profiles/:id operation on user_profile resource
1008
+ */
1009
+ static patchUserProfilesById(options) {
1010
+ return (options?.client ?? client).patch({
1011
+ ...options,
1012
+ url: "/user_profiles/{id}"
1013
+ });
1014
+ }
1015
+ };
1016
+ var AgentService = class {
1017
+ /**
1018
+ * Validate sample output against agent schema
1019
+ */
1020
+ static postAgentsByIdValidate(options) {
1021
+ return (options?.client ?? client).post({
1022
+ ...options,
1023
+ url: "/agents/{id}/validate"
1024
+ });
1025
+ }
1026
+ /**
1027
+ * /agents/:id operation on agent resource
1028
+ */
1029
+ static deleteAgentsById(options) {
1030
+ return (options?.client ?? client).delete({
1031
+ ...options,
1032
+ url: "/agents/{id}"
1033
+ });
1034
+ }
1035
+ /**
1036
+ * /agents/:id operation on agent resource
1037
+ */
1038
+ static getAgentsById(options) {
1039
+ return (options?.client ?? client).get({
1040
+ ...options,
1041
+ url: "/agents/{id}"
1042
+ });
1043
+ }
1044
+ /**
1045
+ * /agents/:id operation on agent resource
1046
+ */
1047
+ static patchAgentsById(options) {
1048
+ return (options?.client ?? client).patch({
1049
+ ...options,
1050
+ url: "/agents/{id}"
1051
+ });
1052
+ }
1053
+ /**
1054
+ * Run the agent against sample input
1055
+ */
1056
+ static postAgentsByIdTest(options) {
1057
+ return (options?.client ?? client).post({
1058
+ ...options,
1059
+ url: "/agents/{id}/test"
1060
+ });
1061
+ }
1062
+ /**
1063
+ * Clone the agent to a new one with a new name
1064
+ */
1065
+ static postAgentsByIdClone(options) {
1066
+ return (options?.client ?? client).post({
1067
+ ...options,
1068
+ url: "/agents/{id}/clone"
1069
+ });
1070
+ }
1071
+ /**
1072
+ * /agents operation on agent resource
1073
+ */
1074
+ static getAgents(options) {
1075
+ return (options?.client ?? client).get({
1076
+ ...options,
1077
+ url: "/agents"
1078
+ });
1079
+ }
1080
+ /**
1081
+ * /agents operation on agent resource
1082
+ */
1083
+ static postAgents(options) {
1084
+ return (options?.client ?? client).post({
1085
+ ...options,
1086
+ url: "/agents"
1087
+ });
1088
+ }
1089
+ };
1090
+ var PresignedUrlService = class {
1091
+ /**
1092
+ * /storage/sign_download operation on presigned_url resource
1093
+ */
1094
+ static postStorageSignDownload(options) {
1095
+ return (options?.client ?? client).post({
1096
+ ...options,
1097
+ url: "/storage/sign_download"
1098
+ });
1099
+ }
1100
+ /**
1101
+ * /documents/presigned_upload operation on presigned_url resource
1102
+ */
1103
+ static postDocumentsPresignedUpload(options) {
1104
+ return (options?.client ?? client).post({
1105
+ ...options,
1106
+ url: "/documents/presigned_upload"
1107
+ });
1108
+ }
1109
+ /**
1110
+ * /storage/sign_upload operation on presigned_url resource
1111
+ */
1112
+ static postStorageSignUpload(options) {
1113
+ return (options?.client ?? client).post({
1114
+ ...options,
1115
+ url: "/storage/sign_upload"
1116
+ });
1117
+ }
1118
+ };
1119
+ var ApplicationService = class {
1120
+ /**
1121
+ * /applications operation on application resource
1122
+ */
1123
+ static getApplications(options) {
1124
+ return (options?.client ?? client).get({
1125
+ ...options,
1126
+ url: "/applications"
1127
+ });
1128
+ }
1129
+ /**
1130
+ * /applications operation on application resource
1131
+ */
1132
+ static postApplications(options) {
1133
+ return (options?.client ?? client).post({
1134
+ ...options,
1135
+ url: "/applications"
1136
+ });
1137
+ }
1138
+ /**
1139
+ * /applications/:id operation on application resource
1140
+ */
1141
+ static deleteApplicationsById(options) {
1142
+ return (options?.client ?? client).delete({
1143
+ ...options,
1144
+ url: "/applications/{id}"
1145
+ });
1146
+ }
1147
+ /**
1148
+ * /applications/:id operation on application resource
1149
+ */
1150
+ static getApplicationsById(options) {
1151
+ return (options?.client ?? client).get({
1152
+ ...options,
1153
+ url: "/applications/{id}"
1154
+ });
1155
+ }
1156
+ /**
1157
+ * /applications/:id operation on application resource
1158
+ */
1159
+ static patchApplicationsById(options) {
1160
+ return (options?.client ?? client).patch({
1161
+ ...options,
1162
+ url: "/applications/{id}"
1163
+ });
1164
+ }
1165
+ /**
1166
+ * /applications/by-slug/:slug operation on application resource
1167
+ */
1168
+ static getApplicationsBySlugBySlug(options) {
1169
+ return (options?.client ?? client).get({
1170
+ ...options,
1171
+ url: "/applications/by-slug/{slug}"
1172
+ });
1173
+ }
1174
+ };
1175
+ var TenantService = class {
1176
+ /**
1177
+ * /tenants operation on tenant resource
1178
+ */
1179
+ static getTenants(options) {
1180
+ return (options?.client ?? client).get({
1181
+ ...options,
1182
+ url: "/tenants"
1183
+ });
1184
+ }
1185
+ /**
1186
+ * /tenants operation on tenant resource
1187
+ */
1188
+ static postTenants(options) {
1189
+ return (options?.client ?? client).post({
1190
+ ...options,
1191
+ url: "/tenants"
1192
+ });
1193
+ }
1194
+ /**
1195
+ * /tenants/:id/remove-storage operation on tenant resource
1196
+ */
1197
+ static postTenantsByIdRemoveStorage(options) {
1198
+ return (options?.client ?? client).post({
1199
+ ...options,
1200
+ url: "/tenants/{id}/remove-storage"
1201
+ });
1202
+ }
1203
+ /**
1204
+ * /tenants/:id/buy-storage operation on tenant resource
1205
+ */
1206
+ static postTenantsByIdBuyStorage(options) {
1207
+ return (options?.client ?? client).post({
1208
+ ...options,
1209
+ url: "/tenants/{id}/buy-storage"
1210
+ });
1211
+ }
1212
+ /**
1213
+ * /tenants/:id operation on tenant resource
1214
+ */
1215
+ static deleteTenantsById(options) {
1216
+ return (options?.client ?? client).delete({
1217
+ ...options,
1218
+ url: "/tenants/{id}"
1219
+ });
1220
+ }
1221
+ /**
1222
+ * /tenants/:id operation on tenant resource
1223
+ */
1224
+ static getTenantsById(options) {
1225
+ return (options?.client ?? client).get({
1226
+ ...options,
1227
+ url: "/tenants/{id}"
1228
+ });
1229
+ }
1230
+ /**
1231
+ * /tenants/:id operation on tenant resource
1232
+ */
1233
+ static patchTenantsById(options) {
1234
+ return (options?.client ?? client).patch({
1235
+ ...options,
1236
+ url: "/tenants/{id}"
1237
+ });
1238
+ }
1239
+ };
1240
+ var AuditLogService = class {
1241
+ /**
1242
+ * /audit-logs operation on audit-log resource
1243
+ */
1244
+ static getAuditLogs(options) {
1245
+ return (options?.client ?? client).get({
1246
+ ...options,
1247
+ url: "/audit-logs"
1248
+ });
1249
+ }
1250
+ };
1251
+ var PlanService = class {
1252
+ /**
1253
+ * /plans/:id operation on plan resource
1254
+ */
1255
+ static deletePlansById(options) {
1256
+ return (options?.client ?? client).delete({
1257
+ ...options,
1258
+ url: "/plans/{id}"
1259
+ });
1260
+ }
1261
+ /**
1262
+ * /plans/:id operation on plan resource
1263
+ */
1264
+ static getPlansById(options) {
1265
+ return (options?.client ?? client).get({
1266
+ ...options,
1267
+ url: "/plans/{id}"
1268
+ });
1269
+ }
1270
+ /**
1271
+ * /plans/:id operation on plan resource
1272
+ */
1273
+ static patchPlansById(options) {
1274
+ return (options?.client ?? client).patch({
1275
+ ...options,
1276
+ url: "/plans/{id}"
1277
+ });
1278
+ }
1279
+ /**
1280
+ * /plans/slug/:slug operation on plan resource
1281
+ */
1282
+ static getPlansSlugBySlug(options) {
1283
+ return (options?.client ?? client).get({
1284
+ ...options,
1285
+ url: "/plans/slug/{slug}"
1286
+ });
1287
+ }
1288
+ /**
1289
+ * /plans operation on plan resource
1290
+ */
1291
+ static getPlans(options) {
1292
+ return (options?.client ?? client).get({
1293
+ ...options,
1294
+ url: "/plans"
1295
+ });
1296
+ }
1297
+ /**
1298
+ * /plans operation on plan resource
1299
+ */
1300
+ static postPlans(options) {
1301
+ return (options?.client ?? client).post({
1302
+ ...options,
1303
+ url: "/plans"
1304
+ });
1305
+ }
1306
+ };
1307
+ var WalletService = class {
1308
+ /**
1309
+ * Purchase an add-on for the wallet
1310
+ */
1311
+ static patchWalletAddons(options) {
1312
+ return (options?.client ?? client).patch({
1313
+ ...options,
1314
+ url: "/wallet/addons"
1315
+ });
1316
+ }
1317
+ /**
1318
+ * /wallet/addons/:addon_slug/cancel operation on wallet resource
1319
+ */
1320
+ static patchWalletAddonsByAddonSlugCancel(options) {
1321
+ return (options?.client ?? client).patch({
1322
+ ...options,
1323
+ url: "/wallet/addons/{addon_slug}/cancel"
1324
+ });
1325
+ }
1326
+ /**
1327
+ * Change the main plan for the wallet
1328
+ */
1329
+ static patchWalletPlan(options) {
1330
+ return (options?.client ?? client).patch({
1331
+ ...options,
1332
+ url: "/wallet/plan"
1333
+ });
1334
+ }
1335
+ /**
1336
+ * Reads the wallet for the current tenant
1337
+ */
1338
+ static getWallet(options) {
1339
+ return (options?.client ?? client).get({
1340
+ ...options,
1341
+ url: "/wallet"
1342
+ });
1343
+ }
1344
+ };
1345
+ var EmbeddingService = class {
1346
+ /**
1347
+ * /ai/embed operation on embedding resource
1348
+ */
1349
+ static postAiEmbed(options) {
1350
+ return (options?.client ?? client).post({
1351
+ ...options,
1352
+ url: "/ai/embed"
1353
+ });
1354
+ }
1355
+ };
1356
+
1357
+ // src/base-client.ts
1358
+ var BaseClient = class {
1359
+ constructor(config = {}) {
1360
+ if (config.baseUrl) {
1361
+ client.setConfig({ baseUrl: config.baseUrl });
1362
+ }
1363
+ client.interceptors.request.use((req) => {
1364
+ req.headers.set("Accept", "application/vnd.api+json");
1365
+ req.headers.set("Content-Type", "application/vnd.api+json");
1366
+ if (config.apiKey) {
1367
+ req.headers.set("x-application-key", config.apiKey);
1368
+ }
1369
+ if (config.token) {
1370
+ req.headers.set("Authorization", `Bearer ${config.token}`);
1371
+ }
1372
+ return req;
1373
+ });
1374
+ }
1375
+ unwrap(resource) {
1376
+ if (!resource) return null;
1377
+ if (resource.data && !resource.id && !resource.type) {
1378
+ return resource.data;
1379
+ }
1380
+ return resource;
1381
+ }
1382
+ };
1383
+
1384
+ // src/gpt-client.ts
1385
+ var GptClient = class extends BaseClient {
1386
+ constructor(config) {
1387
+ super(config);
1388
+ this.identity = {
1389
+ login: async (email, password) => {
1390
+ const { data, error } = await UserService.postUsersAuthLogin({
1391
+ body: { data: { type: "user", attributes: { email, password } } }
1392
+ });
1393
+ if (error) throw error;
1394
+ return {
1395
+ user: this.unwrap(data?.data),
1396
+ token: data?.meta?.token
1397
+ };
1398
+ },
1399
+ register: async (email, password, password_confirmation) => {
1400
+ const { data, error } = await UserService.postUsersAuthRegister({
1401
+ body: {
1402
+ data: {
1403
+ type: "user",
1404
+ attributes: { email, password, password_confirmation }
1405
+ }
1406
+ }
1407
+ });
1408
+ if (error) throw error;
1409
+ return this.unwrap(data?.data);
1410
+ },
1411
+ me: async () => {
1412
+ const { data, error } = await UserService.getUsersMe();
1413
+ if (error) throw error;
1414
+ return this.unwrap(data?.data);
1415
+ },
1416
+ profile: async () => {
1417
+ const { data, error } = await UserProfileService.getUserProfilesMe();
1418
+ if (error) throw error;
1419
+ return this.unwrap(data?.data);
1420
+ },
1421
+ apiKeys: {
1422
+ list: async () => {
1423
+ const { data, error } = await ApiKeyService.getApiKeys();
1424
+ if (error) throw error;
1425
+ return this.unwrap(data?.data);
1426
+ },
1427
+ create: async (name) => {
1428
+ const { data, error } = await ApiKeyService.postApiKeys({
1429
+ body: { data: { type: "api_key", attributes: { name } } }
1430
+ });
1431
+ if (error) throw error;
1432
+ return this.unwrap(data?.data);
1433
+ },
1434
+ allocate: async (id, amount, description) => {
1435
+ const { error } = await ApiKeyService.patchApiKeysByIdAllocate({
1436
+ path: { id },
1437
+ body: { data: { type: "api_key", id, attributes: { amount, description } } }
1438
+ });
1439
+ if (error) throw error;
1440
+ return true;
1441
+ }
1442
+ }
1443
+ };
1444
+ this.platform = {
1445
+ applications: {
1446
+ list: async () => {
1447
+ const { data, error } = await ApplicationService.getApplications();
1448
+ if (error) throw error;
1449
+ return this.unwrap(data?.data);
1450
+ },
1451
+ create: async (attributes) => {
1452
+ const { data, error } = await ApplicationService.postApplications({
1453
+ body: { data: { type: "application", attributes } }
1454
+ });
1455
+ if (error) throw error;
1456
+ return this.unwrap(data?.data);
1457
+ },
1458
+ getBySlug: async (slug) => {
1459
+ const { data, error } = await ApplicationService.getApplicationsBySlugBySlug({
1460
+ path: { slug }
1461
+ });
1462
+ if (error) throw error;
1463
+ return this.unwrap(data?.data);
1464
+ }
1465
+ },
1466
+ workspaces: {
1467
+ list: async () => {
1468
+ const { data, error } = await WorkspaceService.getWorkspaces();
1469
+ if (error) throw error;
1470
+ return this.unwrap(data?.data);
1471
+ },
1472
+ mine: async () => {
1473
+ const { data, error } = await WorkspaceService.getWorkspacesMine();
1474
+ if (error) throw error;
1475
+ return this.unwrap(data?.data);
1476
+ },
1477
+ create: async (name, slug) => {
1478
+ const { data, error } = await WorkspaceService.postWorkspaces({
1479
+ body: { data: { type: "workspace", attributes: { name, slug } } }
1480
+ });
1481
+ if (error) throw error;
1482
+ return this.unwrap(data?.data);
1483
+ }
1484
+ },
1485
+ tenants: {
1486
+ list: async () => {
1487
+ const { data, error } = await TenantService.getTenants();
1488
+ if (error) throw error;
1489
+ return this.unwrap(data?.data);
1490
+ }
1491
+ },
1492
+ invitations: {
1493
+ list: async () => {
1494
+ const { data, error } = await InvitationService.getInvitations();
1495
+ if (error) throw error;
1496
+ return this.unwrap(data?.data);
1497
+ },
1498
+ invite: async (email, role2, scopeType, scopeId) => {
1499
+ const { error } = await InvitationService.postInvitationsInvite({
1500
+ body: { email, role: role2, scope_type: scopeType, scope_id: scopeId }
1501
+ });
1502
+ if (error) throw error;
1503
+ return true;
1504
+ }
1505
+ },
1506
+ auditLogs: {
1507
+ list: async () => {
1508
+ const { data, error } = await AuditLogService.getAuditLogs();
1509
+ if (error) throw error;
1510
+ return this.unwrap(data?.data);
1511
+ }
1512
+ }
1513
+ };
1514
+ this.ai = {
1515
+ agents: {
1516
+ list: async () => {
1517
+ const { data, error } = await AgentService.getAgents();
1518
+ if (error) throw error;
1519
+ return this.unwrap(data?.data);
1520
+ },
1521
+ create: async (name, promptTemplate) => {
1522
+ const { data, error } = await AgentService.postAgents({
1523
+ body: { data: { type: "agent", attributes: { name, prompt_template: promptTemplate } } }
1524
+ });
1525
+ if (error) throw error;
1526
+ return this.unwrap(data?.data);
1527
+ }
1528
+ },
1529
+ threads: {
1530
+ list: async () => {
1531
+ const { data, error } = await ThreadService.getThreads();
1532
+ if (error) throw error;
1533
+ return this.unwrap(data?.data);
1534
+ },
1535
+ create: async (title) => {
1536
+ const { data, error } = await ThreadService.postThreads({
1537
+ body: { data: { type: "thread", attributes: { title } } }
1538
+ });
1539
+ if (error) throw error;
1540
+ return this.unwrap(data?.data);
1541
+ },
1542
+ sendMessage: async (threadId, content) => {
1543
+ const { data, error } = await ThreadService.postThreadsByIdMessages({
1544
+ path: { id: threadId },
1545
+ body: { data: { attributes: { content } } }
1546
+ });
1547
+ if (error) throw error;
1548
+ return this.unwrap(data);
1549
+ }
1550
+ },
1551
+ search: async (query, top_k = 5) => {
1552
+ const { data, error } = await SearchService.postAiSearch({
1553
+ body: { query, top_k }
1554
+ });
1555
+ if (error) throw error;
1556
+ return this.unwrap(data);
1557
+ },
1558
+ embed: async (text, workspaceId) => {
1559
+ const { data, error } = await EmbeddingService.postAiEmbed({
1560
+ body: { text, workspace_id: workspaceId }
1561
+ });
1562
+ if (error) throw error;
1563
+ return this.unwrap(data);
1564
+ }
1565
+ };
1566
+ this.extraction = {
1567
+ documents: {
1568
+ list: async () => {
1569
+ const { data, error } = await DocumentService.getDocuments();
1570
+ if (error) throw error;
1571
+ return this.unwrap(data?.data);
1572
+ },
1573
+ upload: async (_file, _filename) => {
1574
+ throw new Error("Use uploadBase64 for now");
1575
+ },
1576
+ uploadBase64: async (filename, base64Content) => {
1577
+ const { data, error } = await DocumentService.postDocuments({
1578
+ body: { data: { type: "document", attributes: { filename, content: base64Content } } }
1579
+ });
1580
+ if (error) throw error;
1581
+ return this.unwrap(data?.data);
1582
+ },
1583
+ get: async (id) => {
1584
+ const { data, error } = await DocumentService.getDocumentsById({ path: { id } });
1585
+ if (error) throw error;
1586
+ return this.unwrap(data?.data);
1587
+ },
1588
+ delete: async (id) => {
1589
+ const { error } = await DocumentService.deleteDocumentsById({ path: { id } });
1590
+ if (error) throw error;
1591
+ return true;
1592
+ },
1593
+ analyze: async (id) => {
1594
+ const { error } = await DocumentService.postDocumentsByIdAnalyze({ path: { id }, body: {} });
1595
+ if (error) throw error;
1596
+ return true;
1597
+ }
1598
+ },
1599
+ results: {
1600
+ list: async () => {
1601
+ const { data, error } = await ExtractionResultService.getExtractionResults();
1602
+ if (error) throw error;
1603
+ return this.unwrap(data?.data);
1604
+ }
1605
+ }
1606
+ };
1607
+ this.storage = {
1608
+ buckets: {
1609
+ list: async () => {
1610
+ const { data, error } = await BucketService.getBuckets();
1611
+ if (error) throw error;
1612
+ return this.unwrap(data?.data);
1613
+ },
1614
+ create: async (name, isPublic = false) => {
1615
+ const { data, error } = await BucketService.postBuckets({
1616
+ body: { data: { type: "bucket", attributes: { name, type: isPublic ? "public" : "private" } } }
1617
+ });
1618
+ if (error) throw error;
1619
+ return this.unwrap(data?.data);
1620
+ }
1621
+ },
1622
+ presigned: {
1623
+ upload: async (filename, contentType) => {
1624
+ const { data, error } = await PresignedUrlService.postStorageSignUpload({
1625
+ body: { filename, content_type: contentType }
1626
+ });
1627
+ if (error) throw error;
1628
+ return this.unwrap(data);
1629
+ },
1630
+ download: async (fileId) => {
1631
+ const { data, error } = await PresignedUrlService.postStorageSignDownload({
1632
+ body: { file_id: fileId }
1633
+ });
1634
+ if (error) throw error;
1635
+ return this.unwrap(data);
1636
+ }
1637
+ }
1638
+ };
1639
+ this.billing = {
1640
+ wallet: {
1641
+ get: async () => {
1642
+ const { data, error } = await WalletService.getWallet();
1643
+ if (error) throw error;
1644
+ return this.unwrap(data?.data);
1645
+ }
1646
+ },
1647
+ plans: {
1648
+ list: async () => {
1649
+ const { data, error } = await PlanService.getPlans();
1650
+ if (error) throw error;
1651
+ return this.unwrap(data?.data);
1652
+ }
1653
+ }
1654
+ };
1655
+ }
1656
+ };
1657
+
1658
+ // src/_internal/types.gen.ts
1659
+ var eq = {
1660
+ KEYWORD: "keyword",
1661
+ SEMANTIC: "semantic"
1662
+ };
1663
+ var greater_than = {
1664
+ KEYWORD: "keyword",
1665
+ SEMANTIC: "semantic"
1666
+ };
1667
+ var greater_than_or_equal = {
1668
+ KEYWORD: "keyword",
1669
+ SEMANTIC: "semantic"
1670
+ };
1671
+ var less_than = {
1672
+ KEYWORD: "keyword",
1673
+ SEMANTIC: "semantic"
1674
+ };
1675
+ var less_than_or_equal = {
1676
+ KEYWORD: "keyword",
1677
+ SEMANTIC: "semantic"
1678
+ };
1679
+ var not_eq = {
1680
+ KEYWORD: "keyword",
1681
+ SEMANTIC: "semantic"
1682
+ };
1683
+ var eq2 = {
1684
+ PENDING: "pending",
1685
+ PROCESSING: "processing",
1686
+ COMPLETED: "completed",
1687
+ FAILED: "failed"
1688
+ };
1689
+ var greater_than2 = {
1690
+ PENDING: "pending",
1691
+ PROCESSING: "processing",
1692
+ COMPLETED: "completed",
1693
+ FAILED: "failed"
1694
+ };
1695
+ var greater_than_or_equal2 = {
1696
+ PENDING: "pending",
1697
+ PROCESSING: "processing",
1698
+ COMPLETED: "completed",
1699
+ FAILED: "failed"
1700
+ };
1701
+ var less_than2 = {
1702
+ PENDING: "pending",
1703
+ PROCESSING: "processing",
1704
+ COMPLETED: "completed",
1705
+ FAILED: "failed"
1706
+ };
1707
+ var less_than_or_equal2 = {
1708
+ PENDING: "pending",
1709
+ PROCESSING: "processing",
1710
+ COMPLETED: "completed",
1711
+ FAILED: "failed"
1712
+ };
1713
+ var not_eq2 = {
1714
+ PENDING: "pending",
1715
+ PROCESSING: "processing",
1716
+ COMPLETED: "completed",
1717
+ FAILED: "failed"
1718
+ };
1719
+ var status = {
1720
+ PENDING: "pending",
1721
+ PROCESSING: "processing",
1722
+ COMPLETED: "completed",
1723
+ FAILED: "failed"
1724
+ };
1725
+ var eq3 = {
1726
+ ACTIVE: "active",
1727
+ REVOKED: "revoked",
1728
+ EXPIRED: "expired"
1729
+ };
1730
+ var greater_than3 = {
1731
+ ACTIVE: "active",
1732
+ REVOKED: "revoked",
1733
+ EXPIRED: "expired"
1734
+ };
1735
+ var greater_than_or_equal3 = {
1736
+ ACTIVE: "active",
1737
+ REVOKED: "revoked",
1738
+ EXPIRED: "expired"
1739
+ };
1740
+ var less_than3 = {
1741
+ ACTIVE: "active",
1742
+ REVOKED: "revoked",
1743
+ EXPIRED: "expired"
1744
+ };
1745
+ var less_than_or_equal3 = {
1746
+ ACTIVE: "active",
1747
+ REVOKED: "revoked",
1748
+ EXPIRED: "expired"
1749
+ };
1750
+ var not_eq3 = {
1751
+ ACTIVE: "active",
1752
+ REVOKED: "revoked",
1753
+ EXPIRED: "expired"
1754
+ };
1755
+ var eq4 = {
1756
+ PENDING: "pending",
1757
+ SUCCESS: "success",
1758
+ FAILED: "failed",
1759
+ REFUNDED: "refunded",
1760
+ VOIDED: "voided"
1761
+ };
1762
+ var greater_than4 = {
1763
+ PENDING: "pending",
1764
+ SUCCESS: "success",
1765
+ FAILED: "failed",
1766
+ REFUNDED: "refunded",
1767
+ VOIDED: "voided"
1768
+ };
1769
+ var greater_than_or_equal4 = {
1770
+ PENDING: "pending",
1771
+ SUCCESS: "success",
1772
+ FAILED: "failed",
1773
+ REFUNDED: "refunded",
1774
+ VOIDED: "voided"
1775
+ };
1776
+ var less_than4 = {
1777
+ PENDING: "pending",
1778
+ SUCCESS: "success",
1779
+ FAILED: "failed",
1780
+ REFUNDED: "refunded",
1781
+ VOIDED: "voided"
1782
+ };
1783
+ var less_than_or_equal4 = {
1784
+ PENDING: "pending",
1785
+ SUCCESS: "success",
1786
+ FAILED: "failed",
1787
+ REFUNDED: "refunded",
1788
+ VOIDED: "voided"
1789
+ };
1790
+ var not_eq4 = {
1791
+ PENDING: "pending",
1792
+ SUCCESS: "success",
1793
+ FAILED: "failed",
1794
+ REFUNDED: "refunded",
1795
+ VOIDED: "voided"
1796
+ };
1797
+ var status2 = {
1798
+ ACTIVE: "active",
1799
+ REVOKED: "revoked",
1800
+ EXPIRED: "expired"
1801
+ };
1802
+ var format = {
1803
+ ENTITY: "entity",
1804
+ TABULAR: "tabular",
1805
+ GRAPH: "graph",
1806
+ COMPOSITE: "composite"
1807
+ };
1808
+ var eq5 = {
1809
+ OWNER: "owner",
1810
+ ADMIN: "admin",
1811
+ MEMBER: "member"
1812
+ };
1813
+ var greater_than5 = {
1814
+ OWNER: "owner",
1815
+ ADMIN: "admin",
1816
+ MEMBER: "member"
1817
+ };
1818
+ var greater_than_or_equal5 = {
1819
+ OWNER: "owner",
1820
+ ADMIN: "admin",
1821
+ MEMBER: "member"
1822
+ };
1823
+ var less_than5 = {
1824
+ OWNER: "owner",
1825
+ ADMIN: "admin",
1826
+ MEMBER: "member"
1827
+ };
1828
+ var less_than_or_equal5 = {
1829
+ OWNER: "owner",
1830
+ ADMIN: "admin",
1831
+ MEMBER: "member"
1832
+ };
1833
+ var not_eq5 = {
1834
+ OWNER: "owner",
1835
+ ADMIN: "admin",
1836
+ MEMBER: "member"
1837
+ };
1838
+ var eq6 = {
1839
+ PLAN: "plan",
1840
+ ADDON: "addon"
1841
+ };
1842
+ var greater_than6 = {
1843
+ PLAN: "plan",
1844
+ ADDON: "addon"
1845
+ };
1846
+ var greater_than_or_equal6 = {
1847
+ PLAN: "plan",
1848
+ ADDON: "addon"
1849
+ };
1850
+ var less_than6 = {
1851
+ PLAN: "plan",
1852
+ ADDON: "addon"
1853
+ };
1854
+ var less_than_or_equal6 = {
1855
+ PLAN: "plan",
1856
+ ADDON: "addon"
1857
+ };
1858
+ var not_eq6 = {
1859
+ PLAN: "plan",
1860
+ ADDON: "addon"
1861
+ };
1862
+ var role = {
1863
+ OWNER: "owner",
1864
+ ADMIN: "admin",
1865
+ MEMBER: "member"
1866
+ };
1867
+ var eq7 = {
1868
+ PUBLIC: "public",
1869
+ PRIVATE: "private"
1870
+ };
1871
+ var greater_than7 = {
1872
+ PUBLIC: "public",
1873
+ PRIVATE: "private"
1874
+ };
1875
+ var greater_than_or_equal7 = {
1876
+ PUBLIC: "public",
1877
+ PRIVATE: "private"
1878
+ };
1879
+ var less_than7 = {
1880
+ PUBLIC: "public",
1881
+ PRIVATE: "private"
1882
+ };
1883
+ var less_than_or_equal7 = {
1884
+ PUBLIC: "public",
1885
+ PRIVATE: "private"
1886
+ };
1887
+ var not_eq7 = {
1888
+ PUBLIC: "public",
1889
+ PRIVATE: "private"
1890
+ };
1891
+ var eq8 = {
1892
+ SALE: "sale",
1893
+ AUTH: "auth",
1894
+ REFUND: "refund",
1895
+ VOID: "void"
1896
+ };
1897
+ var greater_than8 = {
1898
+ SALE: "sale",
1899
+ AUTH: "auth",
1900
+ REFUND: "refund",
1901
+ VOID: "void"
1902
+ };
1903
+ var greater_than_or_equal8 = {
1904
+ SALE: "sale",
1905
+ AUTH: "auth",
1906
+ REFUND: "refund",
1907
+ VOID: "void"
1908
+ };
1909
+ var less_than8 = {
1910
+ SALE: "sale",
1911
+ AUTH: "auth",
1912
+ REFUND: "refund",
1913
+ VOID: "void"
1914
+ };
1915
+ var less_than_or_equal8 = {
1916
+ SALE: "sale",
1917
+ AUTH: "auth",
1918
+ REFUND: "refund",
1919
+ VOID: "void"
1920
+ };
1921
+ var not_eq8 = {
1922
+ SALE: "sale",
1923
+ AUTH: "auth",
1924
+ REFUND: "refund",
1925
+ VOID: "void"
1926
+ };
1927
+ var type = {
1928
+ PUBLIC: "public",
1929
+ PRIVATE: "private"
1930
+ };
1931
+ export {
1932
+ GptClient,
1933
+ eq,
1934
+ eq2,
1935
+ eq3,
1936
+ eq4,
1937
+ eq5,
1938
+ eq6,
1939
+ eq7,
1940
+ eq8,
1941
+ format,
1942
+ greater_than,
1943
+ greater_than2,
1944
+ greater_than3,
1945
+ greater_than4,
1946
+ greater_than5,
1947
+ greater_than6,
1948
+ greater_than7,
1949
+ greater_than8,
1950
+ greater_than_or_equal,
1951
+ greater_than_or_equal2,
1952
+ greater_than_or_equal3,
1953
+ greater_than_or_equal4,
1954
+ greater_than_or_equal5,
1955
+ greater_than_or_equal6,
1956
+ greater_than_or_equal7,
1957
+ greater_than_or_equal8,
1958
+ less_than,
1959
+ less_than2,
1960
+ less_than3,
1961
+ less_than4,
1962
+ less_than5,
1963
+ less_than6,
1964
+ less_than7,
1965
+ less_than8,
1966
+ less_than_or_equal,
1967
+ less_than_or_equal2,
1968
+ less_than_or_equal3,
1969
+ less_than_or_equal4,
1970
+ less_than_or_equal5,
1971
+ less_than_or_equal6,
1972
+ less_than_or_equal7,
1973
+ less_than_or_equal8,
1974
+ not_eq,
1975
+ not_eq2,
1976
+ not_eq3,
1977
+ not_eq4,
1978
+ not_eq5,
1979
+ not_eq6,
1980
+ not_eq7,
1981
+ not_eq8,
1982
+ role,
1983
+ status,
1984
+ status2,
1985
+ type
1986
+ };