v0-api 0.3.0 → 1.0.16

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.
Files changed (43) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +13 -3
  3. package/dist/{components-eb0j7zgr.d.ts → components-lojiycjm.d.ts} +165 -284
  4. package/dist/components-lojiycjm.d.ts.map +1 -0
  5. package/dist/components-mcjsnuad.d.ts +894 -0
  6. package/dist/components-mcjsnuad.d.ts.map +1 -0
  7. package/dist/components.cjs +1567 -63
  8. package/dist/components.d.cts +1 -1
  9. package/dist/components.d.mts +1 -1
  10. package/dist/components.mjs +1509 -1
  11. package/dist/effect.cjs +131 -24
  12. package/dist/effect.d.cts +75 -5
  13. package/dist/effect.d.cts.map +1 -1
  14. package/dist/effect.d.mts +75 -5
  15. package/dist/effect.d.mts.map +1 -1
  16. package/dist/effect.mjs +125 -4
  17. package/dist/index.cjs +139 -23
  18. package/dist/index.d.cts +13 -8
  19. package/dist/index.d.cts.map +1 -1
  20. package/dist/index.d.mts +13 -8
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.d.ts +21676 -7155
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.mjs +30 -25
  25. package/dist/{schemas-i6n5csd3.cjs → schemas-eef01xgn.cjs} +2182 -768
  26. package/dist/schemas-kunw251r.js +3825 -0
  27. package/dist/schemas.cjs +78 -1
  28. package/dist/schemas.d.cts +13169 -788
  29. package/dist/schemas.d.cts.map +1 -1
  30. package/dist/schemas.d.mts +13169 -788
  31. package/dist/schemas.d.mts.map +1 -1
  32. package/dist/schemas.mjs +1 -1
  33. package/dist/types.cjs +249 -10
  34. package/dist/types.d.cts +2943 -686
  35. package/dist/types.d.cts.map +1 -1
  36. package/dist/types.d.mts +2943 -686
  37. package/dist/types.d.mts.map +1 -1
  38. package/dist/types.mjs +215 -10
  39. package/package.json +18 -15
  40. package/dist/components-da0zh5te.cjs +0 -1497
  41. package/dist/components-eb0j7zgr.d.ts.map +0 -1
  42. package/dist/components-ja14lgg1.js +0 -1435
  43. package/dist/schemas-o0oxolpj.js +0 -2488
@@ -1 +1,1509 @@
1
- export { b as chatsCreate, d as chatsDelete, e as chatsDeleteVersionFiles, f as chatsDownloadVersion, g as chatsFavorite, h as chatsFind, i as chatsFindMessages, j as chatsFindVersions, k as chatsFork, l as chatsGetById, m as chatsGetMessage, n as chatsGetVersion, p as chatsInit, q as chatsResolveTask, r as chatsRestore, s as chatsResume, u as chatsSendMessage, v as chatsStop, w as chatsUpdate, x as chatsUpdateVersion, y as deploymentsCreate, z as deploymentsDelete, A as deploymentsFind, B as deploymentsFindErrors, C as deploymentsFindLogs, D as deploymentsGetById, E as hooksCreate, F as hooksDelete, G as hooksFind, H as hooksGetById, I as hooksUpdate, J as integrationsVercelProjectsCreate, K as integrationsVercelProjectsFind, L as mcpServersCreate, M as mcpServersCreateOAuthAuthorizationUrl, N as mcpServersDelete, O as mcpServersFind, P as mcpServersGetById, Q as mcpServersUpdate, a as operationsByPath, o as operationsByTag, R as projectsAssign, S as projectsCreate, T as projectsCreateEnvVars, U as projectsDelete, V as projectsDeleteEnvVars, W as projectsFind, X as projectsFindEnvVars, Y as projectsGetByChatId, Z as projectsGetById, _ as projectsGetEnvVar, $ as projectsUpdate, a0 as projectsUpdateEnvVars, a1 as rateLimitsFind, a2 as reportsGetAIUsage, a3 as reportsGetUsage, a4 as reportsGetUserActivity, t as tagDictionary, a5 as userGet, a6 as userGetBilling, a7 as userGetPlan, a8 as userGetScopes } from './components-ja14lgg1.js';
1
+ function notEmpty(value) {
2
+ return value !== null && value !== undefined;
3
+ }
4
+ function compactObject(obj) {
5
+ return Object.fromEntries(Object.entries(obj).filter(([, value])=>notEmpty(value)));
6
+ }
7
+
8
+ // The spec's server; the generated operations carry only the path.
9
+ const defaultBaseUrl = "https://api.v0.dev/v1";
10
+ const maxErrorBodyLength = 1000;
11
+ const binaryMediaTypes = new Set([
12
+ "application/gzip",
13
+ "application/octet-stream",
14
+ "application/pdf",
15
+ "application/vnd.tcpdump.pcap",
16
+ "application/wasm",
17
+ "application/x-gzip",
18
+ "application/x-tar",
19
+ "application/zip"
20
+ ]);
21
+ const isBinary = (contentType)=>{
22
+ const mediaType = contentType.split(";")[0]?.trim().toLowerCase() ?? "";
23
+ return binaryMediaTypes.has(mediaType) || /^(image|audio|video|font)\//.test(mediaType);
24
+ };
25
+ class ResponseError {
26
+ constructor(error){
27
+ this.error = error;
28
+ }
29
+ }
30
+ async function client({ url, method, body, headers, queryParams, signal, token = null, baseUrl = defaultBaseUrl, fetchImpl = fetch }) {
31
+ try {
32
+ const mergedHeaders = {
33
+ "Content-Type": "application/json",
34
+ Authorization: token ? `Bearer ${token}` : undefined
35
+ };
36
+ // Header names are case-insensitive: a caller's `authorization` replaces the default rather than joining it.
37
+ for (const [name, value] of Object.entries(headers ?? {})){
38
+ const known = Object.keys(mergedHeaders).find((key)=>key.toLowerCase() === name.toLowerCase());
39
+ mergedHeaders[known ?? name] = value;
40
+ }
41
+ const requestHeaders = compactObject(mergedHeaders);
42
+ /**
43
+ * As the fetch API is being used, when multipart/form-data is specified
44
+ * the Content-Type header must be deleted so that the browser can set
45
+ * the correct boundary.
46
+ * https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects#sending_files_using_a_formdata_object
47
+ */ if (requestHeaders["Content-Type"]?.toLowerCase().includes("multipart/form-data")) {
48
+ delete requestHeaders["Content-Type"];
49
+ }
50
+ const payload = body instanceof FormData ? body : requestHeaders["Content-Type"] === "application/json" ? JSON.stringify(body) : body;
51
+ // Every operation path starts with a slash, so one ending the base URL would send `//path`.
52
+ const fullUrl = `${baseUrl.replace(/\/+$/, "")}${resolveUrl(url, queryParams)}`;
53
+ const response = await fetchImpl(fullUrl, {
54
+ signal,
55
+ method: method.toUpperCase(),
56
+ body: payload,
57
+ headers: requestHeaders
58
+ });
59
+ if (!response.ok) {
60
+ const text = await response.text();
61
+ let payload;
62
+ try {
63
+ payload = JSON.parse(text);
64
+ } catch {
65
+ payload = text.slice(0, maxErrorBodyLength);
66
+ }
67
+ throw new ResponseError({
68
+ status: response.status,
69
+ payload
70
+ });
71
+ }
72
+ const contentType = response.headers?.get("content-type") ?? "";
73
+ // Decoding a zip, an image or other bytes as UTF-8 text would corrupt them.
74
+ if (response.blob && isBinary(contentType)) {
75
+ const blob = await response.blob();
76
+ if (!blob.size) return undefined;
77
+ return blob;
78
+ }
79
+ // A 204 or an empty body (common on DELETE) has nothing to parse.
80
+ const text = await response.text();
81
+ if (!text) return undefined;
82
+ if (contentType.includes("json")) return JSON.parse(text);
83
+ return text;
84
+ } catch (e) {
85
+ // Rethrown as is so the HTTP status survives; the Effect bindings map it to ApiError.
86
+ if (e instanceof ResponseError) throw e.error;
87
+ // A cancelled call rejects with the signal's reason as is, such as the TimeoutError of AbortSignal.timeout().
88
+ if (signal?.aborted || e instanceof Error && e.name === "AbortError") throw e;
89
+ const reason = e instanceof Error ? e.message : String(e);
90
+ // Only the path: query values can carry secrets.
91
+ throw new Error(`${method.toUpperCase()} ${url.split("?")[0]} failed: ${reason}`, {
92
+ cause: e
93
+ });
94
+ }
95
+ }
96
+ const resolveUrl = (url, queryParams = {})=>{
97
+ const search = new URLSearchParams();
98
+ for (const [key, value] of Object.entries(queryParams ?? {})){
99
+ if (value === undefined || value === null) continue;
100
+ if (Array.isArray(value)) {
101
+ for (const item of value)search.append(key, String(item));
102
+ } else if (typeof value === "object") {
103
+ // The spec's only object parameter, `metadata` on `GET /chats`, is `style: deepObject`.
104
+ for (const [name, item] of Object.entries(value)){
105
+ if (item !== undefined && item !== null) search.append(`${key}[${name}]`, String(item));
106
+ }
107
+ } else {
108
+ search.append(key, String(value));
109
+ }
110
+ }
111
+ const query = search.toString() ? `?${search.toString()}` : "";
112
+ return url + query;
113
+ };
114
+
115
+ /**
116
+ * @summary Create Chat
117
+ * @description Creates a new chat using a user message, optional system context, and model configuration. Useful for prompting the model within the scope of a specific project.
118
+ * @link /chats
119
+ */ async function chatsCreate({ body, config } = {}) {
120
+ const { client: request = client, ...requestConfig } = config ?? {};
121
+ const data = await request({
122
+ method: "POST",
123
+ url: `/chats`,
124
+ body: body,
125
+ ...requestConfig,
126
+ headers: {
127
+ ...requestConfig.headers
128
+ }
129
+ });
130
+ return data;
131
+ }
132
+ /**
133
+ * @summary Find Chats
134
+ * @description Retrieves a list of existing chats, with support for pagination and filtering by favorite status, Vercel project, or Git branch. Helps manage and navigate chat history.
135
+ * @link /chats
136
+ */ async function chatsFind({ queryParams, config } = {}) {
137
+ const { client: request = client, ...requestConfig } = config ?? {};
138
+ const data = await request({
139
+ method: "GET",
140
+ url: `/chats`,
141
+ queryParams,
142
+ ...requestConfig,
143
+ headers: {
144
+ ...requestConfig.headers
145
+ }
146
+ });
147
+ return data;
148
+ }
149
+ /**
150
+ * @summary Initialize Chat
151
+ * @description Initializes a new chat from source content such as files, repositories, registries, or zip archives. Enables context-rich conversations based on code or assets.
152
+ * @link /chats/init
153
+ */ async function chatsInit({ body, config } = {}) {
154
+ const { client: request = client, ...requestConfig } = config ?? {};
155
+ const data = await request({
156
+ method: "POST",
157
+ url: `/chats/init`,
158
+ body: body,
159
+ ...requestConfig,
160
+ headers: {
161
+ ...requestConfig.headers
162
+ }
163
+ });
164
+ return data;
165
+ }
166
+ /**
167
+ * @summary Delete Chat
168
+ * @description Deletes a specific chat based on the provided chatId. The chat and its contents are moved to trash and stop being retrievable immediately, then retained for 30 days before being permanently removed.
169
+ * @link /chats/{chatId}
170
+ */ async function chatsDelete({ pathParams, config } = {}) {
171
+ const { client: request = client, ...requestConfig } = config ?? {};
172
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
173
+ throw new Error(`Missing required path parameter: chatId`);
174
+ }
175
+ const data = await request({
176
+ method: "DELETE",
177
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}`,
178
+ ...requestConfig,
179
+ headers: {
180
+ ...requestConfig.headers
181
+ }
182
+ });
183
+ return data;
184
+ }
185
+ /**
186
+ * @summary Get Chat
187
+ * @description Retrieves the full details of a specific chat using its `chatId`. Includes messages, metadata, and associated configuration.
188
+ * @link /chats/{chatId}
189
+ */ async function chatsGetById({ pathParams, config } = {}) {
190
+ const { client: request = client, ...requestConfig } = config ?? {};
191
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
192
+ throw new Error(`Missing required path parameter: chatId`);
193
+ }
194
+ const data = await request({
195
+ method: "GET",
196
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}`,
197
+ ...requestConfig,
198
+ headers: {
199
+ ...requestConfig.headers
200
+ }
201
+ });
202
+ return data;
203
+ }
204
+ /**
205
+ * @summary Update Chat
206
+ * @description Updates the metadata of an existing chat using its `chatId`. Supports changes to the chat name and privacy setting.
207
+ * @link /chats/{chatId}
208
+ */ async function chatsUpdate({ pathParams, body, config } = {}) {
209
+ const { client: request = client, ...requestConfig } = config ?? {};
210
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
211
+ throw new Error(`Missing required path parameter: chatId`);
212
+ }
213
+ const data = await request({
214
+ method: "PATCH",
215
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}`,
216
+ body: body,
217
+ ...requestConfig,
218
+ headers: {
219
+ ...requestConfig.headers
220
+ }
221
+ });
222
+ return data;
223
+ }
224
+ /**
225
+ * @summary Favorite Chat
226
+ * @description Marks or unmarks a chat as a favorite using its `chatId`. This helps with organizing and quickly accessing important chats.
227
+ * @link /chats/{chatId}/favorite
228
+ */ async function chatsFavorite({ pathParams, body, config } = {}) {
229
+ const { client: request = client, ...requestConfig } = config ?? {};
230
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
231
+ throw new Error(`Missing required path parameter: chatId`);
232
+ }
233
+ const data = await request({
234
+ method: "PUT",
235
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/favorite`,
236
+ body: body,
237
+ ...requestConfig,
238
+ headers: {
239
+ ...requestConfig.headers
240
+ }
241
+ });
242
+ return data;
243
+ }
244
+ /**
245
+ * @summary Fork Chat
246
+ * @description Creates a new chat fork (duplicate) from a specific version within a chat created through Platform API v1. To duplicate chats created in v0 web or Platform API v2, use POST /v2/chats/{chatId}/duplicate.
247
+ * @link /chats/{chatId}/fork
248
+ */ async function chatsFork({ pathParams, body, config } = {}) {
249
+ const { client: request = client, ...requestConfig } = config ?? {};
250
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
251
+ throw new Error(`Missing required path parameter: chatId`);
252
+ }
253
+ const data = await request({
254
+ method: "POST",
255
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/fork`,
256
+ body: body,
257
+ ...requestConfig,
258
+ headers: {
259
+ ...requestConfig.headers
260
+ }
261
+ });
262
+ return data;
263
+ }
264
+ /**
265
+ * @summary Get Project by Chat ID
266
+ * @description Retrieves the v0 project associated with a given chat. Useful for determining the context or scope of a chat session.
267
+ * @link /chats/{chatId}/project
268
+ */ async function projectsGetByChatId({ pathParams, config } = {}) {
269
+ const { client: request = client, ...requestConfig } = config ?? {};
270
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
271
+ throw new Error(`Missing required path parameter: chatId`);
272
+ }
273
+ const data = await request({
274
+ method: "GET",
275
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/project`,
276
+ ...requestConfig,
277
+ headers: {
278
+ ...requestConfig.headers
279
+ }
280
+ });
281
+ return data;
282
+ }
283
+ /**
284
+ * @summary Find Chat Messages
285
+ * @description Retrieves a list of all messages for a specific chat, ordered by creation date (newest first). Supports cursor-based pagination and includes message content, role, and type information.
286
+ * @link /chats/{chatId}/messages
287
+ */ async function chatsFindMessages({ pathParams, queryParams, config } = {}) {
288
+ const { client: request = client, ...requestConfig } = config ?? {};
289
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
290
+ throw new Error(`Missing required path parameter: chatId`);
291
+ }
292
+ const data = await request({
293
+ method: "GET",
294
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/messages`,
295
+ queryParams,
296
+ ...requestConfig,
297
+ headers: {
298
+ ...requestConfig.headers
299
+ }
300
+ });
301
+ return data;
302
+ }
303
+ /**
304
+ * @summary Send Message
305
+ * @description Creates a new message in an existing chat. Triggers a model response using the provided prompt, with optional attachments and configuration settings.
306
+ * @link /chats/{chatId}/messages
307
+ */ async function chatsSendMessage({ pathParams, body, config } = {}) {
308
+ const { client: request = client, ...requestConfig } = config ?? {};
309
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
310
+ throw new Error(`Missing required path parameter: chatId`);
311
+ }
312
+ const data = await request({
313
+ method: "POST",
314
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/messages`,
315
+ body: body,
316
+ ...requestConfig,
317
+ headers: {
318
+ ...requestConfig.headers
319
+ }
320
+ });
321
+ return data;
322
+ }
323
+ /**
324
+ * @summary Get Chat Message
325
+ * @description Retrieves detailed information about a specific message within a chat, including content, files, model configuration, and demo URLs.
326
+ * @link /chats/{chatId}/messages/{messageId}
327
+ */ async function chatsGetMessage({ pathParams, config } = {}) {
328
+ const { client: request = client, ...requestConfig } = config ?? {};
329
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
330
+ throw new Error(`Missing required path parameter: chatId`);
331
+ }
332
+ if (pathParams?.messageId == null || String(pathParams.messageId) === "") {
333
+ throw new Error(`Missing required path parameter: messageId`);
334
+ }
335
+ const data = await request({
336
+ method: "GET",
337
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/messages/${encodeURIComponent(String(pathParams.messageId))}`,
338
+ ...requestConfig,
339
+ headers: {
340
+ ...requestConfig.headers
341
+ }
342
+ });
343
+ return data;
344
+ }
345
+ /**
346
+ * @summary Find Chat Versions
347
+ * @description Retrieves a list of all versions (iterations) for a specific chat, ordered by creation date (newest first). Supports cursor-based pagination and includes version status and demo URLs.
348
+ * @link /chats/{chatId}/versions
349
+ */ async function chatsFindVersions({ pathParams, queryParams, config } = {}) {
350
+ const { client: request = client, ...requestConfig } = config ?? {};
351
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
352
+ throw new Error(`Missing required path parameter: chatId`);
353
+ }
354
+ const data = await request({
355
+ method: "GET",
356
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/versions`,
357
+ queryParams,
358
+ ...requestConfig,
359
+ headers: {
360
+ ...requestConfig.headers
361
+ }
362
+ });
363
+ return data;
364
+ }
365
+ /**
366
+ * @summary Get Chat Version
367
+ * @description Retrieves detailed information about a specific version of a chat, including all files with their content and lock status.
368
+ * @link /chats/{chatId}/versions/{versionId}
369
+ */ async function chatsGetVersion({ pathParams, queryParams, config } = {}) {
370
+ const { client: request = client, ...requestConfig } = config ?? {};
371
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
372
+ throw new Error(`Missing required path parameter: chatId`);
373
+ }
374
+ if (pathParams?.versionId == null || String(pathParams.versionId) === "") {
375
+ throw new Error(`Missing required path parameter: versionId`);
376
+ }
377
+ const data = await request({
378
+ method: "GET",
379
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/versions/${encodeURIComponent(String(pathParams.versionId))}`,
380
+ queryParams,
381
+ ...requestConfig,
382
+ headers: {
383
+ ...requestConfig.headers
384
+ }
385
+ });
386
+ return data;
387
+ }
388
+ /**
389
+ * @summary Update Chat Version Files
390
+ * @description Updates the source files of a specific chat version (block) manually. This allows editing generated files directly through the API.
391
+ * @link /chats/{chatId}/versions/{versionId}
392
+ */ async function chatsUpdateVersion({ pathParams, body, config } = {}) {
393
+ const { client: request = client, ...requestConfig } = config ?? {};
394
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
395
+ throw new Error(`Missing required path parameter: chatId`);
396
+ }
397
+ if (pathParams?.versionId == null || String(pathParams.versionId) === "") {
398
+ throw new Error(`Missing required path parameter: versionId`);
399
+ }
400
+ const data = await request({
401
+ method: "PATCH",
402
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/versions/${encodeURIComponent(String(pathParams.versionId))}`,
403
+ body: body,
404
+ ...requestConfig,
405
+ headers: {
406
+ ...requestConfig.headers
407
+ }
408
+ });
409
+ return data;
410
+ }
411
+ /**
412
+ * @summary Download version files
413
+ * @description Download all files for a specific chat version as a zip or tarball archive. Use includeDefaultFiles=true to include all deployment files (package.json, configuration files, etc.) or false/omitted to return only the generated source files.
414
+ * @link /chats/{chatId}/versions/{versionId}/download
415
+ */ async function chatsDownloadVersion({ pathParams, queryParams, config } = {}) {
416
+ const { client: request = client, ...requestConfig } = config ?? {};
417
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
418
+ throw new Error(`Missing required path parameter: chatId`);
419
+ }
420
+ if (pathParams?.versionId == null || String(pathParams.versionId) === "") {
421
+ throw new Error(`Missing required path parameter: versionId`);
422
+ }
423
+ const data = await request({
424
+ method: "GET",
425
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/versions/${encodeURIComponent(String(pathParams.versionId))}/download`,
426
+ queryParams,
427
+ ...requestConfig,
428
+ headers: {
429
+ ...requestConfig.headers
430
+ }
431
+ });
432
+ return data;
433
+ }
434
+ /**
435
+ * @summary Delete Chat Version Files
436
+ * @description Deletes source files from a specific chat version (block). Files are removed from the version and a new source version is created.
437
+ * @link /chats/{chatId}/versions/{versionId}/files/delete
438
+ */ async function chatsDeleteVersionFiles({ pathParams, body, config } = {}) {
439
+ const { client: request = client, ...requestConfig } = config ?? {};
440
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
441
+ throw new Error(`Missing required path parameter: chatId`);
442
+ }
443
+ if (pathParams?.versionId == null || String(pathParams.versionId) === "") {
444
+ throw new Error(`Missing required path parameter: versionId`);
445
+ }
446
+ const data = await request({
447
+ method: "POST",
448
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/versions/${encodeURIComponent(String(pathParams.versionId))}/files/delete`,
449
+ body: body,
450
+ ...requestConfig,
451
+ headers: {
452
+ ...requestConfig.headers
453
+ }
454
+ });
455
+ return data;
456
+ }
457
+ /**
458
+ * @summary Resume Message
459
+ * @description Reconnects to an active assistant message stream and returns it as Server-Sent Events. This does not restart or continue a stopped generation.
460
+ * @link /chats/{chatId}/messages/{messageId}/resume
461
+ */ async function chatsResume({ pathParams, config } = {}) {
462
+ const { client: request = client, ...requestConfig } = config ?? {};
463
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
464
+ throw new Error(`Missing required path parameter: chatId`);
465
+ }
466
+ if (pathParams?.messageId == null || String(pathParams.messageId) === "") {
467
+ throw new Error(`Missing required path parameter: messageId`);
468
+ }
469
+ const data = await request({
470
+ method: "POST",
471
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/messages/${encodeURIComponent(String(pathParams.messageId))}/resume`,
472
+ ...requestConfig,
473
+ headers: {
474
+ ...requestConfig.headers
475
+ }
476
+ });
477
+ return data;
478
+ }
479
+ /**
480
+ * @summary Stop Message
481
+ * @description Stops an in-flight message generation in a chat. Useful for cancelling a streaming response that is still being generated.
482
+ * @link /chats/{chatId}/messages/{messageId}/stop
483
+ */ async function chatsStop({ pathParams, config } = {}) {
484
+ const { client: request = client, ...requestConfig } = config ?? {};
485
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
486
+ throw new Error(`Missing required path parameter: chatId`);
487
+ }
488
+ if (pathParams?.messageId == null || String(pathParams.messageId) === "") {
489
+ throw new Error(`Missing required path parameter: messageId`);
490
+ }
491
+ const data = await request({
492
+ method: "POST",
493
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/messages/${encodeURIComponent(String(pathParams.messageId))}/stop`,
494
+ ...requestConfig,
495
+ headers: {
496
+ ...requestConfig.headers
497
+ }
498
+ });
499
+ return data;
500
+ }
501
+ /**
502
+ * @summary Resolve Task
503
+ * @description Resolves a pending task in a chat, continuing the conversation. The latest message in the active chat fork must be an assistant message currently blocked on a matching task (integration setup, plan approval, question answers, or permission grants).
504
+ * @link /chats/{chatId}/tasks/resolve
505
+ */ async function chatsResolveTask({ pathParams, body, config } = {}) {
506
+ const { client: request = client, ...requestConfig } = config ?? {};
507
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
508
+ throw new Error(`Missing required path parameter: chatId`);
509
+ }
510
+ const data = await request({
511
+ method: "POST",
512
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/tasks/resolve`,
513
+ body: body,
514
+ ...requestConfig,
515
+ headers: {
516
+ ...requestConfig.headers
517
+ }
518
+ });
519
+ return data;
520
+ }
521
+ /**
522
+ * @summary Find Deployments
523
+ * @description Find deployments by project and chat IDs. This will return a list of deployments for the given project and chat IDs.
524
+ * @link /deployments
525
+ */ async function deploymentsFind({ queryParams, config } = {}) {
526
+ const { client: request = client, ...requestConfig } = config ?? {};
527
+ const data = await request({
528
+ method: "GET",
529
+ url: `/deployments`,
530
+ queryParams,
531
+ ...requestConfig,
532
+ headers: {
533
+ ...requestConfig.headers
534
+ }
535
+ });
536
+ return data;
537
+ }
538
+ /**
539
+ * @summary Create Deployment
540
+ * @description Create a new deployment for a specific chat and version. This will trigger a deployment to Vercel.
541
+ * @link /deployments
542
+ */ async function deploymentsCreate({ body, config } = {}) {
543
+ const { client: request = client, ...requestConfig } = config ?? {};
544
+ const data = await request({
545
+ method: "POST",
546
+ url: `/deployments`,
547
+ body: body,
548
+ ...requestConfig,
549
+ headers: {
550
+ ...requestConfig.headers
551
+ }
552
+ });
553
+ return data;
554
+ }
555
+ /**
556
+ * @summary Get Deployment
557
+ * @description Get a deployment by ID. This will return the details of the deployment, including the inspector URL, chat ID, project ID, version ID, API URL, and web URL.
558
+ * @link /deployments/{deploymentId}
559
+ */ async function deploymentsGetById({ pathParams, config } = {}) {
560
+ const { client: request = client, ...requestConfig } = config ?? {};
561
+ if (pathParams?.deploymentId == null || String(pathParams.deploymentId) === "") {
562
+ throw new Error(`Missing required path parameter: deploymentId`);
563
+ }
564
+ const data = await request({
565
+ method: "GET",
566
+ url: `/deployments/${encodeURIComponent(String(pathParams.deploymentId))}`,
567
+ ...requestConfig,
568
+ headers: {
569
+ ...requestConfig.headers
570
+ }
571
+ });
572
+ return data;
573
+ }
574
+ /**
575
+ * @summary Delete Deployment
576
+ * @description Delete a deployment by ID. This will delete the deployment from Vercel.
577
+ * @link /deployments/{deploymentId}
578
+ */ async function deploymentsDelete({ pathParams, config } = {}) {
579
+ const { client: request = client, ...requestConfig } = config ?? {};
580
+ if (pathParams?.deploymentId == null || String(pathParams.deploymentId) === "") {
581
+ throw new Error(`Missing required path parameter: deploymentId`);
582
+ }
583
+ const data = await request({
584
+ method: "DELETE",
585
+ url: `/deployments/${encodeURIComponent(String(pathParams.deploymentId))}`,
586
+ ...requestConfig,
587
+ headers: {
588
+ ...requestConfig.headers
589
+ }
590
+ });
591
+ return data;
592
+ }
593
+ /**
594
+ * @summary Find Deployment Logs
595
+ * @description Retrieves logs for a specific deployment. Supports filtering by timestamp to fetch only recent logs.
596
+ * @link /deployments/{deploymentId}/logs
597
+ */ async function deploymentsFindLogs({ pathParams, queryParams, config } = {}) {
598
+ const { client: request = client, ...requestConfig } = config ?? {};
599
+ if (pathParams?.deploymentId == null || String(pathParams.deploymentId) === "") {
600
+ throw new Error(`Missing required path parameter: deploymentId`);
601
+ }
602
+ const data = await request({
603
+ method: "GET",
604
+ url: `/deployments/${encodeURIComponent(String(pathParams.deploymentId))}/logs`,
605
+ queryParams,
606
+ ...requestConfig,
607
+ headers: {
608
+ ...requestConfig.headers
609
+ }
610
+ });
611
+ return data;
612
+ }
613
+ /**
614
+ * @summary Find Deployment Errors
615
+ * @description Retrieves a list of errors that occurred during a specific deployment. Useful for diagnosing and debugging deployment issues.
616
+ * @link /deployments/{deploymentId}/errors
617
+ */ async function deploymentsFindErrors({ pathParams, config } = {}) {
618
+ const { client: request = client, ...requestConfig } = config ?? {};
619
+ if (pathParams?.deploymentId == null || String(pathParams.deploymentId) === "") {
620
+ throw new Error(`Missing required path parameter: deploymentId`);
621
+ }
622
+ const data = await request({
623
+ method: "GET",
624
+ url: `/deployments/${encodeURIComponent(String(pathParams.deploymentId))}/errors`,
625
+ ...requestConfig,
626
+ headers: {
627
+ ...requestConfig.headers
628
+ }
629
+ });
630
+ return data;
631
+ }
632
+ /**
633
+ * @summary Find Hooks
634
+ * @description Retrieves a list of existing hooks in your workspace. Useful for managing active webhooks tied to chat events or deployments.
635
+ * @link /hooks
636
+ */ async function hooksFind({ config } = {}) {
637
+ const { client: request = client, ...requestConfig } = config ?? {};
638
+ const data = await request({
639
+ method: "GET",
640
+ url: `/hooks`,
641
+ ...requestConfig,
642
+ headers: {
643
+ ...requestConfig.headers
644
+ }
645
+ });
646
+ return data;
647
+ }
648
+ /**
649
+ * @summary Create Hook
650
+ * @description Creates a new webhook that listens for specific events. Supports optional association with a chat.
651
+ * @link /hooks
652
+ */ async function hooksCreate({ body, config } = {}) {
653
+ const { client: request = client, ...requestConfig } = config ?? {};
654
+ const data = await request({
655
+ method: "POST",
656
+ url: `/hooks`,
657
+ body: body,
658
+ ...requestConfig,
659
+ headers: {
660
+ ...requestConfig.headers
661
+ }
662
+ });
663
+ return data;
664
+ }
665
+ /**
666
+ * @summary Get Hook
667
+ * @description Retrieves the details of a specific webhook using its ID.
668
+ * @link /hooks/{hookId}
669
+ */ async function hooksGetById({ pathParams, config } = {}) {
670
+ const { client: request = client, ...requestConfig } = config ?? {};
671
+ if (pathParams?.hookId == null || String(pathParams.hookId) === "") {
672
+ throw new Error(`Missing required path parameter: hookId`);
673
+ }
674
+ const data = await request({
675
+ method: "GET",
676
+ url: `/hooks/${encodeURIComponent(String(pathParams.hookId))}`,
677
+ ...requestConfig,
678
+ headers: {
679
+ ...requestConfig.headers
680
+ }
681
+ });
682
+ return data;
683
+ }
684
+ /**
685
+ * @summary Update Hook
686
+ * @description Updates the configuration of an existing webhook, including its name, event subscriptions, or target URL.
687
+ * @link /hooks/{hookId}
688
+ */ async function hooksUpdate({ pathParams, body, config } = {}) {
689
+ const { client: request = client, ...requestConfig } = config ?? {};
690
+ if (pathParams?.hookId == null || String(pathParams.hookId) === "") {
691
+ throw new Error(`Missing required path parameter: hookId`);
692
+ }
693
+ const data = await request({
694
+ method: "PATCH",
695
+ url: `/hooks/${encodeURIComponent(String(pathParams.hookId))}`,
696
+ body: body,
697
+ ...requestConfig,
698
+ headers: {
699
+ ...requestConfig.headers
700
+ }
701
+ });
702
+ return data;
703
+ }
704
+ /**
705
+ * @summary Delete Hook
706
+ * @description Deletes a webhook based on its ID. This action is irreversible.
707
+ * @link /hooks/{hookId}
708
+ */ async function hooksDelete({ pathParams, config } = {}) {
709
+ const { client: request = client, ...requestConfig } = config ?? {};
710
+ if (pathParams?.hookId == null || String(pathParams.hookId) === "") {
711
+ throw new Error(`Missing required path parameter: hookId`);
712
+ }
713
+ const data = await request({
714
+ method: "DELETE",
715
+ url: `/hooks/${encodeURIComponent(String(pathParams.hookId))}`,
716
+ ...requestConfig,
717
+ headers: {
718
+ ...requestConfig.headers
719
+ }
720
+ });
721
+ return data;
722
+ }
723
+ /**
724
+ * @summary Find Vercel Projects
725
+ * @description Retrieves a list of Vercel projects linked to your integration. Useful for associating chats, deployments, or hooks with specific Vercel projects.
726
+ * @link /integrations/vercel/projects
727
+ */ async function integrationsVercelProjectsFind({ config } = {}) {
728
+ const { client: request = client, ...requestConfig } = config ?? {};
729
+ const data = await request({
730
+ method: "GET",
731
+ url: `/integrations/vercel/projects`,
732
+ ...requestConfig,
733
+ headers: {
734
+ ...requestConfig.headers
735
+ }
736
+ });
737
+ return data;
738
+ }
739
+ /**
740
+ * @summary Create Vercel Project
741
+ * @description Links a Vercel project to an existing v0 project. Enables Vercel-related features and deployment integration within the v0 workspace.
742
+ * @link /integrations/vercel/projects
743
+ */ async function integrationsVercelProjectsCreate({ body, config } = {}) {
744
+ const { client: request = client, ...requestConfig } = config ?? {};
745
+ const data = await request({
746
+ method: "POST",
747
+ url: `/integrations/vercel/projects`,
748
+ body: body,
749
+ ...requestConfig,
750
+ headers: {
751
+ ...requestConfig.headers
752
+ }
753
+ });
754
+ return data;
755
+ }
756
+ /**
757
+ * @summary Find Projects
758
+ * @description Returns a list of all v0 projects in your workspace. Useful for browsing or managing projects across different chats or use cases.
759
+ * @link /projects
760
+ */ async function projectsFind({ config } = {}) {
761
+ const { client: request = client, ...requestConfig } = config ?? {};
762
+ const data = await request({
763
+ method: "GET",
764
+ url: `/projects`,
765
+ ...requestConfig,
766
+ headers: {
767
+ ...requestConfig.headers
768
+ }
769
+ });
770
+ return data;
771
+ }
772
+ /**
773
+ * @summary Create Project
774
+ * @description Creates a new v0 project with an optional description, icon, environment variables, and instructions. Projects help organize chats and manage context.
775
+ * @link /projects
776
+ */ async function projectsCreate({ body, config } = {}) {
777
+ const { client: request = client, ...requestConfig } = config ?? {};
778
+ const data = await request({
779
+ method: "POST",
780
+ url: `/projects`,
781
+ body: body,
782
+ ...requestConfig,
783
+ headers: {
784
+ ...requestConfig.headers
785
+ }
786
+ });
787
+ return data;
788
+ }
789
+ /**
790
+ * @summary Get Project by ID
791
+ * @description Retrieves the details of a specific v0 project by its ID.
792
+ * @link /projects/{projectId}
793
+ */ async function projectsGetById({ pathParams, config } = {}) {
794
+ const { client: request = client, ...requestConfig } = config ?? {};
795
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
796
+ throw new Error(`Missing required path parameter: projectId`);
797
+ }
798
+ const data = await request({
799
+ method: "GET",
800
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}`,
801
+ ...requestConfig,
802
+ headers: {
803
+ ...requestConfig.headers
804
+ }
805
+ });
806
+ return data;
807
+ }
808
+ /**
809
+ * @summary Update Project
810
+ * @description Updates the metadata of an existing project using its `projectId`. Supports changes to the project name and privacy setting.
811
+ * @link /projects/{projectId}
812
+ */ async function projectsUpdate({ pathParams, body, config } = {}) {
813
+ const { client: request = client, ...requestConfig } = config ?? {};
814
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
815
+ throw new Error(`Missing required path parameter: projectId`);
816
+ }
817
+ const data = await request({
818
+ method: "PATCH",
819
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}`,
820
+ body: body,
821
+ ...requestConfig,
822
+ headers: {
823
+ ...requestConfig.headers
824
+ }
825
+ });
826
+ return data;
827
+ }
828
+ /**
829
+ * @summary Delete Project
830
+ * @description Deletes a specific project based on the provided projectId. This operation marks the project as deleted and is irreversible.
831
+ * @link /projects/{projectId}
832
+ */ async function projectsDelete({ pathParams, queryParams, config } = {}) {
833
+ const { client: request = client, ...requestConfig } = config ?? {};
834
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
835
+ throw new Error(`Missing required path parameter: projectId`);
836
+ }
837
+ const data = await request({
838
+ method: "DELETE",
839
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}`,
840
+ queryParams,
841
+ ...requestConfig,
842
+ headers: {
843
+ ...requestConfig.headers
844
+ }
845
+ });
846
+ return data;
847
+ }
848
+ /**
849
+ * @summary Assign Project to Chat
850
+ * @description Links an existing v0 project to a specific chat. Helps group conversations under a shared project context.
851
+ * @link /projects/{projectId}/assign
852
+ */ async function projectsAssign({ pathParams, body, config } = {}) {
853
+ const { client: request = client, ...requestConfig } = config ?? {};
854
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
855
+ throw new Error(`Missing required path parameter: projectId`);
856
+ }
857
+ const data = await request({
858
+ method: "POST",
859
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}/assign`,
860
+ body: body,
861
+ ...requestConfig,
862
+ headers: {
863
+ ...requestConfig.headers
864
+ }
865
+ });
866
+ return data;
867
+ }
868
+ /**
869
+ * @summary Find Environment Variables
870
+ * @description Retrieves all environment variables for a given project.
871
+ * @link /projects/{projectId}/env-vars
872
+ */ async function projectsFindEnvVars({ pathParams, queryParams, config } = {}) {
873
+ const { client: request = client, ...requestConfig } = config ?? {};
874
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
875
+ throw new Error(`Missing required path parameter: projectId`);
876
+ }
877
+ const data = await request({
878
+ method: "GET",
879
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}/env-vars`,
880
+ queryParams,
881
+ ...requestConfig,
882
+ headers: {
883
+ ...requestConfig.headers
884
+ }
885
+ });
886
+ return data;
887
+ }
888
+ /**
889
+ * @summary Create Environment Variables
890
+ * @description Creates new environment variables for a given project. This endpoint will fail if any of the specified environment variable keys already exist, unless upsert is set to true.
891
+ * @link /projects/{projectId}/env-vars
892
+ */ async function projectsCreateEnvVars({ pathParams, body, queryParams, config } = {}) {
893
+ const { client: request = client, ...requestConfig } = config ?? {};
894
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
895
+ throw new Error(`Missing required path parameter: projectId`);
896
+ }
897
+ const data = await request({
898
+ method: "POST",
899
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}/env-vars`,
900
+ queryParams,
901
+ body: body,
902
+ ...requestConfig,
903
+ headers: {
904
+ ...requestConfig.headers
905
+ }
906
+ });
907
+ return data;
908
+ }
909
+ /**
910
+ * @summary Update Environment Variables
911
+ * @description Updates multiple environment variables for a given project. Only the value of each environment variable can be updated.
912
+ * @link /projects/{projectId}/env-vars
913
+ */ async function projectsUpdateEnvVars({ pathParams, body, queryParams, config } = {}) {
914
+ const { client: request = client, ...requestConfig } = config ?? {};
915
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
916
+ throw new Error(`Missing required path parameter: projectId`);
917
+ }
918
+ const data = await request({
919
+ method: "PATCH",
920
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}/env-vars`,
921
+ queryParams,
922
+ body: body,
923
+ ...requestConfig,
924
+ headers: {
925
+ ...requestConfig.headers
926
+ }
927
+ });
928
+ return data;
929
+ }
930
+ /**
931
+ * @summary Delete Environment Variables
932
+ * @description Deletes multiple environment variables for a given project by their IDs.
933
+ * @link /projects/{projectId}/env-vars/delete
934
+ */ async function projectsDeleteEnvVars({ pathParams, body, config } = {}) {
935
+ const { client: request = client, ...requestConfig } = config ?? {};
936
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
937
+ throw new Error(`Missing required path parameter: projectId`);
938
+ }
939
+ const data = await request({
940
+ method: "POST",
941
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}/env-vars/delete`,
942
+ body: body,
943
+ ...requestConfig,
944
+ headers: {
945
+ ...requestConfig.headers
946
+ }
947
+ });
948
+ return data;
949
+ }
950
+ /**
951
+ * @summary Get Environment Variable
952
+ * @description Retrieves a specific environment variable for a given project by its ID, including its value.
953
+ * @link /projects/{projectId}/env-vars/{environmentVariableId}
954
+ */ async function projectsGetEnvVar({ pathParams, queryParams, config } = {}) {
955
+ const { client: request = client, ...requestConfig } = config ?? {};
956
+ if (pathParams?.projectId == null || String(pathParams.projectId) === "") {
957
+ throw new Error(`Missing required path parameter: projectId`);
958
+ }
959
+ if (pathParams?.environmentVariableId == null || String(pathParams.environmentVariableId) === "") {
960
+ throw new Error(`Missing required path parameter: environmentVariableId`);
961
+ }
962
+ const data = await request({
963
+ method: "GET",
964
+ url: `/projects/${encodeURIComponent(String(pathParams.projectId))}/env-vars/${encodeURIComponent(String(pathParams.environmentVariableId))}`,
965
+ queryParams,
966
+ ...requestConfig,
967
+ headers: {
968
+ ...requestConfig.headers
969
+ }
970
+ });
971
+ return data;
972
+ }
973
+ /**
974
+ * @summary Find Rate Limit
975
+ * @description Retrieves rate limit information for a given scope. Useful for monitoring usage limits and avoiding throttling.
976
+ * @link /rate-limits
977
+ */ async function rateLimitsFind({ queryParams, config } = {}) {
978
+ const { client: request = client, ...requestConfig } = config ?? {};
979
+ const data = await request({
980
+ method: "GET",
981
+ url: `/rate-limits`,
982
+ queryParams,
983
+ ...requestConfig,
984
+ headers: {
985
+ ...requestConfig.headers
986
+ }
987
+ });
988
+ return data;
989
+ }
990
+ /**
991
+ * @summary Get User
992
+ * @description Retrieves information about the authenticated user, including their ID, name, email, and account metadata.
993
+ * @link /user
994
+ */ async function userGet({ config } = {}) {
995
+ const { client: request = client, ...requestConfig } = config ?? {};
996
+ const data = await request({
997
+ method: "GET",
998
+ url: `/user`,
999
+ ...requestConfig,
1000
+ headers: {
1001
+ ...requestConfig.headers
1002
+ }
1003
+ });
1004
+ return data;
1005
+ }
1006
+ /**
1007
+ * @summary Get Billing
1008
+ * @description Fetches billing usage and quota information for the authenticated user. Can be scoped to a specific context (e.g. project or namespace).
1009
+ * @link /user/billing
1010
+ */ async function userGetBilling({ queryParams, config } = {}) {
1011
+ const { client: request = client, ...requestConfig } = config ?? {};
1012
+ const data = await request({
1013
+ method: "GET",
1014
+ url: `/user/billing`,
1015
+ queryParams,
1016
+ ...requestConfig,
1017
+ headers: {
1018
+ ...requestConfig.headers
1019
+ }
1020
+ });
1021
+ return data;
1022
+ }
1023
+ /**
1024
+ * @summary Get Plan
1025
+ * @description Returns the current subscription plan for the authenticated user, including tier details and feature limits.
1026
+ * @link /user/plan
1027
+ */ async function userGetPlan({ config } = {}) {
1028
+ const { client: request = client, ...requestConfig } = config ?? {};
1029
+ const data = await request({
1030
+ method: "GET",
1031
+ url: `/user/plan`,
1032
+ ...requestConfig,
1033
+ headers: {
1034
+ ...requestConfig.headers
1035
+ }
1036
+ });
1037
+ return data;
1038
+ }
1039
+ /**
1040
+ * @summary Get User Scopes
1041
+ * @description Retrieves all accessible scopes for the authenticated user, such as personal workspaces or shared teams.
1042
+ * @link /user/scopes
1043
+ */ async function userGetScopes({ config } = {}) {
1044
+ const { client: request = client, ...requestConfig } = config ?? {};
1045
+ const data = await request({
1046
+ method: "GET",
1047
+ url: `/user/scopes`,
1048
+ ...requestConfig,
1049
+ headers: {
1050
+ ...requestConfig.headers
1051
+ }
1052
+ });
1053
+ return data;
1054
+ }
1055
+ /**
1056
+ * @summary Restore Block
1057
+ * @description Restores a block to a specific version.
1058
+ * @link /chats/{chatId}/versions/{versionId}/restore
1059
+ */ async function chatsRestore({ pathParams, config } = {}) {
1060
+ const { client: request = client, ...requestConfig } = config ?? {};
1061
+ if (pathParams?.chatId == null || String(pathParams.chatId) === "") {
1062
+ throw new Error(`Missing required path parameter: chatId`);
1063
+ }
1064
+ if (pathParams?.versionId == null || String(pathParams.versionId) === "") {
1065
+ throw new Error(`Missing required path parameter: versionId`);
1066
+ }
1067
+ const data = await request({
1068
+ method: "POST",
1069
+ url: `/chats/${encodeURIComponent(String(pathParams.chatId))}/versions/${encodeURIComponent(String(pathParams.versionId))}/restore`,
1070
+ ...requestConfig,
1071
+ headers: {
1072
+ ...requestConfig.headers
1073
+ }
1074
+ });
1075
+ return data;
1076
+ }
1077
+ /**
1078
+ * @summary Get Usage Report
1079
+ * @description Retrieves detailed usage events for the authenticated user or team, including costs, event types, models used, and metadata. Shows the same data as displayed in the usage dashboard. Can be filtered by chatId to show usage for a specific chat, or by userId to show usage for a specific user.
1080
+ * @link /reports/usage
1081
+ */ async function reportsGetUsage({ queryParams, config } = {}) {
1082
+ const { client: request = client, ...requestConfig } = config ?? {};
1083
+ const data = await request({
1084
+ method: "GET",
1085
+ url: `/reports/usage`,
1086
+ queryParams,
1087
+ ...requestConfig,
1088
+ headers: {
1089
+ ...requestConfig.headers
1090
+ }
1091
+ });
1092
+ return data;
1093
+ }
1094
+ /**
1095
+ * @summary Get AI Usage Report
1096
+ * @description Retrieves v0 AI usage events for the authenticated user or active team scope.
1097
+ * @link /reports/usage/ai
1098
+ */ async function reportsGetAIUsage({ queryParams, config } = {}) {
1099
+ const { client: request = client, ...requestConfig } = config ?? {};
1100
+ const data = await request({
1101
+ method: "GET",
1102
+ url: `/reports/usage/ai`,
1103
+ queryParams,
1104
+ ...requestConfig,
1105
+ headers: {
1106
+ ...requestConfig.headers
1107
+ }
1108
+ });
1109
+ return data;
1110
+ }
1111
+ /**
1112
+ * @summary Get User Activity Report
1113
+ * @description Retrieves aggregated user activity data for team members, including chat counts, message counts, and activity timestamps. Only available for Enterprise teams with OWNER or BILLING role. Shows the same data as displayed in the Usage settings for Enterprise teams.
1114
+ * @link /reports/user-activity
1115
+ */ async function reportsGetUserActivity({ queryParams, config } = {}) {
1116
+ const { client: request = client, ...requestConfig } = config ?? {};
1117
+ const data = await request({
1118
+ method: "GET",
1119
+ url: `/reports/user-activity`,
1120
+ queryParams,
1121
+ ...requestConfig,
1122
+ headers: {
1123
+ ...requestConfig.headers
1124
+ }
1125
+ });
1126
+ return data;
1127
+ }
1128
+ /**
1129
+ * @summary List MCP Servers
1130
+ * @description Retrieves all MCP servers configured for the authenticated user.
1131
+ * @link /mcp-servers
1132
+ */ async function mcpServersFind({ config } = {}) {
1133
+ const { client: request = client, ...requestConfig } = config ?? {};
1134
+ const data = await request({
1135
+ method: "GET",
1136
+ url: `/mcp-servers`,
1137
+ ...requestConfig,
1138
+ headers: {
1139
+ ...requestConfig.headers
1140
+ }
1141
+ });
1142
+ return data;
1143
+ }
1144
+ /**
1145
+ * @summary Create MCP Server
1146
+ * @description Creates a new MCP server configuration for the authenticated user. Supports OAuth, bearer token, custom headers, and unauthenticated servers.
1147
+ * @link /mcp-servers
1148
+ */ async function mcpServersCreate({ body, config } = {}) {
1149
+ const { client: request = client, ...requestConfig } = config ?? {};
1150
+ const data = await request({
1151
+ method: "POST",
1152
+ url: `/mcp-servers`,
1153
+ body: body,
1154
+ ...requestConfig,
1155
+ headers: {
1156
+ ...requestConfig.headers
1157
+ }
1158
+ });
1159
+ return data;
1160
+ }
1161
+ /**
1162
+ * @summary Get MCP Server
1163
+ * @description Retrieves the details of a specific MCP server by its ID.
1164
+ * @link /mcp-servers/{mcpServerId}
1165
+ */ async function mcpServersGetById({ pathParams, config } = {}) {
1166
+ const { client: request = client, ...requestConfig } = config ?? {};
1167
+ if (pathParams?.mcpServerId == null || String(pathParams.mcpServerId) === "") {
1168
+ throw new Error(`Missing required path parameter: mcpServerId`);
1169
+ }
1170
+ const data = await request({
1171
+ method: "GET",
1172
+ url: `/mcp-servers/${encodeURIComponent(String(pathParams.mcpServerId))}`,
1173
+ ...requestConfig,
1174
+ headers: {
1175
+ ...requestConfig.headers
1176
+ }
1177
+ });
1178
+ return data;
1179
+ }
1180
+ /**
1181
+ * @summary Update MCP Server
1182
+ * @description Updates the configuration of an existing MCP server, including its name, URL, description, enabled status, and authentication settings.
1183
+ * @link /mcp-servers/{mcpServerId}
1184
+ */ async function mcpServersUpdate({ pathParams, body, config } = {}) {
1185
+ const { client: request = client, ...requestConfig } = config ?? {};
1186
+ if (pathParams?.mcpServerId == null || String(pathParams.mcpServerId) === "") {
1187
+ throw new Error(`Missing required path parameter: mcpServerId`);
1188
+ }
1189
+ const data = await request({
1190
+ method: "PATCH",
1191
+ url: `/mcp-servers/${encodeURIComponent(String(pathParams.mcpServerId))}`,
1192
+ body: body,
1193
+ ...requestConfig,
1194
+ headers: {
1195
+ ...requestConfig.headers
1196
+ }
1197
+ });
1198
+ return data;
1199
+ }
1200
+ /**
1201
+ * @summary Delete MCP Server
1202
+ * @description Deletes an MCP server based on its ID. This action is irreversible and will also remove any associated OAuth tokens.
1203
+ * @link /mcp-servers/{mcpServerId}
1204
+ */ async function mcpServersDelete({ pathParams, config } = {}) {
1205
+ const { client: request = client, ...requestConfig } = config ?? {};
1206
+ if (pathParams?.mcpServerId == null || String(pathParams.mcpServerId) === "") {
1207
+ throw new Error(`Missing required path parameter: mcpServerId`);
1208
+ }
1209
+ const data = await request({
1210
+ method: "DELETE",
1211
+ url: `/mcp-servers/${encodeURIComponent(String(pathParams.mcpServerId))}`,
1212
+ ...requestConfig,
1213
+ headers: {
1214
+ ...requestConfig.headers
1215
+ }
1216
+ });
1217
+ return data;
1218
+ }
1219
+ /**
1220
+ * @summary Create MCP Server OAuth Authorization URL
1221
+ * @description Creates an OAuth authorization URL for an OAuth MCP server. Redirect the user to the returned URL, and the Platform API OAuth callback will store the resulting tokens before redirecting to your returnUrl.
1222
+ * @link /mcp-servers/{mcpServerId}/oauth/authorize
1223
+ */ async function mcpServersCreateOAuthAuthorizationUrl({ pathParams, body, config } = {}) {
1224
+ const { client: request = client, ...requestConfig } = config ?? {};
1225
+ if (pathParams?.mcpServerId == null || String(pathParams.mcpServerId) === "") {
1226
+ throw new Error(`Missing required path parameter: mcpServerId`);
1227
+ }
1228
+ const data = await request({
1229
+ method: "POST",
1230
+ url: `/mcp-servers/${encodeURIComponent(String(pathParams.mcpServerId))}/oauth/authorize`,
1231
+ body: body,
1232
+ ...requestConfig,
1233
+ headers: {
1234
+ ...requestConfig.headers
1235
+ }
1236
+ });
1237
+ return data;
1238
+ }
1239
+ const operationsByPath = {
1240
+ "POST /chats": chatsCreate,
1241
+ "GET /chats": chatsFind,
1242
+ "POST /chats/init": chatsInit,
1243
+ "DELETE /chats/{chatId}": chatsDelete,
1244
+ "GET /chats/{chatId}": chatsGetById,
1245
+ "PATCH /chats/{chatId}": chatsUpdate,
1246
+ "PUT /chats/{chatId}/favorite": chatsFavorite,
1247
+ "POST /chats/{chatId}/fork": chatsFork,
1248
+ "GET /chats/{chatId}/project": projectsGetByChatId,
1249
+ "GET /chats/{chatId}/messages": chatsFindMessages,
1250
+ "POST /chats/{chatId}/messages": chatsSendMessage,
1251
+ "GET /chats/{chatId}/messages/{messageId}": chatsGetMessage,
1252
+ "GET /chats/{chatId}/versions": chatsFindVersions,
1253
+ "GET /chats/{chatId}/versions/{versionId}": chatsGetVersion,
1254
+ "PATCH /chats/{chatId}/versions/{versionId}": chatsUpdateVersion,
1255
+ "GET /chats/{chatId}/versions/{versionId}/download": chatsDownloadVersion,
1256
+ "POST /chats/{chatId}/versions/{versionId}/files/delete": chatsDeleteVersionFiles,
1257
+ "POST /chats/{chatId}/messages/{messageId}/resume": chatsResume,
1258
+ "POST /chats/{chatId}/messages/{messageId}/stop": chatsStop,
1259
+ "POST /chats/{chatId}/tasks/resolve": chatsResolveTask,
1260
+ "GET /deployments": deploymentsFind,
1261
+ "POST /deployments": deploymentsCreate,
1262
+ "GET /deployments/{deploymentId}": deploymentsGetById,
1263
+ "DELETE /deployments/{deploymentId}": deploymentsDelete,
1264
+ "GET /deployments/{deploymentId}/logs": deploymentsFindLogs,
1265
+ "GET /deployments/{deploymentId}/errors": deploymentsFindErrors,
1266
+ "GET /hooks": hooksFind,
1267
+ "POST /hooks": hooksCreate,
1268
+ "GET /hooks/{hookId}": hooksGetById,
1269
+ "PATCH /hooks/{hookId}": hooksUpdate,
1270
+ "DELETE /hooks/{hookId}": hooksDelete,
1271
+ "GET /integrations/vercel/projects": integrationsVercelProjectsFind,
1272
+ "POST /integrations/vercel/projects": integrationsVercelProjectsCreate,
1273
+ "GET /projects": projectsFind,
1274
+ "POST /projects": projectsCreate,
1275
+ "GET /projects/{projectId}": projectsGetById,
1276
+ "PATCH /projects/{projectId}": projectsUpdate,
1277
+ "DELETE /projects/{projectId}": projectsDelete,
1278
+ "POST /projects/{projectId}/assign": projectsAssign,
1279
+ "GET /projects/{projectId}/env-vars": projectsFindEnvVars,
1280
+ "POST /projects/{projectId}/env-vars": projectsCreateEnvVars,
1281
+ "PATCH /projects/{projectId}/env-vars": projectsUpdateEnvVars,
1282
+ "POST /projects/{projectId}/env-vars/delete": projectsDeleteEnvVars,
1283
+ "GET /projects/{projectId}/env-vars/{environmentVariableId}": projectsGetEnvVar,
1284
+ "GET /rate-limits": rateLimitsFind,
1285
+ "GET /user": userGet,
1286
+ "GET /user/billing": userGetBilling,
1287
+ "GET /user/plan": userGetPlan,
1288
+ "GET /user/scopes": userGetScopes,
1289
+ "POST /chats/{chatId}/versions/{versionId}/restore": chatsRestore,
1290
+ "GET /reports/usage": reportsGetUsage,
1291
+ "GET /reports/usage/ai": reportsGetAIUsage,
1292
+ "GET /reports/user-activity": reportsGetUserActivity,
1293
+ "GET /mcp-servers": mcpServersFind,
1294
+ "POST /mcp-servers": mcpServersCreate,
1295
+ "GET /mcp-servers/{mcpServerId}": mcpServersGetById,
1296
+ "PATCH /mcp-servers/{mcpServerId}": mcpServersUpdate,
1297
+ "DELETE /mcp-servers/{mcpServerId}": mcpServersDelete,
1298
+ "POST /mcp-servers/{mcpServerId}/oauth/authorize": mcpServersCreateOAuthAuthorizationUrl
1299
+ };
1300
+ const operationsByTag = {
1301
+ chats: {
1302
+ chatsCreate,
1303
+ chatsFind,
1304
+ chatsInit,
1305
+ chatsDelete,
1306
+ chatsGetById,
1307
+ chatsUpdate,
1308
+ chatsFavorite,
1309
+ chatsFork,
1310
+ chatsFindMessages,
1311
+ chatsSendMessage,
1312
+ chatsGetMessage,
1313
+ chatsFindVersions,
1314
+ chatsGetVersion,
1315
+ chatsUpdateVersion,
1316
+ chatsDownloadVersion,
1317
+ chatsDeleteVersionFiles,
1318
+ chatsResume,
1319
+ chatsStop,
1320
+ chatsResolveTask,
1321
+ chatsRestore
1322
+ },
1323
+ projects: {
1324
+ projectsGetByChatId,
1325
+ projectsFind,
1326
+ projectsCreate,
1327
+ projectsGetById,
1328
+ projectsUpdate,
1329
+ projectsDelete,
1330
+ projectsAssign,
1331
+ projectsFindEnvVars,
1332
+ projectsCreateEnvVars,
1333
+ projectsUpdateEnvVars,
1334
+ projectsDeleteEnvVars,
1335
+ projectsGetEnvVar
1336
+ },
1337
+ deployments: {
1338
+ deploymentsFind,
1339
+ deploymentsCreate,
1340
+ deploymentsGetById,
1341
+ deploymentsDelete,
1342
+ deploymentsFindLogs,
1343
+ deploymentsFindErrors
1344
+ },
1345
+ hooks: {
1346
+ hooksFind,
1347
+ hooksCreate,
1348
+ hooksGetById,
1349
+ hooksUpdate,
1350
+ hooksDelete
1351
+ },
1352
+ integrations: {
1353
+ integrationsVercelProjectsFind,
1354
+ integrationsVercelProjectsCreate
1355
+ },
1356
+ ratelimits: {
1357
+ rateLimitsFind
1358
+ },
1359
+ user: {
1360
+ userGet,
1361
+ userGetBilling,
1362
+ userGetPlan,
1363
+ userGetScopes
1364
+ },
1365
+ reports: {
1366
+ reportsGetUsage,
1367
+ reportsGetAIUsage,
1368
+ reportsGetUserActivity
1369
+ },
1370
+ mcpservers: {
1371
+ mcpServersFind,
1372
+ mcpServersCreate,
1373
+ mcpServersGetById,
1374
+ mcpServersUpdate,
1375
+ mcpServersDelete,
1376
+ mcpServersCreateOAuthAuthorizationUrl
1377
+ }
1378
+ };
1379
+ const tagDictionary = {
1380
+ chats: {
1381
+ POST: [
1382
+ "chatsCreate",
1383
+ "chatsInit",
1384
+ "chatsFork",
1385
+ "chatsSendMessage",
1386
+ "chatsDeleteVersionFiles",
1387
+ "chatsResume",
1388
+ "chatsStop",
1389
+ "chatsResolveTask",
1390
+ "chatsRestore"
1391
+ ],
1392
+ GET: [
1393
+ "chatsFind",
1394
+ "chatsGetById",
1395
+ "chatsFindMessages",
1396
+ "chatsGetMessage",
1397
+ "chatsFindVersions",
1398
+ "chatsGetVersion",
1399
+ "chatsDownloadVersion"
1400
+ ],
1401
+ DELETE: [
1402
+ "chatsDelete"
1403
+ ],
1404
+ PATCH: [
1405
+ "chatsUpdate",
1406
+ "chatsUpdateVersion"
1407
+ ],
1408
+ PUT: [
1409
+ "chatsFavorite"
1410
+ ]
1411
+ },
1412
+ projects: {
1413
+ GET: [
1414
+ "projectsGetByChatId",
1415
+ "projectsFind",
1416
+ "projectsGetById",
1417
+ "projectsFindEnvVars",
1418
+ "projectsGetEnvVar"
1419
+ ],
1420
+ POST: [
1421
+ "projectsCreate",
1422
+ "projectsAssign",
1423
+ "projectsCreateEnvVars",
1424
+ "projectsDeleteEnvVars"
1425
+ ],
1426
+ PATCH: [
1427
+ "projectsUpdate",
1428
+ "projectsUpdateEnvVars"
1429
+ ],
1430
+ DELETE: [
1431
+ "projectsDelete"
1432
+ ]
1433
+ },
1434
+ deployments: {
1435
+ GET: [
1436
+ "deploymentsFind",
1437
+ "deploymentsGetById",
1438
+ "deploymentsFindLogs",
1439
+ "deploymentsFindErrors"
1440
+ ],
1441
+ POST: [
1442
+ "deploymentsCreate"
1443
+ ],
1444
+ DELETE: [
1445
+ "deploymentsDelete"
1446
+ ]
1447
+ },
1448
+ hooks: {
1449
+ GET: [
1450
+ "hooksFind",
1451
+ "hooksGetById"
1452
+ ],
1453
+ POST: [
1454
+ "hooksCreate"
1455
+ ],
1456
+ PATCH: [
1457
+ "hooksUpdate"
1458
+ ],
1459
+ DELETE: [
1460
+ "hooksDelete"
1461
+ ]
1462
+ },
1463
+ integrations: {
1464
+ GET: [
1465
+ "integrationsVercelProjectsFind"
1466
+ ],
1467
+ POST: [
1468
+ "integrationsVercelProjectsCreate"
1469
+ ]
1470
+ },
1471
+ ratelimits: {
1472
+ GET: [
1473
+ "rateLimitsFind"
1474
+ ]
1475
+ },
1476
+ user: {
1477
+ GET: [
1478
+ "userGet",
1479
+ "userGetBilling",
1480
+ "userGetPlan",
1481
+ "userGetScopes"
1482
+ ]
1483
+ },
1484
+ reports: {
1485
+ GET: [
1486
+ "reportsGetUsage",
1487
+ "reportsGetAIUsage",
1488
+ "reportsGetUserActivity"
1489
+ ]
1490
+ },
1491
+ mcpservers: {
1492
+ GET: [
1493
+ "mcpServersFind",
1494
+ "mcpServersGetById"
1495
+ ],
1496
+ POST: [
1497
+ "mcpServersCreate",
1498
+ "mcpServersCreateOAuthAuthorizationUrl"
1499
+ ],
1500
+ PATCH: [
1501
+ "mcpServersUpdate"
1502
+ ],
1503
+ DELETE: [
1504
+ "mcpServersDelete"
1505
+ ]
1506
+ }
1507
+ };
1508
+
1509
+ export { chatsCreate, chatsDelete, chatsDeleteVersionFiles, chatsDownloadVersion, chatsFavorite, chatsFind, chatsFindMessages, chatsFindVersions, chatsFork, chatsGetById, chatsGetMessage, chatsGetVersion, chatsInit, chatsResolveTask, chatsRestore, chatsResume, chatsSendMessage, chatsStop, chatsUpdate, chatsUpdateVersion, deploymentsCreate, deploymentsDelete, deploymentsFind, deploymentsFindErrors, deploymentsFindLogs, deploymentsGetById, hooksCreate, hooksDelete, hooksFind, hooksGetById, hooksUpdate, integrationsVercelProjectsCreate, integrationsVercelProjectsFind, mcpServersCreate, mcpServersCreateOAuthAuthorizationUrl, mcpServersDelete, mcpServersFind, mcpServersGetById, mcpServersUpdate, operationsByPath, operationsByTag, projectsAssign, projectsCreate, projectsCreateEnvVars, projectsDelete, projectsDeleteEnvVars, projectsFind, projectsFindEnvVars, projectsGetByChatId, projectsGetById, projectsGetEnvVar, projectsUpdate, projectsUpdateEnvVars, rateLimitsFind, reportsGetAIUsage, reportsGetUsage, reportsGetUserActivity, tagDictionary, userGet, userGetBilling, userGetPlan, userGetScopes };