@savantoai/ai-sdk 2.1.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/LICENSE +22 -0
- package/README.md +280 -0
- package/dist/index.cjs +2618 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7785 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +7785 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2484 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +76 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2484 @@
|
|
|
1
|
+
//#region src/generated/core/bodySerializer.gen.ts
|
|
2
|
+
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
3
|
+
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/generated/core/serverSentEvents.gen.ts
|
|
6
|
+
const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
|
|
7
|
+
let lastEventId;
|
|
8
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
9
|
+
const createStream = async function* () {
|
|
10
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
11
|
+
let attempt = 0;
|
|
12
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
13
|
+
while (true) {
|
|
14
|
+
if (signal.aborted) break;
|
|
15
|
+
attempt++;
|
|
16
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
17
|
+
if (lastEventId !== void 0) headers.set("Last-Event-ID", lastEventId);
|
|
18
|
+
try {
|
|
19
|
+
const requestInit = {
|
|
20
|
+
redirect: "follow",
|
|
21
|
+
...options,
|
|
22
|
+
body: options.serializedBody,
|
|
23
|
+
headers,
|
|
24
|
+
signal
|
|
25
|
+
};
|
|
26
|
+
let request = new Request(url, requestInit);
|
|
27
|
+
if (onRequest) request = await onRequest(url, requestInit);
|
|
28
|
+
const response = await (options.fetch ?? globalThis.fetch)(request);
|
|
29
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
30
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
31
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
32
|
+
let buffer = "";
|
|
33
|
+
const abortHandler = () => {
|
|
34
|
+
try {
|
|
35
|
+
reader.cancel();
|
|
36
|
+
} catch {}
|
|
37
|
+
};
|
|
38
|
+
signal.addEventListener("abort", abortHandler);
|
|
39
|
+
try {
|
|
40
|
+
while (true) {
|
|
41
|
+
const { done, value } = await reader.read();
|
|
42
|
+
if (done) break;
|
|
43
|
+
buffer += value;
|
|
44
|
+
buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
45
|
+
const chunks = buffer.split("\n\n");
|
|
46
|
+
buffer = chunks.pop() ?? "";
|
|
47
|
+
for (const chunk of chunks) {
|
|
48
|
+
const lines = chunk.split("\n");
|
|
49
|
+
const dataLines = [];
|
|
50
|
+
let eventName;
|
|
51
|
+
for (const line of lines) if (line.startsWith("data:")) dataLines.push(line.replace(/^data:\s*/, ""));
|
|
52
|
+
else if (line.startsWith("event:")) eventName = line.replace(/^event:\s*/, "");
|
|
53
|
+
else if (line.startsWith("id:")) lastEventId = line.replace(/^id:\s*/, "");
|
|
54
|
+
else if (line.startsWith("retry:")) {
|
|
55
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
56
|
+
if (!Number.isNaN(parsed)) retryDelay = parsed;
|
|
57
|
+
}
|
|
58
|
+
let data;
|
|
59
|
+
let parsedJson = false;
|
|
60
|
+
if (dataLines.length) {
|
|
61
|
+
const rawData = dataLines.join("\n");
|
|
62
|
+
try {
|
|
63
|
+
data = JSON.parse(rawData);
|
|
64
|
+
parsedJson = true;
|
|
65
|
+
} catch {
|
|
66
|
+
data = rawData;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (parsedJson) {
|
|
70
|
+
if (responseValidator) await responseValidator(data);
|
|
71
|
+
if (responseTransformer) data = await responseTransformer(data);
|
|
72
|
+
}
|
|
73
|
+
onSseEvent?.({
|
|
74
|
+
data,
|
|
75
|
+
event: eventName,
|
|
76
|
+
id: lastEventId,
|
|
77
|
+
retry: retryDelay
|
|
78
|
+
});
|
|
79
|
+
if (dataLines.length) yield data;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} finally {
|
|
83
|
+
signal.removeEventListener("abort", abortHandler);
|
|
84
|
+
reader.releaseLock();
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
} catch (error) {
|
|
88
|
+
onSseError?.(error);
|
|
89
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) break;
|
|
90
|
+
await sleep(Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return { stream: createStream() };
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/generated/core/pathSerializer.gen.ts
|
|
99
|
+
const separatorArrayExplode = (style) => {
|
|
100
|
+
switch (style) {
|
|
101
|
+
case "label": return ".";
|
|
102
|
+
case "matrix": return ";";
|
|
103
|
+
case "simple": return ",";
|
|
104
|
+
default: return "&";
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const separatorArrayNoExplode = (style) => {
|
|
108
|
+
switch (style) {
|
|
109
|
+
case "form": return ",";
|
|
110
|
+
case "pipeDelimited": return "|";
|
|
111
|
+
case "spaceDelimited": return "%20";
|
|
112
|
+
default: return ",";
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const separatorObjectExplode = (style) => {
|
|
116
|
+
switch (style) {
|
|
117
|
+
case "label": return ".";
|
|
118
|
+
case "matrix": return ";";
|
|
119
|
+
case "simple": return ",";
|
|
120
|
+
default: return "&";
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
124
|
+
if (!explode) {
|
|
125
|
+
const joinedValues$1 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
126
|
+
switch (style) {
|
|
127
|
+
case "label": return `.${joinedValues$1}`;
|
|
128
|
+
case "matrix": return `;${name}=${joinedValues$1}`;
|
|
129
|
+
case "simple": return joinedValues$1;
|
|
130
|
+
default: return `${name}=${joinedValues$1}`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const separator = separatorArrayExplode(style);
|
|
134
|
+
const joinedValues = value.map((v) => {
|
|
135
|
+
if (style === "label" || style === "simple") return allowReserved ? v : encodeURIComponent(v);
|
|
136
|
+
return serializePrimitiveParam({
|
|
137
|
+
allowReserved,
|
|
138
|
+
name,
|
|
139
|
+
value: v
|
|
140
|
+
});
|
|
141
|
+
}).join(separator);
|
|
142
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
143
|
+
};
|
|
144
|
+
const serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
145
|
+
if (value === void 0 || value === null) return "";
|
|
146
|
+
if (typeof value === "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
|
|
147
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
148
|
+
};
|
|
149
|
+
const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
150
|
+
if (value instanceof Date) return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
151
|
+
if (style !== "deepObject" && !explode) {
|
|
152
|
+
let values = [];
|
|
153
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
154
|
+
values = [
|
|
155
|
+
...values,
|
|
156
|
+
key,
|
|
157
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
158
|
+
];
|
|
159
|
+
});
|
|
160
|
+
const joinedValues$1 = values.join(",");
|
|
161
|
+
switch (style) {
|
|
162
|
+
case "form": return `${name}=${joinedValues$1}`;
|
|
163
|
+
case "label": return `.${joinedValues$1}`;
|
|
164
|
+
case "matrix": return `;${name}=${joinedValues$1}`;
|
|
165
|
+
default: return joinedValues$1;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const separator = separatorObjectExplode(style);
|
|
169
|
+
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
170
|
+
allowReserved,
|
|
171
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
172
|
+
value: v
|
|
173
|
+
})).join(separator);
|
|
174
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/generated/core/utils.gen.ts
|
|
179
|
+
const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
180
|
+
const defaultPathSerializer = ({ path, url: _url }) => {
|
|
181
|
+
let url = _url;
|
|
182
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
183
|
+
if (matches) for (const match of matches) {
|
|
184
|
+
let explode = false;
|
|
185
|
+
let name = match.substring(1, match.length - 1);
|
|
186
|
+
let style = "simple";
|
|
187
|
+
if (name.endsWith("*")) {
|
|
188
|
+
explode = true;
|
|
189
|
+
name = name.substring(0, name.length - 1);
|
|
190
|
+
}
|
|
191
|
+
if (name.startsWith(".")) {
|
|
192
|
+
name = name.substring(1);
|
|
193
|
+
style = "label";
|
|
194
|
+
} else if (name.startsWith(";")) {
|
|
195
|
+
name = name.substring(1);
|
|
196
|
+
style = "matrix";
|
|
197
|
+
}
|
|
198
|
+
const value = path[name];
|
|
199
|
+
if (value === void 0 || value === null) continue;
|
|
200
|
+
if (Array.isArray(value)) {
|
|
201
|
+
url = url.replace(match, serializeArrayParam({
|
|
202
|
+
explode,
|
|
203
|
+
name,
|
|
204
|
+
style,
|
|
205
|
+
value
|
|
206
|
+
}));
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (typeof value === "object") {
|
|
210
|
+
url = url.replace(match, serializeObjectParam({
|
|
211
|
+
explode,
|
|
212
|
+
name,
|
|
213
|
+
style,
|
|
214
|
+
value,
|
|
215
|
+
valueOnly: true
|
|
216
|
+
}));
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (style === "matrix") {
|
|
220
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
221
|
+
name,
|
|
222
|
+
value
|
|
223
|
+
})}`);
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
|
|
227
|
+
url = url.replace(match, replaceValue);
|
|
228
|
+
}
|
|
229
|
+
return url;
|
|
230
|
+
};
|
|
231
|
+
const getUrl = ({ baseUrl, path, query, querySerializer, url: _url }) => {
|
|
232
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
233
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
234
|
+
if (path) url = defaultPathSerializer({
|
|
235
|
+
path,
|
|
236
|
+
url
|
|
237
|
+
});
|
|
238
|
+
let search = query ? querySerializer(query) : "";
|
|
239
|
+
if (search.startsWith("?")) search = search.substring(1);
|
|
240
|
+
if (search) url += `?${search}`;
|
|
241
|
+
return url;
|
|
242
|
+
};
|
|
243
|
+
function getValidRequestBody(options) {
|
|
244
|
+
const hasBody = options.body !== void 0;
|
|
245
|
+
if (hasBody && options.bodySerializer) {
|
|
246
|
+
if ("serializedBody" in options) return options.serializedBody !== void 0 && options.serializedBody !== "" ? options.serializedBody : null;
|
|
247
|
+
return options.body !== "" ? options.body : null;
|
|
248
|
+
}
|
|
249
|
+
if (hasBody) return options.body;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/generated/core/auth.gen.ts
|
|
254
|
+
const getAuthToken = async (auth, callback) => {
|
|
255
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
256
|
+
if (!token) return;
|
|
257
|
+
if (auth.scheme === "bearer") return `Bearer ${token}`;
|
|
258
|
+
if (auth.scheme === "basic") return `Basic ${btoa(token)}`;
|
|
259
|
+
return token;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/generated/client/utils.gen.ts
|
|
264
|
+
const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
|
|
265
|
+
const querySerializer = (queryParams) => {
|
|
266
|
+
const search = [];
|
|
267
|
+
if (queryParams && typeof queryParams === "object") for (const name in queryParams) {
|
|
268
|
+
const value = queryParams[name];
|
|
269
|
+
if (value === void 0 || value === null) continue;
|
|
270
|
+
const options = parameters[name] || args;
|
|
271
|
+
if (Array.isArray(value)) {
|
|
272
|
+
const serializedArray = serializeArrayParam({
|
|
273
|
+
allowReserved: options.allowReserved,
|
|
274
|
+
explode: true,
|
|
275
|
+
name,
|
|
276
|
+
style: "form",
|
|
277
|
+
value,
|
|
278
|
+
...options.array
|
|
279
|
+
});
|
|
280
|
+
if (serializedArray) search.push(serializedArray);
|
|
281
|
+
} else if (typeof value === "object") {
|
|
282
|
+
const serializedObject = serializeObjectParam({
|
|
283
|
+
allowReserved: options.allowReserved,
|
|
284
|
+
explode: true,
|
|
285
|
+
name,
|
|
286
|
+
style: "deepObject",
|
|
287
|
+
value,
|
|
288
|
+
...options.object
|
|
289
|
+
});
|
|
290
|
+
if (serializedObject) search.push(serializedObject);
|
|
291
|
+
} else {
|
|
292
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
293
|
+
allowReserved: options.allowReserved,
|
|
294
|
+
name,
|
|
295
|
+
value
|
|
296
|
+
});
|
|
297
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return search.join("&");
|
|
301
|
+
};
|
|
302
|
+
return querySerializer;
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* Infers parseAs value from provided Content-Type header.
|
|
306
|
+
*/
|
|
307
|
+
const getParseAs = (contentType) => {
|
|
308
|
+
if (!contentType) return "stream";
|
|
309
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
310
|
+
if (!cleanContent) return;
|
|
311
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) return "json";
|
|
312
|
+
if (cleanContent === "multipart/form-data") return "formData";
|
|
313
|
+
if ([
|
|
314
|
+
"application/",
|
|
315
|
+
"audio/",
|
|
316
|
+
"image/",
|
|
317
|
+
"video/"
|
|
318
|
+
].some((type) => cleanContent.startsWith(type))) return "blob";
|
|
319
|
+
if (cleanContent.startsWith("text/")) return "text";
|
|
320
|
+
};
|
|
321
|
+
const checkForExistence = (options, name) => {
|
|
322
|
+
if (!name) return false;
|
|
323
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) return true;
|
|
324
|
+
return false;
|
|
325
|
+
};
|
|
326
|
+
const setAuthParams = async ({ security, ...options }) => {
|
|
327
|
+
for (const auth of security) {
|
|
328
|
+
if (checkForExistence(options, auth.name)) continue;
|
|
329
|
+
const token = await getAuthToken(auth, options.auth);
|
|
330
|
+
if (!token) continue;
|
|
331
|
+
const name = auth.name ?? "Authorization";
|
|
332
|
+
switch (auth.in) {
|
|
333
|
+
case "query":
|
|
334
|
+
if (!options.query) options.query = {};
|
|
335
|
+
options.query[name] = token;
|
|
336
|
+
break;
|
|
337
|
+
case "cookie":
|
|
338
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
339
|
+
break;
|
|
340
|
+
case "header":
|
|
341
|
+
default:
|
|
342
|
+
options.headers.set(name, token);
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
const buildUrl = (options) => getUrl({
|
|
348
|
+
baseUrl: options.baseUrl,
|
|
349
|
+
path: options.path,
|
|
350
|
+
query: options.query,
|
|
351
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
352
|
+
url: options.url
|
|
353
|
+
});
|
|
354
|
+
const mergeConfigs = (a, b) => {
|
|
355
|
+
const config = {
|
|
356
|
+
...a,
|
|
357
|
+
...b
|
|
358
|
+
};
|
|
359
|
+
if (config.baseUrl?.endsWith("/")) config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
360
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
361
|
+
return config;
|
|
362
|
+
};
|
|
363
|
+
const headersEntries = (headers) => {
|
|
364
|
+
const entries = [];
|
|
365
|
+
headers.forEach((value, key) => {
|
|
366
|
+
entries.push([key, value]);
|
|
367
|
+
});
|
|
368
|
+
return entries;
|
|
369
|
+
};
|
|
370
|
+
const mergeHeaders = (...headers) => {
|
|
371
|
+
const mergedHeaders = new Headers();
|
|
372
|
+
for (const header of headers) {
|
|
373
|
+
if (!header) continue;
|
|
374
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
375
|
+
for (const [key, value] of iterator) if (value === null) mergedHeaders.delete(key);
|
|
376
|
+
else if (Array.isArray(value)) for (const v of value) mergedHeaders.append(key, v);
|
|
377
|
+
else if (value !== void 0) mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
378
|
+
}
|
|
379
|
+
return mergedHeaders;
|
|
380
|
+
};
|
|
381
|
+
var Interceptors = class {
|
|
382
|
+
constructor() {
|
|
383
|
+
this.fns = [];
|
|
384
|
+
}
|
|
385
|
+
clear() {
|
|
386
|
+
this.fns = [];
|
|
387
|
+
}
|
|
388
|
+
eject(id) {
|
|
389
|
+
const index = this.getInterceptorIndex(id);
|
|
390
|
+
if (this.fns[index]) this.fns[index] = null;
|
|
391
|
+
}
|
|
392
|
+
exists(id) {
|
|
393
|
+
const index = this.getInterceptorIndex(id);
|
|
394
|
+
return Boolean(this.fns[index]);
|
|
395
|
+
}
|
|
396
|
+
getInterceptorIndex(id) {
|
|
397
|
+
if (typeof id === "number") return this.fns[id] ? id : -1;
|
|
398
|
+
return this.fns.indexOf(id);
|
|
399
|
+
}
|
|
400
|
+
update(id, fn) {
|
|
401
|
+
const index = this.getInterceptorIndex(id);
|
|
402
|
+
if (this.fns[index]) {
|
|
403
|
+
this.fns[index] = fn;
|
|
404
|
+
return id;
|
|
405
|
+
}
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
use(fn) {
|
|
409
|
+
this.fns.push(fn);
|
|
410
|
+
return this.fns.length - 1;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
const createInterceptors = () => ({
|
|
414
|
+
error: new Interceptors(),
|
|
415
|
+
request: new Interceptors(),
|
|
416
|
+
response: new Interceptors()
|
|
417
|
+
});
|
|
418
|
+
const defaultQuerySerializer = createQuerySerializer({
|
|
419
|
+
allowReserved: false,
|
|
420
|
+
array: {
|
|
421
|
+
explode: true,
|
|
422
|
+
style: "form"
|
|
423
|
+
},
|
|
424
|
+
object: {
|
|
425
|
+
explode: true,
|
|
426
|
+
style: "deepObject"
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
const defaultHeaders = { "Content-Type": "application/json" };
|
|
430
|
+
const createConfig = (override = {}) => ({
|
|
431
|
+
...jsonBodySerializer,
|
|
432
|
+
headers: defaultHeaders,
|
|
433
|
+
parseAs: "auto",
|
|
434
|
+
querySerializer: defaultQuerySerializer,
|
|
435
|
+
...override
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/generated/client/client.gen.ts
|
|
440
|
+
const createClient = (config = {}) => {
|
|
441
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
442
|
+
const getConfig = () => ({ ..._config });
|
|
443
|
+
const setConfig = (config$1) => {
|
|
444
|
+
_config = mergeConfigs(_config, config$1);
|
|
445
|
+
return getConfig();
|
|
446
|
+
};
|
|
447
|
+
const interceptors = createInterceptors();
|
|
448
|
+
const beforeRequest = async (options) => {
|
|
449
|
+
const opts = {
|
|
450
|
+
..._config,
|
|
451
|
+
...options,
|
|
452
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
453
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
454
|
+
serializedBody: void 0
|
|
455
|
+
};
|
|
456
|
+
if (opts.security) await setAuthParams({
|
|
457
|
+
...opts,
|
|
458
|
+
security: opts.security
|
|
459
|
+
});
|
|
460
|
+
if (opts.requestValidator) await opts.requestValidator(opts);
|
|
461
|
+
if (opts.body !== void 0 && opts.bodySerializer) opts.serializedBody = opts.bodySerializer(opts.body);
|
|
462
|
+
if (opts.body === void 0 || opts.serializedBody === "") opts.headers.delete("Content-Type");
|
|
463
|
+
return {
|
|
464
|
+
opts,
|
|
465
|
+
url: buildUrl(opts)
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
const request = async (options) => {
|
|
469
|
+
const { opts, url } = await beforeRequest(options);
|
|
470
|
+
const requestInit = {
|
|
471
|
+
redirect: "follow",
|
|
472
|
+
...opts,
|
|
473
|
+
body: getValidRequestBody(opts)
|
|
474
|
+
};
|
|
475
|
+
let request$1 = new Request(url, requestInit);
|
|
476
|
+
for (const fn of interceptors.request.fns) if (fn) request$1 = await fn(request$1, opts);
|
|
477
|
+
const _fetch = opts.fetch;
|
|
478
|
+
let response;
|
|
479
|
+
try {
|
|
480
|
+
response = await _fetch(request$1);
|
|
481
|
+
} catch (error$1) {
|
|
482
|
+
let finalError$1 = error$1;
|
|
483
|
+
for (const fn of interceptors.error.fns) if (fn) finalError$1 = await fn(error$1, void 0, request$1, opts);
|
|
484
|
+
finalError$1 = finalError$1 || {};
|
|
485
|
+
if (opts.throwOnError) throw finalError$1;
|
|
486
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
487
|
+
error: finalError$1,
|
|
488
|
+
request: request$1,
|
|
489
|
+
response: void 0
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request$1, opts);
|
|
493
|
+
const result = {
|
|
494
|
+
request: request$1,
|
|
495
|
+
response
|
|
496
|
+
};
|
|
497
|
+
if (response.ok) {
|
|
498
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
499
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
500
|
+
let emptyData;
|
|
501
|
+
switch (parseAs) {
|
|
502
|
+
case "arrayBuffer":
|
|
503
|
+
case "blob":
|
|
504
|
+
case "text":
|
|
505
|
+
emptyData = await response[parseAs]();
|
|
506
|
+
break;
|
|
507
|
+
case "formData":
|
|
508
|
+
emptyData = new FormData();
|
|
509
|
+
break;
|
|
510
|
+
case "stream":
|
|
511
|
+
emptyData = response.body;
|
|
512
|
+
break;
|
|
513
|
+
case "json":
|
|
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
|
+
const error = jsonError ?? textError;
|
|
556
|
+
let finalError = error;
|
|
557
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request$1, opts);
|
|
558
|
+
finalError = finalError || {};
|
|
559
|
+
if (opts.throwOnError) throw finalError;
|
|
560
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
561
|
+
error: finalError,
|
|
562
|
+
...result
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
const makeMethodFn = (method) => (options) => request({
|
|
566
|
+
...options,
|
|
567
|
+
method
|
|
568
|
+
});
|
|
569
|
+
const makeSseFn = (method) => async (options) => {
|
|
570
|
+
const { opts, url } = await beforeRequest(options);
|
|
571
|
+
return createSseClient({
|
|
572
|
+
...opts,
|
|
573
|
+
body: opts.body,
|
|
574
|
+
headers: opts.headers,
|
|
575
|
+
method,
|
|
576
|
+
onRequest: async (url$1, init) => {
|
|
577
|
+
let request$1 = new Request(url$1, init);
|
|
578
|
+
for (const fn of interceptors.request.fns) if (fn) request$1 = await fn(request$1, opts);
|
|
579
|
+
return request$1;
|
|
580
|
+
},
|
|
581
|
+
serializedBody: getValidRequestBody(opts),
|
|
582
|
+
url
|
|
583
|
+
});
|
|
584
|
+
};
|
|
585
|
+
const _buildUrl = (options) => buildUrl({
|
|
586
|
+
..._config,
|
|
587
|
+
...options
|
|
588
|
+
});
|
|
589
|
+
return {
|
|
590
|
+
buildUrl: _buildUrl,
|
|
591
|
+
connect: makeMethodFn("CONNECT"),
|
|
592
|
+
delete: makeMethodFn("DELETE"),
|
|
593
|
+
get: makeMethodFn("GET"),
|
|
594
|
+
getConfig,
|
|
595
|
+
head: makeMethodFn("HEAD"),
|
|
596
|
+
interceptors,
|
|
597
|
+
options: makeMethodFn("OPTIONS"),
|
|
598
|
+
patch: makeMethodFn("PATCH"),
|
|
599
|
+
post: makeMethodFn("POST"),
|
|
600
|
+
put: makeMethodFn("PUT"),
|
|
601
|
+
request,
|
|
602
|
+
setConfig,
|
|
603
|
+
sse: {
|
|
604
|
+
connect: makeSseFn("CONNECT"),
|
|
605
|
+
delete: makeSseFn("DELETE"),
|
|
606
|
+
get: makeSseFn("GET"),
|
|
607
|
+
head: makeSseFn("HEAD"),
|
|
608
|
+
options: makeSseFn("OPTIONS"),
|
|
609
|
+
patch: makeSseFn("PATCH"),
|
|
610
|
+
post: makeSseFn("POST"),
|
|
611
|
+
put: makeSseFn("PUT"),
|
|
612
|
+
trace: makeSseFn("TRACE")
|
|
613
|
+
},
|
|
614
|
+
trace: makeMethodFn("TRACE")
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region src/generated/client.gen.ts
|
|
620
|
+
const client = createClient(createConfig({ baseUrl: "https://api.savanto.ai" }));
|
|
621
|
+
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/generated/sdk.gen.ts
|
|
624
|
+
/**
|
|
625
|
+
* Send a chat message
|
|
626
|
+
*
|
|
627
|
+
* Send a message and receive AI response. Supports streaming via NDJSON.
|
|
628
|
+
*/
|
|
629
|
+
const chat = (options) => (options?.client ?? client).post({
|
|
630
|
+
security: [{
|
|
631
|
+
scheme: "bearer",
|
|
632
|
+
type: "http"
|
|
633
|
+
}],
|
|
634
|
+
url: "/chat",
|
|
635
|
+
...options,
|
|
636
|
+
headers: {
|
|
637
|
+
"Content-Type": "application/json",
|
|
638
|
+
...options?.headers
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
/**
|
|
642
|
+
* Start a website crawl
|
|
643
|
+
*
|
|
644
|
+
* Initiate a crawl of a website URL. Pages are discovered and indexed into the knowledge base.
|
|
645
|
+
*/
|
|
646
|
+
const startCrawl = (options) => (options?.client ?? client).post({
|
|
647
|
+
security: [{
|
|
648
|
+
scheme: "bearer",
|
|
649
|
+
type: "http"
|
|
650
|
+
}],
|
|
651
|
+
url: "/crawl",
|
|
652
|
+
...options,
|
|
653
|
+
headers: {
|
|
654
|
+
"Content-Type": "application/json",
|
|
655
|
+
...options?.headers
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
/**
|
|
659
|
+
* Scrape a single page
|
|
660
|
+
*
|
|
661
|
+
* Scrape and index a single page via the crawl queue.
|
|
662
|
+
*/
|
|
663
|
+
const scrapeSinglePage = (options) => (options?.client ?? client).post({
|
|
664
|
+
security: [{
|
|
665
|
+
scheme: "bearer",
|
|
666
|
+
type: "http"
|
|
667
|
+
}],
|
|
668
|
+
url: "/crawl/scrape",
|
|
669
|
+
...options,
|
|
670
|
+
headers: {
|
|
671
|
+
"Content-Type": "application/json",
|
|
672
|
+
...options?.headers
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
/**
|
|
676
|
+
* Get crawl configuration
|
|
677
|
+
*
|
|
678
|
+
* Retrieve the crawl configuration for a workspace.
|
|
679
|
+
*/
|
|
680
|
+
const getCrawlConfig = (options) => (options?.client ?? client).get({
|
|
681
|
+
security: [{
|
|
682
|
+
scheme: "bearer",
|
|
683
|
+
type: "http"
|
|
684
|
+
}],
|
|
685
|
+
url: "/crawl/config",
|
|
686
|
+
...options
|
|
687
|
+
});
|
|
688
|
+
/**
|
|
689
|
+
* Update crawl configuration
|
|
690
|
+
*
|
|
691
|
+
* Update the crawl configuration for a workspace including strategy, schedule, exclude patterns, etc.
|
|
692
|
+
*/
|
|
693
|
+
const updateCrawlConfig = (options) => (options?.client ?? client).put({
|
|
694
|
+
security: [{
|
|
695
|
+
scheme: "bearer",
|
|
696
|
+
type: "http"
|
|
697
|
+
}],
|
|
698
|
+
url: "/crawl/config",
|
|
699
|
+
...options,
|
|
700
|
+
headers: {
|
|
701
|
+
"Content-Type": "application/json",
|
|
702
|
+
...options?.headers
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
/**
|
|
706
|
+
* Get crawl history
|
|
707
|
+
*
|
|
708
|
+
* Retrieve recent crawl history for the tenant.
|
|
709
|
+
*/
|
|
710
|
+
const getCrawlHistory = (options) => (options?.client ?? client).get({
|
|
711
|
+
security: [{
|
|
712
|
+
scheme: "bearer",
|
|
713
|
+
type: "http"
|
|
714
|
+
}],
|
|
715
|
+
url: "/crawl/history",
|
|
716
|
+
...options
|
|
717
|
+
});
|
|
718
|
+
/**
|
|
719
|
+
* Get crawl status
|
|
720
|
+
*
|
|
721
|
+
* Check the progress and status of a running or completed crawl.
|
|
722
|
+
*/
|
|
723
|
+
const getCrawlStatus = (options) => (options.client ?? client).get({
|
|
724
|
+
security: [{
|
|
725
|
+
scheme: "bearer",
|
|
726
|
+
type: "http"
|
|
727
|
+
}],
|
|
728
|
+
url: "/crawl/{id}/status",
|
|
729
|
+
...options
|
|
730
|
+
});
|
|
731
|
+
/**
|
|
732
|
+
* Cancel a running crawl
|
|
733
|
+
*
|
|
734
|
+
* Cancel a crawl that is currently in progress.
|
|
735
|
+
*/
|
|
736
|
+
const cancelCrawl = (options) => (options.client ?? client).post({
|
|
737
|
+
security: [{
|
|
738
|
+
scheme: "bearer",
|
|
739
|
+
type: "http"
|
|
740
|
+
}],
|
|
741
|
+
url: "/crawl/{id}/cancel",
|
|
742
|
+
...options
|
|
743
|
+
});
|
|
744
|
+
/**
|
|
745
|
+
* Scrape or delete a single page
|
|
746
|
+
*
|
|
747
|
+
* Scrape a URL and index it into the knowledge base, or delete a previously scraped page.
|
|
748
|
+
*/
|
|
749
|
+
const scrapePage = (options) => (options?.client ?? client).post({
|
|
750
|
+
security: [{
|
|
751
|
+
scheme: "bearer",
|
|
752
|
+
type: "http"
|
|
753
|
+
}],
|
|
754
|
+
url: "/webhooks/scrape",
|
|
755
|
+
...options,
|
|
756
|
+
headers: {
|
|
757
|
+
"Content-Type": "application/json",
|
|
758
|
+
...options?.headers
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
/**
|
|
762
|
+
* List products
|
|
763
|
+
*
|
|
764
|
+
* List products with optional filters. Supports pagination, category/tag/status filters, and metadata queries.
|
|
765
|
+
*/
|
|
766
|
+
const listProducts = (options) => (options?.client ?? client).get({
|
|
767
|
+
security: [{
|
|
768
|
+
scheme: "bearer",
|
|
769
|
+
type: "http"
|
|
770
|
+
}],
|
|
771
|
+
url: "/products",
|
|
772
|
+
...options
|
|
773
|
+
});
|
|
774
|
+
/**
|
|
775
|
+
* Upsert a product
|
|
776
|
+
*
|
|
777
|
+
* Create or update a product by external ID. Generates vector embeddings for semantic search.
|
|
778
|
+
*/
|
|
779
|
+
const upsertProduct = (options) => (options?.client ?? client).post({
|
|
780
|
+
security: [{
|
|
781
|
+
scheme: "bearer",
|
|
782
|
+
type: "http"
|
|
783
|
+
}],
|
|
784
|
+
url: "/products",
|
|
785
|
+
...options,
|
|
786
|
+
headers: {
|
|
787
|
+
"Content-Type": "application/json",
|
|
788
|
+
...options?.headers
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
/**
|
|
792
|
+
* Bulk delete products
|
|
793
|
+
*
|
|
794
|
+
* Delete multiple products by their external IDs.
|
|
795
|
+
*/
|
|
796
|
+
const bulkDeleteProducts = (options) => (options?.client ?? client).delete({
|
|
797
|
+
security: [{
|
|
798
|
+
scheme: "bearer",
|
|
799
|
+
type: "http"
|
|
800
|
+
}],
|
|
801
|
+
url: "/products/bulk",
|
|
802
|
+
...options,
|
|
803
|
+
headers: {
|
|
804
|
+
"Content-Type": "application/json",
|
|
805
|
+
...options?.headers
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
/**
|
|
809
|
+
* Bulk upsert products
|
|
810
|
+
*
|
|
811
|
+
* Create or update up to 100 products in a single request.
|
|
812
|
+
*/
|
|
813
|
+
const bulkUpsertProducts = (options) => (options?.client ?? client).post({
|
|
814
|
+
security: [{
|
|
815
|
+
scheme: "bearer",
|
|
816
|
+
type: "http"
|
|
817
|
+
}],
|
|
818
|
+
url: "/products/bulk",
|
|
819
|
+
...options,
|
|
820
|
+
headers: {
|
|
821
|
+
"Content-Type": "application/json",
|
|
822
|
+
...options?.headers
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
/**
|
|
826
|
+
* Search products
|
|
827
|
+
*
|
|
828
|
+
* Semantic search across products with optional filters and facets. Uses AI agent for query enhancement when beneficial.
|
|
829
|
+
*/
|
|
830
|
+
const searchProducts = (options) => (options?.client ?? client).post({
|
|
831
|
+
security: [{
|
|
832
|
+
scheme: "bearer",
|
|
833
|
+
type: "http"
|
|
834
|
+
}],
|
|
835
|
+
url: "/products/search",
|
|
836
|
+
...options,
|
|
837
|
+
headers: {
|
|
838
|
+
"Content-Type": "application/json",
|
|
839
|
+
...options?.headers
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
/**
|
|
843
|
+
* Delete products by query
|
|
844
|
+
*
|
|
845
|
+
* Delete all products matching the given filter criteria.
|
|
846
|
+
*/
|
|
847
|
+
const deleteProductsByQuery = (options) => (options?.client ?? client).post({
|
|
848
|
+
security: [{
|
|
849
|
+
scheme: "bearer",
|
|
850
|
+
type: "http"
|
|
851
|
+
}],
|
|
852
|
+
url: "/products/delete-by-query",
|
|
853
|
+
...options,
|
|
854
|
+
headers: {
|
|
855
|
+
"Content-Type": "application/json",
|
|
856
|
+
...options?.headers
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
/**
|
|
860
|
+
* List product IDs
|
|
861
|
+
*
|
|
862
|
+
* Retrieve external IDs of indexed products with optional filters. Supports large offsets for sync.
|
|
863
|
+
*/
|
|
864
|
+
const listProductIds = (options) => (options?.client ?? client).get({
|
|
865
|
+
security: [{
|
|
866
|
+
scheme: "bearer",
|
|
867
|
+
type: "http"
|
|
868
|
+
}],
|
|
869
|
+
url: "/products/ids",
|
|
870
|
+
...options
|
|
871
|
+
});
|
|
872
|
+
/**
|
|
873
|
+
* Delete a product
|
|
874
|
+
*
|
|
875
|
+
* Delete a single product by external ID.
|
|
876
|
+
*/
|
|
877
|
+
const deleteProduct = (options) => (options.client ?? client).delete({
|
|
878
|
+
security: [{
|
|
879
|
+
scheme: "bearer",
|
|
880
|
+
type: "http"
|
|
881
|
+
}],
|
|
882
|
+
url: "/products/{id}",
|
|
883
|
+
...options
|
|
884
|
+
});
|
|
885
|
+
/**
|
|
886
|
+
* Get a product
|
|
887
|
+
*
|
|
888
|
+
* Retrieve a single product by external ID.
|
|
889
|
+
*/
|
|
890
|
+
const getProduct = (options) => (options.client ?? client).get({
|
|
891
|
+
security: [{
|
|
892
|
+
scheme: "bearer",
|
|
893
|
+
type: "http"
|
|
894
|
+
}],
|
|
895
|
+
url: "/products/{id}",
|
|
896
|
+
...options
|
|
897
|
+
});
|
|
898
|
+
/**
|
|
899
|
+
* Patch a product
|
|
900
|
+
*
|
|
901
|
+
* Partially update a product (e.g. change indexStatus).
|
|
902
|
+
*/
|
|
903
|
+
const patchProduct = (options) => (options.client ?? client).patch({
|
|
904
|
+
security: [{
|
|
905
|
+
scheme: "bearer",
|
|
906
|
+
type: "http"
|
|
907
|
+
}],
|
|
908
|
+
url: "/products/{id}",
|
|
909
|
+
...options,
|
|
910
|
+
headers: {
|
|
911
|
+
"Content-Type": "application/json",
|
|
912
|
+
...options.headers
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
/**
|
|
916
|
+
* Upsert a post
|
|
917
|
+
*
|
|
918
|
+
* Create or update a post by external ID. Generates vector embeddings for semantic search.
|
|
919
|
+
*/
|
|
920
|
+
const upsertPost = (options) => (options?.client ?? client).post({
|
|
921
|
+
security: [{
|
|
922
|
+
scheme: "bearer",
|
|
923
|
+
type: "http"
|
|
924
|
+
}],
|
|
925
|
+
url: "/posts",
|
|
926
|
+
...options,
|
|
927
|
+
headers: {
|
|
928
|
+
"Content-Type": "application/json",
|
|
929
|
+
...options?.headers
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
/**
|
|
933
|
+
* Bulk delete posts
|
|
934
|
+
*
|
|
935
|
+
* Delete multiple posts by their external IDs.
|
|
936
|
+
*/
|
|
937
|
+
const bulkDeletePosts = (options) => (options?.client ?? client).delete({
|
|
938
|
+
security: [{
|
|
939
|
+
scheme: "bearer",
|
|
940
|
+
type: "http"
|
|
941
|
+
}],
|
|
942
|
+
url: "/posts/bulk",
|
|
943
|
+
...options,
|
|
944
|
+
headers: {
|
|
945
|
+
"Content-Type": "application/json",
|
|
946
|
+
...options?.headers
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
/**
|
|
950
|
+
* Bulk upsert posts
|
|
951
|
+
*
|
|
952
|
+
* Create or update up to 100 posts in a single request.
|
|
953
|
+
*/
|
|
954
|
+
const bulkUpsertPosts = (options) => (options?.client ?? client).post({
|
|
955
|
+
security: [{
|
|
956
|
+
scheme: "bearer",
|
|
957
|
+
type: "http"
|
|
958
|
+
}],
|
|
959
|
+
url: "/posts/bulk",
|
|
960
|
+
...options,
|
|
961
|
+
headers: {
|
|
962
|
+
"Content-Type": "application/json",
|
|
963
|
+
...options?.headers
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
/**
|
|
967
|
+
* Search posts
|
|
968
|
+
*
|
|
969
|
+
* Semantic search across posts with optional filters. Uses AI agent for query enhancement when beneficial.
|
|
970
|
+
*/
|
|
971
|
+
const searchPosts = (options) => (options?.client ?? client).post({
|
|
972
|
+
security: [{
|
|
973
|
+
scheme: "bearer",
|
|
974
|
+
type: "http"
|
|
975
|
+
}],
|
|
976
|
+
url: "/posts/search",
|
|
977
|
+
...options,
|
|
978
|
+
headers: {
|
|
979
|
+
"Content-Type": "application/json",
|
|
980
|
+
...options?.headers
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
/**
|
|
984
|
+
* Delete posts by query
|
|
985
|
+
*
|
|
986
|
+
* Delete all posts matching the given filter criteria.
|
|
987
|
+
*/
|
|
988
|
+
const deletePostsByQuery = (options) => (options?.client ?? client).post({
|
|
989
|
+
security: [{
|
|
990
|
+
scheme: "bearer",
|
|
991
|
+
type: "http"
|
|
992
|
+
}],
|
|
993
|
+
url: "/posts/delete-by-query",
|
|
994
|
+
...options,
|
|
995
|
+
headers: {
|
|
996
|
+
"Content-Type": "application/json",
|
|
997
|
+
...options?.headers
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
/**
|
|
1001
|
+
* List post IDs
|
|
1002
|
+
*
|
|
1003
|
+
* Retrieve external IDs of indexed posts with optional filters. Supports large offsets for sync.
|
|
1004
|
+
*/
|
|
1005
|
+
const listPostIds = (options) => (options?.client ?? client).get({
|
|
1006
|
+
security: [{
|
|
1007
|
+
scheme: "bearer",
|
|
1008
|
+
type: "http"
|
|
1009
|
+
}],
|
|
1010
|
+
url: "/posts/ids",
|
|
1011
|
+
...options
|
|
1012
|
+
});
|
|
1013
|
+
/**
|
|
1014
|
+
* Delete a post
|
|
1015
|
+
*
|
|
1016
|
+
* Delete a single post by external ID.
|
|
1017
|
+
*/
|
|
1018
|
+
const deletePost = (options) => (options.client ?? client).delete({
|
|
1019
|
+
security: [{
|
|
1020
|
+
scheme: "bearer",
|
|
1021
|
+
type: "http"
|
|
1022
|
+
}],
|
|
1023
|
+
url: "/posts/{id}",
|
|
1024
|
+
...options
|
|
1025
|
+
});
|
|
1026
|
+
/**
|
|
1027
|
+
* Get a post
|
|
1028
|
+
*
|
|
1029
|
+
* Retrieve a single post by external ID.
|
|
1030
|
+
*/
|
|
1031
|
+
const getPost = (options) => (options.client ?? client).get({
|
|
1032
|
+
security: [{
|
|
1033
|
+
scheme: "bearer",
|
|
1034
|
+
type: "http"
|
|
1035
|
+
}],
|
|
1036
|
+
url: "/posts/{id}",
|
|
1037
|
+
...options
|
|
1038
|
+
});
|
|
1039
|
+
/**
|
|
1040
|
+
* Patch a post
|
|
1041
|
+
*
|
|
1042
|
+
* Partially update a post (e.g. change indexStatus).
|
|
1043
|
+
*/
|
|
1044
|
+
const patchPost = (options) => (options.client ?? client).patch({
|
|
1045
|
+
security: [{
|
|
1046
|
+
scheme: "bearer",
|
|
1047
|
+
type: "http"
|
|
1048
|
+
}],
|
|
1049
|
+
url: "/posts/{id}",
|
|
1050
|
+
...options,
|
|
1051
|
+
headers: {
|
|
1052
|
+
"Content-Type": "application/json",
|
|
1053
|
+
...options.headers
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
/**
|
|
1057
|
+
* Search threads
|
|
1058
|
+
*
|
|
1059
|
+
* Search and filter conversation threads with pagination, date ranges, and sorting.
|
|
1060
|
+
*/
|
|
1061
|
+
const searchThreads = (options) => (options?.client ?? client).post({
|
|
1062
|
+
security: [{
|
|
1063
|
+
scheme: "bearer",
|
|
1064
|
+
type: "http"
|
|
1065
|
+
}],
|
|
1066
|
+
url: "/threads/search",
|
|
1067
|
+
...options,
|
|
1068
|
+
headers: {
|
|
1069
|
+
"Content-Type": "application/json",
|
|
1070
|
+
...options?.headers
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
/**
|
|
1074
|
+
* Export threads
|
|
1075
|
+
*
|
|
1076
|
+
* Export conversation threads in JSON or CSV format with optional date and user filtering.
|
|
1077
|
+
*/
|
|
1078
|
+
const exportThreads = (options) => (options?.client ?? client).post({
|
|
1079
|
+
security: [{
|
|
1080
|
+
scheme: "bearer",
|
|
1081
|
+
type: "http"
|
|
1082
|
+
}],
|
|
1083
|
+
url: "/threads/export",
|
|
1084
|
+
...options,
|
|
1085
|
+
headers: {
|
|
1086
|
+
"Content-Type": "application/json",
|
|
1087
|
+
...options?.headers
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
/**
|
|
1091
|
+
* Get thread analytics
|
|
1092
|
+
*
|
|
1093
|
+
* Retrieve aggregate analytics and statistics about conversation threads.
|
|
1094
|
+
*/
|
|
1095
|
+
const getThreadAnalytics = (options) => (options?.client ?? client).get({
|
|
1096
|
+
security: [{
|
|
1097
|
+
scheme: "bearer",
|
|
1098
|
+
type: "http"
|
|
1099
|
+
}],
|
|
1100
|
+
url: "/threads/analytics",
|
|
1101
|
+
...options
|
|
1102
|
+
});
|
|
1103
|
+
/**
|
|
1104
|
+
* Get thread messages
|
|
1105
|
+
*
|
|
1106
|
+
* Retrieve all messages for a specific conversation thread. Requires admin:threads or chat scope.
|
|
1107
|
+
*/
|
|
1108
|
+
const getThreadMessages = (options) => (options.client ?? client).get({
|
|
1109
|
+
security: [{
|
|
1110
|
+
scheme: "bearer",
|
|
1111
|
+
type: "http"
|
|
1112
|
+
}],
|
|
1113
|
+
url: "/threads/{id}/messages",
|
|
1114
|
+
...options
|
|
1115
|
+
});
|
|
1116
|
+
/**
|
|
1117
|
+
* End live agent handoff
|
|
1118
|
+
*
|
|
1119
|
+
* End a live agent handoff session for a thread. Requires admin:threads or chat scope.
|
|
1120
|
+
*/
|
|
1121
|
+
const endHandoff = (options) => (options.client ?? client).post({
|
|
1122
|
+
security: [{
|
|
1123
|
+
scheme: "bearer",
|
|
1124
|
+
type: "http"
|
|
1125
|
+
}],
|
|
1126
|
+
url: "/threads/{id}/handoff/end",
|
|
1127
|
+
...options
|
|
1128
|
+
});
|
|
1129
|
+
/**
|
|
1130
|
+
* Delete a thread
|
|
1131
|
+
*
|
|
1132
|
+
* Permanently delete a conversation thread by its ID.
|
|
1133
|
+
*/
|
|
1134
|
+
const deleteThread = (options) => (options.client ?? client).delete({
|
|
1135
|
+
security: [{
|
|
1136
|
+
scheme: "bearer",
|
|
1137
|
+
type: "http"
|
|
1138
|
+
}],
|
|
1139
|
+
url: "/threads/{id}",
|
|
1140
|
+
...options
|
|
1141
|
+
});
|
|
1142
|
+
/**
|
|
1143
|
+
* Get thread by ID
|
|
1144
|
+
*
|
|
1145
|
+
* Retrieve a single conversation thread by its ID, optionally including feedback data.
|
|
1146
|
+
*/
|
|
1147
|
+
const getThread = (options) => (options.client ?? client).get({
|
|
1148
|
+
security: [{
|
|
1149
|
+
scheme: "bearer",
|
|
1150
|
+
type: "http"
|
|
1151
|
+
}],
|
|
1152
|
+
url: "/threads/{id}",
|
|
1153
|
+
...options
|
|
1154
|
+
});
|
|
1155
|
+
/**
|
|
1156
|
+
* Bulk delete threads
|
|
1157
|
+
*
|
|
1158
|
+
* Delete multiple conversation threads by their IDs in a single request.
|
|
1159
|
+
*/
|
|
1160
|
+
const bulkDeleteThreads = (options) => (options?.client ?? client).delete({
|
|
1161
|
+
security: [{
|
|
1162
|
+
scheme: "bearer",
|
|
1163
|
+
type: "http"
|
|
1164
|
+
}],
|
|
1165
|
+
url: "/threads",
|
|
1166
|
+
...options,
|
|
1167
|
+
headers: {
|
|
1168
|
+
"Content-Type": "application/json",
|
|
1169
|
+
...options?.headers
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
/**
|
|
1173
|
+
* Search feedback
|
|
1174
|
+
*
|
|
1175
|
+
* Search and filter feedback entries with pagination.
|
|
1176
|
+
*/
|
|
1177
|
+
const listFeedback = (options) => (options?.client ?? client).get({
|
|
1178
|
+
security: [{
|
|
1179
|
+
scheme: "bearer",
|
|
1180
|
+
type: "http"
|
|
1181
|
+
}],
|
|
1182
|
+
url: "/feedback",
|
|
1183
|
+
...options
|
|
1184
|
+
});
|
|
1185
|
+
/**
|
|
1186
|
+
* Submit feedback
|
|
1187
|
+
*
|
|
1188
|
+
* Submit user feedback for a piece of content or chat message.
|
|
1189
|
+
*/
|
|
1190
|
+
const submitFeedback = (options) => (options?.client ?? client).post({
|
|
1191
|
+
security: [{
|
|
1192
|
+
scheme: "bearer",
|
|
1193
|
+
type: "http"
|
|
1194
|
+
}],
|
|
1195
|
+
url: "/feedback",
|
|
1196
|
+
...options,
|
|
1197
|
+
headers: {
|
|
1198
|
+
"Content-Type": "application/json",
|
|
1199
|
+
...options?.headers
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
/**
|
|
1203
|
+
* Get feedback analytics
|
|
1204
|
+
*
|
|
1205
|
+
* Retrieve aggregated feedback analytics for a date range.
|
|
1206
|
+
*/
|
|
1207
|
+
const getFeedbackAnalytics = (options) => (options?.client ?? client).get({
|
|
1208
|
+
security: [{
|
|
1209
|
+
scheme: "bearer",
|
|
1210
|
+
type: "http"
|
|
1211
|
+
}],
|
|
1212
|
+
url: "/feedback/analytics",
|
|
1213
|
+
...options
|
|
1214
|
+
});
|
|
1215
|
+
/**
|
|
1216
|
+
* Get feedback for a thread
|
|
1217
|
+
*
|
|
1218
|
+
* Retrieve all feedback entries associated with a specific thread.
|
|
1219
|
+
*/
|
|
1220
|
+
const getThreadFeedback = (options) => (options.client ?? client).get({
|
|
1221
|
+
security: [{
|
|
1222
|
+
scheme: "bearer",
|
|
1223
|
+
type: "http"
|
|
1224
|
+
}],
|
|
1225
|
+
url: "/feedback/thread/{threadId}",
|
|
1226
|
+
...options
|
|
1227
|
+
});
|
|
1228
|
+
/**
|
|
1229
|
+
* Delete feedback
|
|
1230
|
+
*
|
|
1231
|
+
* Delete a feedback entry by ID.
|
|
1232
|
+
*/
|
|
1233
|
+
const deleteFeedback = (options) => (options.client ?? client).delete({
|
|
1234
|
+
security: [{
|
|
1235
|
+
scheme: "bearer",
|
|
1236
|
+
type: "http"
|
|
1237
|
+
}],
|
|
1238
|
+
url: "/feedback/{id}",
|
|
1239
|
+
...options
|
|
1240
|
+
});
|
|
1241
|
+
/**
|
|
1242
|
+
* List prompts
|
|
1243
|
+
*
|
|
1244
|
+
* List prompts with optional pagination and metadata filters.
|
|
1245
|
+
*/
|
|
1246
|
+
const listPrompts = (options) => (options?.client ?? client).get({
|
|
1247
|
+
security: [{
|
|
1248
|
+
scheme: "bearer",
|
|
1249
|
+
type: "http"
|
|
1250
|
+
}],
|
|
1251
|
+
url: "/prompts",
|
|
1252
|
+
...options
|
|
1253
|
+
});
|
|
1254
|
+
/**
|
|
1255
|
+
* Upsert a prompt
|
|
1256
|
+
*
|
|
1257
|
+
* Create or update a prompt by external ID.
|
|
1258
|
+
*/
|
|
1259
|
+
const upsertPrompt = (options) => (options?.client ?? client).post({
|
|
1260
|
+
security: [{
|
|
1261
|
+
scheme: "bearer",
|
|
1262
|
+
type: "http"
|
|
1263
|
+
}],
|
|
1264
|
+
url: "/prompts",
|
|
1265
|
+
...options,
|
|
1266
|
+
headers: {
|
|
1267
|
+
"Content-Type": "application/json",
|
|
1268
|
+
...options?.headers
|
|
1269
|
+
}
|
|
1270
|
+
});
|
|
1271
|
+
/**
|
|
1272
|
+
* Search prompts
|
|
1273
|
+
*
|
|
1274
|
+
* Semantic search across prompts with optional filters.
|
|
1275
|
+
*/
|
|
1276
|
+
const searchPrompts = (options) => (options?.client ?? client).post({
|
|
1277
|
+
security: [{
|
|
1278
|
+
scheme: "bearer",
|
|
1279
|
+
type: "http"
|
|
1280
|
+
}],
|
|
1281
|
+
url: "/prompts/search",
|
|
1282
|
+
...options,
|
|
1283
|
+
headers: {
|
|
1284
|
+
"Content-Type": "application/json",
|
|
1285
|
+
...options?.headers
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
/**
|
|
1289
|
+
* Bulk delete prompts
|
|
1290
|
+
*
|
|
1291
|
+
* Delete multiple prompts by their external IDs.
|
|
1292
|
+
*/
|
|
1293
|
+
const bulkDeletePrompts = (options) => (options?.client ?? client).delete({
|
|
1294
|
+
security: [{
|
|
1295
|
+
scheme: "bearer",
|
|
1296
|
+
type: "http"
|
|
1297
|
+
}],
|
|
1298
|
+
url: "/prompts/bulk",
|
|
1299
|
+
...options,
|
|
1300
|
+
headers: {
|
|
1301
|
+
"Content-Type": "application/json",
|
|
1302
|
+
...options?.headers
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
/**
|
|
1306
|
+
* Bulk upsert prompts
|
|
1307
|
+
*
|
|
1308
|
+
* Create or update up to 100 prompts in a single request.
|
|
1309
|
+
*/
|
|
1310
|
+
const bulkUpsertPrompts = (options) => (options?.client ?? client).post({
|
|
1311
|
+
security: [{
|
|
1312
|
+
scheme: "bearer",
|
|
1313
|
+
type: "http"
|
|
1314
|
+
}],
|
|
1315
|
+
url: "/prompts/bulk",
|
|
1316
|
+
...options,
|
|
1317
|
+
headers: {
|
|
1318
|
+
"Content-Type": "application/json",
|
|
1319
|
+
...options?.headers
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
/**
|
|
1323
|
+
* Delete a prompt
|
|
1324
|
+
*
|
|
1325
|
+
* Delete a single prompt by external ID.
|
|
1326
|
+
*/
|
|
1327
|
+
const deletePrompt = (options) => (options.client ?? client).delete({
|
|
1328
|
+
security: [{
|
|
1329
|
+
scheme: "bearer",
|
|
1330
|
+
type: "http"
|
|
1331
|
+
}],
|
|
1332
|
+
url: "/prompts/{id}",
|
|
1333
|
+
...options
|
|
1334
|
+
});
|
|
1335
|
+
/**
|
|
1336
|
+
* Get a prompt
|
|
1337
|
+
*
|
|
1338
|
+
* Retrieve a single prompt by external ID.
|
|
1339
|
+
*/
|
|
1340
|
+
const getPrompt = (options) => (options.client ?? client).get({
|
|
1341
|
+
security: [{
|
|
1342
|
+
scheme: "bearer",
|
|
1343
|
+
type: "http"
|
|
1344
|
+
}],
|
|
1345
|
+
url: "/prompts/{id}",
|
|
1346
|
+
...options
|
|
1347
|
+
});
|
|
1348
|
+
/**
|
|
1349
|
+
* Bulk update webhook status
|
|
1350
|
+
*
|
|
1351
|
+
* Update the status of multiple webhooks at once.
|
|
1352
|
+
*/
|
|
1353
|
+
const bulkUpdateWebhookStatus = (options) => (options?.client ?? client).post({
|
|
1354
|
+
security: [{
|
|
1355
|
+
scheme: "bearer",
|
|
1356
|
+
type: "http"
|
|
1357
|
+
}],
|
|
1358
|
+
url: "/webhooks/bulk-status",
|
|
1359
|
+
...options,
|
|
1360
|
+
headers: {
|
|
1361
|
+
"Content-Type": "application/json",
|
|
1362
|
+
...options?.headers
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
/**
|
|
1366
|
+
* List webhooks
|
|
1367
|
+
*
|
|
1368
|
+
* List all webhooks with optional filters, pagination, and sorting.
|
|
1369
|
+
*/
|
|
1370
|
+
const listWebhooks = (options) => (options?.client ?? client).get({
|
|
1371
|
+
security: [{
|
|
1372
|
+
scheme: "bearer",
|
|
1373
|
+
type: "http"
|
|
1374
|
+
}],
|
|
1375
|
+
url: "/webhooks",
|
|
1376
|
+
...options
|
|
1377
|
+
});
|
|
1378
|
+
/**
|
|
1379
|
+
* Create a webhook
|
|
1380
|
+
*
|
|
1381
|
+
* Register a new webhook endpoint to receive event notifications.
|
|
1382
|
+
*/
|
|
1383
|
+
const createWebhook = (options) => (options?.client ?? client).post({
|
|
1384
|
+
security: [{
|
|
1385
|
+
scheme: "bearer",
|
|
1386
|
+
type: "http"
|
|
1387
|
+
}],
|
|
1388
|
+
url: "/webhooks",
|
|
1389
|
+
...options,
|
|
1390
|
+
headers: {
|
|
1391
|
+
"Content-Type": "application/json",
|
|
1392
|
+
...options?.headers
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
/**
|
|
1396
|
+
* Test a webhook
|
|
1397
|
+
*
|
|
1398
|
+
* Send a test event to a webhook endpoint to verify connectivity.
|
|
1399
|
+
*/
|
|
1400
|
+
const testWebhook = (options) => (options.client ?? client).post({
|
|
1401
|
+
security: [{
|
|
1402
|
+
scheme: "bearer",
|
|
1403
|
+
type: "http"
|
|
1404
|
+
}],
|
|
1405
|
+
url: "/webhooks/{id}/test",
|
|
1406
|
+
...options
|
|
1407
|
+
});
|
|
1408
|
+
/**
|
|
1409
|
+
* Get webhook stats
|
|
1410
|
+
*
|
|
1411
|
+
* Retrieve delivery statistics for a specific webhook.
|
|
1412
|
+
*/
|
|
1413
|
+
const getWebhookStats = (options) => (options.client ?? client).get({
|
|
1414
|
+
security: [{
|
|
1415
|
+
scheme: "bearer",
|
|
1416
|
+
type: "http"
|
|
1417
|
+
}],
|
|
1418
|
+
url: "/webhooks/{id}/stats",
|
|
1419
|
+
...options
|
|
1420
|
+
});
|
|
1421
|
+
/**
|
|
1422
|
+
* Delete a webhook
|
|
1423
|
+
*
|
|
1424
|
+
* Permanently delete a webhook by ID.
|
|
1425
|
+
*/
|
|
1426
|
+
const deleteWebhook = (options) => (options.client ?? client).delete({
|
|
1427
|
+
security: [{
|
|
1428
|
+
scheme: "bearer",
|
|
1429
|
+
type: "http"
|
|
1430
|
+
}],
|
|
1431
|
+
url: "/webhooks/{id}",
|
|
1432
|
+
...options
|
|
1433
|
+
});
|
|
1434
|
+
/**
|
|
1435
|
+
* Get a webhook
|
|
1436
|
+
*
|
|
1437
|
+
* Retrieve a single webhook by ID. Sensitive fields are redacted.
|
|
1438
|
+
*/
|
|
1439
|
+
const getWebhook = (options) => (options.client ?? client).get({
|
|
1440
|
+
security: [{
|
|
1441
|
+
scheme: "bearer",
|
|
1442
|
+
type: "http"
|
|
1443
|
+
}],
|
|
1444
|
+
url: "/webhooks/{id}",
|
|
1445
|
+
...options
|
|
1446
|
+
});
|
|
1447
|
+
/**
|
|
1448
|
+
* Update a webhook
|
|
1449
|
+
*
|
|
1450
|
+
* Update an existing webhook configuration.
|
|
1451
|
+
*/
|
|
1452
|
+
const updateWebhook = (options) => (options.client ?? client).put({
|
|
1453
|
+
security: [{
|
|
1454
|
+
scheme: "bearer",
|
|
1455
|
+
type: "http"
|
|
1456
|
+
}],
|
|
1457
|
+
url: "/webhooks/{id}",
|
|
1458
|
+
...options,
|
|
1459
|
+
headers: {
|
|
1460
|
+
"Content-Type": "application/json",
|
|
1461
|
+
...options.headers
|
|
1462
|
+
}
|
|
1463
|
+
});
|
|
1464
|
+
/**
|
|
1465
|
+
* List taxonomy terms
|
|
1466
|
+
*
|
|
1467
|
+
* List taxonomy terms with optional filters and pagination.
|
|
1468
|
+
*/
|
|
1469
|
+
const listTaxonomies = (options) => (options?.client ?? client).get({
|
|
1470
|
+
security: [{
|
|
1471
|
+
scheme: "bearer",
|
|
1472
|
+
type: "http"
|
|
1473
|
+
}],
|
|
1474
|
+
url: "/taxonomies",
|
|
1475
|
+
...options
|
|
1476
|
+
});
|
|
1477
|
+
/**
|
|
1478
|
+
* Upsert a taxonomy term
|
|
1479
|
+
*
|
|
1480
|
+
* Create or update a taxonomy term by external ID.
|
|
1481
|
+
*/
|
|
1482
|
+
const upsertTaxonomy = (options) => (options?.client ?? client).post({
|
|
1483
|
+
security: [{
|
|
1484
|
+
scheme: "bearer",
|
|
1485
|
+
type: "http"
|
|
1486
|
+
}],
|
|
1487
|
+
url: "/taxonomies",
|
|
1488
|
+
...options,
|
|
1489
|
+
headers: {
|
|
1490
|
+
"Content-Type": "application/json",
|
|
1491
|
+
...options?.headers
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
/**
|
|
1495
|
+
* Bulk delete taxonomy terms
|
|
1496
|
+
*
|
|
1497
|
+
* Delete multiple taxonomy terms by their external IDs.
|
|
1498
|
+
*/
|
|
1499
|
+
const bulkDeleteTaxonomies = (options) => (options?.client ?? client).delete({
|
|
1500
|
+
security: [{
|
|
1501
|
+
scheme: "bearer",
|
|
1502
|
+
type: "http"
|
|
1503
|
+
}],
|
|
1504
|
+
url: "/taxonomies/bulk",
|
|
1505
|
+
...options,
|
|
1506
|
+
headers: {
|
|
1507
|
+
"Content-Type": "application/json",
|
|
1508
|
+
...options?.headers
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
/**
|
|
1512
|
+
* Bulk upsert taxonomy terms
|
|
1513
|
+
*
|
|
1514
|
+
* Create or update up to 100 taxonomy terms in a single request.
|
|
1515
|
+
*/
|
|
1516
|
+
const bulkUpsertTaxonomies = (options) => (options?.client ?? client).post({
|
|
1517
|
+
security: [{
|
|
1518
|
+
scheme: "bearer",
|
|
1519
|
+
type: "http"
|
|
1520
|
+
}],
|
|
1521
|
+
url: "/taxonomies/bulk",
|
|
1522
|
+
...options,
|
|
1523
|
+
headers: {
|
|
1524
|
+
"Content-Type": "application/json",
|
|
1525
|
+
...options?.headers
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
/**
|
|
1529
|
+
* Delete taxonomy terms by query
|
|
1530
|
+
*
|
|
1531
|
+
* Delete all taxonomy terms matching the given filter criteria.
|
|
1532
|
+
*/
|
|
1533
|
+
const deleteTaxonomiesByQuery = (options) => (options?.client ?? client).post({
|
|
1534
|
+
security: [{
|
|
1535
|
+
scheme: "bearer",
|
|
1536
|
+
type: "http"
|
|
1537
|
+
}],
|
|
1538
|
+
url: "/taxonomies/delete-by-query",
|
|
1539
|
+
...options,
|
|
1540
|
+
headers: {
|
|
1541
|
+
"Content-Type": "application/json",
|
|
1542
|
+
...options?.headers
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1545
|
+
/**
|
|
1546
|
+
* List taxonomy term IDs
|
|
1547
|
+
*
|
|
1548
|
+
* Retrieve external IDs of indexed taxonomy terms with optional filters.
|
|
1549
|
+
*/
|
|
1550
|
+
const listTaxonomyIds = (options) => (options?.client ?? client).get({
|
|
1551
|
+
security: [{
|
|
1552
|
+
scheme: "bearer",
|
|
1553
|
+
type: "http"
|
|
1554
|
+
}],
|
|
1555
|
+
url: "/taxonomies/ids",
|
|
1556
|
+
...options
|
|
1557
|
+
});
|
|
1558
|
+
/**
|
|
1559
|
+
* Delete a taxonomy term
|
|
1560
|
+
*
|
|
1561
|
+
* Delete a single taxonomy term by external ID.
|
|
1562
|
+
*/
|
|
1563
|
+
const deleteTaxonomy = (options) => (options.client ?? client).delete({
|
|
1564
|
+
security: [{
|
|
1565
|
+
scheme: "bearer",
|
|
1566
|
+
type: "http"
|
|
1567
|
+
}],
|
|
1568
|
+
url: "/taxonomies/{id}",
|
|
1569
|
+
...options
|
|
1570
|
+
});
|
|
1571
|
+
/**
|
|
1572
|
+
* Get a taxonomy term
|
|
1573
|
+
*
|
|
1574
|
+
* Retrieve a single taxonomy term by external ID.
|
|
1575
|
+
*/
|
|
1576
|
+
const getTaxonomy = (options) => (options.client ?? client).get({
|
|
1577
|
+
security: [{
|
|
1578
|
+
scheme: "bearer",
|
|
1579
|
+
type: "http"
|
|
1580
|
+
}],
|
|
1581
|
+
url: "/taxonomies/{id}",
|
|
1582
|
+
...options
|
|
1583
|
+
});
|
|
1584
|
+
/**
|
|
1585
|
+
* Get search analytics
|
|
1586
|
+
*
|
|
1587
|
+
* Retrieve search analytics data including top queries, zero-result queries, and volume over time.
|
|
1588
|
+
*/
|
|
1589
|
+
const getSearchAnalytics = (options) => (options?.client ?? client).get({
|
|
1590
|
+
security: [{
|
|
1591
|
+
scheme: "bearer",
|
|
1592
|
+
type: "http"
|
|
1593
|
+
}],
|
|
1594
|
+
url: "/analytics/search",
|
|
1595
|
+
...options
|
|
1596
|
+
});
|
|
1597
|
+
/**
|
|
1598
|
+
* Search through search logs
|
|
1599
|
+
*
|
|
1600
|
+
* Query and filter recorded search logs with pagination and sorting.
|
|
1601
|
+
*/
|
|
1602
|
+
const searchSearches = (options) => (options?.client ?? client).post({
|
|
1603
|
+
security: [{
|
|
1604
|
+
scheme: "bearer",
|
|
1605
|
+
type: "http"
|
|
1606
|
+
}],
|
|
1607
|
+
url: "/analytics/searches/search",
|
|
1608
|
+
...options,
|
|
1609
|
+
headers: {
|
|
1610
|
+
"Content-Type": "application/json",
|
|
1611
|
+
...options?.headers
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1614
|
+
/**
|
|
1615
|
+
* Commit a search event
|
|
1616
|
+
*
|
|
1617
|
+
* Record a search event for analytics tracking. Requires search scope.
|
|
1618
|
+
*/
|
|
1619
|
+
const commitSearch = (options) => (options?.client ?? client).post({
|
|
1620
|
+
security: [{
|
|
1621
|
+
scheme: "bearer",
|
|
1622
|
+
type: "http"
|
|
1623
|
+
}],
|
|
1624
|
+
url: "/analytics/searches/commit",
|
|
1625
|
+
...options,
|
|
1626
|
+
headers: {
|
|
1627
|
+
"Content-Type": "application/json",
|
|
1628
|
+
...options?.headers
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
/**
|
|
1632
|
+
* Get chat analytics
|
|
1633
|
+
*
|
|
1634
|
+
* Retrieve chat/thread analytics data over a configurable time window.
|
|
1635
|
+
*/
|
|
1636
|
+
const getChatAnalytics = (options) => (options?.client ?? client).get({
|
|
1637
|
+
security: [{
|
|
1638
|
+
scheme: "bearer",
|
|
1639
|
+
type: "http"
|
|
1640
|
+
}],
|
|
1641
|
+
url: "/analytics/chat",
|
|
1642
|
+
...options
|
|
1643
|
+
});
|
|
1644
|
+
/**
|
|
1645
|
+
* Get feedback analytics
|
|
1646
|
+
*
|
|
1647
|
+
* Retrieve feedback analytics data with optional date range filtering.
|
|
1648
|
+
*/
|
|
1649
|
+
const getAnalyticsFeedback = (options) => (options?.client ?? client).get({
|
|
1650
|
+
security: [{
|
|
1651
|
+
scheme: "bearer",
|
|
1652
|
+
type: "http"
|
|
1653
|
+
}],
|
|
1654
|
+
url: "/analytics/feedback",
|
|
1655
|
+
...options
|
|
1656
|
+
});
|
|
1657
|
+
/**
|
|
1658
|
+
* Get product recommendations
|
|
1659
|
+
*
|
|
1660
|
+
* Retrieve AI-powered product recommendations based on a source product, basket affinity, and optional filters.
|
|
1661
|
+
*/
|
|
1662
|
+
const getProductRecommendations = (options) => (options?.client ?? client).post({
|
|
1663
|
+
security: [{
|
|
1664
|
+
scheme: "bearer",
|
|
1665
|
+
type: "http"
|
|
1666
|
+
}],
|
|
1667
|
+
url: "/recommendations/products",
|
|
1668
|
+
...options,
|
|
1669
|
+
headers: {
|
|
1670
|
+
"Content-Type": "application/json",
|
|
1671
|
+
...options?.headers
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
/**
|
|
1675
|
+
* Self-delete tenant
|
|
1676
|
+
*/
|
|
1677
|
+
const deleteTenant = (options) => (options.client ?? client).delete({
|
|
1678
|
+
security: [{
|
|
1679
|
+
scheme: "bearer",
|
|
1680
|
+
type: "http"
|
|
1681
|
+
}],
|
|
1682
|
+
url: "/tenant/{tenantId}",
|
|
1683
|
+
...options
|
|
1684
|
+
});
|
|
1685
|
+
/**
|
|
1686
|
+
* Get tenant status
|
|
1687
|
+
*
|
|
1688
|
+
* Validate API key and retrieve tenant account information including tier, publishable key, and JWT secret.
|
|
1689
|
+
*/
|
|
1690
|
+
const getTenantStatus = (options) => (options?.client ?? client).get({
|
|
1691
|
+
security: [{
|
|
1692
|
+
scheme: "bearer",
|
|
1693
|
+
type: "http"
|
|
1694
|
+
}],
|
|
1695
|
+
url: "/tenant/status",
|
|
1696
|
+
...options
|
|
1697
|
+
});
|
|
1698
|
+
/**
|
|
1699
|
+
* Update tenant feature flags
|
|
1700
|
+
*/
|
|
1701
|
+
const updateTenantFeatures = (options) => (options?.client ?? client).patch({
|
|
1702
|
+
security: [{
|
|
1703
|
+
scheme: "bearer",
|
|
1704
|
+
type: "http"
|
|
1705
|
+
}],
|
|
1706
|
+
url: "/tenant/features",
|
|
1707
|
+
...options,
|
|
1708
|
+
headers: {
|
|
1709
|
+
"Content-Type": "application/json",
|
|
1710
|
+
...options?.headers
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
/**
|
|
1714
|
+
* Get usage summary
|
|
1715
|
+
*/
|
|
1716
|
+
const getTenantUsage = (options) => (options?.client ?? client).get({
|
|
1717
|
+
security: [{
|
|
1718
|
+
scheme: "bearer",
|
|
1719
|
+
type: "http"
|
|
1720
|
+
}],
|
|
1721
|
+
url: "/tenant/usage",
|
|
1722
|
+
...options
|
|
1723
|
+
});
|
|
1724
|
+
/**
|
|
1725
|
+
* Get daily usage history
|
|
1726
|
+
*/
|
|
1727
|
+
const getTenantUsageHistory = (options) => (options?.client ?? client).get({
|
|
1728
|
+
security: [{
|
|
1729
|
+
scheme: "bearer",
|
|
1730
|
+
type: "http"
|
|
1731
|
+
}],
|
|
1732
|
+
url: "/tenant/usage/history",
|
|
1733
|
+
...options
|
|
1734
|
+
});
|
|
1735
|
+
/**
|
|
1736
|
+
* List workspaces
|
|
1737
|
+
*
|
|
1738
|
+
* List all workspaces for the authenticated tenant.
|
|
1739
|
+
*/
|
|
1740
|
+
const listTenantWorkspaces = (options) => (options?.client ?? client).get({
|
|
1741
|
+
security: [{
|
|
1742
|
+
scheme: "bearer",
|
|
1743
|
+
type: "http"
|
|
1744
|
+
}],
|
|
1745
|
+
url: "/tenant/workspaces",
|
|
1746
|
+
...options
|
|
1747
|
+
});
|
|
1748
|
+
/**
|
|
1749
|
+
* Create a workspace
|
|
1750
|
+
*
|
|
1751
|
+
* Create a new workspace under the authenticated tenant.
|
|
1752
|
+
*/
|
|
1753
|
+
const createTenantWorkspace = (options) => (options?.client ?? client).post({
|
|
1754
|
+
security: [{
|
|
1755
|
+
scheme: "bearer",
|
|
1756
|
+
type: "http"
|
|
1757
|
+
}],
|
|
1758
|
+
url: "/tenant/workspaces",
|
|
1759
|
+
...options,
|
|
1760
|
+
headers: {
|
|
1761
|
+
"Content-Type": "application/json",
|
|
1762
|
+
...options?.headers
|
|
1763
|
+
}
|
|
1764
|
+
});
|
|
1765
|
+
/**
|
|
1766
|
+
* Delete a workspace
|
|
1767
|
+
*/
|
|
1768
|
+
const deleteWorkspace = (options) => (options.client ?? client).delete({
|
|
1769
|
+
security: [{
|
|
1770
|
+
scheme: "bearer",
|
|
1771
|
+
type: "http"
|
|
1772
|
+
}],
|
|
1773
|
+
url: "/tenant/workspaces/{workspaceId}",
|
|
1774
|
+
...options
|
|
1775
|
+
});
|
|
1776
|
+
/**
|
|
1777
|
+
* Update a workspace
|
|
1778
|
+
*/
|
|
1779
|
+
const updateWorkspace = (options) => (options.client ?? client).put({
|
|
1780
|
+
security: [{
|
|
1781
|
+
scheme: "bearer",
|
|
1782
|
+
type: "http"
|
|
1783
|
+
}],
|
|
1784
|
+
url: "/tenant/workspaces/{workspaceId}",
|
|
1785
|
+
...options,
|
|
1786
|
+
headers: {
|
|
1787
|
+
"Content-Type": "application/json",
|
|
1788
|
+
...options.headers
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1791
|
+
/**
|
|
1792
|
+
* Get document statistics
|
|
1793
|
+
*
|
|
1794
|
+
* Retrieve document counts and breakdown by type from the knowledge base.
|
|
1795
|
+
*/
|
|
1796
|
+
const getKnowledge = (options) => (options?.client ?? client).get({
|
|
1797
|
+
security: [{
|
|
1798
|
+
scheme: "bearer",
|
|
1799
|
+
type: "http"
|
|
1800
|
+
}],
|
|
1801
|
+
url: "/tenant/knowledge",
|
|
1802
|
+
...options
|
|
1803
|
+
});
|
|
1804
|
+
/**
|
|
1805
|
+
* Search knowledge base documents
|
|
1806
|
+
*/
|
|
1807
|
+
const searchKnowledge = (options) => (options?.client ?? client).get({
|
|
1808
|
+
security: [{
|
|
1809
|
+
scheme: "bearer",
|
|
1810
|
+
type: "http"
|
|
1811
|
+
}],
|
|
1812
|
+
url: "/tenant/knowledge/search",
|
|
1813
|
+
...options
|
|
1814
|
+
});
|
|
1815
|
+
/**
|
|
1816
|
+
* Get presigned upload URL
|
|
1817
|
+
*/
|
|
1818
|
+
const getUploadUrl = (options) => (options?.client ?? client).post({
|
|
1819
|
+
security: [{
|
|
1820
|
+
scheme: "bearer",
|
|
1821
|
+
type: "http"
|
|
1822
|
+
}],
|
|
1823
|
+
url: "/tenant/upload-url",
|
|
1824
|
+
...options,
|
|
1825
|
+
headers: {
|
|
1826
|
+
"Content-Type": "application/json",
|
|
1827
|
+
...options?.headers
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
/**
|
|
1831
|
+
* Delete MCP configuration
|
|
1832
|
+
*/
|
|
1833
|
+
const deleteMcpConfig = (options) => (options?.client ?? client).delete({
|
|
1834
|
+
security: [{
|
|
1835
|
+
scheme: "bearer",
|
|
1836
|
+
type: "http"
|
|
1837
|
+
}],
|
|
1838
|
+
url: "/tenant/mcp",
|
|
1839
|
+
...options
|
|
1840
|
+
});
|
|
1841
|
+
/**
|
|
1842
|
+
* Get MCP configuration
|
|
1843
|
+
*/
|
|
1844
|
+
const getMcpConfig = (options) => (options?.client ?? client).get({
|
|
1845
|
+
security: [{
|
|
1846
|
+
scheme: "bearer",
|
|
1847
|
+
type: "http"
|
|
1848
|
+
}],
|
|
1849
|
+
url: "/tenant/mcp",
|
|
1850
|
+
...options
|
|
1851
|
+
});
|
|
1852
|
+
/**
|
|
1853
|
+
* Update MCP configuration
|
|
1854
|
+
*/
|
|
1855
|
+
const updateMcpConfig = (options) => (options?.client ?? client).put({
|
|
1856
|
+
security: [{
|
|
1857
|
+
scheme: "bearer",
|
|
1858
|
+
type: "http"
|
|
1859
|
+
}],
|
|
1860
|
+
url: "/tenant/mcp",
|
|
1861
|
+
...options,
|
|
1862
|
+
headers: {
|
|
1863
|
+
"Content-Type": "application/json",
|
|
1864
|
+
...options?.headers
|
|
1865
|
+
}
|
|
1866
|
+
});
|
|
1867
|
+
/**
|
|
1868
|
+
* Check live agent credential status
|
|
1869
|
+
*/
|
|
1870
|
+
const getCredentialStatus = (options) => (options?.client ?? client).get({
|
|
1871
|
+
security: [{
|
|
1872
|
+
scheme: "bearer",
|
|
1873
|
+
type: "http"
|
|
1874
|
+
}],
|
|
1875
|
+
url: "/tenant/credentials/status",
|
|
1876
|
+
...options
|
|
1877
|
+
});
|
|
1878
|
+
/**
|
|
1879
|
+
* Delete live agent credentials
|
|
1880
|
+
*/
|
|
1881
|
+
const deleteCredentials = (options) => (options?.client ?? client).delete({
|
|
1882
|
+
security: [{
|
|
1883
|
+
scheme: "bearer",
|
|
1884
|
+
type: "http"
|
|
1885
|
+
}],
|
|
1886
|
+
url: "/tenant/credentials",
|
|
1887
|
+
...options
|
|
1888
|
+
});
|
|
1889
|
+
/**
|
|
1890
|
+
* Store live agent credentials
|
|
1891
|
+
*/
|
|
1892
|
+
const storeCredentials = (options) => (options?.client ?? client).post({
|
|
1893
|
+
security: [{
|
|
1894
|
+
scheme: "bearer",
|
|
1895
|
+
type: "http"
|
|
1896
|
+
}],
|
|
1897
|
+
url: "/tenant/credentials",
|
|
1898
|
+
...options,
|
|
1899
|
+
headers: {
|
|
1900
|
+
"Content-Type": "application/json",
|
|
1901
|
+
...options?.headers
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
/**
|
|
1905
|
+
* Delete live agent schedule
|
|
1906
|
+
*/
|
|
1907
|
+
const deleteLiveAgentSchedule = (options) => (options?.client ?? client).delete({
|
|
1908
|
+
security: [{
|
|
1909
|
+
scheme: "bearer",
|
|
1910
|
+
type: "http"
|
|
1911
|
+
}],
|
|
1912
|
+
url: "/tenant/schedule",
|
|
1913
|
+
...options
|
|
1914
|
+
});
|
|
1915
|
+
/**
|
|
1916
|
+
* Get live agent schedule
|
|
1917
|
+
*/
|
|
1918
|
+
const getLiveAgentSchedule = (options) => (options?.client ?? client).get({
|
|
1919
|
+
security: [{
|
|
1920
|
+
scheme: "bearer",
|
|
1921
|
+
type: "http"
|
|
1922
|
+
}],
|
|
1923
|
+
url: "/tenant/schedule",
|
|
1924
|
+
...options
|
|
1925
|
+
});
|
|
1926
|
+
/**
|
|
1927
|
+
* Update live agent schedule
|
|
1928
|
+
*/
|
|
1929
|
+
const updateLiveAgentSchedule = (options) => (options?.client ?? client).put({
|
|
1930
|
+
security: [{
|
|
1931
|
+
scheme: "bearer",
|
|
1932
|
+
type: "http"
|
|
1933
|
+
}],
|
|
1934
|
+
url: "/tenant/schedule",
|
|
1935
|
+
...options,
|
|
1936
|
+
headers: {
|
|
1937
|
+
"Content-Type": "application/json",
|
|
1938
|
+
...options?.headers
|
|
1939
|
+
}
|
|
1940
|
+
});
|
|
1941
|
+
/**
|
|
1942
|
+
* Get workspace settings
|
|
1943
|
+
*
|
|
1944
|
+
* Retrieve settings for a workspace including live agent configuration and special instructions.
|
|
1945
|
+
*/
|
|
1946
|
+
const getWorkspaceSettings = (options) => (options.client ?? client).get({
|
|
1947
|
+
security: [{
|
|
1948
|
+
scheme: "bearer",
|
|
1949
|
+
type: "http"
|
|
1950
|
+
}],
|
|
1951
|
+
url: "/workspace/{workspaceId}/settings",
|
|
1952
|
+
...options
|
|
1953
|
+
});
|
|
1954
|
+
/**
|
|
1955
|
+
* Update workspace settings
|
|
1956
|
+
*
|
|
1957
|
+
* Update workspace settings such as live agent configuration, description, and special instructions.
|
|
1958
|
+
*/
|
|
1959
|
+
const updateWorkspaceSettings = (options) => (options.client ?? client).patch({
|
|
1960
|
+
security: [{
|
|
1961
|
+
scheme: "bearer",
|
|
1962
|
+
type: "http"
|
|
1963
|
+
}],
|
|
1964
|
+
url: "/workspace/{workspaceId}/settings",
|
|
1965
|
+
...options,
|
|
1966
|
+
headers: {
|
|
1967
|
+
"Content-Type": "application/json",
|
|
1968
|
+
...options.headers
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
/**
|
|
1972
|
+
* Get live agent connection status
|
|
1973
|
+
*/
|
|
1974
|
+
const getLiveAgentStatus = (options) => (options.client ?? client).get({
|
|
1975
|
+
security: [{
|
|
1976
|
+
scheme: "bearer",
|
|
1977
|
+
type: "http"
|
|
1978
|
+
}],
|
|
1979
|
+
url: "/workspace/{workspaceId}/live-agent/status",
|
|
1980
|
+
...options
|
|
1981
|
+
});
|
|
1982
|
+
/**
|
|
1983
|
+
* List Slack channels for live agent
|
|
1984
|
+
*/
|
|
1985
|
+
const listSlackChannels = (options) => (options.client ?? client).get({
|
|
1986
|
+
security: [{
|
|
1987
|
+
scheme: "bearer",
|
|
1988
|
+
type: "http"
|
|
1989
|
+
}],
|
|
1990
|
+
url: "/workspace/{workspaceId}/live-agent/slack/channels",
|
|
1991
|
+
...options
|
|
1992
|
+
});
|
|
1993
|
+
/**
|
|
1994
|
+
* Get chat widget configuration
|
|
1995
|
+
*/
|
|
1996
|
+
const getChatWidgetConfig = (options) => (options.client ?? client).get({
|
|
1997
|
+
security: [{
|
|
1998
|
+
scheme: "bearer",
|
|
1999
|
+
type: "http"
|
|
2000
|
+
}],
|
|
2001
|
+
url: "/workspace/{workspaceId}/chat",
|
|
2002
|
+
...options
|
|
2003
|
+
});
|
|
2004
|
+
/**
|
|
2005
|
+
* Update chat widget configuration
|
|
2006
|
+
*/
|
|
2007
|
+
const updateChatWidgetConfig = (options) => (options.client ?? client).post({
|
|
2008
|
+
security: [{
|
|
2009
|
+
scheme: "bearer",
|
|
2010
|
+
type: "http"
|
|
2011
|
+
}],
|
|
2012
|
+
url: "/workspace/{workspaceId}/chat",
|
|
2013
|
+
...options,
|
|
2014
|
+
headers: {
|
|
2015
|
+
"Content-Type": "application/json",
|
|
2016
|
+
...options.headers
|
|
2017
|
+
}
|
|
2018
|
+
});
|
|
2019
|
+
/**
|
|
2020
|
+
* Get search widget configuration
|
|
2021
|
+
*/
|
|
2022
|
+
const getSearchWidgetConfig = (options) => (options.client ?? client).get({
|
|
2023
|
+
security: [{
|
|
2024
|
+
scheme: "bearer",
|
|
2025
|
+
type: "http"
|
|
2026
|
+
}],
|
|
2027
|
+
url: "/workspace/{workspaceId}/search",
|
|
2028
|
+
...options
|
|
2029
|
+
});
|
|
2030
|
+
/**
|
|
2031
|
+
* Update search widget configuration
|
|
2032
|
+
*/
|
|
2033
|
+
const updateSearchWidgetConfig = (options) => (options.client ?? client).post({
|
|
2034
|
+
security: [{
|
|
2035
|
+
scheme: "bearer",
|
|
2036
|
+
type: "http"
|
|
2037
|
+
}],
|
|
2038
|
+
url: "/workspace/{workspaceId}/search",
|
|
2039
|
+
...options,
|
|
2040
|
+
headers: {
|
|
2041
|
+
"Content-Type": "application/json",
|
|
2042
|
+
...options.headers
|
|
2043
|
+
}
|
|
2044
|
+
});
|
|
2045
|
+
/**
|
|
2046
|
+
* List custom domains
|
|
2047
|
+
*/
|
|
2048
|
+
const listCustomDomains = (options) => (options.client ?? client).get({
|
|
2049
|
+
security: [{
|
|
2050
|
+
scheme: "bearer",
|
|
2051
|
+
type: "http"
|
|
2052
|
+
}],
|
|
2053
|
+
url: "/workspace/{workspaceId}/custom-domain",
|
|
2054
|
+
...options
|
|
2055
|
+
});
|
|
2056
|
+
/**
|
|
2057
|
+
* Create a custom domain
|
|
2058
|
+
*
|
|
2059
|
+
* Register a custom domain (MCP server, API endpoints) for AI chat integration.
|
|
2060
|
+
*/
|
|
2061
|
+
const createCustomDomain = (options) => (options.client ?? client).post({
|
|
2062
|
+
security: [{
|
|
2063
|
+
scheme: "bearer",
|
|
2064
|
+
type: "http"
|
|
2065
|
+
}],
|
|
2066
|
+
url: "/workspace/{workspaceId}/custom-domain",
|
|
2067
|
+
...options,
|
|
2068
|
+
headers: {
|
|
2069
|
+
"Content-Type": "application/json",
|
|
2070
|
+
...options.headers
|
|
2071
|
+
}
|
|
2072
|
+
});
|
|
2073
|
+
/**
|
|
2074
|
+
* Delete a custom domain
|
|
2075
|
+
*
|
|
2076
|
+
* Remove a custom domain configuration from the workspace.
|
|
2077
|
+
*/
|
|
2078
|
+
const deleteCustomDomain = (options) => (options.client ?? client).delete({
|
|
2079
|
+
security: [{
|
|
2080
|
+
scheme: "bearer",
|
|
2081
|
+
type: "http"
|
|
2082
|
+
}],
|
|
2083
|
+
url: "/workspace/{workspaceId}/custom-domain/{domainId}",
|
|
2084
|
+
...options
|
|
2085
|
+
});
|
|
2086
|
+
/**
|
|
2087
|
+
* Update a custom domain
|
|
2088
|
+
*/
|
|
2089
|
+
const updateCustomDomain = (options) => (options.client ?? client).put({
|
|
2090
|
+
security: [{
|
|
2091
|
+
scheme: "bearer",
|
|
2092
|
+
type: "http"
|
|
2093
|
+
}],
|
|
2094
|
+
url: "/workspace/{workspaceId}/custom-domain/{domainId}",
|
|
2095
|
+
...options,
|
|
2096
|
+
headers: {
|
|
2097
|
+
"Content-Type": "application/json",
|
|
2098
|
+
...options.headers
|
|
2099
|
+
}
|
|
2100
|
+
});
|
|
2101
|
+
/**
|
|
2102
|
+
* Get error counts across all domains
|
|
2103
|
+
*/
|
|
2104
|
+
const getDomainErrorSummary = (options) => (options.client ?? client).get({
|
|
2105
|
+
security: [{
|
|
2106
|
+
scheme: "bearer",
|
|
2107
|
+
type: "http"
|
|
2108
|
+
}],
|
|
2109
|
+
url: "/workspace/{workspaceId}/custom-domain/error-summary",
|
|
2110
|
+
...options
|
|
2111
|
+
});
|
|
2112
|
+
/**
|
|
2113
|
+
* Clear error logs for a domain
|
|
2114
|
+
*/
|
|
2115
|
+
const clearDomainErrors = (options) => (options.client ?? client).delete({
|
|
2116
|
+
security: [{
|
|
2117
|
+
scheme: "bearer",
|
|
2118
|
+
type: "http"
|
|
2119
|
+
}],
|
|
2120
|
+
url: "/workspace/{workspaceId}/custom-domain/{domainId}/errors",
|
|
2121
|
+
...options
|
|
2122
|
+
});
|
|
2123
|
+
/**
|
|
2124
|
+
* Get error logs for a domain
|
|
2125
|
+
*/
|
|
2126
|
+
const getDomainErrors = (options) => (options.client ?? client).get({
|
|
2127
|
+
security: [{
|
|
2128
|
+
scheme: "bearer",
|
|
2129
|
+
type: "http"
|
|
2130
|
+
}],
|
|
2131
|
+
url: "/workspace/{workspaceId}/custom-domain/{domainId}/errors",
|
|
2132
|
+
...options
|
|
2133
|
+
});
|
|
2134
|
+
/**
|
|
2135
|
+
* Validate a custom domain configuration
|
|
2136
|
+
*/
|
|
2137
|
+
const validateCustomDomain = (options) => (options.client ?? client).post({
|
|
2138
|
+
security: [{
|
|
2139
|
+
scheme: "bearer",
|
|
2140
|
+
type: "http"
|
|
2141
|
+
}],
|
|
2142
|
+
url: "/workspace/{workspaceId}/custom-domain/validate",
|
|
2143
|
+
...options,
|
|
2144
|
+
headers: {
|
|
2145
|
+
"Content-Type": "application/json",
|
|
2146
|
+
...options.headers
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
/**
|
|
2150
|
+
* Test domain classification with sample queries
|
|
2151
|
+
*/
|
|
2152
|
+
const testDomainConnection = (options) => (options.client ?? client).post({
|
|
2153
|
+
security: [{
|
|
2154
|
+
scheme: "bearer",
|
|
2155
|
+
type: "http"
|
|
2156
|
+
}],
|
|
2157
|
+
url: "/workspace/{workspaceId}/test-connection",
|
|
2158
|
+
...options,
|
|
2159
|
+
headers: {
|
|
2160
|
+
"Content-Type": "application/json",
|
|
2161
|
+
...options.headers
|
|
2162
|
+
}
|
|
2163
|
+
});
|
|
2164
|
+
/**
|
|
2165
|
+
* Get workspace details
|
|
2166
|
+
*/
|
|
2167
|
+
const getWorkspaceDetails = (options) => (options.client ?? client).get({
|
|
2168
|
+
security: [{
|
|
2169
|
+
scheme: "bearer",
|
|
2170
|
+
type: "http"
|
|
2171
|
+
}],
|
|
2172
|
+
url: "/workspace/{workspaceId}/details",
|
|
2173
|
+
...options
|
|
2174
|
+
});
|
|
2175
|
+
/**
|
|
2176
|
+
* Discover available tools from MCP servers
|
|
2177
|
+
*/
|
|
2178
|
+
const discoverTools = (options) => (options.client ?? client).post({
|
|
2179
|
+
security: [{
|
|
2180
|
+
scheme: "bearer",
|
|
2181
|
+
type: "http"
|
|
2182
|
+
}],
|
|
2183
|
+
url: "/workspace/{workspaceId}/discover-tools",
|
|
2184
|
+
...options,
|
|
2185
|
+
headers: {
|
|
2186
|
+
"Content-Type": "application/json",
|
|
2187
|
+
...options.headers
|
|
2188
|
+
}
|
|
2189
|
+
});
|
|
2190
|
+
/**
|
|
2191
|
+
* AI-generate a custom domain configuration
|
|
2192
|
+
*/
|
|
2193
|
+
const generateDomainConfig = (options) => (options.client ?? client).post({
|
|
2194
|
+
security: [{
|
|
2195
|
+
scheme: "bearer",
|
|
2196
|
+
type: "http"
|
|
2197
|
+
}],
|
|
2198
|
+
url: "/workspace/{workspaceId}/custom-domain/generate",
|
|
2199
|
+
...options,
|
|
2200
|
+
headers: {
|
|
2201
|
+
"Content-Type": "application/json",
|
|
2202
|
+
...options.headers
|
|
2203
|
+
}
|
|
2204
|
+
});
|
|
2205
|
+
/**
|
|
2206
|
+
* Get available domain templates
|
|
2207
|
+
*/
|
|
2208
|
+
const getDomainTemplates = (options) => (options.client ?? client).get({
|
|
2209
|
+
security: [{
|
|
2210
|
+
scheme: "bearer",
|
|
2211
|
+
type: "http"
|
|
2212
|
+
}],
|
|
2213
|
+
url: "/workspace/{workspaceId}/templates",
|
|
2214
|
+
...options
|
|
2215
|
+
});
|
|
2216
|
+
/**
|
|
2217
|
+
* Deprovision a tenant or workspace
|
|
2218
|
+
*
|
|
2219
|
+
* Tear down a tenant or single workspace. Supports two auth modes: admin (set tenantId in the body to deprovision any tenant) or tenant self-deprovision (authenticate with the tenant API key; tenantId is derived from the auth context). Used by the Shopify app on app uninstall.
|
|
2220
|
+
*/
|
|
2221
|
+
const deprovision = (options) => (options?.client ?? client).post({
|
|
2222
|
+
security: [{
|
|
2223
|
+
scheme: "bearer",
|
|
2224
|
+
type: "http"
|
|
2225
|
+
}],
|
|
2226
|
+
url: "/provision/deprovision",
|
|
2227
|
+
...options,
|
|
2228
|
+
headers: {
|
|
2229
|
+
"Content-Type": "application/json",
|
|
2230
|
+
...options?.headers
|
|
2231
|
+
}
|
|
2232
|
+
});
|
|
2233
|
+
/**
|
|
2234
|
+
* List API keys
|
|
2235
|
+
*
|
|
2236
|
+
* List all API keys for the authenticated tenant.
|
|
2237
|
+
*/
|
|
2238
|
+
const listApiKeys = (options) => (options?.client ?? client).get({
|
|
2239
|
+
security: [{
|
|
2240
|
+
scheme: "bearer",
|
|
2241
|
+
type: "http"
|
|
2242
|
+
}],
|
|
2243
|
+
url: "/provision/keys",
|
|
2244
|
+
...options
|
|
2245
|
+
});
|
|
2246
|
+
/**
|
|
2247
|
+
* Create an API key
|
|
2248
|
+
*
|
|
2249
|
+
* Create a new API key for the authenticated tenant.
|
|
2250
|
+
*/
|
|
2251
|
+
const createApiKey = (options) => (options?.client ?? client).post({
|
|
2252
|
+
security: [{
|
|
2253
|
+
scheme: "bearer",
|
|
2254
|
+
type: "http"
|
|
2255
|
+
}],
|
|
2256
|
+
url: "/provision/keys",
|
|
2257
|
+
...options,
|
|
2258
|
+
headers: {
|
|
2259
|
+
"Content-Type": "application/json",
|
|
2260
|
+
...options?.headers
|
|
2261
|
+
}
|
|
2262
|
+
});
|
|
2263
|
+
/**
|
|
2264
|
+
* Revoke an API key
|
|
2265
|
+
*
|
|
2266
|
+
* Revoke an API key by ID.
|
|
2267
|
+
*/
|
|
2268
|
+
const revokeApiKey = (options) => (options.client ?? client).post({
|
|
2269
|
+
security: [{
|
|
2270
|
+
scheme: "bearer",
|
|
2271
|
+
type: "http"
|
|
2272
|
+
}],
|
|
2273
|
+
url: "/provision/keys/{keyId}/revoke",
|
|
2274
|
+
...options
|
|
2275
|
+
});
|
|
2276
|
+
/**
|
|
2277
|
+
* Rotate an API key
|
|
2278
|
+
*
|
|
2279
|
+
* Rotate an API key, generating a new key and revoking the old one.
|
|
2280
|
+
*/
|
|
2281
|
+
const rotateApiKey = (options) => (options.client ?? client).post({
|
|
2282
|
+
security: [{
|
|
2283
|
+
scheme: "bearer",
|
|
2284
|
+
type: "http"
|
|
2285
|
+
}],
|
|
2286
|
+
url: "/provision/keys/{keyId}/rotate",
|
|
2287
|
+
...options,
|
|
2288
|
+
headers: {
|
|
2289
|
+
"Content-Type": "application/json",
|
|
2290
|
+
...options.headers
|
|
2291
|
+
}
|
|
2292
|
+
});
|
|
2293
|
+
/**
|
|
2294
|
+
* Provision a Shopify tenant
|
|
2295
|
+
*
|
|
2296
|
+
* Called by the Savanto Shopify app after a merchant completes OAuth. Creates a new tenant + workspace, or reactivates and reissues keys if the shop was previously installed.
|
|
2297
|
+
*/
|
|
2298
|
+
const provisionShopify = (options) => (options?.client ?? client).post({
|
|
2299
|
+
security: [{
|
|
2300
|
+
scheme: "bearer",
|
|
2301
|
+
type: "http"
|
|
2302
|
+
}],
|
|
2303
|
+
url: "/provision/shopify",
|
|
2304
|
+
...options,
|
|
2305
|
+
headers: {
|
|
2306
|
+
"Content-Type": "application/json",
|
|
2307
|
+
...options?.headers
|
|
2308
|
+
}
|
|
2309
|
+
});
|
|
2310
|
+
/**
|
|
2311
|
+
* Delete a tenant and all associated data
|
|
2312
|
+
*/
|
|
2313
|
+
const adminDeleteTenant = (options) => (options.client ?? client).delete({
|
|
2314
|
+
security: [{
|
|
2315
|
+
scheme: "bearer",
|
|
2316
|
+
type: "http"
|
|
2317
|
+
}],
|
|
2318
|
+
url: "/admin/tenant/{tenantId}",
|
|
2319
|
+
...options
|
|
2320
|
+
});
|
|
2321
|
+
/**
|
|
2322
|
+
* Get tenant details
|
|
2323
|
+
*/
|
|
2324
|
+
const adminGetTenant = (options) => (options.client ?? client).get({
|
|
2325
|
+
security: [{
|
|
2326
|
+
scheme: "bearer",
|
|
2327
|
+
type: "http"
|
|
2328
|
+
}],
|
|
2329
|
+
url: "/admin/tenant/{tenantId}",
|
|
2330
|
+
...options
|
|
2331
|
+
});
|
|
2332
|
+
/**
|
|
2333
|
+
* Find unclaimed tenants by email
|
|
2334
|
+
*/
|
|
2335
|
+
const adminFindByEmail = (options) => (options.client ?? client).get({
|
|
2336
|
+
security: [{
|
|
2337
|
+
scheme: "bearer",
|
|
2338
|
+
type: "http"
|
|
2339
|
+
}],
|
|
2340
|
+
url: "/admin/tenant/by-email/{email}",
|
|
2341
|
+
...options
|
|
2342
|
+
});
|
|
2343
|
+
/**
|
|
2344
|
+
* Find tenants by owner ID
|
|
2345
|
+
*/
|
|
2346
|
+
const adminFindByOwner = (options) => (options.client ?? client).get({
|
|
2347
|
+
security: [{
|
|
2348
|
+
scheme: "bearer",
|
|
2349
|
+
type: "http"
|
|
2350
|
+
}],
|
|
2351
|
+
url: "/admin/tenant/by-owner/{ownerId}",
|
|
2352
|
+
...options
|
|
2353
|
+
});
|
|
2354
|
+
/**
|
|
2355
|
+
* Claim an unclaimed tenant
|
|
2356
|
+
*/
|
|
2357
|
+
const adminClaimTenant = (options) => (options.client ?? client).post({
|
|
2358
|
+
security: [{
|
|
2359
|
+
scheme: "bearer",
|
|
2360
|
+
type: "http"
|
|
2361
|
+
}],
|
|
2362
|
+
url: "/admin/tenant/{tenantId}/claim",
|
|
2363
|
+
...options,
|
|
2364
|
+
headers: {
|
|
2365
|
+
"Content-Type": "application/json",
|
|
2366
|
+
...options.headers
|
|
2367
|
+
}
|
|
2368
|
+
});
|
|
2369
|
+
/**
|
|
2370
|
+
* Update a tenant's owner email
|
|
2371
|
+
*/
|
|
2372
|
+
const adminUpdateOwnerEmail = (options) => (options.client ?? client).patch({
|
|
2373
|
+
security: [{
|
|
2374
|
+
scheme: "bearer",
|
|
2375
|
+
type: "http"
|
|
2376
|
+
}],
|
|
2377
|
+
url: "/admin/tenant/{tenantId}/owner-email",
|
|
2378
|
+
...options,
|
|
2379
|
+
headers: {
|
|
2380
|
+
"Content-Type": "application/json",
|
|
2381
|
+
...options.headers
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
2384
|
+
/**
|
|
2385
|
+
* Update a tenant's subscription
|
|
2386
|
+
*/
|
|
2387
|
+
const adminUpdateSubscription = (options) => (options.client ?? client).patch({
|
|
2388
|
+
security: [{
|
|
2389
|
+
scheme: "bearer",
|
|
2390
|
+
type: "http"
|
|
2391
|
+
}],
|
|
2392
|
+
url: "/admin/tenant/{tenantId}/subscription",
|
|
2393
|
+
...options,
|
|
2394
|
+
headers: {
|
|
2395
|
+
"Content-Type": "application/json",
|
|
2396
|
+
...options.headers
|
|
2397
|
+
}
|
|
2398
|
+
});
|
|
2399
|
+
/**
|
|
2400
|
+
* Reactivate a soft-deleted tenant
|
|
2401
|
+
*/
|
|
2402
|
+
const adminReactivateTenant = (options) => (options.client ?? client).post({
|
|
2403
|
+
security: [{
|
|
2404
|
+
scheme: "bearer",
|
|
2405
|
+
type: "http"
|
|
2406
|
+
}],
|
|
2407
|
+
url: "/admin/tenant/{tenantId}/reactivate",
|
|
2408
|
+
...options
|
|
2409
|
+
});
|
|
2410
|
+
/**
|
|
2411
|
+
* Get detailed usage for a tenant
|
|
2412
|
+
*/
|
|
2413
|
+
const adminGetUsage = (options) => (options.client ?? client).get({
|
|
2414
|
+
security: [{
|
|
2415
|
+
scheme: "bearer",
|
|
2416
|
+
type: "http"
|
|
2417
|
+
}],
|
|
2418
|
+
url: "/admin/tenant/{tenantId}/usage",
|
|
2419
|
+
...options
|
|
2420
|
+
});
|
|
2421
|
+
/**
|
|
2422
|
+
* Set usage metric values
|
|
2423
|
+
*/
|
|
2424
|
+
const adminUpdateUsage = (options) => (options.client ?? client).patch({
|
|
2425
|
+
security: [{
|
|
2426
|
+
scheme: "bearer",
|
|
2427
|
+
type: "http"
|
|
2428
|
+
}],
|
|
2429
|
+
url: "/admin/tenant/{tenantId}/usage",
|
|
2430
|
+
...options,
|
|
2431
|
+
headers: {
|
|
2432
|
+
"Content-Type": "application/json",
|
|
2433
|
+
...options.headers
|
|
2434
|
+
}
|
|
2435
|
+
});
|
|
2436
|
+
/**
|
|
2437
|
+
* Update a tenant's tier
|
|
2438
|
+
*/
|
|
2439
|
+
const adminUpdateTier = (options) => (options.client ?? client).patch({
|
|
2440
|
+
security: [{
|
|
2441
|
+
scheme: "bearer",
|
|
2442
|
+
type: "http"
|
|
2443
|
+
}],
|
|
2444
|
+
url: "/admin/tenant/{tenantId}/tier",
|
|
2445
|
+
...options,
|
|
2446
|
+
headers: {
|
|
2447
|
+
"Content-Type": "application/json",
|
|
2448
|
+
...options.headers
|
|
2449
|
+
}
|
|
2450
|
+
});
|
|
2451
|
+
/**
|
|
2452
|
+
* Reset a tenant's crawl records for the current month
|
|
2453
|
+
*/
|
|
2454
|
+
const adminResetCrawls = (options) => (options.client ?? client).post({
|
|
2455
|
+
security: [{
|
|
2456
|
+
scheme: "bearer",
|
|
2457
|
+
type: "http"
|
|
2458
|
+
}],
|
|
2459
|
+
url: "/admin/tenant/{tenantId}/crawls/reset",
|
|
2460
|
+
...options
|
|
2461
|
+
});
|
|
2462
|
+
|
|
2463
|
+
//#endregion
|
|
2464
|
+
//#region src/util.ts
|
|
2465
|
+
/**
|
|
2466
|
+
* Convert a URL or domain to a normalized workspace ID.
|
|
2467
|
+
*
|
|
2468
|
+
* @example
|
|
2469
|
+
* workspaceIdFromUrl('https://mystore.com') // 'mystore-com'
|
|
2470
|
+
* workspaceIdFromUrl('my-store.myshopify.com') // 'my-store-myshopify-com'
|
|
2471
|
+
* workspaceIdFromUrl('example.com/path') // 'example-com'
|
|
2472
|
+
*/
|
|
2473
|
+
function workspaceIdFromUrl(url) {
|
|
2474
|
+
if (!url) return "";
|
|
2475
|
+
try {
|
|
2476
|
+
return new URL(url.startsWith("http") ? url : `https://${url}`).hostname.replace(/\./g, "-").toLowerCase();
|
|
2477
|
+
} catch {
|
|
2478
|
+
return url.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/[^a-z0-9-]/gi, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").toLowerCase();
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
//#endregion
|
|
2483
|
+
export { adminClaimTenant, adminDeleteTenant, adminFindByEmail, adminFindByOwner, adminGetTenant, adminGetUsage, adminReactivateTenant, adminResetCrawls, adminUpdateOwnerEmail, adminUpdateSubscription, adminUpdateTier, adminUpdateUsage, bulkDeletePosts, bulkDeleteProducts, bulkDeletePrompts, bulkDeleteTaxonomies, bulkDeleteThreads, bulkUpdateWebhookStatus, bulkUpsertPosts, bulkUpsertProducts, bulkUpsertPrompts, bulkUpsertTaxonomies, cancelCrawl, chat, clearDomainErrors, client, commitSearch, createApiKey, createClient, createConfig, createCustomDomain, createTenantWorkspace, createWebhook, deleteCredentials, deleteCustomDomain, deleteFeedback, deleteLiveAgentSchedule, deleteMcpConfig, deletePost, deletePostsByQuery, deleteProduct, deleteProductsByQuery, deletePrompt, deleteTaxonomiesByQuery, deleteTaxonomy, deleteTenant, deleteThread, deleteWebhook, deleteWorkspace, deprovision, discoverTools, endHandoff, exportThreads, generateDomainConfig, getAnalyticsFeedback, getChatAnalytics, getChatWidgetConfig, getCrawlConfig, getCrawlHistory, getCrawlStatus, getCredentialStatus, getDomainErrorSummary, getDomainErrors, getDomainTemplates, getFeedbackAnalytics, getKnowledge, getLiveAgentSchedule, getLiveAgentStatus, getMcpConfig, getPost, getProduct, getProductRecommendations, getPrompt, getSearchAnalytics, getSearchWidgetConfig, getTaxonomy, getTenantStatus, getTenantUsage, getTenantUsageHistory, getThread, getThreadAnalytics, getThreadFeedback, getThreadMessages, getUploadUrl, getWebhook, getWebhookStats, getWorkspaceDetails, getWorkspaceSettings, listApiKeys, listCustomDomains, listFeedback, listPostIds, listProductIds, listProducts, listPrompts, listSlackChannels, listTaxonomies, listTaxonomyIds, listTenantWorkspaces, listWebhooks, patchPost, patchProduct, provisionShopify, revokeApiKey, rotateApiKey, scrapePage, scrapeSinglePage, searchKnowledge, searchPosts, searchProducts, searchPrompts, searchSearches, searchThreads, startCrawl, storeCredentials, submitFeedback, testDomainConnection, testWebhook, updateChatWidgetConfig, updateCrawlConfig, updateCustomDomain, updateLiveAgentSchedule, updateMcpConfig, updateSearchWidgetConfig, updateTenantFeatures, updateWebhook, updateWorkspace, updateWorkspaceSettings, upsertPost, upsertProduct, upsertPrompt, upsertTaxonomy, validateCustomDomain, workspaceIdFromUrl };
|
|
2484
|
+
//# sourceMappingURL=index.mjs.map
|