v0-sdk 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -15
- package/dist/index.d.ts +172 -52
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -60,6 +60,18 @@ function createClient(config = {}) {
|
|
|
60
60
|
} : {}
|
|
61
61
|
});
|
|
62
62
|
},
|
|
63
|
+
init: {
|
|
64
|
+
async create (params) {
|
|
65
|
+
const body = {
|
|
66
|
+
files: params.files,
|
|
67
|
+
chatPrivacy: params.chatPrivacy,
|
|
68
|
+
projectId: params.projectId
|
|
69
|
+
};
|
|
70
|
+
return fetcher(`/chats/init`, 'POST', {
|
|
71
|
+
body
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
},
|
|
63
75
|
async delete (params) {
|
|
64
76
|
const pathParams = {
|
|
65
77
|
chatId: params.chatId
|
|
@@ -112,7 +124,7 @@ function createClient(config = {}) {
|
|
|
112
124
|
body
|
|
113
125
|
});
|
|
114
126
|
},
|
|
115
|
-
async
|
|
127
|
+
async sendMessage (params) {
|
|
116
128
|
const pathParams = {
|
|
117
129
|
chatId: params.chatId
|
|
118
130
|
};
|
|
@@ -258,20 +270,6 @@ function createClient(config = {}) {
|
|
|
258
270
|
async getScopes () {
|
|
259
271
|
return fetcher(`/user/scopes`, 'GET', {});
|
|
260
272
|
}
|
|
261
|
-
},
|
|
262
|
-
notifications: {
|
|
263
|
-
deviceToken: {
|
|
264
|
-
deviceId: {
|
|
265
|
-
async delete (params) {
|
|
266
|
-
const pathParams = {
|
|
267
|
-
deviceId: params.deviceId
|
|
268
|
-
};
|
|
269
|
-
return fetcher(`/notifications/device-token/${pathParams.deviceId}`, 'DELETE', {
|
|
270
|
-
pathParams
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
273
|
}
|
|
276
274
|
};
|
|
277
275
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,36 +2,55 @@ type ChatDetail = {
|
|
|
2
2
|
id: string;
|
|
3
3
|
object: 'chat';
|
|
4
4
|
url: string;
|
|
5
|
-
demo?: string;
|
|
6
5
|
shareable: boolean;
|
|
7
6
|
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
8
7
|
title?: string;
|
|
9
8
|
updatedAt?: string;
|
|
10
9
|
favorite: boolean;
|
|
11
10
|
authorId: string;
|
|
12
|
-
|
|
13
|
-
id: string;
|
|
14
|
-
status: 'pending' | 'completed' | 'failed';
|
|
15
|
-
};
|
|
16
|
-
messages: {
|
|
11
|
+
messages: Array<{
|
|
17
12
|
id: string;
|
|
18
13
|
object: 'message';
|
|
19
14
|
content: string;
|
|
20
15
|
createdAt: string;
|
|
21
|
-
type: 'message' | '
|
|
16
|
+
type: 'message' | 'forked-block' | 'forked-chat' | 'open-in-v0' | 'refinement' | 'added-environment-variables' | 'added-integration' | 'deleted-file' | 'moved-file' | 'renamed-file' | 'edited-file' | 'replace-src' | 'reverted-block' | 'fix-with-v0' | 'sync-git';
|
|
17
|
+
role: 'user' | 'assistant';
|
|
18
|
+
}>;
|
|
19
|
+
latestVersion?: {
|
|
20
|
+
id: string;
|
|
21
|
+
object: 'version';
|
|
22
|
+
status: 'pending' | 'completed' | 'failed';
|
|
23
|
+
files: {
|
|
24
|
+
object: 'file';
|
|
25
|
+
name: string;
|
|
26
|
+
content: string;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
files?: {
|
|
30
|
+
lang: string;
|
|
31
|
+
meta: Record<string, any>;
|
|
32
|
+
source: string;
|
|
22
33
|
}[];
|
|
34
|
+
demo?: string;
|
|
35
|
+
text: string;
|
|
36
|
+
modelConfiguration: {
|
|
37
|
+
modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg';
|
|
38
|
+
imageGenerations?: boolean;
|
|
39
|
+
thinking?: boolean;
|
|
40
|
+
};
|
|
23
41
|
};
|
|
24
42
|
type ChatSummary = {
|
|
25
43
|
id: string;
|
|
26
44
|
object: 'chat';
|
|
27
45
|
shareable: boolean;
|
|
28
|
-
privacy:
|
|
46
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
29
47
|
title?: string;
|
|
30
48
|
updatedAt: string;
|
|
31
49
|
favorite: boolean;
|
|
32
50
|
authorId: string;
|
|
33
51
|
latestVersion?: {
|
|
34
52
|
id: string;
|
|
53
|
+
object: 'version';
|
|
35
54
|
status: 'pending' | 'completed' | 'failed';
|
|
36
55
|
};
|
|
37
56
|
};
|
|
@@ -40,10 +59,9 @@ type MessageDetail = {
|
|
|
40
59
|
object: 'message';
|
|
41
60
|
chatId: string;
|
|
42
61
|
url: string;
|
|
43
|
-
files
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
source: string;
|
|
62
|
+
files: {
|
|
63
|
+
object: 'file';
|
|
64
|
+
name: string;
|
|
47
65
|
}[];
|
|
48
66
|
demo?: string;
|
|
49
67
|
text: string;
|
|
@@ -53,6 +71,14 @@ type MessageDetail = {
|
|
|
53
71
|
thinking?: boolean;
|
|
54
72
|
};
|
|
55
73
|
};
|
|
74
|
+
type MessageSummary = {
|
|
75
|
+
id: string;
|
|
76
|
+
object: 'message';
|
|
77
|
+
content: string;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
type: 'message' | 'forked-block' | 'forked-chat' | 'open-in-v0' | 'refinement' | 'added-environment-variables' | 'added-integration' | 'deleted-file' | 'moved-file' | 'renamed-file' | 'edited-file' | 'replace-src' | 'reverted-block' | 'fix-with-v0' | 'sync-git';
|
|
80
|
+
role: 'user' | 'assistant';
|
|
81
|
+
};
|
|
56
82
|
interface ProjectDetail {
|
|
57
83
|
id: string;
|
|
58
84
|
object: 'project';
|
|
@@ -76,6 +102,16 @@ interface VercelProjectDetail {
|
|
|
76
102
|
object: 'vercel_project';
|
|
77
103
|
name: string;
|
|
78
104
|
}
|
|
105
|
+
type VersionDetail = {
|
|
106
|
+
id: string;
|
|
107
|
+
object: 'version';
|
|
108
|
+
status: 'pending' | 'completed' | 'failed';
|
|
109
|
+
files: {
|
|
110
|
+
object: 'file';
|
|
111
|
+
name: string;
|
|
112
|
+
content: string;
|
|
113
|
+
}[];
|
|
114
|
+
};
|
|
79
115
|
interface ChatsCreateRequest {
|
|
80
116
|
message: string;
|
|
81
117
|
attachments?: {
|
|
@@ -90,10 +126,36 @@ interface ChatsCreateRequest {
|
|
|
90
126
|
thinking?: boolean;
|
|
91
127
|
};
|
|
92
128
|
}
|
|
93
|
-
type ChatsCreateResponse =
|
|
129
|
+
type ChatsCreateResponse = ChatDetail;
|
|
130
|
+
interface ChatsFindResponse {
|
|
131
|
+
object: 'list';
|
|
132
|
+
data: ChatSummary[];
|
|
133
|
+
}
|
|
134
|
+
interface ChatsInitCreateRequest {
|
|
135
|
+
files: Array<{
|
|
136
|
+
name: string;
|
|
137
|
+
url: string;
|
|
138
|
+
content?: never;
|
|
139
|
+
} | {
|
|
140
|
+
name: string;
|
|
141
|
+
content: string;
|
|
142
|
+
url?: never;
|
|
143
|
+
}>;
|
|
144
|
+
chatPrivacy?: 'public' | 'private' | 'team-edit' | 'team' | 'unlisted';
|
|
145
|
+
projectId?: string;
|
|
146
|
+
}
|
|
147
|
+
type ChatsInitCreateResponse = {
|
|
94
148
|
id: string;
|
|
95
149
|
object: 'chat';
|
|
96
150
|
url: string;
|
|
151
|
+
shareable: boolean;
|
|
152
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
153
|
+
title?: string;
|
|
154
|
+
updatedAt?: string;
|
|
155
|
+
favorite: boolean;
|
|
156
|
+
authorId: string;
|
|
157
|
+
messages: MessageSummary[];
|
|
158
|
+
latestVersion?: VersionDetail;
|
|
97
159
|
files?: {
|
|
98
160
|
lang: string;
|
|
99
161
|
meta: Record<string, any>;
|
|
@@ -101,26 +163,55 @@ type ChatsCreateResponse = {
|
|
|
101
163
|
}[];
|
|
102
164
|
demo?: string;
|
|
103
165
|
text: string;
|
|
104
|
-
modelConfiguration: {
|
|
105
|
-
modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg';
|
|
106
|
-
imageGenerations?: boolean;
|
|
107
|
-
thinking?: boolean;
|
|
108
|
-
};
|
|
109
166
|
};
|
|
110
|
-
interface ChatsFindResponse {
|
|
111
|
-
object: 'list';
|
|
112
|
-
data: ChatSummary[];
|
|
113
|
-
}
|
|
114
167
|
interface ChatsDeleteResponse {
|
|
115
168
|
id: string;
|
|
116
169
|
object: 'chat';
|
|
117
170
|
deleted: true;
|
|
118
171
|
}
|
|
119
|
-
type ChatsGetByIdResponse =
|
|
172
|
+
type ChatsGetByIdResponse = {
|
|
173
|
+
id: string;
|
|
174
|
+
object: 'chat';
|
|
175
|
+
url: string;
|
|
176
|
+
shareable: boolean;
|
|
177
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
178
|
+
title?: string;
|
|
179
|
+
updatedAt?: string;
|
|
180
|
+
favorite: boolean;
|
|
181
|
+
authorId: string;
|
|
182
|
+
messages: MessageSummary[];
|
|
183
|
+
latestVersion?: VersionDetail;
|
|
184
|
+
files?: {
|
|
185
|
+
lang: string;
|
|
186
|
+
meta: Record<string, any>;
|
|
187
|
+
source: string;
|
|
188
|
+
}[];
|
|
189
|
+
demo?: string;
|
|
190
|
+
text: string;
|
|
191
|
+
};
|
|
120
192
|
interface ChatsUpdateRequest {
|
|
121
193
|
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
122
194
|
}
|
|
123
|
-
type ChatsUpdateResponse =
|
|
195
|
+
type ChatsUpdateResponse = {
|
|
196
|
+
id: string;
|
|
197
|
+
object: 'chat';
|
|
198
|
+
url: string;
|
|
199
|
+
shareable: boolean;
|
|
200
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
201
|
+
title?: string;
|
|
202
|
+
updatedAt?: string;
|
|
203
|
+
favorite: boolean;
|
|
204
|
+
authorId: string;
|
|
205
|
+
messages: MessageSummary[];
|
|
206
|
+
latestVersion?: VersionDetail;
|
|
207
|
+
files?: {
|
|
208
|
+
lang: string;
|
|
209
|
+
meta: Record<string, any>;
|
|
210
|
+
source: string;
|
|
211
|
+
}[];
|
|
212
|
+
demo?: string;
|
|
213
|
+
text: string;
|
|
214
|
+
};
|
|
124
215
|
interface ChatsFavoriteRequest {
|
|
125
216
|
isFavorite: boolean;
|
|
126
217
|
}
|
|
@@ -132,9 +223,28 @@ interface ChatsFavoriteResponse {
|
|
|
132
223
|
interface ChatsForkRequest {
|
|
133
224
|
versionId?: string;
|
|
134
225
|
}
|
|
135
|
-
type ChatsForkResponse =
|
|
226
|
+
type ChatsForkResponse = {
|
|
227
|
+
id: string;
|
|
228
|
+
object: 'chat';
|
|
229
|
+
url: string;
|
|
230
|
+
shareable: boolean;
|
|
231
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
232
|
+
title?: string;
|
|
233
|
+
updatedAt?: string;
|
|
234
|
+
favorite: boolean;
|
|
235
|
+
authorId: string;
|
|
236
|
+
messages: MessageSummary[];
|
|
237
|
+
latestVersion?: VersionDetail;
|
|
238
|
+
files?: {
|
|
239
|
+
lang: string;
|
|
240
|
+
meta: Record<string, any>;
|
|
241
|
+
source: string;
|
|
242
|
+
}[];
|
|
243
|
+
demo?: string;
|
|
244
|
+
text: string;
|
|
245
|
+
};
|
|
136
246
|
type ProjectsGetByChatIdResponse = ProjectDetail;
|
|
137
|
-
interface
|
|
247
|
+
interface ChatsSendMessageRequest {
|
|
138
248
|
message: string;
|
|
139
249
|
attachments?: {
|
|
140
250
|
url: string;
|
|
@@ -145,7 +255,32 @@ interface ChatsCreateMessageRequest {
|
|
|
145
255
|
thinking?: boolean;
|
|
146
256
|
};
|
|
147
257
|
}
|
|
148
|
-
type
|
|
258
|
+
type ChatsSendMessageResponse = {
|
|
259
|
+
id: string;
|
|
260
|
+
object: 'chat';
|
|
261
|
+
url: string;
|
|
262
|
+
shareable: boolean;
|
|
263
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
264
|
+
title?: string;
|
|
265
|
+
updatedAt?: string;
|
|
266
|
+
favorite: boolean;
|
|
267
|
+
authorId: string;
|
|
268
|
+
messages: MessageSummary[];
|
|
269
|
+
latestVersion?: VersionDetail;
|
|
270
|
+
files?: {
|
|
271
|
+
lang: string;
|
|
272
|
+
meta: Record<string, any>;
|
|
273
|
+
source: string;
|
|
274
|
+
}[];
|
|
275
|
+
demo?: string;
|
|
276
|
+
text: string;
|
|
277
|
+
modelConfiguration: {
|
|
278
|
+
modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg';
|
|
279
|
+
imageGenerations?: boolean;
|
|
280
|
+
thinking?: boolean;
|
|
281
|
+
};
|
|
282
|
+
chatId: string;
|
|
283
|
+
};
|
|
149
284
|
interface ChatsGetMetadataResponse {
|
|
150
285
|
git: {
|
|
151
286
|
branch: string;
|
|
@@ -258,9 +393,6 @@ interface UserGetScopesResponse {
|
|
|
258
393
|
object: 'list';
|
|
259
394
|
data: ScopeSummary[];
|
|
260
395
|
}
|
|
261
|
-
interface NotificationsDeviceTokenDeviceIdDeleteResponse {
|
|
262
|
-
success: boolean;
|
|
263
|
-
}
|
|
264
396
|
interface V0ClientConfig {
|
|
265
397
|
apiKey?: string;
|
|
266
398
|
baseUrl?: string;
|
|
@@ -273,6 +405,9 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
273
405
|
offset?: string;
|
|
274
406
|
isFavorite?: string;
|
|
275
407
|
}): Promise<ChatsFindResponse>;
|
|
408
|
+
init: {
|
|
409
|
+
create(params: ChatsInitCreateRequest): Promise<ChatsInitCreateResponse>;
|
|
410
|
+
};
|
|
276
411
|
delete(params: {
|
|
277
412
|
chatId: string;
|
|
278
413
|
}): Promise<ChatsDeleteResponse>;
|
|
@@ -288,9 +423,9 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
288
423
|
fork(params: {
|
|
289
424
|
chatId: string;
|
|
290
425
|
} & ChatsForkRequest): Promise<ChatsForkResponse>;
|
|
291
|
-
|
|
426
|
+
sendMessage(params: {
|
|
292
427
|
chatId: string;
|
|
293
|
-
} &
|
|
428
|
+
} & ChatsSendMessageRequest): Promise<ChatsSendMessageResponse>;
|
|
294
429
|
getMetadata(params: {
|
|
295
430
|
chatId: string;
|
|
296
431
|
}): Promise<ChatsGetMetadataResponse>;
|
|
@@ -339,15 +474,6 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
339
474
|
getPlan(): Promise<UserGetPlanResponse>;
|
|
340
475
|
getScopes(): Promise<UserGetScopesResponse>;
|
|
341
476
|
};
|
|
342
|
-
notifications: {
|
|
343
|
-
deviceToken: {
|
|
344
|
-
deviceId: {
|
|
345
|
-
delete(params: {
|
|
346
|
-
deviceId: string;
|
|
347
|
-
}): Promise<NotificationsDeviceTokenDeviceIdDeleteResponse>;
|
|
348
|
-
};
|
|
349
|
-
};
|
|
350
|
-
};
|
|
351
477
|
};
|
|
352
478
|
declare const v0: {
|
|
353
479
|
chats: {
|
|
@@ -357,6 +483,9 @@ declare const v0: {
|
|
|
357
483
|
offset?: string;
|
|
358
484
|
isFavorite?: string;
|
|
359
485
|
}): Promise<ChatsFindResponse>;
|
|
486
|
+
init: {
|
|
487
|
+
create(params: ChatsInitCreateRequest): Promise<ChatsInitCreateResponse>;
|
|
488
|
+
};
|
|
360
489
|
delete(params: {
|
|
361
490
|
chatId: string;
|
|
362
491
|
}): Promise<ChatsDeleteResponse>;
|
|
@@ -372,9 +501,9 @@ declare const v0: {
|
|
|
372
501
|
fork(params: {
|
|
373
502
|
chatId: string;
|
|
374
503
|
} & ChatsForkRequest): Promise<ChatsForkResponse>;
|
|
375
|
-
|
|
504
|
+
sendMessage(params: {
|
|
376
505
|
chatId: string;
|
|
377
|
-
} &
|
|
506
|
+
} & ChatsSendMessageRequest): Promise<ChatsSendMessageResponse>;
|
|
378
507
|
getMetadata(params: {
|
|
379
508
|
chatId: string;
|
|
380
509
|
}): Promise<ChatsGetMetadataResponse>;
|
|
@@ -423,15 +552,6 @@ declare const v0: {
|
|
|
423
552
|
getPlan(): Promise<UserGetPlanResponse>;
|
|
424
553
|
getScopes(): Promise<UserGetScopesResponse>;
|
|
425
554
|
};
|
|
426
|
-
notifications: {
|
|
427
|
-
deviceToken: {
|
|
428
|
-
deviceId: {
|
|
429
|
-
delete(params: {
|
|
430
|
-
deviceId: string;
|
|
431
|
-
}): Promise<NotificationsDeviceTokenDeviceIdDeleteResponse>;
|
|
432
|
-
};
|
|
433
|
-
};
|
|
434
|
-
};
|
|
435
555
|
};
|
|
436
556
|
|
|
437
557
|
export { createClient, v0 };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../src/sdk/v0.ts"],"sourcesContent":["import { createFetcher } from './core'\n\nexport type ChatDetail = {\n id: string\n object: 'chat'\n url: string\n demo?: string\n shareable: boolean\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n latestVersion?: {\n id: string\n status: 'pending' | 'completed' | 'failed'\n }\n messages: {\n id: string\n object: 'message'\n content: string\n createdAt: string\n type:\n | 'message'\n | 'refinement'\n | 'forked-block'\n | 'forked-chat'\n | 'open-in-v0'\n | 'added-environment-variables'\n | 'added-integration'\n | 'deleted-file'\n | 'moved-file'\n | 'renamed-file'\n | 'edited-file'\n | 'replace-src'\n | 'reverted-block'\n | 'fix-with-v0'\n | 'sync-git'\n }[]\n}\n\nexport type ChatSummary = {\n id: string\n object: 'chat'\n shareable: boolean\n privacy: string\n title?: string\n updatedAt: string\n favorite: boolean\n authorId: string\n latestVersion?: {\n id: string\n status: 'pending' | 'completed' | 'failed'\n }\n}\n\nexport type MessageDetail = {\n id: string\n object: 'message'\n chatId: string\n url: string\n files?: {\n lang: string\n meta: Record<string, any>\n source: string\n }[]\n demo?: string\n text: string\n modelConfiguration: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n}\n\nexport interface ProjectDetail {\n id: string\n object: 'project'\n name: string\n vercelProjectId?: string\n}\n\nexport interface ProjectSummary {\n id: string\n object: 'project'\n name: string\n vercelProjectId?: string\n}\n\nexport interface ScopeSummary {\n id: string\n object: 'scope'\n name?: string\n}\n\nexport interface UserDetail {\n id: string\n object: 'user'\n name?: string\n email: string\n avatar: string\n}\n\nexport interface VercelProjectDetail {\n id: string\n object: 'vercel_project'\n name: string\n}\n\nexport interface ChatsCreateRequest {\n message: string\n attachments?: {\n url: string\n }[]\n system?: string\n chatPrivacy?: 'public' | 'private' | 'team-edit' | 'team' | 'unlisted'\n projectId?: string\n modelConfiguration?: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n}\n\nexport type ChatsCreateResponse = {\n id: string\n object: 'chat'\n url: string\n files?: {\n lang: string\n meta: Record<string, any>\n source: string\n }[]\n demo?: string\n text: string\n modelConfiguration: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n}\n\nexport interface ChatsFindResponse {\n object: 'list'\n data: ChatSummary[]\n}\n\nexport interface ChatsDeleteResponse {\n id: string\n object: 'chat'\n deleted: true\n}\n\nexport type ChatsGetByIdResponse = ChatDetail\n\nexport interface ChatsUpdateRequest {\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n}\n\nexport type ChatsUpdateResponse = ChatDetail\n\nexport interface ChatsFavoriteRequest {\n isFavorite: boolean\n}\n\nexport interface ChatsFavoriteResponse {\n id: string\n object: 'chat'\n favorited: boolean\n}\n\nexport interface ChatsForkRequest {\n versionId?: string\n}\n\nexport type ChatsForkResponse = ChatDetail\n\nexport type ProjectsGetByChatIdResponse = ProjectDetail\n\nexport interface ChatsCreateMessageRequest {\n message: string\n attachments?: {\n url: string\n }[]\n modelConfiguration?: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n}\n\nexport type ChatsCreateMessageResponse = MessageDetail\n\nexport interface ChatsGetMetadataResponse {\n git: {\n branch: string\n commit: string\n }\n deployment: {\n id: string\n }\n project: {\n id: string\n name: string\n url: string\n }\n}\n\nexport type ChatsResumeResponse = MessageDetail\n\nexport interface DeploymentsFindLogsResponse {\n error?: string\n logs: string[]\n nextSince?: number\n}\n\nexport interface DeploymentsFindErrorsResponse {\n error?: string\n fullErrorText?: string\n errorType?: string\n formattedError?: string\n}\n\nexport interface IntegrationsVercelProjectsFindResponse {\n object: 'list'\n data: VercelProjectDetail[]\n}\n\nexport interface IntegrationsVercelProjectsCreateRequest {\n projectId: string\n name: string\n}\n\nexport type IntegrationsVercelProjectsCreateResponse = VercelProjectDetail\n\nexport interface ProjectsFindResponse {\n object: 'list'\n data: ProjectDetail[]\n}\n\nexport interface ProjectsCreateRequest {\n name: string\n description?: string\n icon?: string\n environmentVariables?: {\n key: string\n value: string\n }[]\n instructions?: string\n}\n\nexport type ProjectsCreateResponse = ProjectDetail\n\nexport interface ProjectsAssignRequest {\n chatId: string\n}\n\nexport interface ProjectsAssignResponse {\n object: 'project'\n id: string\n assigned: true\n}\n\nexport interface RateLimitsFindResponse {\n remaining?: number\n reset?: number\n limit: number\n}\n\nexport type UserGetResponse = UserDetail\n\nexport type UserGetBillingResponse =\n | {\n billingType: 'token'\n data: {\n plan: string\n billingMode?: 'test'\n role: string\n billingCycle: {\n start: number\n end: number\n }\n balance: {\n remaining: number\n total: number\n }\n onDemand: {\n balance: number\n blocks?: {\n expirationDate?: number\n effectiveDate: number\n originalBalance: number\n currentBalance: number\n }[]\n }\n }\n }\n | {\n billingType: 'legacy'\n data: {\n remaining?: number\n reset?: number\n limit: number\n }\n }\n\nexport interface UserGetPlanResponse {\n object: 'plan'\n plan: string\n billingCycle: {\n start: number\n end: number\n }\n balance: {\n remaining: number\n total: number\n }\n}\n\nexport interface UserGetScopesResponse {\n object: 'list'\n data: ScopeSummary[]\n}\n\nexport interface NotificationsDeviceTokenDeviceIdDeleteResponse {\n success: boolean\n}\n\nexport interface V0ClientConfig {\n apiKey?: string\n baseUrl?: string\n}\n\nexport function createClient(config: V0ClientConfig = {}) {\n const fetcher = createFetcher(config)\n\n return {\n chats: {\n async create(params: ChatsCreateRequest): Promise<ChatsCreateResponse> {\n const body = {\n message: params.message,\n attachments: params.attachments,\n system: params.system,\n chatPrivacy: params.chatPrivacy,\n projectId: params.projectId,\n modelConfiguration: params.modelConfiguration,\n }\n return fetcher(`/chats`, 'POST', { body })\n },\n\n async find(params?: {\n limit?: string\n offset?: string\n isFavorite?: string\n }): Promise<ChatsFindResponse> {\n const query = params\n ? (Object.fromEntries(\n Object.entries({\n limit: params.limit,\n offset: params.offset,\n isFavorite: params.isFavorite,\n }).filter(([_, value]) => value !== undefined),\n ) as Record<string, string>)\n : {}\n const hasQuery = Object.keys(query).length > 0\n return fetcher(`/chats`, 'GET', { ...(hasQuery ? { query } : {}) })\n },\n\n async delete(params: { chatId: string }): Promise<ChatsDeleteResponse> {\n const pathParams = { chatId: params.chatId }\n return fetcher(`/chats/${pathParams.chatId}`, 'DELETE', { pathParams })\n },\n\n async getById(params: { chatId: string }): Promise<ChatsGetByIdResponse> {\n const pathParams = { chatId: params.chatId }\n return fetcher(`/chats/${pathParams.chatId}`, 'GET', { pathParams })\n },\n\n async update(\n params: { chatId: string } & ChatsUpdateRequest,\n ): Promise<ChatsUpdateResponse> {\n const pathParams = { chatId: params.chatId }\n const body = { privacy: params.privacy }\n return fetcher(`/chats/${pathParams.chatId}`, 'PATCH', {\n pathParams,\n body,\n })\n },\n\n async favorite(\n params: { chatId: string } & ChatsFavoriteRequest,\n ): Promise<ChatsFavoriteResponse> {\n const pathParams = { chatId: params.chatId }\n const body = { isFavorite: params.isFavorite }\n return fetcher(`/chats/${pathParams.chatId}/favorite`, 'PUT', {\n pathParams,\n body,\n })\n },\n\n async fork(\n params: { chatId: string } & ChatsForkRequest,\n ): Promise<ChatsForkResponse> {\n const pathParams = { chatId: params.chatId }\n const body = { versionId: params.versionId }\n return fetcher(`/chats/${pathParams.chatId}/fork`, 'POST', {\n pathParams,\n body,\n })\n },\n\n async createMessage(\n params: { chatId: string } & ChatsCreateMessageRequest,\n ): Promise<ChatsCreateMessageResponse> {\n const pathParams = { chatId: params.chatId }\n const body = {\n message: params.message,\n attachments: params.attachments,\n modelConfiguration: params.modelConfiguration,\n }\n return fetcher(`/chats/${pathParams.chatId}/messages`, 'POST', {\n pathParams,\n body,\n })\n },\n\n async getMetadata(params: {\n chatId: string\n }): Promise<ChatsGetMetadataResponse> {\n const pathParams = { chatId: params.chatId }\n return fetcher(`/chats/${pathParams.chatId}/metadata`, 'GET', {\n pathParams,\n })\n },\n\n async resume(params: {\n chatId: string\n messageId: string\n }): Promise<ChatsResumeResponse> {\n const pathParams = {\n chatId: params.chatId,\n messageId: params.messageId,\n }\n return fetcher(\n `/chats/${pathParams.chatId}/messages/${pathParams.messageId}/resume`,\n 'POST',\n { pathParams },\n )\n },\n },\n\n projects: {\n async getByChatId(params: {\n chatId: string\n }): Promise<ProjectsGetByChatIdResponse> {\n const pathParams = { chatId: params.chatId }\n return fetcher(`/chats/${pathParams.chatId}/project`, 'GET', {\n pathParams,\n })\n },\n\n async find(): Promise<ProjectsFindResponse> {\n return fetcher(`/projects`, 'GET', {})\n },\n\n async create(\n params: ProjectsCreateRequest,\n ): Promise<ProjectsCreateResponse> {\n const body = {\n name: params.name,\n description: params.description,\n icon: params.icon,\n environmentVariables: params.environmentVariables,\n instructions: params.instructions,\n }\n return fetcher(`/projects`, 'POST', { body })\n },\n\n async assign(\n params: { projectId: string } & ProjectsAssignRequest,\n ): Promise<ProjectsAssignResponse> {\n const pathParams = { projectId: params.projectId }\n const body = { chatId: params.chatId }\n return fetcher(`/projects/${pathParams.projectId}/assign`, 'POST', {\n pathParams,\n body,\n })\n },\n },\n\n deployments: {\n async findLogs(params: {\n deploymentId: string\n since?: string\n }): Promise<DeploymentsFindLogsResponse> {\n const pathParams = { deploymentId: params.deploymentId }\n const query = Object.fromEntries(\n Object.entries({\n since: params.since,\n }).filter(([_, value]) => value !== undefined),\n ) as Record<string, string>\n const hasQuery = Object.keys(query).length > 0\n return fetcher(`/deployments/${pathParams.deploymentId}/logs`, 'GET', {\n pathParams,\n ...(hasQuery ? { query } : {}),\n })\n },\n\n async findErrors(params: {\n deploymentId: string\n }): Promise<DeploymentsFindErrorsResponse> {\n const pathParams = { deploymentId: params.deploymentId }\n return fetcher(\n `/deployments/${pathParams.deploymentId}/errors`,\n 'GET',\n { pathParams },\n )\n },\n },\n\n integrations: {\n vercel: {\n projects: {\n async find(): Promise<IntegrationsVercelProjectsFindResponse> {\n return fetcher(`/integrations/vercel/projects`, 'GET', {})\n },\n\n async create(\n params: IntegrationsVercelProjectsCreateRequest,\n ): Promise<IntegrationsVercelProjectsCreateResponse> {\n const body = { projectId: params.projectId, name: params.name }\n return fetcher(`/integrations/vercel/projects`, 'POST', { body })\n },\n },\n },\n },\n\n rateLimits: {\n async find(params?: { scope?: string }): Promise<RateLimitsFindResponse> {\n const query = params\n ? (Object.fromEntries(\n Object.entries({\n scope: params.scope,\n }).filter(([_, value]) => value !== undefined),\n ) as Record<string, string>)\n : {}\n const hasQuery = Object.keys(query).length > 0\n return fetcher(`/rate-limits`, 'GET', {\n ...(hasQuery ? { query } : {}),\n })\n },\n },\n\n user: {\n async get(): Promise<UserGetResponse> {\n return fetcher(`/user`, 'GET', {})\n },\n\n async getBilling(params?: {\n scope?: string\n }): Promise<UserGetBillingResponse> {\n const query = params\n ? (Object.fromEntries(\n Object.entries({\n scope: params.scope,\n }).filter(([_, value]) => value !== undefined),\n ) as Record<string, string>)\n : {}\n const hasQuery = Object.keys(query).length > 0\n return fetcher(`/user/billing`, 'GET', {\n ...(hasQuery ? { query } : {}),\n })\n },\n\n async getPlan(): Promise<UserGetPlanResponse> {\n return fetcher(`/user/plan`, 'GET', {})\n },\n\n async getScopes(): Promise<UserGetScopesResponse> {\n return fetcher(`/user/scopes`, 'GET', {})\n },\n },\n\n notifications: {\n deviceToken: {\n deviceId: {\n async delete(params: {\n deviceId: string\n }): Promise<NotificationsDeviceTokenDeviceIdDeleteResponse> {\n const pathParams = { deviceId: params.deviceId }\n return fetcher(\n `/notifications/device-token/${pathParams.deviceId}`,\n 'DELETE',\n { pathParams },\n )\n },\n },\n },\n },\n }\n}\n\n// Default client for backward compatibility\nexport const v0 = createClient()\n"],"names":[],"mappings":"AAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AAOO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACO;AACA;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACA;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../src/sdk/v0.ts"],"sourcesContent":["import { createFetcher } from './core'\n\nexport type ChatDetail = {\n id: string\n object: 'chat'\n url: string\n shareable: boolean\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n messages: Array<{\n id: string\n object: 'message'\n content: string\n createdAt: string\n type:\n | 'message'\n | 'forked-block'\n | 'forked-chat'\n | 'open-in-v0'\n | 'refinement'\n | 'added-environment-variables'\n | 'added-integration'\n | 'deleted-file'\n | 'moved-file'\n | 'renamed-file'\n | 'edited-file'\n | 'replace-src'\n | 'reverted-block'\n | 'fix-with-v0'\n | 'sync-git'\n role: 'user' | 'assistant'\n }>\n latestVersion?: {\n id: string\n object: 'version'\n status: 'pending' | 'completed' | 'failed'\n files: {\n object: 'file'\n name: string\n content: string\n }[]\n }\n files?: {\n lang: string\n meta: Record<string, any>\n source: string\n }[]\n demo?: string\n text: string\n modelConfiguration: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n}\n\nexport type ChatSummary = {\n id: string\n object: 'chat'\n shareable: boolean\n privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n title?: string\n updatedAt: string\n favorite: boolean\n authorId: string\n latestVersion?: {\n id: string\n object: 'version'\n status: 'pending' | 'completed' | 'failed'\n }\n}\n\nexport interface FileDetail {\n object: 'file'\n name: string\n content: string\n}\n\nexport interface FileSummary {\n object: 'file'\n name: string\n}\n\nexport type MessageDetail = {\n id: string\n object: 'message'\n chatId: string\n url: string\n files: {\n object: 'file'\n name: string\n }[]\n demo?: string\n text: string\n modelConfiguration: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n}\n\nexport type MessageSummary = {\n id: string\n object: 'message'\n content: string\n createdAt: string\n type:\n | 'message'\n | 'forked-block'\n | 'forked-chat'\n | 'open-in-v0'\n | 'refinement'\n | 'added-environment-variables'\n | 'added-integration'\n | 'deleted-file'\n | 'moved-file'\n | 'renamed-file'\n | 'edited-file'\n | 'replace-src'\n | 'reverted-block'\n | 'fix-with-v0'\n | 'sync-git'\n role: 'user' | 'assistant'\n}\n\nexport interface ProjectDetail {\n id: string\n object: 'project'\n name: string\n vercelProjectId?: string\n}\n\nexport interface ProjectSummary {\n id: string\n object: 'project'\n name: string\n vercelProjectId?: string\n}\n\nexport interface ScopeSummary {\n id: string\n object: 'scope'\n name?: string\n}\n\nexport interface UserDetail {\n id: string\n object: 'user'\n name?: string\n email: string\n avatar: string\n}\n\nexport interface VercelProjectDetail {\n id: string\n object: 'vercel_project'\n name: string\n}\n\nexport type VersionDetail = {\n id: string\n object: 'version'\n status: 'pending' | 'completed' | 'failed'\n files: {\n object: 'file'\n name: string\n content: string\n }[]\n}\n\nexport type VersionSummary = {\n id: string\n object: 'version'\n status: 'pending' | 'completed' | 'failed'\n}\n\nexport interface ChatsCreateRequest {\n message: string\n attachments?: {\n url: string\n }[]\n system?: string\n chatPrivacy?: 'public' | 'private' | 'team-edit' | 'team' | 'unlisted'\n projectId?: string\n modelConfiguration?: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n}\n\nexport type ChatsCreateResponse = ChatDetail\n\nexport interface ChatsFindResponse {\n object: 'list'\n data: ChatSummary[]\n}\n\nexport interface ChatsInitCreateRequest {\n files: Array<\n | {\n name: string\n url: string\n content?: never\n }\n | {\n name: string\n content: string\n url?: never\n }\n >\n chatPrivacy?: 'public' | 'private' | 'team-edit' | 'team' | 'unlisted'\n projectId?: string\n}\n\nexport type ChatsInitCreateResponse = {\n id: string\n object: 'chat'\n url: string\n shareable: boolean\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n messages: MessageSummary[]\n latestVersion?: VersionDetail\n files?: {\n lang: string\n meta: Record<string, any>\n source: string\n }[]\n demo?: string\n text: string\n}\n\nexport interface ChatsDeleteResponse {\n id: string\n object: 'chat'\n deleted: true\n}\n\nexport type ChatsGetByIdResponse = {\n id: string\n object: 'chat'\n url: string\n shareable: boolean\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n messages: MessageSummary[]\n latestVersion?: VersionDetail\n files?: {\n lang: string\n meta: Record<string, any>\n source: string\n }[]\n demo?: string\n text: string\n}\n\nexport interface ChatsUpdateRequest {\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n}\n\nexport type ChatsUpdateResponse = {\n id: string\n object: 'chat'\n url: string\n shareable: boolean\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n messages: MessageSummary[]\n latestVersion?: VersionDetail\n files?: {\n lang: string\n meta: Record<string, any>\n source: string\n }[]\n demo?: string\n text: string\n}\n\nexport interface ChatsFavoriteRequest {\n isFavorite: boolean\n}\n\nexport interface ChatsFavoriteResponse {\n id: string\n object: 'chat'\n favorited: boolean\n}\n\nexport interface ChatsForkRequest {\n versionId?: string\n}\n\nexport type ChatsForkResponse = {\n id: string\n object: 'chat'\n url: string\n shareable: boolean\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n messages: MessageSummary[]\n latestVersion?: VersionDetail\n files?: {\n lang: string\n meta: Record<string, any>\n source: string\n }[]\n demo?: string\n text: string\n}\n\nexport type ProjectsGetByChatIdResponse = ProjectDetail\n\nexport interface ChatsSendMessageRequest {\n message: string\n attachments?: {\n url: string\n }[]\n modelConfiguration?: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n}\n\nexport type ChatsSendMessageResponse = {\n id: string\n object: 'chat'\n url: string\n shareable: boolean\n privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n messages: MessageSummary[]\n latestVersion?: VersionDetail\n files?: {\n lang: string\n meta: Record<string, any>\n source: string\n }[]\n demo?: string\n text: string\n modelConfiguration: {\n modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg'\n imageGenerations?: boolean\n thinking?: boolean\n }\n chatId: string\n}\n\nexport interface ChatsGetMetadataResponse {\n git: {\n branch: string\n commit: string\n }\n deployment: {\n id: string\n }\n project: {\n id: string\n name: string\n url: string\n }\n}\n\nexport type ChatsResumeResponse = MessageDetail\n\nexport interface DeploymentsFindLogsResponse {\n error?: string\n logs: string[]\n nextSince?: number\n}\n\nexport interface DeploymentsFindErrorsResponse {\n error?: string\n fullErrorText?: string\n errorType?: string\n formattedError?: string\n}\n\nexport interface IntegrationsVercelProjectsFindResponse {\n object: 'list'\n data: VercelProjectDetail[]\n}\n\nexport interface IntegrationsVercelProjectsCreateRequest {\n projectId: string\n name: string\n}\n\nexport type IntegrationsVercelProjectsCreateResponse = VercelProjectDetail\n\nexport interface ProjectsFindResponse {\n object: 'list'\n data: ProjectDetail[]\n}\n\nexport interface ProjectsCreateRequest {\n name: string\n description?: string\n icon?: string\n environmentVariables?: {\n key: string\n value: string\n }[]\n instructions?: string\n}\n\nexport type ProjectsCreateResponse = ProjectDetail\n\nexport interface ProjectsAssignRequest {\n chatId: string\n}\n\nexport interface ProjectsAssignResponse {\n object: 'project'\n id: string\n assigned: true\n}\n\nexport interface RateLimitsFindResponse {\n remaining?: number\n reset?: number\n limit: number\n}\n\nexport type UserGetResponse = UserDetail\n\nexport type UserGetBillingResponse =\n | {\n billingType: 'token'\n data: {\n plan: string\n billingMode?: 'test'\n role: string\n billingCycle: {\n start: number\n end: number\n }\n balance: {\n remaining: number\n total: number\n }\n onDemand: {\n balance: number\n blocks?: {\n expirationDate?: number\n effectiveDate: number\n originalBalance: number\n currentBalance: number\n }[]\n }\n }\n }\n | {\n billingType: 'legacy'\n data: {\n remaining?: number\n reset?: number\n limit: number\n }\n }\n\nexport interface UserGetPlanResponse {\n object: 'plan'\n plan: string\n billingCycle: {\n start: number\n end: number\n }\n balance: {\n remaining: number\n total: number\n }\n}\n\nexport interface UserGetScopesResponse {\n object: 'list'\n data: ScopeSummary[]\n}\n\nexport interface V0ClientConfig {\n apiKey?: string\n baseUrl?: string\n}\n\nexport function createClient(config: V0ClientConfig = {}) {\n const fetcher = createFetcher(config)\n\n return {\n chats: {\n async create(params: ChatsCreateRequest): Promise<ChatsCreateResponse> {\n const body = {\n message: params.message,\n attachments: params.attachments,\n system: params.system,\n chatPrivacy: params.chatPrivacy,\n projectId: params.projectId,\n modelConfiguration: params.modelConfiguration,\n }\n return fetcher(`/chats`, 'POST', { body })\n },\n\n async find(params?: {\n limit?: string\n offset?: string\n isFavorite?: string\n }): Promise<ChatsFindResponse> {\n const query = params\n ? (Object.fromEntries(\n Object.entries({\n limit: params.limit,\n offset: params.offset,\n isFavorite: params.isFavorite,\n }).filter(([_, value]) => value !== undefined),\n ) as Record<string, string>)\n : {}\n const hasQuery = Object.keys(query).length > 0\n return fetcher(`/chats`, 'GET', { ...(hasQuery ? { query } : {}) })\n },\n\n init: {\n async create(\n params: ChatsInitCreateRequest,\n ): Promise<ChatsInitCreateResponse> {\n const body = {\n files: params.files,\n chatPrivacy: params.chatPrivacy,\n projectId: params.projectId,\n }\n return fetcher(`/chats/init`, 'POST', { body })\n },\n },\n\n async delete(params: { chatId: string }): Promise<ChatsDeleteResponse> {\n const pathParams = { chatId: params.chatId }\n return fetcher(`/chats/${pathParams.chatId}`, 'DELETE', { pathParams })\n },\n\n async getById(params: { chatId: string }): Promise<ChatsGetByIdResponse> {\n const pathParams = { chatId: params.chatId }\n return fetcher(`/chats/${pathParams.chatId}`, 'GET', { pathParams })\n },\n\n async update(\n params: { chatId: string } & ChatsUpdateRequest,\n ): Promise<ChatsUpdateResponse> {\n const pathParams = { chatId: params.chatId }\n const body = { privacy: params.privacy }\n return fetcher(`/chats/${pathParams.chatId}`, 'PATCH', {\n pathParams,\n body,\n })\n },\n\n async favorite(\n params: { chatId: string } & ChatsFavoriteRequest,\n ): Promise<ChatsFavoriteResponse> {\n const pathParams = { chatId: params.chatId }\n const body = { isFavorite: params.isFavorite }\n return fetcher(`/chats/${pathParams.chatId}/favorite`, 'PUT', {\n pathParams,\n body,\n })\n },\n\n async fork(\n params: { chatId: string } & ChatsForkRequest,\n ): Promise<ChatsForkResponse> {\n const pathParams = { chatId: params.chatId }\n const body = { versionId: params.versionId }\n return fetcher(`/chats/${pathParams.chatId}/fork`, 'POST', {\n pathParams,\n body,\n })\n },\n\n async sendMessage(\n params: { chatId: string } & ChatsSendMessageRequest,\n ): Promise<ChatsSendMessageResponse> {\n const pathParams = { chatId: params.chatId }\n const body = {\n message: params.message,\n attachments: params.attachments,\n modelConfiguration: params.modelConfiguration,\n }\n return fetcher(`/chats/${pathParams.chatId}/messages`, 'POST', {\n pathParams,\n body,\n })\n },\n\n async getMetadata(params: {\n chatId: string\n }): Promise<ChatsGetMetadataResponse> {\n const pathParams = { chatId: params.chatId }\n return fetcher(`/chats/${pathParams.chatId}/metadata`, 'GET', {\n pathParams,\n })\n },\n\n async resume(params: {\n chatId: string\n messageId: string\n }): Promise<ChatsResumeResponse> {\n const pathParams = {\n chatId: params.chatId,\n messageId: params.messageId,\n }\n return fetcher(\n `/chats/${pathParams.chatId}/messages/${pathParams.messageId}/resume`,\n 'POST',\n { pathParams },\n )\n },\n },\n\n projects: {\n async getByChatId(params: {\n chatId: string\n }): Promise<ProjectsGetByChatIdResponse> {\n const pathParams = { chatId: params.chatId }\n return fetcher(`/chats/${pathParams.chatId}/project`, 'GET', {\n pathParams,\n })\n },\n\n async find(): Promise<ProjectsFindResponse> {\n return fetcher(`/projects`, 'GET', {})\n },\n\n async create(\n params: ProjectsCreateRequest,\n ): Promise<ProjectsCreateResponse> {\n const body = {\n name: params.name,\n description: params.description,\n icon: params.icon,\n environmentVariables: params.environmentVariables,\n instructions: params.instructions,\n }\n return fetcher(`/projects`, 'POST', { body })\n },\n\n async assign(\n params: { projectId: string } & ProjectsAssignRequest,\n ): Promise<ProjectsAssignResponse> {\n const pathParams = { projectId: params.projectId }\n const body = { chatId: params.chatId }\n return fetcher(`/projects/${pathParams.projectId}/assign`, 'POST', {\n pathParams,\n body,\n })\n },\n },\n\n deployments: {\n async findLogs(params: {\n deploymentId: string\n since?: string\n }): Promise<DeploymentsFindLogsResponse> {\n const pathParams = { deploymentId: params.deploymentId }\n const query = Object.fromEntries(\n Object.entries({\n since: params.since,\n }).filter(([_, value]) => value !== undefined),\n ) as Record<string, string>\n const hasQuery = Object.keys(query).length > 0\n return fetcher(`/deployments/${pathParams.deploymentId}/logs`, 'GET', {\n pathParams,\n ...(hasQuery ? { query } : {}),\n })\n },\n\n async findErrors(params: {\n deploymentId: string\n }): Promise<DeploymentsFindErrorsResponse> {\n const pathParams = { deploymentId: params.deploymentId }\n return fetcher(\n `/deployments/${pathParams.deploymentId}/errors`,\n 'GET',\n { pathParams },\n )\n },\n },\n\n integrations: {\n vercel: {\n projects: {\n async find(): Promise<IntegrationsVercelProjectsFindResponse> {\n return fetcher(`/integrations/vercel/projects`, 'GET', {})\n },\n\n async create(\n params: IntegrationsVercelProjectsCreateRequest,\n ): Promise<IntegrationsVercelProjectsCreateResponse> {\n const body = { projectId: params.projectId, name: params.name }\n return fetcher(`/integrations/vercel/projects`, 'POST', { body })\n },\n },\n },\n },\n\n rateLimits: {\n async find(params?: { scope?: string }): Promise<RateLimitsFindResponse> {\n const query = params\n ? (Object.fromEntries(\n Object.entries({\n scope: params.scope,\n }).filter(([_, value]) => value !== undefined),\n ) as Record<string, string>)\n : {}\n const hasQuery = Object.keys(query).length > 0\n return fetcher(`/rate-limits`, 'GET', {\n ...(hasQuery ? { query } : {}),\n })\n },\n },\n\n user: {\n async get(): Promise<UserGetResponse> {\n return fetcher(`/user`, 'GET', {})\n },\n\n async getBilling(params?: {\n scope?: string\n }): Promise<UserGetBillingResponse> {\n const query = params\n ? (Object.fromEntries(\n Object.entries({\n scope: params.scope,\n }).filter(([_, value]) => value !== undefined),\n ) as Record<string, string>)\n : {}\n const hasQuery = Object.keys(query).length > 0\n return fetcher(`/user/billing`, 'GET', {\n ...(hasQuery ? { query } : {}),\n })\n },\n\n async getPlan(): Promise<UserGetPlanResponse> {\n return fetcher(`/user/plan`, 'GET', {})\n },\n\n async getScopes(): Promise<UserGetScopesResponse> {\n return fetcher(`/user/scopes`, 'GET', {})\n },\n },\n }\n}\n\n// Default client for backward compatibility\nexport const v0 = createClient()\n"],"names":[],"mappings":"AAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AAOO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;"}
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,18 @@ function createClient(config = {}) {
|
|
|
58
58
|
} : {}
|
|
59
59
|
});
|
|
60
60
|
},
|
|
61
|
+
init: {
|
|
62
|
+
async create (params) {
|
|
63
|
+
const body = {
|
|
64
|
+
files: params.files,
|
|
65
|
+
chatPrivacy: params.chatPrivacy,
|
|
66
|
+
projectId: params.projectId
|
|
67
|
+
};
|
|
68
|
+
return fetcher(`/chats/init`, 'POST', {
|
|
69
|
+
body
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
},
|
|
61
73
|
async delete (params) {
|
|
62
74
|
const pathParams = {
|
|
63
75
|
chatId: params.chatId
|
|
@@ -110,7 +122,7 @@ function createClient(config = {}) {
|
|
|
110
122
|
body
|
|
111
123
|
});
|
|
112
124
|
},
|
|
113
|
-
async
|
|
125
|
+
async sendMessage (params) {
|
|
114
126
|
const pathParams = {
|
|
115
127
|
chatId: params.chatId
|
|
116
128
|
};
|
|
@@ -256,20 +268,6 @@ function createClient(config = {}) {
|
|
|
256
268
|
async getScopes () {
|
|
257
269
|
return fetcher(`/user/scopes`, 'GET', {});
|
|
258
270
|
}
|
|
259
|
-
},
|
|
260
|
-
notifications: {
|
|
261
|
-
deviceToken: {
|
|
262
|
-
deviceId: {
|
|
263
|
-
async delete (params) {
|
|
264
|
-
const pathParams = {
|
|
265
|
-
deviceId: params.deviceId
|
|
266
|
-
};
|
|
267
|
-
return fetcher(`/notifications/device-token/${pathParams.deviceId}`, 'DELETE', {
|
|
268
|
-
pathParams
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
271
|
}
|
|
274
272
|
};
|
|
275
273
|
}
|