v0-sdk 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +56 -0
- package/dist/index.d.ts +137 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -62,6 +62,7 @@ function createClient(config = {}) {
|
|
|
62
62
|
},
|
|
63
63
|
async init (params) {
|
|
64
64
|
const body = {
|
|
65
|
+
name: params.name,
|
|
65
66
|
files: params.files,
|
|
66
67
|
chatPrivacy: params.chatPrivacy,
|
|
67
68
|
projectId: params.projectId
|
|
@@ -178,6 +179,14 @@ function createClient(config = {}) {
|
|
|
178
179
|
body
|
|
179
180
|
});
|
|
180
181
|
},
|
|
182
|
+
async getById (params) {
|
|
183
|
+
const pathParams = {
|
|
184
|
+
projectId: params.projectId
|
|
185
|
+
};
|
|
186
|
+
return fetcher(`/projects/${pathParams.projectId}`, 'GET', {
|
|
187
|
+
pathParams
|
|
188
|
+
});
|
|
189
|
+
},
|
|
181
190
|
async assign (params) {
|
|
182
191
|
const pathParams = {
|
|
183
192
|
projectId: params.projectId
|
|
@@ -216,6 +225,53 @@ function createClient(config = {}) {
|
|
|
216
225
|
});
|
|
217
226
|
}
|
|
218
227
|
},
|
|
228
|
+
hooks: {
|
|
229
|
+
async find () {
|
|
230
|
+
return fetcher(`/hooks`, 'GET', {});
|
|
231
|
+
},
|
|
232
|
+
async create (params) {
|
|
233
|
+
const body = {
|
|
234
|
+
name: params.name,
|
|
235
|
+
events: params.events,
|
|
236
|
+
chatId: params.chatId,
|
|
237
|
+
projectId: params.projectId,
|
|
238
|
+
url: params.url
|
|
239
|
+
};
|
|
240
|
+
return fetcher(`/hooks`, 'POST', {
|
|
241
|
+
body
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
async getById (params) {
|
|
245
|
+
const pathParams = {
|
|
246
|
+
hookId: params.hookId
|
|
247
|
+
};
|
|
248
|
+
return fetcher(`/hooks/${pathParams.hookId}`, 'GET', {
|
|
249
|
+
pathParams
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
async update (params) {
|
|
253
|
+
const pathParams = {
|
|
254
|
+
hookId: params.hookId
|
|
255
|
+
};
|
|
256
|
+
const body = {
|
|
257
|
+
name: params.name,
|
|
258
|
+
events: params.events,
|
|
259
|
+
url: params.url
|
|
260
|
+
};
|
|
261
|
+
return fetcher(`/hooks/${pathParams.hookId}`, 'PATCH', {
|
|
262
|
+
pathParams,
|
|
263
|
+
body
|
|
264
|
+
});
|
|
265
|
+
},
|
|
266
|
+
async delete (params) {
|
|
267
|
+
const pathParams = {
|
|
268
|
+
hookId: params.hookId
|
|
269
|
+
};
|
|
270
|
+
return fetcher(`/hooks/${pathParams.hookId}`, 'DELETE', {
|
|
271
|
+
pathParams
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
},
|
|
219
275
|
integrations: {
|
|
220
276
|
vercel: {
|
|
221
277
|
projects: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
type ChatDetail = {
|
|
2
2
|
id: string;
|
|
3
3
|
object: 'chat';
|
|
4
|
-
url: string;
|
|
5
4
|
shareable: boolean;
|
|
6
|
-
privacy
|
|
5
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
6
|
+
name?: string;
|
|
7
|
+
/** @deprecated */
|
|
7
8
|
title?: string;
|
|
8
9
|
updatedAt?: string;
|
|
9
10
|
favorite: boolean;
|
|
10
11
|
authorId: string;
|
|
11
|
-
messages: Array<{
|
|
12
|
-
id: string;
|
|
13
|
-
object: 'message';
|
|
14
|
-
content: string;
|
|
15
|
-
createdAt: string;
|
|
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
12
|
latestVersion?: {
|
|
20
13
|
id: string;
|
|
21
14
|
object: 'version';
|
|
@@ -26,6 +19,15 @@ type ChatDetail = {
|
|
|
26
19
|
content: string;
|
|
27
20
|
}[];
|
|
28
21
|
};
|
|
22
|
+
url: string;
|
|
23
|
+
messages: Array<{
|
|
24
|
+
id: string;
|
|
25
|
+
object: 'message';
|
|
26
|
+
content: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
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';
|
|
29
|
+
role: 'user' | 'assistant';
|
|
30
|
+
}>;
|
|
29
31
|
files?: {
|
|
30
32
|
lang: string;
|
|
31
33
|
meta: Record<string, any>;
|
|
@@ -44,8 +46,10 @@ type ChatSummary = {
|
|
|
44
46
|
object: 'chat';
|
|
45
47
|
shareable: boolean;
|
|
46
48
|
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
49
|
+
name?: string;
|
|
50
|
+
/** @deprecated */
|
|
47
51
|
title?: string;
|
|
48
|
-
updatedAt
|
|
52
|
+
updatedAt?: string;
|
|
49
53
|
favorite: boolean;
|
|
50
54
|
authorId: string;
|
|
51
55
|
latestVersion?: {
|
|
@@ -54,6 +58,20 @@ type ChatSummary = {
|
|
|
54
58
|
status: 'pending' | 'completed' | 'failed';
|
|
55
59
|
};
|
|
56
60
|
};
|
|
61
|
+
type HookDetail = {
|
|
62
|
+
id: string;
|
|
63
|
+
object: 'hook';
|
|
64
|
+
name: string;
|
|
65
|
+
events: Array<'chat.created' | 'chat.updated' | 'chat.deleted' | 'message.created' | 'message.updated' | 'message.deleted' | 'project.created' | 'project.updated' | 'project.deleted'>;
|
|
66
|
+
chatId?: string;
|
|
67
|
+
projectId?: string;
|
|
68
|
+
url: string;
|
|
69
|
+
};
|
|
70
|
+
interface HookSummary {
|
|
71
|
+
id: string;
|
|
72
|
+
object: 'hook';
|
|
73
|
+
name: string;
|
|
74
|
+
}
|
|
57
75
|
type MessageDetail = {
|
|
58
76
|
id: string;
|
|
59
77
|
object: 'message';
|
|
@@ -79,7 +97,30 @@ type MessageSummary = {
|
|
|
79
97
|
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
98
|
role: 'user' | 'assistant';
|
|
81
99
|
};
|
|
82
|
-
|
|
100
|
+
type ProjectDetail = {
|
|
101
|
+
id: string;
|
|
102
|
+
object: 'project';
|
|
103
|
+
name: string;
|
|
104
|
+
chats: Array<{
|
|
105
|
+
id: string;
|
|
106
|
+
object: 'chat';
|
|
107
|
+
shareable: boolean;
|
|
108
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
109
|
+
name?: string;
|
|
110
|
+
/** @deprecated */
|
|
111
|
+
title?: string;
|
|
112
|
+
updatedAt?: string;
|
|
113
|
+
favorite: boolean;
|
|
114
|
+
authorId: string;
|
|
115
|
+
latestVersion?: {
|
|
116
|
+
id: string;
|
|
117
|
+
object: 'version';
|
|
118
|
+
status: 'pending' | 'completed' | 'failed';
|
|
119
|
+
};
|
|
120
|
+
}>;
|
|
121
|
+
vercelProjectId?: string;
|
|
122
|
+
};
|
|
123
|
+
interface ProjectSummary {
|
|
83
124
|
id: string;
|
|
84
125
|
object: 'project';
|
|
85
126
|
name: string;
|
|
@@ -132,6 +173,7 @@ interface ChatsFindResponse {
|
|
|
132
173
|
data: ChatSummary[];
|
|
133
174
|
}
|
|
134
175
|
interface ChatsInitRequest {
|
|
176
|
+
name?: string;
|
|
135
177
|
files: Array<{
|
|
136
178
|
name: string;
|
|
137
179
|
url: string;
|
|
@@ -147,15 +189,17 @@ interface ChatsInitRequest {
|
|
|
147
189
|
type ChatsInitResponse = {
|
|
148
190
|
id: string;
|
|
149
191
|
object: 'chat';
|
|
150
|
-
url: string;
|
|
151
192
|
shareable: boolean;
|
|
152
|
-
privacy
|
|
193
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
194
|
+
name?: string;
|
|
195
|
+
/** @deprecated */
|
|
153
196
|
title?: string;
|
|
154
197
|
updatedAt?: string;
|
|
155
198
|
favorite: boolean;
|
|
156
199
|
authorId: string;
|
|
157
|
-
messages: MessageSummary[];
|
|
158
200
|
latestVersion?: VersionDetail;
|
|
201
|
+
url: string;
|
|
202
|
+
messages: MessageSummary[];
|
|
159
203
|
files?: {
|
|
160
204
|
lang: string;
|
|
161
205
|
meta: Record<string, any>;
|
|
@@ -172,15 +216,17 @@ interface ChatsDeleteResponse {
|
|
|
172
216
|
type ChatsGetByIdResponse = {
|
|
173
217
|
id: string;
|
|
174
218
|
object: 'chat';
|
|
175
|
-
url: string;
|
|
176
219
|
shareable: boolean;
|
|
177
|
-
privacy
|
|
220
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
221
|
+
name?: string;
|
|
222
|
+
/** @deprecated */
|
|
178
223
|
title?: string;
|
|
179
224
|
updatedAt?: string;
|
|
180
225
|
favorite: boolean;
|
|
181
226
|
authorId: string;
|
|
182
|
-
messages: MessageSummary[];
|
|
183
227
|
latestVersion?: VersionDetail;
|
|
228
|
+
url: string;
|
|
229
|
+
messages: MessageSummary[];
|
|
184
230
|
files?: {
|
|
185
231
|
lang: string;
|
|
186
232
|
meta: Record<string, any>;
|
|
@@ -195,15 +241,17 @@ interface ChatsUpdateRequest {
|
|
|
195
241
|
type ChatsUpdateResponse = {
|
|
196
242
|
id: string;
|
|
197
243
|
object: 'chat';
|
|
198
|
-
url: string;
|
|
199
244
|
shareable: boolean;
|
|
200
|
-
privacy
|
|
245
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
246
|
+
name?: string;
|
|
247
|
+
/** @deprecated */
|
|
201
248
|
title?: string;
|
|
202
249
|
updatedAt?: string;
|
|
203
250
|
favorite: boolean;
|
|
204
251
|
authorId: string;
|
|
205
|
-
messages: MessageSummary[];
|
|
206
252
|
latestVersion?: VersionDetail;
|
|
253
|
+
url: string;
|
|
254
|
+
messages: MessageSummary[];
|
|
207
255
|
files?: {
|
|
208
256
|
lang: string;
|
|
209
257
|
meta: Record<string, any>;
|
|
@@ -226,15 +274,17 @@ interface ChatsForkRequest {
|
|
|
226
274
|
type ChatsForkResponse = {
|
|
227
275
|
id: string;
|
|
228
276
|
object: 'chat';
|
|
229
|
-
url: string;
|
|
230
277
|
shareable: boolean;
|
|
231
|
-
privacy
|
|
278
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
279
|
+
name?: string;
|
|
280
|
+
/** @deprecated */
|
|
232
281
|
title?: string;
|
|
233
282
|
updatedAt?: string;
|
|
234
283
|
favorite: boolean;
|
|
235
284
|
authorId: string;
|
|
236
|
-
messages: MessageSummary[];
|
|
237
285
|
latestVersion?: VersionDetail;
|
|
286
|
+
url: string;
|
|
287
|
+
messages: MessageSummary[];
|
|
238
288
|
files?: {
|
|
239
289
|
lang: string;
|
|
240
290
|
meta: Record<string, any>;
|
|
@@ -258,15 +308,17 @@ interface ChatsSendMessageRequest {
|
|
|
258
308
|
type ChatsSendMessageResponse = {
|
|
259
309
|
id: string;
|
|
260
310
|
object: 'chat';
|
|
261
|
-
url: string;
|
|
262
311
|
shareable: boolean;
|
|
263
|
-
privacy
|
|
312
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
313
|
+
name?: string;
|
|
314
|
+
/** @deprecated */
|
|
264
315
|
title?: string;
|
|
265
316
|
updatedAt?: string;
|
|
266
317
|
favorite: boolean;
|
|
267
318
|
authorId: string;
|
|
268
|
-
messages: MessageSummary[];
|
|
269
319
|
latestVersion?: VersionDetail;
|
|
320
|
+
url: string;
|
|
321
|
+
messages: MessageSummary[];
|
|
270
322
|
files?: {
|
|
271
323
|
lang: string;
|
|
272
324
|
meta: Record<string, any>;
|
|
@@ -307,6 +359,30 @@ interface DeploymentsFindErrorsResponse {
|
|
|
307
359
|
errorType?: string;
|
|
308
360
|
formattedError?: string;
|
|
309
361
|
}
|
|
362
|
+
interface HooksFindResponse {
|
|
363
|
+
object: 'list';
|
|
364
|
+
data: HookSummary[];
|
|
365
|
+
}
|
|
366
|
+
interface HooksCreateRequest {
|
|
367
|
+
name: string;
|
|
368
|
+
events: Array<'chat.created' | 'chat.updated' | 'chat.deleted' | 'message.created' | 'message.updated' | 'message.deleted' | 'project.created' | 'project.updated' | 'project.deleted'>;
|
|
369
|
+
chatId?: string;
|
|
370
|
+
projectId?: string;
|
|
371
|
+
url: string;
|
|
372
|
+
}
|
|
373
|
+
type HooksCreateResponse = HookDetail;
|
|
374
|
+
type HooksGetByIdResponse = HookDetail;
|
|
375
|
+
interface HooksUpdateRequest {
|
|
376
|
+
name?: string;
|
|
377
|
+
events?: Array<'chat.created' | 'chat.updated' | 'chat.deleted' | 'message.created' | 'message.updated' | 'message.deleted' | 'project.created' | 'project.updated' | 'project.deleted'>;
|
|
378
|
+
url?: string;
|
|
379
|
+
}
|
|
380
|
+
type HooksUpdateResponse = HookDetail;
|
|
381
|
+
interface HooksDeleteResponse {
|
|
382
|
+
id: string;
|
|
383
|
+
object: 'hook';
|
|
384
|
+
deleted: true;
|
|
385
|
+
}
|
|
310
386
|
interface IntegrationsVercelProjectsFindResponse {
|
|
311
387
|
object: 'list';
|
|
312
388
|
data: VercelProjectDetail[];
|
|
@@ -318,7 +394,7 @@ interface IntegrationsVercelProjectsCreateRequest {
|
|
|
318
394
|
type IntegrationsVercelProjectsCreateResponse = VercelProjectDetail;
|
|
319
395
|
interface ProjectsFindResponse {
|
|
320
396
|
object: 'list';
|
|
321
|
-
data:
|
|
397
|
+
data: ProjectSummary[];
|
|
322
398
|
}
|
|
323
399
|
interface ProjectsCreateRequest {
|
|
324
400
|
name: string;
|
|
@@ -331,6 +407,7 @@ interface ProjectsCreateRequest {
|
|
|
331
407
|
instructions?: string;
|
|
332
408
|
}
|
|
333
409
|
type ProjectsCreateResponse = ProjectDetail;
|
|
410
|
+
type ProjectsGetByIdResponse = ProjectDetail;
|
|
334
411
|
interface ProjectsAssignRequest {
|
|
335
412
|
chatId: string;
|
|
336
413
|
}
|
|
@@ -438,6 +515,9 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
438
515
|
}): Promise<ProjectsGetByChatIdResponse>;
|
|
439
516
|
find(): Promise<ProjectsFindResponse>;
|
|
440
517
|
create(params: ProjectsCreateRequest): Promise<ProjectsCreateResponse>;
|
|
518
|
+
getById(params: {
|
|
519
|
+
projectId: string;
|
|
520
|
+
}): Promise<ProjectsGetByIdResponse>;
|
|
441
521
|
assign(params: {
|
|
442
522
|
projectId: string;
|
|
443
523
|
} & ProjectsAssignRequest): Promise<ProjectsAssignResponse>;
|
|
@@ -451,6 +531,19 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
451
531
|
deploymentId: string;
|
|
452
532
|
}): Promise<DeploymentsFindErrorsResponse>;
|
|
453
533
|
};
|
|
534
|
+
hooks: {
|
|
535
|
+
find(): Promise<HooksFindResponse>;
|
|
536
|
+
create(params: HooksCreateRequest): Promise<HooksCreateResponse>;
|
|
537
|
+
getById(params: {
|
|
538
|
+
hookId: string;
|
|
539
|
+
}): Promise<HooksGetByIdResponse>;
|
|
540
|
+
update(params: {
|
|
541
|
+
hookId: string;
|
|
542
|
+
} & HooksUpdateRequest): Promise<HooksUpdateResponse>;
|
|
543
|
+
delete(params: {
|
|
544
|
+
hookId: string;
|
|
545
|
+
}): Promise<HooksDeleteResponse>;
|
|
546
|
+
};
|
|
454
547
|
integrations: {
|
|
455
548
|
vercel: {
|
|
456
549
|
projects: {
|
|
@@ -514,6 +607,9 @@ declare const v0: {
|
|
|
514
607
|
}): Promise<ProjectsGetByChatIdResponse>;
|
|
515
608
|
find(): Promise<ProjectsFindResponse>;
|
|
516
609
|
create(params: ProjectsCreateRequest): Promise<ProjectsCreateResponse>;
|
|
610
|
+
getById(params: {
|
|
611
|
+
projectId: string;
|
|
612
|
+
}): Promise<ProjectsGetByIdResponse>;
|
|
517
613
|
assign(params: {
|
|
518
614
|
projectId: string;
|
|
519
615
|
} & ProjectsAssignRequest): Promise<ProjectsAssignResponse>;
|
|
@@ -527,6 +623,19 @@ declare const v0: {
|
|
|
527
623
|
deploymentId: string;
|
|
528
624
|
}): Promise<DeploymentsFindErrorsResponse>;
|
|
529
625
|
};
|
|
626
|
+
hooks: {
|
|
627
|
+
find(): Promise<HooksFindResponse>;
|
|
628
|
+
create(params: HooksCreateRequest): Promise<HooksCreateResponse>;
|
|
629
|
+
getById(params: {
|
|
630
|
+
hookId: string;
|
|
631
|
+
}): Promise<HooksGetByIdResponse>;
|
|
632
|
+
update(params: {
|
|
633
|
+
hookId: string;
|
|
634
|
+
} & HooksUpdateRequest): Promise<HooksUpdateResponse>;
|
|
635
|
+
delete(params: {
|
|
636
|
+
hookId: string;
|
|
637
|
+
}): Promise<HooksDeleteResponse>;
|
|
638
|
+
};
|
|
530
639
|
integrations: {
|
|
531
640
|
vercel: {
|
|
532
641
|
projects: {
|
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 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 ChatsInitRequest {\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 ChatsInitResponse = {\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 async init(params: ChatsInitRequest): Promise<ChatsInitResponse> {\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 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;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;;;"}
|
|
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 shareable: boolean\n privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n name?: string\n /** @deprecated */\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 files: {\n object: 'file'\n name: string\n content: string\n }[]\n }\n url: 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 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 name?: string\n /** @deprecated */\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 HookDetail = {\n id: string\n object: 'hook'\n name: string\n events: Array<\n | 'chat.created'\n | 'chat.updated'\n | 'chat.deleted'\n | 'message.created'\n | 'message.updated'\n | 'message.deleted'\n | 'project.created'\n | 'project.updated'\n | 'project.deleted'\n >\n chatId?: string\n projectId?: string\n url: string\n}\n\nexport type HookEventDetail = {\n id: string\n object: 'hookEvent'\n event:\n | 'chat.created'\n | 'chat.updated'\n | 'chat.deleted'\n | 'message.created'\n | 'message.updated'\n | 'message.deleted'\n | 'project.created'\n | 'project.updated'\n | 'project.deleted'\n status?: 'pending' | 'success' | 'error'\n createdAt: string\n}\n\nexport interface HookSummary {\n id: string\n object: 'hook'\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 type ProjectDetail = {\n id: string\n object: 'project'\n name: string\n chats: Array<{\n id: string\n object: 'chat'\n shareable: boolean\n privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n name?: string\n /** @deprecated */\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 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 ChatsInitRequest {\n name?: string\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 ChatsInitResponse = {\n id: string\n object: 'chat'\n shareable: boolean\n privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n name?: string\n /** @deprecated */\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n latestVersion?: VersionDetail\n url: string\n messages: MessageSummary[]\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 shareable: boolean\n privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n name?: string\n /** @deprecated */\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n latestVersion?: VersionDetail\n url: string\n messages: MessageSummary[]\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 shareable: boolean\n privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n name?: string\n /** @deprecated */\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n latestVersion?: VersionDetail\n url: string\n messages: MessageSummary[]\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 shareable: boolean\n privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n name?: string\n /** @deprecated */\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n latestVersion?: VersionDetail\n url: string\n messages: MessageSummary[]\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 shareable: boolean\n privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'\n name?: string\n /** @deprecated */\n title?: string\n updatedAt?: string\n favorite: boolean\n authorId: string\n latestVersion?: VersionDetail\n url: string\n messages: MessageSummary[]\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 HooksFindResponse {\n object: 'list'\n data: HookSummary[]\n}\n\nexport interface HooksCreateRequest {\n name: string\n events: Array<\n | 'chat.created'\n | 'chat.updated'\n | 'chat.deleted'\n | 'message.created'\n | 'message.updated'\n | 'message.deleted'\n | 'project.created'\n | 'project.updated'\n | 'project.deleted'\n >\n chatId?: string\n projectId?: string\n url: string\n}\n\nexport type HooksCreateResponse = HookDetail\n\nexport type HooksGetByIdResponse = HookDetail\n\nexport interface HooksUpdateRequest {\n name?: string\n events?: Array<\n | 'chat.created'\n | 'chat.updated'\n | 'chat.deleted'\n | 'message.created'\n | 'message.updated'\n | 'message.deleted'\n | 'project.created'\n | 'project.updated'\n | 'project.deleted'\n >\n url?: string\n}\n\nexport type HooksUpdateResponse = HookDetail\n\nexport interface HooksDeleteResponse {\n id: string\n object: 'hook'\n deleted: true\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: ProjectSummary[]\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 type ProjectsGetByIdResponse = 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 init(params: ChatsInitRequest): Promise<ChatsInitResponse> {\n const body = {\n name: params.name,\n files: params.files,\n chatPrivacy: params.chatPrivacy,\n projectId: params.projectId,\n }\n return fetcher(`/chats/init`, 'POST', { body })\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 getById(params: {\n projectId: string\n }): Promise<ProjectsGetByIdResponse> {\n const pathParams = { projectId: params.projectId }\n return fetcher(`/projects/${pathParams.projectId}`, 'GET', {\n pathParams,\n })\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 hooks: {\n async find(): Promise<HooksFindResponse> {\n return fetcher(`/hooks`, 'GET', {})\n },\n\n async create(params: HooksCreateRequest): Promise<HooksCreateResponse> {\n const body = {\n name: params.name,\n events: params.events,\n chatId: params.chatId,\n projectId: params.projectId,\n url: params.url,\n }\n return fetcher(`/hooks`, 'POST', { body })\n },\n\n async getById(params: { hookId: string }): Promise<HooksGetByIdResponse> {\n const pathParams = { hookId: params.hookId }\n return fetcher(`/hooks/${pathParams.hookId}`, 'GET', { pathParams })\n },\n\n async update(\n params: { hookId: string } & HooksUpdateRequest,\n ): Promise<HooksUpdateResponse> {\n const pathParams = { hookId: params.hookId }\n const body = {\n name: params.name,\n events: params.events,\n url: params.url,\n }\n return fetcher(`/hooks/${pathParams.hookId}`, 'PATCH', {\n pathParams,\n body,\n })\n },\n\n async delete(params: { hookId: string }): Promise<HooksDeleteResponse> {\n const pathParams = { hookId: params.hookId }\n return fetcher(`/hooks/${pathParams.hookId}`, 'DELETE', { pathParams })\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;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQO;AACP;AACA;AACA;AACA;AACO;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;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;AACA;AACO;AACP;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;AACO;AACP;AACA;AACA;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;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;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;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;AACA;AACA;AACA;AACO;AACA;AACA;AACP;AACA;AACA;AACA;AACO;AACA;AACP;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;"}
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ function createClient(config = {}) {
|
|
|
60
60
|
},
|
|
61
61
|
async init (params) {
|
|
62
62
|
const body = {
|
|
63
|
+
name: params.name,
|
|
63
64
|
files: params.files,
|
|
64
65
|
chatPrivacy: params.chatPrivacy,
|
|
65
66
|
projectId: params.projectId
|
|
@@ -176,6 +177,14 @@ function createClient(config = {}) {
|
|
|
176
177
|
body
|
|
177
178
|
});
|
|
178
179
|
},
|
|
180
|
+
async getById (params) {
|
|
181
|
+
const pathParams = {
|
|
182
|
+
projectId: params.projectId
|
|
183
|
+
};
|
|
184
|
+
return fetcher(`/projects/${pathParams.projectId}`, 'GET', {
|
|
185
|
+
pathParams
|
|
186
|
+
});
|
|
187
|
+
},
|
|
179
188
|
async assign (params) {
|
|
180
189
|
const pathParams = {
|
|
181
190
|
projectId: params.projectId
|
|
@@ -214,6 +223,53 @@ function createClient(config = {}) {
|
|
|
214
223
|
});
|
|
215
224
|
}
|
|
216
225
|
},
|
|
226
|
+
hooks: {
|
|
227
|
+
async find () {
|
|
228
|
+
return fetcher(`/hooks`, 'GET', {});
|
|
229
|
+
},
|
|
230
|
+
async create (params) {
|
|
231
|
+
const body = {
|
|
232
|
+
name: params.name,
|
|
233
|
+
events: params.events,
|
|
234
|
+
chatId: params.chatId,
|
|
235
|
+
projectId: params.projectId,
|
|
236
|
+
url: params.url
|
|
237
|
+
};
|
|
238
|
+
return fetcher(`/hooks`, 'POST', {
|
|
239
|
+
body
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
async getById (params) {
|
|
243
|
+
const pathParams = {
|
|
244
|
+
hookId: params.hookId
|
|
245
|
+
};
|
|
246
|
+
return fetcher(`/hooks/${pathParams.hookId}`, 'GET', {
|
|
247
|
+
pathParams
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
async update (params) {
|
|
251
|
+
const pathParams = {
|
|
252
|
+
hookId: params.hookId
|
|
253
|
+
};
|
|
254
|
+
const body = {
|
|
255
|
+
name: params.name,
|
|
256
|
+
events: params.events,
|
|
257
|
+
url: params.url
|
|
258
|
+
};
|
|
259
|
+
return fetcher(`/hooks/${pathParams.hookId}`, 'PATCH', {
|
|
260
|
+
pathParams,
|
|
261
|
+
body
|
|
262
|
+
});
|
|
263
|
+
},
|
|
264
|
+
async delete (params) {
|
|
265
|
+
const pathParams = {
|
|
266
|
+
hookId: params.hookId
|
|
267
|
+
};
|
|
268
|
+
return fetcher(`/hooks/${pathParams.hookId}`, 'DELETE', {
|
|
269
|
+
pathParams
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
},
|
|
217
273
|
integrations: {
|
|
218
274
|
vercel: {
|
|
219
275
|
projects: {
|