@lobehub/sdk 1.0.20260807012700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/generated/types.gen.d.mts +1601 -0
- package/dist/generated/types.gen.mjs +0 -0
- package/dist/index.d.mts +530 -0
- package/dist/index.mjs +1600 -0
- package/package.json +30 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1600 @@
|
|
|
1
|
+
//#region src/generated/core/bodySerializer.gen.ts
|
|
2
|
+
const serializeFormDataPair = (data, key, value) => {
|
|
3
|
+
if (typeof value === "string" || value instanceof Blob) data.append(key, value);
|
|
4
|
+
else if (value instanceof Date) data.append(key, value.toISOString());
|
|
5
|
+
else data.append(key, JSON.stringify(value));
|
|
6
|
+
};
|
|
7
|
+
const formDataBodySerializer = { bodySerializer: (body) => {
|
|
8
|
+
const data = new FormData();
|
|
9
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
10
|
+
if (value === void 0 || value === null) return;
|
|
11
|
+
if (Array.isArray(value)) value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
12
|
+
else serializeFormDataPair(data, key, value);
|
|
13
|
+
});
|
|
14
|
+
return data;
|
|
15
|
+
} };
|
|
16
|
+
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
17
|
+
Object.entries({
|
|
18
|
+
$body_: "body",
|
|
19
|
+
$headers_: "headers",
|
|
20
|
+
$path_: "path",
|
|
21
|
+
$query_: "query"
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/generated/core/serverSentEvents.gen.ts
|
|
25
|
+
function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
26
|
+
let lastEventId;
|
|
27
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
28
|
+
const createStream = async function* () {
|
|
29
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
30
|
+
let attempt = 0;
|
|
31
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
32
|
+
while (true) {
|
|
33
|
+
if (signal.aborted) break;
|
|
34
|
+
attempt++;
|
|
35
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
36
|
+
if (lastEventId !== void 0) headers.set("Last-Event-ID", lastEventId);
|
|
37
|
+
try {
|
|
38
|
+
const requestInit = {
|
|
39
|
+
redirect: "follow",
|
|
40
|
+
...options,
|
|
41
|
+
body: options.serializedBody,
|
|
42
|
+
headers,
|
|
43
|
+
signal
|
|
44
|
+
};
|
|
45
|
+
let request = new Request(url, requestInit);
|
|
46
|
+
if (onRequest) request = await onRequest(url, requestInit);
|
|
47
|
+
const response = await (options.fetch ?? globalThis.fetch)(request);
|
|
48
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
49
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
50
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
51
|
+
let buffer = "";
|
|
52
|
+
const abortHandler = () => {
|
|
53
|
+
try {
|
|
54
|
+
reader.cancel();
|
|
55
|
+
} catch {}
|
|
56
|
+
};
|
|
57
|
+
signal.addEventListener("abort", abortHandler);
|
|
58
|
+
try {
|
|
59
|
+
while (true) {
|
|
60
|
+
const { done, value } = await reader.read();
|
|
61
|
+
if (done) break;
|
|
62
|
+
buffer += value;
|
|
63
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
64
|
+
const chunks = buffer.split("\n\n");
|
|
65
|
+
buffer = chunks.pop() ?? "";
|
|
66
|
+
for (const chunk of chunks) {
|
|
67
|
+
const lines = chunk.split("\n");
|
|
68
|
+
const dataLines = [];
|
|
69
|
+
let eventName;
|
|
70
|
+
for (const line of lines) if (line.startsWith("data:")) dataLines.push(line.replace(/^data:\s*/, ""));
|
|
71
|
+
else if (line.startsWith("event:")) eventName = line.replace(/^event:\s*/, "");
|
|
72
|
+
else if (line.startsWith("id:")) lastEventId = line.replace(/^id:\s*/, "");
|
|
73
|
+
else if (line.startsWith("retry:")) {
|
|
74
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
75
|
+
if (!Number.isNaN(parsed)) retryDelay = parsed;
|
|
76
|
+
}
|
|
77
|
+
let data;
|
|
78
|
+
let parsedJson = false;
|
|
79
|
+
if (dataLines.length) {
|
|
80
|
+
const rawData = dataLines.join("\n");
|
|
81
|
+
try {
|
|
82
|
+
data = JSON.parse(rawData);
|
|
83
|
+
parsedJson = true;
|
|
84
|
+
} catch {
|
|
85
|
+
data = rawData;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (parsedJson) {
|
|
89
|
+
if (responseValidator) await responseValidator(data);
|
|
90
|
+
if (responseTransformer) data = await responseTransformer(data);
|
|
91
|
+
}
|
|
92
|
+
onSseEvent?.({
|
|
93
|
+
data,
|
|
94
|
+
event: eventName,
|
|
95
|
+
id: lastEventId,
|
|
96
|
+
retry: retryDelay
|
|
97
|
+
});
|
|
98
|
+
if (dataLines.length) yield data;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
} finally {
|
|
102
|
+
signal.removeEventListener("abort", abortHandler);
|
|
103
|
+
reader.releaseLock();
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
} catch (error) {
|
|
107
|
+
onSseError?.(error);
|
|
108
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) break;
|
|
109
|
+
await sleep(Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return { stream: createStream() };
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/generated/core/pathSerializer.gen.ts
|
|
117
|
+
const separatorArrayExplode = (style) => {
|
|
118
|
+
switch (style) {
|
|
119
|
+
case "label": return ".";
|
|
120
|
+
case "matrix": return ";";
|
|
121
|
+
case "simple": return ",";
|
|
122
|
+
default: return "&";
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const separatorArrayNoExplode = (style) => {
|
|
126
|
+
switch (style) {
|
|
127
|
+
case "form": return ",";
|
|
128
|
+
case "pipeDelimited": return "|";
|
|
129
|
+
case "spaceDelimited": return "%20";
|
|
130
|
+
default: return ",";
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const separatorObjectExplode = (style) => {
|
|
134
|
+
switch (style) {
|
|
135
|
+
case "label": return ".";
|
|
136
|
+
case "matrix": return ";";
|
|
137
|
+
case "simple": return ",";
|
|
138
|
+
default: return "&";
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
142
|
+
if (!explode) {
|
|
143
|
+
const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
144
|
+
switch (style) {
|
|
145
|
+
case "label": return `.${joinedValues}`;
|
|
146
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
147
|
+
case "simple": return joinedValues;
|
|
148
|
+
default: return `${name}=${joinedValues}`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const separator = separatorArrayExplode(style);
|
|
152
|
+
const joinedValues = value.map((v) => {
|
|
153
|
+
if (style === "label" || style === "simple") return allowReserved ? v : encodeURIComponent(v);
|
|
154
|
+
return serializePrimitiveParam({
|
|
155
|
+
allowReserved,
|
|
156
|
+
name,
|
|
157
|
+
value: v
|
|
158
|
+
});
|
|
159
|
+
}).join(separator);
|
|
160
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
161
|
+
};
|
|
162
|
+
const serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
163
|
+
if (value === void 0 || value === null) return "";
|
|
164
|
+
if (typeof value === "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
|
|
165
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
166
|
+
};
|
|
167
|
+
const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
168
|
+
if (value instanceof Date) return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
169
|
+
if (style !== "deepObject" && !explode) {
|
|
170
|
+
let values = [];
|
|
171
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
172
|
+
values = [
|
|
173
|
+
...values,
|
|
174
|
+
key,
|
|
175
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
176
|
+
];
|
|
177
|
+
});
|
|
178
|
+
const joinedValues = values.join(",");
|
|
179
|
+
switch (style) {
|
|
180
|
+
case "form": return `${name}=${joinedValues}`;
|
|
181
|
+
case "label": return `.${joinedValues}`;
|
|
182
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
183
|
+
default: return joinedValues;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const separator = separatorObjectExplode(style);
|
|
187
|
+
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
188
|
+
allowReserved,
|
|
189
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
190
|
+
value: v
|
|
191
|
+
})).join(separator);
|
|
192
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
193
|
+
};
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/generated/core/utils.gen.ts
|
|
196
|
+
const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
197
|
+
const defaultPathSerializer = ({ path, url: _url }) => {
|
|
198
|
+
let url = _url;
|
|
199
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
200
|
+
if (matches) for (const match of matches) {
|
|
201
|
+
let explode = false;
|
|
202
|
+
let name = match.substring(1, match.length - 1);
|
|
203
|
+
let style = "simple";
|
|
204
|
+
if (name.endsWith("*")) {
|
|
205
|
+
explode = true;
|
|
206
|
+
name = name.substring(0, name.length - 1);
|
|
207
|
+
}
|
|
208
|
+
if (name.startsWith(".")) {
|
|
209
|
+
name = name.substring(1);
|
|
210
|
+
style = "label";
|
|
211
|
+
} else if (name.startsWith(";")) {
|
|
212
|
+
name = name.substring(1);
|
|
213
|
+
style = "matrix";
|
|
214
|
+
}
|
|
215
|
+
const value = path[name];
|
|
216
|
+
if (value === void 0 || value === null) continue;
|
|
217
|
+
if (Array.isArray(value)) {
|
|
218
|
+
url = url.replace(match, serializeArrayParam({
|
|
219
|
+
explode,
|
|
220
|
+
name,
|
|
221
|
+
style,
|
|
222
|
+
value
|
|
223
|
+
}));
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (typeof value === "object") {
|
|
227
|
+
url = url.replace(match, serializeObjectParam({
|
|
228
|
+
explode,
|
|
229
|
+
name,
|
|
230
|
+
style,
|
|
231
|
+
value,
|
|
232
|
+
valueOnly: true
|
|
233
|
+
}));
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (style === "matrix") {
|
|
237
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
238
|
+
name,
|
|
239
|
+
value
|
|
240
|
+
})}`);
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
|
|
244
|
+
url = url.replace(match, replaceValue);
|
|
245
|
+
}
|
|
246
|
+
return url;
|
|
247
|
+
};
|
|
248
|
+
const getUrl = ({ baseUrl, path, query, querySerializer, url: _url }) => {
|
|
249
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
250
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
251
|
+
if (path) url = defaultPathSerializer({
|
|
252
|
+
path,
|
|
253
|
+
url
|
|
254
|
+
});
|
|
255
|
+
let search = query ? querySerializer(query) : "";
|
|
256
|
+
if (search.startsWith("?")) search = search.substring(1);
|
|
257
|
+
if (search) url += `?${search}`;
|
|
258
|
+
return url;
|
|
259
|
+
};
|
|
260
|
+
function getValidRequestBody(options) {
|
|
261
|
+
const hasBody = options.body !== void 0;
|
|
262
|
+
if (hasBody && options.bodySerializer) {
|
|
263
|
+
if ("serializedBody" in options) return options.serializedBody !== void 0 && options.serializedBody !== "" ? options.serializedBody : null;
|
|
264
|
+
return options.body !== "" ? options.body : null;
|
|
265
|
+
}
|
|
266
|
+
if (hasBody) return options.body;
|
|
267
|
+
}
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/generated/core/auth.gen.ts
|
|
270
|
+
const getAuthToken = async (auth, callback) => {
|
|
271
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
272
|
+
if (!token) return;
|
|
273
|
+
if (auth.scheme === "bearer") return `Bearer ${token}`;
|
|
274
|
+
if (auth.scheme === "basic") return `Basic ${btoa(token)}`;
|
|
275
|
+
return token;
|
|
276
|
+
};
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/generated/client/utils.gen.ts
|
|
279
|
+
const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
|
|
280
|
+
const querySerializer = (queryParams) => {
|
|
281
|
+
const search = [];
|
|
282
|
+
if (queryParams && typeof queryParams === "object") for (const name in queryParams) {
|
|
283
|
+
const value = queryParams[name];
|
|
284
|
+
if (value === void 0 || value === null) continue;
|
|
285
|
+
const options = parameters[name] || args;
|
|
286
|
+
if (Array.isArray(value)) {
|
|
287
|
+
const serializedArray = serializeArrayParam({
|
|
288
|
+
allowReserved: options.allowReserved,
|
|
289
|
+
explode: true,
|
|
290
|
+
name,
|
|
291
|
+
style: "form",
|
|
292
|
+
value,
|
|
293
|
+
...options.array
|
|
294
|
+
});
|
|
295
|
+
if (serializedArray) search.push(serializedArray);
|
|
296
|
+
} else if (typeof value === "object") {
|
|
297
|
+
const serializedObject = serializeObjectParam({
|
|
298
|
+
allowReserved: options.allowReserved,
|
|
299
|
+
explode: true,
|
|
300
|
+
name,
|
|
301
|
+
style: "deepObject",
|
|
302
|
+
value,
|
|
303
|
+
...options.object
|
|
304
|
+
});
|
|
305
|
+
if (serializedObject) search.push(serializedObject);
|
|
306
|
+
} else {
|
|
307
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
308
|
+
allowReserved: options.allowReserved,
|
|
309
|
+
name,
|
|
310
|
+
value
|
|
311
|
+
});
|
|
312
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return search.join("&");
|
|
316
|
+
};
|
|
317
|
+
return querySerializer;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Infers parseAs value from provided Content-Type header.
|
|
321
|
+
*/
|
|
322
|
+
const getParseAs = (contentType) => {
|
|
323
|
+
if (!contentType) return "stream";
|
|
324
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
325
|
+
if (!cleanContent) return;
|
|
326
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) return "json";
|
|
327
|
+
if (cleanContent === "multipart/form-data") return "formData";
|
|
328
|
+
if ([
|
|
329
|
+
"application/",
|
|
330
|
+
"audio/",
|
|
331
|
+
"image/",
|
|
332
|
+
"video/"
|
|
333
|
+
].some((type) => cleanContent.startsWith(type))) return "blob";
|
|
334
|
+
if (cleanContent.startsWith("text/")) return "text";
|
|
335
|
+
};
|
|
336
|
+
const checkForExistence = (options, name) => {
|
|
337
|
+
if (!name) return false;
|
|
338
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) return true;
|
|
339
|
+
return false;
|
|
340
|
+
};
|
|
341
|
+
async function setAuthParams(options) {
|
|
342
|
+
for (const auth of options.security ?? []) {
|
|
343
|
+
if (checkForExistence(options, auth.name)) continue;
|
|
344
|
+
const token = await getAuthToken(auth, options.auth);
|
|
345
|
+
if (!token) continue;
|
|
346
|
+
const name = auth.name ?? "Authorization";
|
|
347
|
+
switch (auth.in) {
|
|
348
|
+
case "query":
|
|
349
|
+
if (!options.query) options.query = {};
|
|
350
|
+
options.query[name] = token;
|
|
351
|
+
break;
|
|
352
|
+
case "cookie":
|
|
353
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
354
|
+
break;
|
|
355
|
+
default:
|
|
356
|
+
options.headers.set(name, token);
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
const buildUrl = (options) => getUrl({
|
|
362
|
+
baseUrl: options.baseUrl,
|
|
363
|
+
path: options.path,
|
|
364
|
+
query: options.query,
|
|
365
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
366
|
+
url: options.url
|
|
367
|
+
});
|
|
368
|
+
const mergeConfigs = (a, b) => {
|
|
369
|
+
const config = {
|
|
370
|
+
...a,
|
|
371
|
+
...b
|
|
372
|
+
};
|
|
373
|
+
if (config.baseUrl?.endsWith("/")) config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
374
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
375
|
+
return config;
|
|
376
|
+
};
|
|
377
|
+
const headersEntries = (headers) => {
|
|
378
|
+
const entries = [];
|
|
379
|
+
headers.forEach((value, key) => {
|
|
380
|
+
entries.push([key, value]);
|
|
381
|
+
});
|
|
382
|
+
return entries;
|
|
383
|
+
};
|
|
384
|
+
const mergeHeaders = (...headers) => {
|
|
385
|
+
const mergedHeaders = new Headers();
|
|
386
|
+
for (const header of headers) {
|
|
387
|
+
if (!header) continue;
|
|
388
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Array.isArray(header) ? headersEntries(new Headers(header)) : Object.entries(header);
|
|
389
|
+
for (const [key, value] of iterator) if (value === null) mergedHeaders.delete(key);
|
|
390
|
+
else if (Array.isArray(value)) for (const v of value) mergedHeaders.append(key, v);
|
|
391
|
+
else if (value !== void 0) mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
392
|
+
}
|
|
393
|
+
return mergedHeaders;
|
|
394
|
+
};
|
|
395
|
+
var Interceptors = class {
|
|
396
|
+
fns = [];
|
|
397
|
+
clear() {
|
|
398
|
+
this.fns = [];
|
|
399
|
+
}
|
|
400
|
+
eject(id) {
|
|
401
|
+
const index = this.getInterceptorIndex(id);
|
|
402
|
+
if (this.fns[index]) this.fns[index] = null;
|
|
403
|
+
}
|
|
404
|
+
exists(id) {
|
|
405
|
+
const index = this.getInterceptorIndex(id);
|
|
406
|
+
return Boolean(this.fns[index]);
|
|
407
|
+
}
|
|
408
|
+
getInterceptorIndex(id) {
|
|
409
|
+
if (typeof id === "number") return this.fns[id] ? id : -1;
|
|
410
|
+
return this.fns.indexOf(id);
|
|
411
|
+
}
|
|
412
|
+
update(id, fn) {
|
|
413
|
+
const index = this.getInterceptorIndex(id);
|
|
414
|
+
if (this.fns[index]) {
|
|
415
|
+
this.fns[index] = fn;
|
|
416
|
+
return id;
|
|
417
|
+
}
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
use(fn) {
|
|
421
|
+
this.fns.push(fn);
|
|
422
|
+
return this.fns.length - 1;
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
const createInterceptors = () => ({
|
|
426
|
+
error: new Interceptors(),
|
|
427
|
+
request: new Interceptors(),
|
|
428
|
+
response: new Interceptors()
|
|
429
|
+
});
|
|
430
|
+
const defaultQuerySerializer = createQuerySerializer({
|
|
431
|
+
allowReserved: false,
|
|
432
|
+
array: {
|
|
433
|
+
explode: true,
|
|
434
|
+
style: "form"
|
|
435
|
+
},
|
|
436
|
+
object: {
|
|
437
|
+
explode: true,
|
|
438
|
+
style: "deepObject"
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
const defaultHeaders = { "Content-Type": "application/json" };
|
|
442
|
+
const createConfig = (override = {}) => ({
|
|
443
|
+
...jsonBodySerializer,
|
|
444
|
+
headers: defaultHeaders,
|
|
445
|
+
parseAs: "auto",
|
|
446
|
+
querySerializer: defaultQuerySerializer,
|
|
447
|
+
...override
|
|
448
|
+
});
|
|
449
|
+
//#endregion
|
|
450
|
+
//#region src/generated/client/client.gen.ts
|
|
451
|
+
const createClient = (config = {}) => {
|
|
452
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
453
|
+
const getConfig = () => ({ ..._config });
|
|
454
|
+
const setConfig = (config) => {
|
|
455
|
+
_config = mergeConfigs(_config, config);
|
|
456
|
+
return getConfig();
|
|
457
|
+
};
|
|
458
|
+
const interceptors = createInterceptors();
|
|
459
|
+
const beforeRequest = async (options) => {
|
|
460
|
+
const opts = {
|
|
461
|
+
..._config,
|
|
462
|
+
...options,
|
|
463
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
464
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
465
|
+
serializedBody: void 0
|
|
466
|
+
};
|
|
467
|
+
if (opts.security) await setAuthParams(opts);
|
|
468
|
+
if (opts.requestValidator) await opts.requestValidator(opts);
|
|
469
|
+
if (opts.body !== void 0 && opts.bodySerializer) opts.serializedBody = opts.bodySerializer(opts.body);
|
|
470
|
+
if (opts.body === void 0 || opts.serializedBody === "") opts.headers.delete("Content-Type");
|
|
471
|
+
const resolvedOpts = opts;
|
|
472
|
+
return {
|
|
473
|
+
opts: resolvedOpts,
|
|
474
|
+
url: buildUrl(resolvedOpts)
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
const request = async (options) => {
|
|
478
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
479
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
480
|
+
let request;
|
|
481
|
+
let response;
|
|
482
|
+
try {
|
|
483
|
+
const { opts, url } = await beforeRequest(options);
|
|
484
|
+
const requestInit = {
|
|
485
|
+
redirect: "follow",
|
|
486
|
+
...opts,
|
|
487
|
+
body: getValidRequestBody(opts)
|
|
488
|
+
};
|
|
489
|
+
request = new Request(url, requestInit);
|
|
490
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
491
|
+
const _fetch = opts.fetch;
|
|
492
|
+
response = await _fetch(request);
|
|
493
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request, opts);
|
|
494
|
+
const result = {
|
|
495
|
+
request,
|
|
496
|
+
response
|
|
497
|
+
};
|
|
498
|
+
if (response.ok) {
|
|
499
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
500
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
501
|
+
let emptyData;
|
|
502
|
+
switch (parseAs) {
|
|
503
|
+
case "arrayBuffer":
|
|
504
|
+
case "blob":
|
|
505
|
+
case "text":
|
|
506
|
+
emptyData = await response[parseAs]();
|
|
507
|
+
break;
|
|
508
|
+
case "formData":
|
|
509
|
+
emptyData = new FormData();
|
|
510
|
+
break;
|
|
511
|
+
case "stream":
|
|
512
|
+
emptyData = response.body;
|
|
513
|
+
break;
|
|
514
|
+
default:
|
|
515
|
+
emptyData = {};
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
519
|
+
data: emptyData,
|
|
520
|
+
...result
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
let data;
|
|
524
|
+
switch (parseAs) {
|
|
525
|
+
case "arrayBuffer":
|
|
526
|
+
case "blob":
|
|
527
|
+
case "formData":
|
|
528
|
+
case "text":
|
|
529
|
+
data = await response[parseAs]();
|
|
530
|
+
break;
|
|
531
|
+
case "json": {
|
|
532
|
+
const text = await response.text();
|
|
533
|
+
data = text ? JSON.parse(text) : {};
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
case "stream": return opts.responseStyle === "data" ? response.body : {
|
|
537
|
+
data: response.body,
|
|
538
|
+
...result
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
if (parseAs === "json") {
|
|
542
|
+
if (opts.responseValidator) await opts.responseValidator(data);
|
|
543
|
+
if (opts.responseTransformer) data = await opts.responseTransformer(data);
|
|
544
|
+
}
|
|
545
|
+
return opts.responseStyle === "data" ? data : {
|
|
546
|
+
data,
|
|
547
|
+
...result
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
const textError = await response.text();
|
|
551
|
+
let jsonError;
|
|
552
|
+
try {
|
|
553
|
+
jsonError = JSON.parse(textError);
|
|
554
|
+
} catch {}
|
|
555
|
+
throw jsonError ?? textError;
|
|
556
|
+
} catch (error) {
|
|
557
|
+
let finalError = error;
|
|
558
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(finalError, response, request, options);
|
|
559
|
+
finalError = finalError || {};
|
|
560
|
+
if (throwOnError) throw finalError;
|
|
561
|
+
return responseStyle === "data" ? void 0 : {
|
|
562
|
+
error: finalError,
|
|
563
|
+
request,
|
|
564
|
+
response
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
const makeMethodFn = (method) => (options) => request({
|
|
569
|
+
...options,
|
|
570
|
+
method
|
|
571
|
+
});
|
|
572
|
+
const makeSseFn = (method) => async (options) => {
|
|
573
|
+
const { opts, url } = await beforeRequest(options);
|
|
574
|
+
return createSseClient({
|
|
575
|
+
...opts,
|
|
576
|
+
body: opts.body,
|
|
577
|
+
method,
|
|
578
|
+
onRequest: async (url, init) => {
|
|
579
|
+
let request = new Request(url, init);
|
|
580
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
581
|
+
return request;
|
|
582
|
+
},
|
|
583
|
+
serializedBody: getValidRequestBody(opts),
|
|
584
|
+
url
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
const _buildUrl = (options) => buildUrl({
|
|
588
|
+
..._config,
|
|
589
|
+
...options
|
|
590
|
+
});
|
|
591
|
+
return {
|
|
592
|
+
buildUrl: _buildUrl,
|
|
593
|
+
connect: makeMethodFn("CONNECT"),
|
|
594
|
+
delete: makeMethodFn("DELETE"),
|
|
595
|
+
get: makeMethodFn("GET"),
|
|
596
|
+
getConfig,
|
|
597
|
+
head: makeMethodFn("HEAD"),
|
|
598
|
+
interceptors,
|
|
599
|
+
options: makeMethodFn("OPTIONS"),
|
|
600
|
+
patch: makeMethodFn("PATCH"),
|
|
601
|
+
post: makeMethodFn("POST"),
|
|
602
|
+
put: makeMethodFn("PUT"),
|
|
603
|
+
request,
|
|
604
|
+
setConfig,
|
|
605
|
+
sse: {
|
|
606
|
+
connect: makeSseFn("CONNECT"),
|
|
607
|
+
delete: makeSseFn("DELETE"),
|
|
608
|
+
get: makeSseFn("GET"),
|
|
609
|
+
head: makeSseFn("HEAD"),
|
|
610
|
+
options: makeSseFn("OPTIONS"),
|
|
611
|
+
patch: makeSseFn("PATCH"),
|
|
612
|
+
post: makeSseFn("POST"),
|
|
613
|
+
put: makeSseFn("PUT"),
|
|
614
|
+
trace: makeSseFn("TRACE")
|
|
615
|
+
},
|
|
616
|
+
trace: makeMethodFn("TRACE")
|
|
617
|
+
};
|
|
618
|
+
};
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/generated/client.gen.ts
|
|
621
|
+
const client = createClient(createConfig({ baseUrl: "https://app.lobehub.com" }));
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/generated/sdk.gen.ts
|
|
624
|
+
const mergeMethodHeaders = (defaults, headers) => {
|
|
625
|
+
const merged = { ...defaults };
|
|
626
|
+
if (!headers) return merged;
|
|
627
|
+
const entries = headers instanceof Headers ? [...headers.entries()] : Array.isArray(headers) ? headers : Object.entries(headers);
|
|
628
|
+
for (const [key, value] of entries) merged[key] = value;
|
|
629
|
+
return merged;
|
|
630
|
+
};
|
|
631
|
+
var HeyApiClient = class {
|
|
632
|
+
client;
|
|
633
|
+
constructor(args) {
|
|
634
|
+
this.client = args?.client ?? client;
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
var HeyApiRegistry = class {
|
|
638
|
+
defaultKey = "default";
|
|
639
|
+
instances = /* @__PURE__ */ new Map();
|
|
640
|
+
get(key) {
|
|
641
|
+
const instance = this.instances.get(key ?? this.defaultKey);
|
|
642
|
+
if (!instance) throw new Error(`No SDK client found. Create one with "new LobeHub()" to fix this error.`);
|
|
643
|
+
return instance;
|
|
644
|
+
}
|
|
645
|
+
set(value, key) {
|
|
646
|
+
this.instances.set(key ?? this.defaultKey, value);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
var Health = class extends HeyApiClient {
|
|
650
|
+
/**
|
|
651
|
+
* Health check
|
|
652
|
+
*/
|
|
653
|
+
check(options) {
|
|
654
|
+
return (options?.client ?? this.client).get({
|
|
655
|
+
security: [{
|
|
656
|
+
scheme: "bearer",
|
|
657
|
+
type: "http"
|
|
658
|
+
}],
|
|
659
|
+
url: "/api/v1/health",
|
|
660
|
+
...options
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
var AgentGroups = class extends HeyApiClient {
|
|
665
|
+
/**
|
|
666
|
+
* Get agent group list
|
|
667
|
+
*/
|
|
668
|
+
list(options) {
|
|
669
|
+
return (options?.client ?? this.client).get({
|
|
670
|
+
security: [{
|
|
671
|
+
scheme: "bearer",
|
|
672
|
+
type: "http"
|
|
673
|
+
}],
|
|
674
|
+
url: "/api/v1/agent-groups",
|
|
675
|
+
...options
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
create(options) {
|
|
679
|
+
return (options.client ?? this.client).post({
|
|
680
|
+
security: [{
|
|
681
|
+
scheme: "bearer",
|
|
682
|
+
type: "http"
|
|
683
|
+
}],
|
|
684
|
+
url: "/api/v1/agent-groups",
|
|
685
|
+
...options,
|
|
686
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
delete(options) {
|
|
690
|
+
return (options.client ?? this.client).delete({
|
|
691
|
+
security: [{
|
|
692
|
+
scheme: "bearer",
|
|
693
|
+
type: "http"
|
|
694
|
+
}],
|
|
695
|
+
url: "/api/v1/agent-groups/{id}",
|
|
696
|
+
...options
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
get(options) {
|
|
700
|
+
return (options.client ?? this.client).get({
|
|
701
|
+
security: [{
|
|
702
|
+
scheme: "bearer",
|
|
703
|
+
type: "http"
|
|
704
|
+
}],
|
|
705
|
+
url: "/api/v1/agent-groups/{id}",
|
|
706
|
+
...options
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
update(options) {
|
|
710
|
+
return (options.client ?? this.client).patch({
|
|
711
|
+
security: [{
|
|
712
|
+
scheme: "bearer",
|
|
713
|
+
type: "http"
|
|
714
|
+
}],
|
|
715
|
+
url: "/api/v1/agent-groups/{id}",
|
|
716
|
+
...options,
|
|
717
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
var Agents = class extends HeyApiClient {
|
|
722
|
+
list(options) {
|
|
723
|
+
return (options?.client ?? this.client).get({
|
|
724
|
+
security: [{
|
|
725
|
+
scheme: "bearer",
|
|
726
|
+
type: "http"
|
|
727
|
+
}],
|
|
728
|
+
url: "/api/v1/agents",
|
|
729
|
+
...options
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
create(options) {
|
|
733
|
+
return (options.client ?? this.client).post({
|
|
734
|
+
security: [{
|
|
735
|
+
scheme: "bearer",
|
|
736
|
+
type: "http"
|
|
737
|
+
}],
|
|
738
|
+
url: "/api/v1/agents",
|
|
739
|
+
...options,
|
|
740
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
delete(options) {
|
|
744
|
+
return (options.client ?? this.client).delete({
|
|
745
|
+
security: [{
|
|
746
|
+
scheme: "bearer",
|
|
747
|
+
type: "http"
|
|
748
|
+
}],
|
|
749
|
+
url: "/api/v1/agents/{id}",
|
|
750
|
+
...options
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
get(options) {
|
|
754
|
+
return (options.client ?? this.client).get({
|
|
755
|
+
security: [{
|
|
756
|
+
scheme: "bearer",
|
|
757
|
+
type: "http"
|
|
758
|
+
}],
|
|
759
|
+
url: "/api/v1/agents/{id}",
|
|
760
|
+
...options
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
update(options) {
|
|
764
|
+
return (options.client ?? this.client).patch({
|
|
765
|
+
security: [{
|
|
766
|
+
scheme: "bearer",
|
|
767
|
+
type: "http"
|
|
768
|
+
}],
|
|
769
|
+
url: "/api/v1/agents/{id}",
|
|
770
|
+
...options,
|
|
771
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
var Files = class extends HeyApiClient {
|
|
776
|
+
list(options) {
|
|
777
|
+
return (options?.client ?? this.client).get({
|
|
778
|
+
security: [{
|
|
779
|
+
scheme: "bearer",
|
|
780
|
+
type: "http"
|
|
781
|
+
}],
|
|
782
|
+
url: "/api/v1/files",
|
|
783
|
+
...options
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Upload a file and return the corresponding file record
|
|
788
|
+
*/
|
|
789
|
+
create(options) {
|
|
790
|
+
return (options.client ?? this.client).post({
|
|
791
|
+
...formDataBodySerializer,
|
|
792
|
+
security: [{
|
|
793
|
+
scheme: "bearer",
|
|
794
|
+
type: "http"
|
|
795
|
+
}],
|
|
796
|
+
url: "/api/v1/files",
|
|
797
|
+
...options,
|
|
798
|
+
headers: mergeMethodHeaders({ "Content-Type": null }, options.headers)
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
delete(options) {
|
|
802
|
+
return (options.client ?? this.client).delete({
|
|
803
|
+
security: [{
|
|
804
|
+
scheme: "bearer",
|
|
805
|
+
type: "http"
|
|
806
|
+
}],
|
|
807
|
+
url: "/api/v1/files/{id}",
|
|
808
|
+
...options
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
get(options) {
|
|
812
|
+
return (options.client ?? this.client).get({
|
|
813
|
+
security: [{
|
|
814
|
+
scheme: "bearer",
|
|
815
|
+
type: "http"
|
|
816
|
+
}],
|
|
817
|
+
url: "/api/v1/files/{id}",
|
|
818
|
+
...options
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
update(options) {
|
|
822
|
+
return (options.client ?? this.client).patch({
|
|
823
|
+
security: [{
|
|
824
|
+
scheme: "bearer",
|
|
825
|
+
type: "http"
|
|
826
|
+
}],
|
|
827
|
+
url: "/api/v1/files/{id}",
|
|
828
|
+
...options,
|
|
829
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
getUrl(options) {
|
|
833
|
+
return (options.client ?? this.client).get({
|
|
834
|
+
security: [{
|
|
835
|
+
scheme: "bearer",
|
|
836
|
+
type: "http"
|
|
837
|
+
}],
|
|
838
|
+
url: "/api/v1/files/{id}/url",
|
|
839
|
+
...options
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
parse(options) {
|
|
843
|
+
return (options.client ?? this.client).post({
|
|
844
|
+
security: [{
|
|
845
|
+
scheme: "bearer",
|
|
846
|
+
type: "http"
|
|
847
|
+
}],
|
|
848
|
+
url: "/api/v1/files/{id}/parses",
|
|
849
|
+
...options
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
listChunks(options) {
|
|
853
|
+
return (options.client ?? this.client).get({
|
|
854
|
+
security: [{
|
|
855
|
+
scheme: "bearer",
|
|
856
|
+
type: "http"
|
|
857
|
+
}],
|
|
858
|
+
url: "/api/v1/files/{id}/chunks",
|
|
859
|
+
...options
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
createChunks(options) {
|
|
863
|
+
return (options.client ?? this.client).post({
|
|
864
|
+
security: [{
|
|
865
|
+
scheme: "bearer",
|
|
866
|
+
type: "http"
|
|
867
|
+
}],
|
|
868
|
+
url: "/api/v1/files/{id}/chunks",
|
|
869
|
+
...options,
|
|
870
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Batch file upload
|
|
875
|
+
*/
|
|
876
|
+
uploadBatch(options) {
|
|
877
|
+
return (options.client ?? this.client).post({
|
|
878
|
+
...formDataBodySerializer,
|
|
879
|
+
security: [{
|
|
880
|
+
scheme: "bearer",
|
|
881
|
+
type: "http"
|
|
882
|
+
}],
|
|
883
|
+
url: "/api/v1/files/batches",
|
|
884
|
+
...options,
|
|
885
|
+
headers: mergeMethodHeaders({ "Content-Type": null }, options.headers)
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
query(options) {
|
|
889
|
+
return (options.client ?? this.client).post({
|
|
890
|
+
security: [{
|
|
891
|
+
scheme: "bearer",
|
|
892
|
+
type: "http"
|
|
893
|
+
}],
|
|
894
|
+
url: "/api/v1/files/queries",
|
|
895
|
+
...options,
|
|
896
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
var KnowledgeBases = class extends HeyApiClient {
|
|
901
|
+
list(options) {
|
|
902
|
+
return (options?.client ?? this.client).get({
|
|
903
|
+
security: [{
|
|
904
|
+
scheme: "bearer",
|
|
905
|
+
type: "http"
|
|
906
|
+
}],
|
|
907
|
+
url: "/api/v1/knowledge-bases",
|
|
908
|
+
...options
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
create(options) {
|
|
912
|
+
return (options.client ?? this.client).post({
|
|
913
|
+
security: [{
|
|
914
|
+
scheme: "bearer",
|
|
915
|
+
type: "http"
|
|
916
|
+
}],
|
|
917
|
+
url: "/api/v1/knowledge-bases",
|
|
918
|
+
...options,
|
|
919
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
delete(options) {
|
|
923
|
+
return (options.client ?? this.client).delete({
|
|
924
|
+
security: [{
|
|
925
|
+
scheme: "bearer",
|
|
926
|
+
type: "http"
|
|
927
|
+
}],
|
|
928
|
+
url: "/api/v1/knowledge-bases/{id}",
|
|
929
|
+
...options
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
get(options) {
|
|
933
|
+
return (options.client ?? this.client).get({
|
|
934
|
+
security: [{
|
|
935
|
+
scheme: "bearer",
|
|
936
|
+
type: "http"
|
|
937
|
+
}],
|
|
938
|
+
url: "/api/v1/knowledge-bases/{id}",
|
|
939
|
+
...options
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
update(options) {
|
|
943
|
+
return (options.client ?? this.client).patch({
|
|
944
|
+
security: [{
|
|
945
|
+
scheme: "bearer",
|
|
946
|
+
type: "http"
|
|
947
|
+
}],
|
|
948
|
+
url: "/api/v1/knowledge-bases/{id}",
|
|
949
|
+
...options,
|
|
950
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
listFiles(options) {
|
|
954
|
+
return (options.client ?? this.client).get({
|
|
955
|
+
security: [{
|
|
956
|
+
scheme: "bearer",
|
|
957
|
+
type: "http"
|
|
958
|
+
}],
|
|
959
|
+
url: "/api/v1/knowledge-bases/{id}/files",
|
|
960
|
+
...options
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
removeFiles(options) {
|
|
964
|
+
return (options.client ?? this.client).delete({
|
|
965
|
+
security: [{
|
|
966
|
+
scheme: "bearer",
|
|
967
|
+
type: "http"
|
|
968
|
+
}],
|
|
969
|
+
url: "/api/v1/knowledge-bases/{id}/files/batch",
|
|
970
|
+
...options,
|
|
971
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
addFiles(options) {
|
|
975
|
+
return (options.client ?? this.client).post({
|
|
976
|
+
security: [{
|
|
977
|
+
scheme: "bearer",
|
|
978
|
+
type: "http"
|
|
979
|
+
}],
|
|
980
|
+
url: "/api/v1/knowledge-bases/{id}/files/batch",
|
|
981
|
+
...options,
|
|
982
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
moveFiles(options) {
|
|
986
|
+
return (options.client ?? this.client).post({
|
|
987
|
+
security: [{
|
|
988
|
+
scheme: "bearer",
|
|
989
|
+
type: "http"
|
|
990
|
+
}],
|
|
991
|
+
url: "/api/v1/knowledge-bases/{id}/files/move",
|
|
992
|
+
...options,
|
|
993
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
var MessageTranslations = class extends HeyApiClient {
|
|
998
|
+
delete(options) {
|
|
999
|
+
return (options.client ?? this.client).delete({
|
|
1000
|
+
security: [{
|
|
1001
|
+
scheme: "bearer",
|
|
1002
|
+
type: "http"
|
|
1003
|
+
}],
|
|
1004
|
+
url: "/api/v1/message-translations/{messageId}",
|
|
1005
|
+
...options
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
get(options) {
|
|
1009
|
+
return (options.client ?? this.client).get({
|
|
1010
|
+
security: [{
|
|
1011
|
+
scheme: "bearer",
|
|
1012
|
+
type: "http"
|
|
1013
|
+
}],
|
|
1014
|
+
url: "/api/v1/message-translations/{messageId}",
|
|
1015
|
+
...options
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
update(options) {
|
|
1019
|
+
return (options.client ?? this.client).patch({
|
|
1020
|
+
security: [{
|
|
1021
|
+
scheme: "bearer",
|
|
1022
|
+
type: "http"
|
|
1023
|
+
}],
|
|
1024
|
+
url: "/api/v1/message-translations/{messageId}",
|
|
1025
|
+
...options,
|
|
1026
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
create(options) {
|
|
1030
|
+
return (options.client ?? this.client).post({
|
|
1031
|
+
security: [{
|
|
1032
|
+
scheme: "bearer",
|
|
1033
|
+
type: "http"
|
|
1034
|
+
}],
|
|
1035
|
+
url: "/api/v1/message-translations/{messageId}",
|
|
1036
|
+
...options,
|
|
1037
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
var Messages = class extends HeyApiClient {
|
|
1042
|
+
getCount(options) {
|
|
1043
|
+
return (options?.client ?? this.client).get({
|
|
1044
|
+
security: [{
|
|
1045
|
+
scheme: "bearer",
|
|
1046
|
+
type: "http"
|
|
1047
|
+
}],
|
|
1048
|
+
url: "/api/v1/messages/count",
|
|
1049
|
+
...options
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
deleteMany(options) {
|
|
1053
|
+
return (options.client ?? this.client).delete({
|
|
1054
|
+
security: [{
|
|
1055
|
+
scheme: "bearer",
|
|
1056
|
+
type: "http"
|
|
1057
|
+
}],
|
|
1058
|
+
url: "/api/v1/messages",
|
|
1059
|
+
...options,
|
|
1060
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
list(options) {
|
|
1064
|
+
return (options?.client ?? this.client).get({
|
|
1065
|
+
security: [{
|
|
1066
|
+
scheme: "bearer",
|
|
1067
|
+
type: "http"
|
|
1068
|
+
}],
|
|
1069
|
+
url: "/api/v1/messages",
|
|
1070
|
+
...options
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
create(options) {
|
|
1074
|
+
return (options.client ?? this.client).post({
|
|
1075
|
+
security: [{
|
|
1076
|
+
scheme: "bearer",
|
|
1077
|
+
type: "http"
|
|
1078
|
+
}],
|
|
1079
|
+
url: "/api/v1/messages",
|
|
1080
|
+
...options,
|
|
1081
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
delete(options) {
|
|
1085
|
+
return (options.client ?? this.client).delete({
|
|
1086
|
+
security: [{
|
|
1087
|
+
scheme: "bearer",
|
|
1088
|
+
type: "http"
|
|
1089
|
+
}],
|
|
1090
|
+
url: "/api/v1/messages/{id}",
|
|
1091
|
+
...options
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
get(options) {
|
|
1095
|
+
return (options.client ?? this.client).get({
|
|
1096
|
+
security: [{
|
|
1097
|
+
scheme: "bearer",
|
|
1098
|
+
type: "http"
|
|
1099
|
+
}],
|
|
1100
|
+
url: "/api/v1/messages/{id}",
|
|
1101
|
+
...options
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
createReply(options) {
|
|
1105
|
+
return (options.client ?? this.client).post({
|
|
1106
|
+
security: [{
|
|
1107
|
+
scheme: "bearer",
|
|
1108
|
+
type: "http"
|
|
1109
|
+
}],
|
|
1110
|
+
url: "/api/v1/messages/replies",
|
|
1111
|
+
...options,
|
|
1112
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
var Models = class extends HeyApiClient {
|
|
1117
|
+
list(options) {
|
|
1118
|
+
return (options?.client ?? this.client).get({
|
|
1119
|
+
security: [{
|
|
1120
|
+
scheme: "bearer",
|
|
1121
|
+
type: "http"
|
|
1122
|
+
}],
|
|
1123
|
+
url: "/api/v1/models",
|
|
1124
|
+
...options
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
create(options) {
|
|
1128
|
+
return (options.client ?? this.client).post({
|
|
1129
|
+
security: [{
|
|
1130
|
+
scheme: "bearer",
|
|
1131
|
+
type: "http"
|
|
1132
|
+
}],
|
|
1133
|
+
url: "/api/v1/models",
|
|
1134
|
+
...options,
|
|
1135
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
get(options) {
|
|
1139
|
+
return (options.client ?? this.client).get({
|
|
1140
|
+
security: [{
|
|
1141
|
+
scheme: "bearer",
|
|
1142
|
+
type: "http"
|
|
1143
|
+
}],
|
|
1144
|
+
url: "/api/v1/models/{providerId}/{modelId}",
|
|
1145
|
+
...options
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
update(options) {
|
|
1149
|
+
return (options.client ?? this.client).patch({
|
|
1150
|
+
security: [{
|
|
1151
|
+
scheme: "bearer",
|
|
1152
|
+
type: "http"
|
|
1153
|
+
}],
|
|
1154
|
+
url: "/api/v1/models/{providerId}/{modelId}",
|
|
1155
|
+
...options,
|
|
1156
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
var Permissions = class extends HeyApiClient {
|
|
1161
|
+
list(options) {
|
|
1162
|
+
return (options?.client ?? this.client).get({
|
|
1163
|
+
security: [{
|
|
1164
|
+
scheme: "bearer",
|
|
1165
|
+
type: "http"
|
|
1166
|
+
}],
|
|
1167
|
+
url: "/api/v1/permissions",
|
|
1168
|
+
...options
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
create(options) {
|
|
1172
|
+
return (options.client ?? this.client).post({
|
|
1173
|
+
security: [{
|
|
1174
|
+
scheme: "bearer",
|
|
1175
|
+
type: "http"
|
|
1176
|
+
}],
|
|
1177
|
+
url: "/api/v1/permissions",
|
|
1178
|
+
...options,
|
|
1179
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
delete(options) {
|
|
1183
|
+
return (options.client ?? this.client).delete({
|
|
1184
|
+
security: [{
|
|
1185
|
+
scheme: "bearer",
|
|
1186
|
+
type: "http"
|
|
1187
|
+
}],
|
|
1188
|
+
url: "/api/v1/permissions/{id}",
|
|
1189
|
+
...options
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
get(options) {
|
|
1193
|
+
return (options.client ?? this.client).get({
|
|
1194
|
+
security: [{
|
|
1195
|
+
scheme: "bearer",
|
|
1196
|
+
type: "http"
|
|
1197
|
+
}],
|
|
1198
|
+
url: "/api/v1/permissions/{id}",
|
|
1199
|
+
...options
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
update(options) {
|
|
1203
|
+
return (options.client ?? this.client).patch({
|
|
1204
|
+
security: [{
|
|
1205
|
+
scheme: "bearer",
|
|
1206
|
+
type: "http"
|
|
1207
|
+
}],
|
|
1208
|
+
url: "/api/v1/permissions/{id}",
|
|
1209
|
+
...options,
|
|
1210
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
var Providers = class extends HeyApiClient {
|
|
1215
|
+
list(options) {
|
|
1216
|
+
return (options?.client ?? this.client).get({
|
|
1217
|
+
security: [{
|
|
1218
|
+
scheme: "bearer",
|
|
1219
|
+
type: "http"
|
|
1220
|
+
}],
|
|
1221
|
+
url: "/api/v1/providers",
|
|
1222
|
+
...options
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
create(options) {
|
|
1226
|
+
return (options.client ?? this.client).post({
|
|
1227
|
+
security: [{
|
|
1228
|
+
scheme: "bearer",
|
|
1229
|
+
type: "http"
|
|
1230
|
+
}],
|
|
1231
|
+
url: "/api/v1/providers",
|
|
1232
|
+
...options,
|
|
1233
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
delete(options) {
|
|
1237
|
+
return (options.client ?? this.client).delete({
|
|
1238
|
+
security: [{
|
|
1239
|
+
scheme: "bearer",
|
|
1240
|
+
type: "http"
|
|
1241
|
+
}],
|
|
1242
|
+
url: "/api/v1/providers/{id}",
|
|
1243
|
+
...options
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
get(options) {
|
|
1247
|
+
return (options.client ?? this.client).get({
|
|
1248
|
+
security: [{
|
|
1249
|
+
scheme: "bearer",
|
|
1250
|
+
type: "http"
|
|
1251
|
+
}],
|
|
1252
|
+
url: "/api/v1/providers/{id}",
|
|
1253
|
+
...options
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
update(options) {
|
|
1257
|
+
return (options.client ?? this.client).patch({
|
|
1258
|
+
security: [{
|
|
1259
|
+
scheme: "bearer",
|
|
1260
|
+
type: "http"
|
|
1261
|
+
}],
|
|
1262
|
+
url: "/api/v1/providers/{id}",
|
|
1263
|
+
...options,
|
|
1264
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
var Responses = class extends HeyApiClient {
|
|
1269
|
+
create(options) {
|
|
1270
|
+
return (options.client ?? this.client).post({
|
|
1271
|
+
security: [{
|
|
1272
|
+
scheme: "bearer",
|
|
1273
|
+
type: "http"
|
|
1274
|
+
}],
|
|
1275
|
+
url: "/api/v1/responses",
|
|
1276
|
+
...options,
|
|
1277
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
var Roles = class extends HeyApiClient {
|
|
1282
|
+
list(options) {
|
|
1283
|
+
return (options?.client ?? this.client).get({
|
|
1284
|
+
security: [{
|
|
1285
|
+
scheme: "bearer",
|
|
1286
|
+
type: "http"
|
|
1287
|
+
}],
|
|
1288
|
+
url: "/api/v1/roles",
|
|
1289
|
+
...options
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
create(options) {
|
|
1293
|
+
return (options.client ?? this.client).post({
|
|
1294
|
+
security: [{
|
|
1295
|
+
scheme: "bearer",
|
|
1296
|
+
type: "http"
|
|
1297
|
+
}],
|
|
1298
|
+
url: "/api/v1/roles",
|
|
1299
|
+
...options,
|
|
1300
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
delete(options) {
|
|
1304
|
+
return (options.client ?? this.client).delete({
|
|
1305
|
+
security: [{
|
|
1306
|
+
scheme: "bearer",
|
|
1307
|
+
type: "http"
|
|
1308
|
+
}],
|
|
1309
|
+
url: "/api/v1/roles/{id}",
|
|
1310
|
+
...options
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
get(options) {
|
|
1314
|
+
return (options.client ?? this.client).get({
|
|
1315
|
+
security: [{
|
|
1316
|
+
scheme: "bearer",
|
|
1317
|
+
type: "http"
|
|
1318
|
+
}],
|
|
1319
|
+
url: "/api/v1/roles/{id}",
|
|
1320
|
+
...options
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
update(options) {
|
|
1324
|
+
return (options.client ?? this.client).patch({
|
|
1325
|
+
security: [{
|
|
1326
|
+
scheme: "bearer",
|
|
1327
|
+
type: "http"
|
|
1328
|
+
}],
|
|
1329
|
+
url: "/api/v1/roles/{id}",
|
|
1330
|
+
...options,
|
|
1331
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
deletePermissions(options) {
|
|
1335
|
+
return (options.client ?? this.client).delete({
|
|
1336
|
+
security: [{
|
|
1337
|
+
scheme: "bearer",
|
|
1338
|
+
type: "http"
|
|
1339
|
+
}],
|
|
1340
|
+
url: "/api/v1/roles/{id}/permissions",
|
|
1341
|
+
...options
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
listPermissions(options) {
|
|
1345
|
+
return (options.client ?? this.client).get({
|
|
1346
|
+
security: [{
|
|
1347
|
+
scheme: "bearer",
|
|
1348
|
+
type: "http"
|
|
1349
|
+
}],
|
|
1350
|
+
url: "/api/v1/roles/{id}/permissions",
|
|
1351
|
+
...options
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
updatePermissions(options) {
|
|
1355
|
+
return (options.client ?? this.client).patch({
|
|
1356
|
+
security: [{
|
|
1357
|
+
scheme: "bearer",
|
|
1358
|
+
type: "http"
|
|
1359
|
+
}],
|
|
1360
|
+
url: "/api/v1/roles/{id}/permissions",
|
|
1361
|
+
...options,
|
|
1362
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
var Topics = class extends HeyApiClient {
|
|
1367
|
+
list(options) {
|
|
1368
|
+
return (options?.client ?? this.client).get({
|
|
1369
|
+
security: [{
|
|
1370
|
+
scheme: "bearer",
|
|
1371
|
+
type: "http"
|
|
1372
|
+
}],
|
|
1373
|
+
url: "/api/v1/topics",
|
|
1374
|
+
...options
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
1377
|
+
create(options) {
|
|
1378
|
+
return (options.client ?? this.client).post({
|
|
1379
|
+
security: [{
|
|
1380
|
+
scheme: "bearer",
|
|
1381
|
+
type: "http"
|
|
1382
|
+
}],
|
|
1383
|
+
url: "/api/v1/topics",
|
|
1384
|
+
...options,
|
|
1385
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
delete(options) {
|
|
1389
|
+
return (options.client ?? this.client).delete({
|
|
1390
|
+
security: [{
|
|
1391
|
+
scheme: "bearer",
|
|
1392
|
+
type: "http"
|
|
1393
|
+
}],
|
|
1394
|
+
url: "/api/v1/topics/{id}",
|
|
1395
|
+
...options
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
get(options) {
|
|
1399
|
+
return (options.client ?? this.client).get({
|
|
1400
|
+
security: [{
|
|
1401
|
+
scheme: "bearer",
|
|
1402
|
+
type: "http"
|
|
1403
|
+
}],
|
|
1404
|
+
url: "/api/v1/topics/{id}",
|
|
1405
|
+
...options
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
update(options) {
|
|
1409
|
+
return (options.client ?? this.client).patch({
|
|
1410
|
+
security: [{
|
|
1411
|
+
scheme: "bearer",
|
|
1412
|
+
type: "http"
|
|
1413
|
+
}],
|
|
1414
|
+
url: "/api/v1/topics/{id}",
|
|
1415
|
+
...options,
|
|
1416
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
};
|
|
1420
|
+
var Users = class extends HeyApiClient {
|
|
1421
|
+
/**
|
|
1422
|
+
* Get current authenticated user
|
|
1423
|
+
*/
|
|
1424
|
+
me(options) {
|
|
1425
|
+
return (options?.client ?? this.client).get({
|
|
1426
|
+
security: [{
|
|
1427
|
+
scheme: "bearer",
|
|
1428
|
+
type: "http"
|
|
1429
|
+
}],
|
|
1430
|
+
url: "/api/v1/users/me",
|
|
1431
|
+
...options
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
list(options) {
|
|
1435
|
+
return (options?.client ?? this.client).get({
|
|
1436
|
+
security: [{
|
|
1437
|
+
scheme: "bearer",
|
|
1438
|
+
type: "http"
|
|
1439
|
+
}],
|
|
1440
|
+
url: "/api/v1/users",
|
|
1441
|
+
...options
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1444
|
+
create(options) {
|
|
1445
|
+
return (options.client ?? this.client).post({
|
|
1446
|
+
security: [{
|
|
1447
|
+
scheme: "bearer",
|
|
1448
|
+
type: "http"
|
|
1449
|
+
}],
|
|
1450
|
+
url: "/api/v1/users",
|
|
1451
|
+
...options,
|
|
1452
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
delete(options) {
|
|
1456
|
+
return (options.client ?? this.client).delete({
|
|
1457
|
+
security: [{
|
|
1458
|
+
scheme: "bearer",
|
|
1459
|
+
type: "http"
|
|
1460
|
+
}],
|
|
1461
|
+
url: "/api/v1/users/{id}",
|
|
1462
|
+
...options
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
get(options) {
|
|
1466
|
+
return (options.client ?? this.client).get({
|
|
1467
|
+
security: [{
|
|
1468
|
+
scheme: "bearer",
|
|
1469
|
+
type: "http"
|
|
1470
|
+
}],
|
|
1471
|
+
url: "/api/v1/users/{id}",
|
|
1472
|
+
...options
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
update(options) {
|
|
1476
|
+
return (options.client ?? this.client).patch({
|
|
1477
|
+
security: [{
|
|
1478
|
+
scheme: "bearer",
|
|
1479
|
+
type: "http"
|
|
1480
|
+
}],
|
|
1481
|
+
url: "/api/v1/users/{id}",
|
|
1482
|
+
...options,
|
|
1483
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
deleteRoles(options) {
|
|
1487
|
+
return (options.client ?? this.client).delete({
|
|
1488
|
+
security: [{
|
|
1489
|
+
scheme: "bearer",
|
|
1490
|
+
type: "http"
|
|
1491
|
+
}],
|
|
1492
|
+
url: "/api/v1/users/{id}/roles",
|
|
1493
|
+
...options
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
listRoles(options) {
|
|
1497
|
+
return (options.client ?? this.client).get({
|
|
1498
|
+
security: [{
|
|
1499
|
+
scheme: "bearer",
|
|
1500
|
+
type: "http"
|
|
1501
|
+
}],
|
|
1502
|
+
url: "/api/v1/users/{id}/roles",
|
|
1503
|
+
...options
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
updateRoles(options) {
|
|
1507
|
+
return (options.client ?? this.client).patch({
|
|
1508
|
+
security: [{
|
|
1509
|
+
scheme: "bearer",
|
|
1510
|
+
type: "http"
|
|
1511
|
+
}],
|
|
1512
|
+
url: "/api/v1/users/{id}/roles",
|
|
1513
|
+
...options,
|
|
1514
|
+
headers: mergeMethodHeaders({ "Content-Type": "application/json" }, options.headers)
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
var LobeHub = class LobeHub extends HeyApiClient {
|
|
1519
|
+
static __registry = new HeyApiRegistry();
|
|
1520
|
+
constructor(args) {
|
|
1521
|
+
super(args);
|
|
1522
|
+
LobeHub.__registry.set(this, args?.key);
|
|
1523
|
+
}
|
|
1524
|
+
_health;
|
|
1525
|
+
get health() {
|
|
1526
|
+
return this._health ??= new Health({ client: this.client });
|
|
1527
|
+
}
|
|
1528
|
+
_agentGroups;
|
|
1529
|
+
get agentGroups() {
|
|
1530
|
+
return this._agentGroups ??= new AgentGroups({ client: this.client });
|
|
1531
|
+
}
|
|
1532
|
+
_agents;
|
|
1533
|
+
get agents() {
|
|
1534
|
+
return this._agents ??= new Agents({ client: this.client });
|
|
1535
|
+
}
|
|
1536
|
+
_files;
|
|
1537
|
+
get files() {
|
|
1538
|
+
return this._files ??= new Files({ client: this.client });
|
|
1539
|
+
}
|
|
1540
|
+
_knowledgeBases;
|
|
1541
|
+
get knowledgeBases() {
|
|
1542
|
+
return this._knowledgeBases ??= new KnowledgeBases({ client: this.client });
|
|
1543
|
+
}
|
|
1544
|
+
_messageTranslations;
|
|
1545
|
+
get messageTranslations() {
|
|
1546
|
+
return this._messageTranslations ??= new MessageTranslations({ client: this.client });
|
|
1547
|
+
}
|
|
1548
|
+
_messages;
|
|
1549
|
+
get messages() {
|
|
1550
|
+
return this._messages ??= new Messages({ client: this.client });
|
|
1551
|
+
}
|
|
1552
|
+
_models;
|
|
1553
|
+
get models() {
|
|
1554
|
+
return this._models ??= new Models({ client: this.client });
|
|
1555
|
+
}
|
|
1556
|
+
_permissions;
|
|
1557
|
+
get permissions() {
|
|
1558
|
+
return this._permissions ??= new Permissions({ client: this.client });
|
|
1559
|
+
}
|
|
1560
|
+
_providers;
|
|
1561
|
+
get providers() {
|
|
1562
|
+
return this._providers ??= new Providers({ client: this.client });
|
|
1563
|
+
}
|
|
1564
|
+
_responses;
|
|
1565
|
+
get responses() {
|
|
1566
|
+
return this._responses ??= new Responses({ client: this.client });
|
|
1567
|
+
}
|
|
1568
|
+
_roles;
|
|
1569
|
+
get roles() {
|
|
1570
|
+
return this._roles ??= new Roles({ client: this.client });
|
|
1571
|
+
}
|
|
1572
|
+
_topics;
|
|
1573
|
+
get topics() {
|
|
1574
|
+
return this._topics ??= new Topics({ client: this.client });
|
|
1575
|
+
}
|
|
1576
|
+
_users;
|
|
1577
|
+
get users() {
|
|
1578
|
+
return this._users ??= new Users({ client: this.client });
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1581
|
+
//#endregion
|
|
1582
|
+
//#region src/index.ts
|
|
1583
|
+
const DEFAULT_BASE_URL = "https://app.lobehub.com";
|
|
1584
|
+
/**
|
|
1585
|
+
* Create a resource-style LobeHub API client: `lobehub.agents.list()`,
|
|
1586
|
+
* `lobehub.files.uploadBatch()`, `lobehub.users.me()`, …
|
|
1587
|
+
*
|
|
1588
|
+
* Resources, methods, and schemas are generated from
|
|
1589
|
+
* `packages/openapi/openapi.yml` — run `bun generate` after the spec changes.
|
|
1590
|
+
*/
|
|
1591
|
+
const createLobeHub = (options) => {
|
|
1592
|
+
const { apiKey, baseURL = DEFAULT_BASE_URL, ...clientConfig } = options;
|
|
1593
|
+
return new LobeHub({ client: createClient(createConfig({
|
|
1594
|
+
...clientConfig,
|
|
1595
|
+
auth: () => apiKey,
|
|
1596
|
+
baseUrl: baseURL
|
|
1597
|
+
})) });
|
|
1598
|
+
};
|
|
1599
|
+
//#endregion
|
|
1600
|
+
export { DEFAULT_BASE_URL, LobeHub, createLobeHub };
|