v0-sdk 0.2.3 → 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 +55 -0
- package/dist/index.d.ts +122 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -179,6 +179,14 @@ function createClient(config = {}) {
|
|
|
179
179
|
body
|
|
180
180
|
});
|
|
181
181
|
},
|
|
182
|
+
async getById (params) {
|
|
183
|
+
const pathParams = {
|
|
184
|
+
projectId: params.projectId
|
|
185
|
+
};
|
|
186
|
+
return fetcher(`/projects/${pathParams.projectId}`, 'GET', {
|
|
187
|
+
pathParams
|
|
188
|
+
});
|
|
189
|
+
},
|
|
182
190
|
async assign (params) {
|
|
183
191
|
const pathParams = {
|
|
184
192
|
projectId: params.projectId
|
|
@@ -217,6 +225,53 @@ function createClient(config = {}) {
|
|
|
217
225
|
});
|
|
218
226
|
}
|
|
219
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
|
+
},
|
|
220
275
|
integrations: {
|
|
221
276
|
vercel: {
|
|
222
277
|
projects: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +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';
|
|
7
6
|
name?: string;
|
|
8
7
|
/** @deprecated */
|
|
9
8
|
title?: string;
|
|
10
9
|
updatedAt?: string;
|
|
11
10
|
favorite: boolean;
|
|
12
11
|
authorId: string;
|
|
13
|
-
messages: Array<{
|
|
14
|
-
id: string;
|
|
15
|
-
object: 'message';
|
|
16
|
-
content: string;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
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';
|
|
19
|
-
role: 'user' | 'assistant';
|
|
20
|
-
}>;
|
|
21
12
|
latestVersion?: {
|
|
22
13
|
id: string;
|
|
23
14
|
object: 'version';
|
|
@@ -28,6 +19,15 @@ type ChatDetail = {
|
|
|
28
19
|
content: string;
|
|
29
20
|
}[];
|
|
30
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
|
+
}>;
|
|
31
31
|
files?: {
|
|
32
32
|
lang: string;
|
|
33
33
|
meta: Record<string, any>;
|
|
@@ -49,7 +49,7 @@ type ChatSummary = {
|
|
|
49
49
|
name?: string;
|
|
50
50
|
/** @deprecated */
|
|
51
51
|
title?: string;
|
|
52
|
-
updatedAt
|
|
52
|
+
updatedAt?: string;
|
|
53
53
|
favorite: boolean;
|
|
54
54
|
authorId: string;
|
|
55
55
|
latestVersion?: {
|
|
@@ -58,6 +58,20 @@ type ChatSummary = {
|
|
|
58
58
|
status: 'pending' | 'completed' | 'failed';
|
|
59
59
|
};
|
|
60
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
|
+
}
|
|
61
75
|
type MessageDetail = {
|
|
62
76
|
id: string;
|
|
63
77
|
object: 'message';
|
|
@@ -83,7 +97,30 @@ type MessageSummary = {
|
|
|
83
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';
|
|
84
98
|
role: 'user' | 'assistant';
|
|
85
99
|
};
|
|
86
|
-
|
|
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 {
|
|
87
124
|
id: string;
|
|
88
125
|
object: 'project';
|
|
89
126
|
name: string;
|
|
@@ -152,17 +189,17 @@ interface ChatsInitRequest {
|
|
|
152
189
|
type ChatsInitResponse = {
|
|
153
190
|
id: string;
|
|
154
191
|
object: 'chat';
|
|
155
|
-
url: string;
|
|
156
192
|
shareable: boolean;
|
|
157
|
-
privacy
|
|
193
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
158
194
|
name?: string;
|
|
159
195
|
/** @deprecated */
|
|
160
196
|
title?: string;
|
|
161
197
|
updatedAt?: string;
|
|
162
198
|
favorite: boolean;
|
|
163
199
|
authorId: string;
|
|
164
|
-
messages: MessageSummary[];
|
|
165
200
|
latestVersion?: VersionDetail;
|
|
201
|
+
url: string;
|
|
202
|
+
messages: MessageSummary[];
|
|
166
203
|
files?: {
|
|
167
204
|
lang: string;
|
|
168
205
|
meta: Record<string, any>;
|
|
@@ -179,17 +216,17 @@ interface ChatsDeleteResponse {
|
|
|
179
216
|
type ChatsGetByIdResponse = {
|
|
180
217
|
id: string;
|
|
181
218
|
object: 'chat';
|
|
182
|
-
url: string;
|
|
183
219
|
shareable: boolean;
|
|
184
|
-
privacy
|
|
220
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
185
221
|
name?: string;
|
|
186
222
|
/** @deprecated */
|
|
187
223
|
title?: string;
|
|
188
224
|
updatedAt?: string;
|
|
189
225
|
favorite: boolean;
|
|
190
226
|
authorId: string;
|
|
191
|
-
messages: MessageSummary[];
|
|
192
227
|
latestVersion?: VersionDetail;
|
|
228
|
+
url: string;
|
|
229
|
+
messages: MessageSummary[];
|
|
193
230
|
files?: {
|
|
194
231
|
lang: string;
|
|
195
232
|
meta: Record<string, any>;
|
|
@@ -204,17 +241,17 @@ interface ChatsUpdateRequest {
|
|
|
204
241
|
type ChatsUpdateResponse = {
|
|
205
242
|
id: string;
|
|
206
243
|
object: 'chat';
|
|
207
|
-
url: string;
|
|
208
244
|
shareable: boolean;
|
|
209
|
-
privacy
|
|
245
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
210
246
|
name?: string;
|
|
211
247
|
/** @deprecated */
|
|
212
248
|
title?: string;
|
|
213
249
|
updatedAt?: string;
|
|
214
250
|
favorite: boolean;
|
|
215
251
|
authorId: string;
|
|
216
|
-
messages: MessageSummary[];
|
|
217
252
|
latestVersion?: VersionDetail;
|
|
253
|
+
url: string;
|
|
254
|
+
messages: MessageSummary[];
|
|
218
255
|
files?: {
|
|
219
256
|
lang: string;
|
|
220
257
|
meta: Record<string, any>;
|
|
@@ -237,17 +274,17 @@ interface ChatsForkRequest {
|
|
|
237
274
|
type ChatsForkResponse = {
|
|
238
275
|
id: string;
|
|
239
276
|
object: 'chat';
|
|
240
|
-
url: string;
|
|
241
277
|
shareable: boolean;
|
|
242
|
-
privacy
|
|
278
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
243
279
|
name?: string;
|
|
244
280
|
/** @deprecated */
|
|
245
281
|
title?: string;
|
|
246
282
|
updatedAt?: string;
|
|
247
283
|
favorite: boolean;
|
|
248
284
|
authorId: string;
|
|
249
|
-
messages: MessageSummary[];
|
|
250
285
|
latestVersion?: VersionDetail;
|
|
286
|
+
url: string;
|
|
287
|
+
messages: MessageSummary[];
|
|
251
288
|
files?: {
|
|
252
289
|
lang: string;
|
|
253
290
|
meta: Record<string, any>;
|
|
@@ -271,17 +308,17 @@ interface ChatsSendMessageRequest {
|
|
|
271
308
|
type ChatsSendMessageResponse = {
|
|
272
309
|
id: string;
|
|
273
310
|
object: 'chat';
|
|
274
|
-
url: string;
|
|
275
311
|
shareable: boolean;
|
|
276
|
-
privacy
|
|
312
|
+
privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted';
|
|
277
313
|
name?: string;
|
|
278
314
|
/** @deprecated */
|
|
279
315
|
title?: string;
|
|
280
316
|
updatedAt?: string;
|
|
281
317
|
favorite: boolean;
|
|
282
318
|
authorId: string;
|
|
283
|
-
messages: MessageSummary[];
|
|
284
319
|
latestVersion?: VersionDetail;
|
|
320
|
+
url: string;
|
|
321
|
+
messages: MessageSummary[];
|
|
285
322
|
files?: {
|
|
286
323
|
lang: string;
|
|
287
324
|
meta: Record<string, any>;
|
|
@@ -322,6 +359,30 @@ interface DeploymentsFindErrorsResponse {
|
|
|
322
359
|
errorType?: string;
|
|
323
360
|
formattedError?: string;
|
|
324
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
|
+
}
|
|
325
386
|
interface IntegrationsVercelProjectsFindResponse {
|
|
326
387
|
object: 'list';
|
|
327
388
|
data: VercelProjectDetail[];
|
|
@@ -333,7 +394,7 @@ interface IntegrationsVercelProjectsCreateRequest {
|
|
|
333
394
|
type IntegrationsVercelProjectsCreateResponse = VercelProjectDetail;
|
|
334
395
|
interface ProjectsFindResponse {
|
|
335
396
|
object: 'list';
|
|
336
|
-
data:
|
|
397
|
+
data: ProjectSummary[];
|
|
337
398
|
}
|
|
338
399
|
interface ProjectsCreateRequest {
|
|
339
400
|
name: string;
|
|
@@ -346,6 +407,7 @@ interface ProjectsCreateRequest {
|
|
|
346
407
|
instructions?: string;
|
|
347
408
|
}
|
|
348
409
|
type ProjectsCreateResponse = ProjectDetail;
|
|
410
|
+
type ProjectsGetByIdResponse = ProjectDetail;
|
|
349
411
|
interface ProjectsAssignRequest {
|
|
350
412
|
chatId: string;
|
|
351
413
|
}
|
|
@@ -453,6 +515,9 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
453
515
|
}): Promise<ProjectsGetByChatIdResponse>;
|
|
454
516
|
find(): Promise<ProjectsFindResponse>;
|
|
455
517
|
create(params: ProjectsCreateRequest): Promise<ProjectsCreateResponse>;
|
|
518
|
+
getById(params: {
|
|
519
|
+
projectId: string;
|
|
520
|
+
}): Promise<ProjectsGetByIdResponse>;
|
|
456
521
|
assign(params: {
|
|
457
522
|
projectId: string;
|
|
458
523
|
} & ProjectsAssignRequest): Promise<ProjectsAssignResponse>;
|
|
@@ -466,6 +531,19 @@ declare function createClient(config?: V0ClientConfig): {
|
|
|
466
531
|
deploymentId: string;
|
|
467
532
|
}): Promise<DeploymentsFindErrorsResponse>;
|
|
468
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
|
+
};
|
|
469
547
|
integrations: {
|
|
470
548
|
vercel: {
|
|
471
549
|
projects: {
|
|
@@ -529,6 +607,9 @@ declare const v0: {
|
|
|
529
607
|
}): Promise<ProjectsGetByChatIdResponse>;
|
|
530
608
|
find(): Promise<ProjectsFindResponse>;
|
|
531
609
|
create(params: ProjectsCreateRequest): Promise<ProjectsCreateResponse>;
|
|
610
|
+
getById(params: {
|
|
611
|
+
projectId: string;
|
|
612
|
+
}): Promise<ProjectsGetByIdResponse>;
|
|
532
613
|
assign(params: {
|
|
533
614
|
projectId: string;
|
|
534
615
|
} & ProjectsAssignRequest): Promise<ProjectsAssignResponse>;
|
|
@@ -542,6 +623,19 @@ declare const v0: {
|
|
|
542
623
|
deploymentId: string;
|
|
543
624
|
}): Promise<DeploymentsFindErrorsResponse>;
|
|
544
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
|
+
};
|
|
545
639
|
integrations: {
|
|
546
640
|
vercel: {
|
|
547
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 name?: string\n /** @deprecated */\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 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 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 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 url: string\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 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 name?: string\n /** @deprecated */\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 name?: string\n /** @deprecated */\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 name?: string\n /** @deprecated */\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 name?: string\n /** @deprecated */\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 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 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;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;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;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;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
|
@@ -177,6 +177,14 @@ function createClient(config = {}) {
|
|
|
177
177
|
body
|
|
178
178
|
});
|
|
179
179
|
},
|
|
180
|
+
async getById (params) {
|
|
181
|
+
const pathParams = {
|
|
182
|
+
projectId: params.projectId
|
|
183
|
+
};
|
|
184
|
+
return fetcher(`/projects/${pathParams.projectId}`, 'GET', {
|
|
185
|
+
pathParams
|
|
186
|
+
});
|
|
187
|
+
},
|
|
180
188
|
async assign (params) {
|
|
181
189
|
const pathParams = {
|
|
182
190
|
projectId: params.projectId
|
|
@@ -215,6 +223,53 @@ function createClient(config = {}) {
|
|
|
215
223
|
});
|
|
216
224
|
}
|
|
217
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
|
+
},
|
|
218
273
|
integrations: {
|
|
219
274
|
vercel: {
|
|
220
275
|
projects: {
|