v0-api 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # v0-api
2
+
3
+ Auto-generated, fully typed client for the [Vercel v0 API](https://v0.dev/docs/api).
4
+
5
+ ## Features
6
+
7
+ - **Fully typed** - every operation, parameter and response is generated from the official OpenAPI spec
8
+ - **Tree-shakable** - only the operations you import end up in your bundle
9
+ - **Runtime agnostic** - uses the global `fetch`, or bring your own implementation
10
+ - **Effect support** - optional [Effect](https://effect.website) bindings via `v0-api/effect`
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install v0-api
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ```ts
21
+ import { V0Api } from "v0-api";
22
+
23
+ const client = new V0Api({ token: process.env.V0_API_KEY ?? null });
24
+
25
+ const chats = await client.api.chats.chatsFind();
26
+ ```
27
+
28
+ Operations are grouped by tag: `client.api.<tag>.<operation>(params)`.
29
+
30
+ ### Custom fetch
31
+
32
+ ```ts
33
+ const client = new V0Api({
34
+ token: process.env.V0_API_KEY ?? null,
35
+ fetch: myFetchImplementation,
36
+ });
37
+ ```
38
+
39
+ ## Effect
40
+
41
+ The `effect` entrypoint exposes every operation as an `Effect`. It requires `effect` as a peer dependency.
42
+
43
+ ```ts
44
+ import { Effect } from "effect";
45
+ import { ApiService, makeApiLayer } from "v0-api/effect";
46
+
47
+ const program = ApiService.chats.chatsFind({});
48
+
49
+ await Effect.runPromise(
50
+ program.pipe(Effect.provide(makeApiLayer({ token: process.env.V0_API_KEY })))
51
+ );
52
+ ```
53
+
54
+ Errors are typed as `ApiError`, `NetworkError` and `ValidationError`.
55
+
56
+ ## Entrypoints
57
+
58
+ | Import | Contents |
59
+ | --- | --- |
60
+ | `v0-api` | client class, operations, schemas and types |
61
+ | `v0-api/components` | operations grouped by tag and by path |
62
+ | `v0-api/schemas` | Zod schemas for every operation |
63
+ | `v0-api/types` | TypeScript types for every operation |
64
+ | `v0-api/effect` | Effect bindings |
65
+
66
+ ## License
67
+
68
+ ISC
@@ -189,7 +189,7 @@ const resolveUrl = (url, queryParams = {})=>{
189
189
  }
190
190
  /**
191
191
  * @summary Fork Chat
192
- * @description Creates a new chat fork (duplicate) from a specific version within an existing chat. Useful for branching off alternate directions without modifying the original conversation.
192
+ * @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.
193
193
  * @link /chats/{chatId}/fork
194
194
  */ async function chatsFork({ pathParams, config } = {}) {
195
195
  const { client: request = client, ...requestConfig } = config ?? {};
@@ -1226,7 +1226,7 @@ const operationsByPath = {
1226
1226
  "POST /mcp-servers/{mcpServerId}/oauth/authorize": mcpServersCreateOAuthAuthorizationUrl
1227
1227
  };
1228
1228
  const operationsByTag = {
1229
- "chats": {
1229
+ chats: {
1230
1230
  chatsCreate,
1231
1231
  chatsFind,
1232
1232
  chatsInit,
@@ -1248,7 +1248,7 @@ const operationsByTag = {
1248
1248
  chatsResolveTask,
1249
1249
  chatsRestore
1250
1250
  },
1251
- "projects": {
1251
+ projects: {
1252
1252
  projectsGetByChatId,
1253
1253
  projectsFind,
1254
1254
  projectsCreate,
@@ -1262,7 +1262,7 @@ const operationsByTag = {
1262
1262
  projectsDeleteEnvVars,
1263
1263
  projectsGetEnvVar
1264
1264
  },
1265
- "deployments": {
1265
+ deployments: {
1266
1266
  deploymentsFind,
1267
1267
  deploymentsCreate,
1268
1268
  deploymentsGetById,
@@ -1270,32 +1270,32 @@ const operationsByTag = {
1270
1270
  deploymentsFindLogs,
1271
1271
  deploymentsFindErrors
1272
1272
  },
1273
- "hooks": {
1273
+ hooks: {
1274
1274
  hooksFind,
1275
1275
  hooksCreate,
1276
1276
  hooksGetById,
1277
1277
  hooksUpdate,
1278
1278
  hooksDelete
1279
1279
  },
1280
- "integrations": {
1280
+ integrations: {
1281
1281
  integrationsVercelProjectsFind,
1282
1282
  integrationsVercelProjectsCreate
1283
1283
  },
1284
- "ratelimits": {
1284
+ ratelimits: {
1285
1285
  rateLimitsFind
1286
1286
  },
1287
- "user": {
1287
+ user: {
1288
1288
  userGet,
1289
1289
  userGetBilling,
1290
1290
  userGetPlan,
1291
1291
  userGetScopes
1292
1292
  },
1293
- "reports": {
1293
+ reports: {
1294
1294
  reportsGetUsage,
1295
1295
  reportsGetAIUsage,
1296
1296
  reportsGetUserActivity
1297
1297
  },
1298
- "mcpservers": {
1298
+ mcpservers: {
1299
1299
  mcpServersFind,
1300
1300
  mcpServersCreate,
1301
1301
  mcpServersGetById,
@@ -1305,8 +1305,8 @@ const operationsByTag = {
1305
1305
  }
1306
1306
  };
1307
1307
  const tagDictionary = {
1308
- "chats": {
1309
- "POST": [
1308
+ chats: {
1309
+ POST: [
1310
1310
  "chatsCreate",
1311
1311
  "chatsInit",
1312
1312
  "chatsFork",
@@ -1317,7 +1317,7 @@ const tagDictionary = {
1317
1317
  "chatsResolveTask",
1318
1318
  "chatsRestore"
1319
1319
  ],
1320
- "GET": [
1320
+ GET: [
1321
1321
  "chatsFind",
1322
1322
  "chatsGetById",
1323
1323
  "chatsFindMessages",
@@ -1326,109 +1326,109 @@ const tagDictionary = {
1326
1326
  "chatsGetVersion",
1327
1327
  "chatsDownloadVersion"
1328
1328
  ],
1329
- "DELETE": [
1329
+ DELETE: [
1330
1330
  "chatsDelete"
1331
1331
  ],
1332
- "PATCH": [
1332
+ PATCH: [
1333
1333
  "chatsUpdate",
1334
1334
  "chatsUpdateVersion"
1335
1335
  ],
1336
- "PUT": [
1336
+ PUT: [
1337
1337
  "chatsFavorite"
1338
1338
  ]
1339
1339
  },
1340
- "projects": {
1341
- "GET": [
1340
+ projects: {
1341
+ GET: [
1342
1342
  "projectsGetByChatId",
1343
1343
  "projectsFind",
1344
1344
  "projectsGetById",
1345
1345
  "projectsFindEnvVars",
1346
1346
  "projectsGetEnvVar"
1347
1347
  ],
1348
- "POST": [
1348
+ POST: [
1349
1349
  "projectsCreate",
1350
1350
  "projectsAssign",
1351
1351
  "projectsCreateEnvVars",
1352
1352
  "projectsDeleteEnvVars"
1353
1353
  ],
1354
- "PATCH": [
1354
+ PATCH: [
1355
1355
  "projectsUpdate",
1356
1356
  "projectsUpdateEnvVars"
1357
1357
  ],
1358
- "DELETE": [
1358
+ DELETE: [
1359
1359
  "projectsDelete"
1360
1360
  ]
1361
1361
  },
1362
- "deployments": {
1363
- "GET": [
1362
+ deployments: {
1363
+ GET: [
1364
1364
  "deploymentsFind",
1365
1365
  "deploymentsGetById",
1366
1366
  "deploymentsFindLogs",
1367
1367
  "deploymentsFindErrors"
1368
1368
  ],
1369
- "POST": [
1369
+ POST: [
1370
1370
  "deploymentsCreate"
1371
1371
  ],
1372
- "DELETE": [
1372
+ DELETE: [
1373
1373
  "deploymentsDelete"
1374
1374
  ]
1375
1375
  },
1376
- "hooks": {
1377
- "GET": [
1376
+ hooks: {
1377
+ GET: [
1378
1378
  "hooksFind",
1379
1379
  "hooksGetById"
1380
1380
  ],
1381
- "POST": [
1381
+ POST: [
1382
1382
  "hooksCreate"
1383
1383
  ],
1384
- "PATCH": [
1384
+ PATCH: [
1385
1385
  "hooksUpdate"
1386
1386
  ],
1387
- "DELETE": [
1387
+ DELETE: [
1388
1388
  "hooksDelete"
1389
1389
  ]
1390
1390
  },
1391
- "integrations": {
1392
- "GET": [
1391
+ integrations: {
1392
+ GET: [
1393
1393
  "integrationsVercelProjectsFind"
1394
1394
  ],
1395
- "POST": [
1395
+ POST: [
1396
1396
  "integrationsVercelProjectsCreate"
1397
1397
  ]
1398
1398
  },
1399
- "ratelimits": {
1400
- "GET": [
1399
+ ratelimits: {
1400
+ GET: [
1401
1401
  "rateLimitsFind"
1402
1402
  ]
1403
1403
  },
1404
- "user": {
1405
- "GET": [
1404
+ user: {
1405
+ GET: [
1406
1406
  "userGet",
1407
1407
  "userGetBilling",
1408
1408
  "userGetPlan",
1409
1409
  "userGetScopes"
1410
1410
  ]
1411
1411
  },
1412
- "reports": {
1413
- "GET": [
1412
+ reports: {
1413
+ GET: [
1414
1414
  "reportsGetUsage",
1415
1415
  "reportsGetAIUsage",
1416
1416
  "reportsGetUserActivity"
1417
1417
  ]
1418
1418
  },
1419
- "mcpservers": {
1420
- "GET": [
1419
+ mcpservers: {
1420
+ GET: [
1421
1421
  "mcpServersFind",
1422
1422
  "mcpServersGetById"
1423
1423
  ],
1424
- "POST": [
1424
+ POST: [
1425
1425
  "mcpServersCreate",
1426
1426
  "mcpServersCreateOAuthAuthorizationUrl"
1427
1427
  ],
1428
- "PATCH": [
1428
+ PATCH: [
1429
1429
  "mcpServersUpdate"
1430
1430
  ],
1431
- "DELETE": [
1431
+ DELETE: [
1432
1432
  "mcpServersDelete"
1433
1433
  ]
1434
1434
  }