v0-sdk 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -15
- package/dist/index.d.ts +136 -55
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -112,7 +112,7 @@ function createClient(config = {}) {
|
|
|
112
112
|
body
|
|
113
113
|
});
|
|
114
114
|
},
|
|
115
|
-
async
|
|
115
|
+
async sendMessage (params) {
|
|
116
116
|
const pathParams = {
|
|
117
117
|
chatId: params.chatId
|
|
118
118
|
};
|
|
@@ -258,20 +258,6 @@ function createClient(config = {}) {
|
|
|
258
258
|
async getScopes () {
|
|
259
259
|
return fetcher(`/user/scopes`, 'GET', {});
|
|
260
260
|
}
|
|
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
261
|
}
|
|
276
262
|
};
|
|
277
263
|
}
|
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
|
-
latestVersion?: {
|
|
13
|
-
id: string;
|
|
14
|
-
status: 'pending' | 'completed' | 'failed';
|
|
15
|
-
};
|
|
16
11
|
messages: {
|
|
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,28 @@ 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 ChatsDeleteResponse {
|
|
135
|
+
id: string;
|
|
136
|
+
object: 'chat';
|
|
137
|
+
deleted: true;
|
|
138
|
+
}
|
|
139
|
+
type ChatsGetByIdResponse = {
|
|
94
140
|
id: string;
|
|
95
141
|
object: 'chat';
|
|
96
142
|
url: string;
|
|
143
|
+
shareable: boolean;
|
|
144
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
145
|
+
title?: string;
|
|
146
|
+
updatedAt?: string;
|
|
147
|
+
favorite: boolean;
|
|
148
|
+
authorId: string;
|
|
149
|
+
messages: MessageSummary[];
|
|
150
|
+
latestVersion?: VersionDetail;
|
|
97
151
|
files?: {
|
|
98
152
|
lang: string;
|
|
99
153
|
meta: Record<string, any>;
|
|
@@ -101,26 +155,30 @@ type ChatsCreateResponse = {
|
|
|
101
155
|
}[];
|
|
102
156
|
demo?: string;
|
|
103
157
|
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
158
|
};
|
|
110
|
-
interface
|
|
111
|
-
|
|
112
|
-
data: ChatSummary[];
|
|
159
|
+
interface ChatsUpdateRequest {
|
|
160
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
113
161
|
}
|
|
114
|
-
|
|
162
|
+
type ChatsUpdateResponse = {
|
|
115
163
|
id: string;
|
|
116
164
|
object: 'chat';
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
type ChatsGetByIdResponse = ChatDetail;
|
|
120
|
-
interface ChatsUpdateRequest {
|
|
165
|
+
url: string;
|
|
166
|
+
shareable: boolean;
|
|
121
167
|
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
122
|
-
|
|
123
|
-
|
|
168
|
+
title?: string;
|
|
169
|
+
updatedAt?: string;
|
|
170
|
+
favorite: boolean;
|
|
171
|
+
authorId: string;
|
|
172
|
+
messages: MessageSummary[];
|
|
173
|
+
latestVersion?: VersionDetail;
|
|
174
|
+
files?: {
|
|
175
|
+
lang: string;
|
|
176
|
+
meta: Record<string, any>;
|
|
177
|
+
source: string;
|
|
178
|
+
}[];
|
|
179
|
+
demo?: string;
|
|
180
|
+
text: string;
|
|
181
|
+
};
|
|
124
182
|
interface ChatsFavoriteRequest {
|
|
125
183
|
isFavorite: boolean;
|
|
126
184
|
}
|
|
@@ -132,9 +190,28 @@ interface ChatsFavoriteResponse {
|
|
|
132
190
|
interface ChatsForkRequest {
|
|
133
191
|
versionId?: string;
|
|
134
192
|
}
|
|
135
|
-
type ChatsForkResponse =
|
|
193
|
+
type ChatsForkResponse = {
|
|
194
|
+
id: string;
|
|
195
|
+
object: 'chat';
|
|
196
|
+
url: string;
|
|
197
|
+
shareable: boolean;
|
|
198
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
199
|
+
title?: string;
|
|
200
|
+
updatedAt?: string;
|
|
201
|
+
favorite: boolean;
|
|
202
|
+
authorId: string;
|
|
203
|
+
messages: MessageSummary[];
|
|
204
|
+
latestVersion?: VersionDetail;
|
|
205
|
+
files?: {
|
|
206
|
+
lang: string;
|
|
207
|
+
meta: Record<string, any>;
|
|
208
|
+
source: string;
|
|
209
|
+
}[];
|
|
210
|
+
demo?: string;
|
|
211
|
+
text: string;
|
|
212
|
+
};
|
|
136
213
|
type ProjectsGetByChatIdResponse = ProjectDetail;
|
|
137
|
-
interface
|
|
214
|
+
interface ChatsSendMessageRequest {
|
|
138
215
|
message: string;
|
|
139
216
|
attachments?: {
|
|
140
217
|
url: string;
|
|
@@ -145,7 +222,32 @@ interface ChatsCreateMessageRequest {
|
|
|
145
222
|
thinking?: boolean;
|
|
146
223
|
};
|
|
147
224
|
}
|
|
148
|
-
type
|
|
225
|
+
type ChatsSendMessageResponse = {
|
|
226
|
+
id: string;
|
|
227
|
+
object: 'chat';
|
|
228
|
+
url: string;
|
|
229
|
+
shareable: boolean;
|
|
230
|
+
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
231
|
+
title?: string;
|
|
232
|
+
updatedAt?: string;
|
|
233
|
+
favorite: boolean;
|
|
234
|
+
authorId: string;
|
|
235
|
+
messages: MessageSummary[];
|
|
236
|
+
latestVersion?: VersionDetail;
|
|
237
|
+
files?: {
|
|
238
|
+
lang: string;
|
|
239
|
+
meta: Record<string, any>;
|
|
240
|
+
source: string;
|
|
241
|
+
}[];
|
|
242
|
+
demo?: string;
|
|
243
|
+
text: string;
|
|
244
|
+
modelConfiguration: {
|
|
245
|
+
modelId: 'v0-1.5-sm' | 'v0-1.5-md' | 'v0-1.5-lg';
|
|
246
|
+
imageGenerations?: boolean;
|
|
247
|
+
thinking?: boolean;
|
|
248
|
+
};
|
|
249
|
+
chatId: string;
|
|
250
|
+
};
|
|
149
251
|
interface ChatsGetMetadataResponse {
|
|
150
252
|
git: {
|
|
151
253
|
branch: string;
|
|
@@ -258,9 +360,6 @@ interface UserGetScopesResponse {
|
|
|
258
360
|
object: 'list';
|
|
259
361
|
data: ScopeSummary[];
|
|
260
362
|
}
|
|
261
|
-
interface NotificationsDeviceTokenDeviceIdDeleteResponse {
|
|
262
|
-
success: boolean;
|
|
263
|
-
}
|
|
264
363
|
interface V0ClientConfig {
|
|
265
364
|
apiKey?: string;
|
|
266
365
|
baseUrl?: string;
|
|
@@ -288,9 +387,9 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
288
387
|
fork(params: {
|
|
289
388
|
chatId: string;
|
|
290
389
|
} & ChatsForkRequest): Promise<ChatsForkResponse>;
|
|
291
|
-
|
|
390
|
+
sendMessage(params: {
|
|
292
391
|
chatId: string;
|
|
293
|
-
} &
|
|
392
|
+
} & ChatsSendMessageRequest): Promise<ChatsSendMessageResponse>;
|
|
294
393
|
getMetadata(params: {
|
|
295
394
|
chatId: string;
|
|
296
395
|
}): Promise<ChatsGetMetadataResponse>;
|
|
@@ -339,15 +438,6 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
339
438
|
getPlan(): Promise<UserGetPlanResponse>;
|
|
340
439
|
getScopes(): Promise<UserGetScopesResponse>;
|
|
341
440
|
};
|
|
342
|
-
notifications: {
|
|
343
|
-
deviceToken: {
|
|
344
|
-
deviceId: {
|
|
345
|
-
delete(params: {
|
|
346
|
-
deviceId: string;
|
|
347
|
-
}): Promise<NotificationsDeviceTokenDeviceIdDeleteResponse>;
|
|
348
|
-
};
|
|
349
|
-
};
|
|
350
|
-
};
|
|
351
441
|
};
|
|
352
442
|
declare const v0: {
|
|
353
443
|
chats: {
|
|
@@ -372,9 +462,9 @@ declare const v0: {
|
|
|
372
462
|
fork(params: {
|
|
373
463
|
chatId: string;
|
|
374
464
|
} & ChatsForkRequest): Promise<ChatsForkResponse>;
|
|
375
|
-
|
|
465
|
+
sendMessage(params: {
|
|
376
466
|
chatId: string;
|
|
377
|
-
} &
|
|
467
|
+
} & ChatsSendMessageRequest): Promise<ChatsSendMessageResponse>;
|
|
378
468
|
getMetadata(params: {
|
|
379
469
|
chatId: string;
|
|
380
470
|
}): Promise<ChatsGetMetadataResponse>;
|
|
@@ -423,15 +513,6 @@ declare const v0: {
|
|
|
423
513
|
getPlan(): Promise<UserGetPlanResponse>;
|
|
424
514
|
getScopes(): Promise<UserGetScopesResponse>;
|
|
425
515
|
};
|
|
426
|
-
notifications: {
|
|
427
|
-
deviceToken: {
|
|
428
|
-
deviceId: {
|
|
429
|
-
delete(params: {
|
|
430
|
-
deviceId: string;
|
|
431
|
-
}): Promise<NotificationsDeviceTokenDeviceIdDeleteResponse>;
|
|
432
|
-
};
|
|
433
|
-
};
|
|
434
|
-
};
|
|
435
516
|
};
|
|
436
517
|
|
|
437
518
|
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: {\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 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 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;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;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;;;"}
|
package/dist/index.js
CHANGED
|
@@ -110,7 +110,7 @@ function createClient(config = {}) {
|
|
|
110
110
|
body
|
|
111
111
|
});
|
|
112
112
|
},
|
|
113
|
-
async
|
|
113
|
+
async sendMessage (params) {
|
|
114
114
|
const pathParams = {
|
|
115
115
|
chatId: params.chatId
|
|
116
116
|
};
|
|
@@ -256,20 +256,6 @@ function createClient(config = {}) {
|
|
|
256
256
|
async getScopes () {
|
|
257
257
|
return fetcher(`/user/scopes`, 'GET', {});
|
|
258
258
|
}
|
|
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
259
|
}
|
|
274
260
|
};
|
|
275
261
|
}
|