@chatsdk-dev/api-client 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/client/client.gen.d.ts +3 -0
- package/dist/generated/client/client.gen.d.ts.map +1 -0
- package/dist/generated/client/client.gen.js +235 -0
- package/dist/generated/client/index.d.ts +9 -0
- package/dist/generated/client/index.d.ts.map +1 -0
- package/dist/generated/client/index.js +6 -0
- package/dist/generated/client/types.gen.d.ts +118 -0
- package/dist/generated/client/types.gen.d.ts.map +1 -0
- package/dist/generated/client/types.gen.js +2 -0
- package/dist/generated/client/utils.gen.d.ts +34 -0
- package/dist/generated/client/utils.gen.d.ts.map +1 -0
- package/dist/generated/client/utils.gen.js +228 -0
- package/dist/generated/client.gen.d.ts +13 -0
- package/dist/generated/client.gen.d.ts.map +1 -0
- package/dist/generated/client.gen.js +3 -0
- package/dist/generated/core/auth.gen.d.ts +19 -0
- package/dist/generated/core/auth.gen.d.ts.map +1 -0
- package/dist/generated/core/auth.gen.js +14 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +26 -0
- package/dist/generated/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/bodySerializer.gen.js +57 -0
- package/dist/generated/core/params.gen.d.ts +44 -0
- package/dist/generated/core/params.gen.d.ts.map +1 -0
- package/dist/generated/core/params.gen.js +100 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +34 -0
- package/dist/generated/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/pathSerializer.gen.js +106 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/queryKeySerializer.gen.js +92 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/generated/core/serverSentEvents.gen.js +133 -0
- package/dist/generated/core/types.gen.d.ts +79 -0
- package/dist/generated/core/types.gen.d.ts.map +1 -0
- package/dist/generated/core/types.gen.js +2 -0
- package/dist/generated/core/utils.gen.d.ts +20 -0
- package/dist/generated/core/utils.gen.d.ts.map +1 -0
- package/dist/generated/core/utils.gen.js +87 -0
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +2 -0
- package/dist/generated/sdk.gen.d.ts +76 -0
- package/dist/generated/sdk.gen.d.ts.map +1 -0
- package/dist/generated/sdk.gen.js +110 -0
- package/dist/generated/types.gen.d.ts +366 -0
- package/dist/generated/types.gen.d.ts.map +1 -0
- package/dist/generated/types.gen.js +2 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/paths.gen.d.ts +12 -0
- package/dist/paths.gen.d.ts.map +1 -0
- package/dist/paths.gen.js +12 -0
- package/package.json +34 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
export type ClientOptions = {
|
|
2
|
+
baseUrl: `${string}://${string}/api/v1` | (string & {});
|
|
3
|
+
};
|
|
4
|
+
export type ChatBaseSettings = {
|
|
5
|
+
userId: string;
|
|
6
|
+
initialChatMessages?: Array<string>;
|
|
7
|
+
footer?: string;
|
|
8
|
+
inputPlaceholder: string;
|
|
9
|
+
suggestedMessages?: Array<string>;
|
|
10
|
+
withRegenerate: boolean;
|
|
11
|
+
withUserFeedback: boolean;
|
|
12
|
+
titleGenerationPrompt?: string;
|
|
13
|
+
hideChatWhenInsufficientCredits: boolean;
|
|
14
|
+
_id: string;
|
|
15
|
+
_creationTime: number;
|
|
16
|
+
};
|
|
17
|
+
export type ChatModelSettings = {
|
|
18
|
+
userId: string;
|
|
19
|
+
systemPrompt?: string;
|
|
20
|
+
temperature: number;
|
|
21
|
+
allowedModels: Array<{
|
|
22
|
+
modelId: string;
|
|
23
|
+
name: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
chef: string;
|
|
26
|
+
chefSlug: string;
|
|
27
|
+
providers: Array<string>;
|
|
28
|
+
consumption?: number;
|
|
29
|
+
}>;
|
|
30
|
+
defaultModel: {
|
|
31
|
+
modelId: string;
|
|
32
|
+
name: string;
|
|
33
|
+
displayName: string;
|
|
34
|
+
chef: string;
|
|
35
|
+
chefSlug: string;
|
|
36
|
+
providers: Array<string>;
|
|
37
|
+
consumption?: number;
|
|
38
|
+
};
|
|
39
|
+
_id: string;
|
|
40
|
+
_creationTime: number;
|
|
41
|
+
};
|
|
42
|
+
export type ChatAppearanceSettings = {
|
|
43
|
+
userId: string;
|
|
44
|
+
displayName: string;
|
|
45
|
+
colorScheme: 'light' | 'dark' | 'system';
|
|
46
|
+
icon?: {
|
|
47
|
+
id: string;
|
|
48
|
+
url: string;
|
|
49
|
+
};
|
|
50
|
+
primaryColor?: string;
|
|
51
|
+
_id: string;
|
|
52
|
+
_creationTime: number;
|
|
53
|
+
};
|
|
54
|
+
export type Chat = {
|
|
55
|
+
userId: string;
|
|
56
|
+
name?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
fileUploadSize: number;
|
|
59
|
+
chatBaseSettings: ChatBaseSettings | null;
|
|
60
|
+
chatModelSettings: ChatModelSettings | null;
|
|
61
|
+
chatAppearanceSettings: ChatAppearanceSettings | null;
|
|
62
|
+
conversations: Array<{
|
|
63
|
+
_id: string;
|
|
64
|
+
actor: {
|
|
65
|
+
id: string;
|
|
66
|
+
type: 'default' | 'tenant';
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
69
|
+
_id: string;
|
|
70
|
+
_creationTime: number;
|
|
71
|
+
};
|
|
72
|
+
export type ChatsGetData = {
|
|
73
|
+
body?: never;
|
|
74
|
+
path: {
|
|
75
|
+
chatId: string;
|
|
76
|
+
};
|
|
77
|
+
query?: never;
|
|
78
|
+
url: '/api/v1/chats/{chatId}';
|
|
79
|
+
};
|
|
80
|
+
export type ChatsGetErrors = {
|
|
81
|
+
/**
|
|
82
|
+
* Unauthorized – missing or invalid session/token. Authenticate via: (1) Convex JWT in Authorization header, or (2) API key via `Authorization: Bearer <api_key>` (keys with prefix `chat_`) or `x-api-key` header.
|
|
83
|
+
*/
|
|
84
|
+
401: {
|
|
85
|
+
error: string;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Chat not found
|
|
89
|
+
*/
|
|
90
|
+
404: {
|
|
91
|
+
error: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export type ChatsGetError = ChatsGetErrors[keyof ChatsGetErrors];
|
|
95
|
+
export type ChatsGetResponses = {
|
|
96
|
+
/**
|
|
97
|
+
* The full chat object with base, model, and appearance settings
|
|
98
|
+
*/
|
|
99
|
+
200: Chat;
|
|
100
|
+
};
|
|
101
|
+
export type ChatsGetResponse = ChatsGetResponses[keyof ChatsGetResponses];
|
|
102
|
+
export type ChatsCompletionData = {
|
|
103
|
+
body: {
|
|
104
|
+
model?: string;
|
|
105
|
+
messages: Array<{
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
}>;
|
|
108
|
+
};
|
|
109
|
+
path: {
|
|
110
|
+
chatId: string;
|
|
111
|
+
};
|
|
112
|
+
query?: never;
|
|
113
|
+
url: '/api/v1/chats/{chatId}/completion';
|
|
114
|
+
};
|
|
115
|
+
export type ChatsCompletionErrors = {
|
|
116
|
+
/**
|
|
117
|
+
* Unauthorized – missing or invalid session/token. Authenticate via: (1) Convex JWT in Authorization header, or (2) API key via `Authorization: Bearer <api_key>` (keys with prefix `chat_`) or `x-api-key` header.
|
|
118
|
+
*/
|
|
119
|
+
401: {
|
|
120
|
+
error: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Not enough enough credits to create a chat message
|
|
124
|
+
*/
|
|
125
|
+
402: {
|
|
126
|
+
error: string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
export type ChatsCompletionError = ChatsCompletionErrors[keyof ChatsCompletionErrors];
|
|
130
|
+
export type ChatsCompletionResponses = {
|
|
131
|
+
/**
|
|
132
|
+
* The chat stream
|
|
133
|
+
*/
|
|
134
|
+
200: string;
|
|
135
|
+
};
|
|
136
|
+
export type ChatsCompletionResponse = ChatsCompletionResponses[keyof ChatsCompletionResponses];
|
|
137
|
+
export type ChatsConversationsListData = {
|
|
138
|
+
body?: never;
|
|
139
|
+
path: {
|
|
140
|
+
chatId: string;
|
|
141
|
+
};
|
|
142
|
+
query: {
|
|
143
|
+
actorId: string;
|
|
144
|
+
};
|
|
145
|
+
url: '/api/v1/chats/{chatId}/conversations';
|
|
146
|
+
};
|
|
147
|
+
export type ChatsConversationsListErrors = {
|
|
148
|
+
/**
|
|
149
|
+
* Unauthorized – missing or invalid session/token. Authenticate via: (1) Convex JWT in Authorization header, or (2) API key via `Authorization: Bearer <api_key>` (keys with prefix `chat_`) or `x-api-key` header.
|
|
150
|
+
*/
|
|
151
|
+
401: {
|
|
152
|
+
error: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
export type ChatsConversationsListError = ChatsConversationsListErrors[keyof ChatsConversationsListErrors];
|
|
156
|
+
export type ChatsConversationsListResponses = {
|
|
157
|
+
/**
|
|
158
|
+
* The conversations
|
|
159
|
+
*/
|
|
160
|
+
200: {
|
|
161
|
+
conversations: Array<{
|
|
162
|
+
actor: {
|
|
163
|
+
id: string;
|
|
164
|
+
type: 'default' | 'tenant';
|
|
165
|
+
};
|
|
166
|
+
usage: {
|
|
167
|
+
messageCredits: number;
|
|
168
|
+
};
|
|
169
|
+
status: 'active' | 'archived';
|
|
170
|
+
summary?: string;
|
|
171
|
+
title?: string;
|
|
172
|
+
messages: Array<{
|
|
173
|
+
id: string;
|
|
174
|
+
role: 'user' | 'assistant' | 'system';
|
|
175
|
+
parts: Array<{
|
|
176
|
+
type: 'text';
|
|
177
|
+
text: string;
|
|
178
|
+
}>;
|
|
179
|
+
}>;
|
|
180
|
+
_id: string;
|
|
181
|
+
_creationTime: number;
|
|
182
|
+
}>;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
export type ChatsConversationsListResponse = ChatsConversationsListResponses[keyof ChatsConversationsListResponses];
|
|
186
|
+
export type ChatsConversationsCreateData = {
|
|
187
|
+
body: {
|
|
188
|
+
actorId: string;
|
|
189
|
+
};
|
|
190
|
+
headers?: {
|
|
191
|
+
'x-chatsdk-actor-id'?: string;
|
|
192
|
+
};
|
|
193
|
+
path: {
|
|
194
|
+
chatId: string;
|
|
195
|
+
};
|
|
196
|
+
query?: never;
|
|
197
|
+
url: '/api/v1/chats/{chatId}/conversations';
|
|
198
|
+
};
|
|
199
|
+
export type ChatsConversationsCreateErrors = {
|
|
200
|
+
/**
|
|
201
|
+
* Unauthorized – missing or invalid session/token. Authenticate via: (1) Convex JWT in Authorization header, or (2) API key via `Authorization: Bearer <api_key>` (keys with prefix `chat_`) or `x-api-key` header.
|
|
202
|
+
*/
|
|
203
|
+
401: {
|
|
204
|
+
error: string;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
export type ChatsConversationsCreateError = ChatsConversationsCreateErrors[keyof ChatsConversationsCreateErrors];
|
|
208
|
+
export type ChatsConversationsCreateResponses = {
|
|
209
|
+
/**
|
|
210
|
+
* The created conversation
|
|
211
|
+
*/
|
|
212
|
+
201: {
|
|
213
|
+
actor: {
|
|
214
|
+
id: string;
|
|
215
|
+
type: 'default' | 'tenant';
|
|
216
|
+
};
|
|
217
|
+
usage: {
|
|
218
|
+
messageCredits: number;
|
|
219
|
+
};
|
|
220
|
+
status: 'active' | 'archived';
|
|
221
|
+
summary?: string;
|
|
222
|
+
title?: string;
|
|
223
|
+
messages: Array<{
|
|
224
|
+
id: string;
|
|
225
|
+
role: 'user' | 'assistant' | 'system';
|
|
226
|
+
parts: Array<{
|
|
227
|
+
type: 'text';
|
|
228
|
+
text: string;
|
|
229
|
+
}>;
|
|
230
|
+
}>;
|
|
231
|
+
_id: string;
|
|
232
|
+
_creationTime: number;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
export type ChatsConversationsCreateResponse = ChatsConversationsCreateResponses[keyof ChatsConversationsCreateResponses];
|
|
236
|
+
export type ChatsConversationsDeleteData = {
|
|
237
|
+
body?: never;
|
|
238
|
+
path: {
|
|
239
|
+
chatId: string;
|
|
240
|
+
conversationId: string;
|
|
241
|
+
};
|
|
242
|
+
query?: never;
|
|
243
|
+
url: '/api/v1/chats/{chatId}/conversations/{conversationId}';
|
|
244
|
+
};
|
|
245
|
+
export type ChatsConversationsDeleteErrors = {
|
|
246
|
+
/**
|
|
247
|
+
* Unauthorized – missing or invalid session/token. Authenticate via: (1) Convex JWT in Authorization header, or (2) API key via `Authorization: Bearer <api_key>` (keys with prefix `chat_`) or `x-api-key` header.
|
|
248
|
+
*/
|
|
249
|
+
401: {
|
|
250
|
+
error: string;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export type ChatsConversationsDeleteError = ChatsConversationsDeleteErrors[keyof ChatsConversationsDeleteErrors];
|
|
254
|
+
export type ChatsConversationsGetData = {
|
|
255
|
+
body?: never;
|
|
256
|
+
path: {
|
|
257
|
+
chatId: string;
|
|
258
|
+
conversationId: string;
|
|
259
|
+
};
|
|
260
|
+
query?: never;
|
|
261
|
+
url: '/api/v1/chats/{chatId}/conversations/{conversationId}';
|
|
262
|
+
};
|
|
263
|
+
export type ChatsConversationsGetErrors = {
|
|
264
|
+
/**
|
|
265
|
+
* Unauthorized – missing or invalid session/token. Authenticate via: (1) Convex JWT in Authorization header, or (2) API key via `Authorization: Bearer <api_key>` (keys with prefix `chat_`) or `x-api-key` header.
|
|
266
|
+
*/
|
|
267
|
+
401: {
|
|
268
|
+
error: string;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
export type ChatsConversationsGetError = ChatsConversationsGetErrors[keyof ChatsConversationsGetErrors];
|
|
272
|
+
export type ChatsConversationsGetResponses = {
|
|
273
|
+
/**
|
|
274
|
+
* The conversation with all messages
|
|
275
|
+
*/
|
|
276
|
+
200: {
|
|
277
|
+
actor: {
|
|
278
|
+
id: string;
|
|
279
|
+
type: 'default' | 'tenant';
|
|
280
|
+
};
|
|
281
|
+
usage: {
|
|
282
|
+
messageCredits: number;
|
|
283
|
+
};
|
|
284
|
+
status: 'active' | 'archived';
|
|
285
|
+
summary?: string;
|
|
286
|
+
title?: string;
|
|
287
|
+
messages: Array<{
|
|
288
|
+
id: string;
|
|
289
|
+
role: 'user' | 'assistant' | 'system';
|
|
290
|
+
parts: Array<{
|
|
291
|
+
type: 'text';
|
|
292
|
+
text: string;
|
|
293
|
+
}>;
|
|
294
|
+
}>;
|
|
295
|
+
_id: string;
|
|
296
|
+
_creationTime: number;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
export type ChatsConversationsGetResponse = ChatsConversationsGetResponses[keyof ChatsConversationsGetResponses];
|
|
300
|
+
export type ChatsConversationsCompletionData = {
|
|
301
|
+
body: {
|
|
302
|
+
model?: string;
|
|
303
|
+
messages: Array<{
|
|
304
|
+
[key: string]: unknown;
|
|
305
|
+
}>;
|
|
306
|
+
};
|
|
307
|
+
path: {
|
|
308
|
+
chatId: string;
|
|
309
|
+
conversationId: string;
|
|
310
|
+
};
|
|
311
|
+
query?: never;
|
|
312
|
+
url: '/api/v1/chats/{chatId}/conversations/{conversationId}/completion';
|
|
313
|
+
};
|
|
314
|
+
export type ChatsConversationsCompletionErrors = {
|
|
315
|
+
/**
|
|
316
|
+
* Unauthorized – missing or invalid session/token. Authenticate via: (1) Convex JWT in Authorization header, or (2) API key via `Authorization: Bearer <api_key>` (keys with prefix `chat_`) or `x-api-key` header.
|
|
317
|
+
*/
|
|
318
|
+
401: {
|
|
319
|
+
error: string;
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Not enough enough credits to create a chat message
|
|
323
|
+
*/
|
|
324
|
+
402: {
|
|
325
|
+
error: string;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
export type ChatsConversationsCompletionError = ChatsConversationsCompletionErrors[keyof ChatsConversationsCompletionErrors];
|
|
329
|
+
export type ChatsConversationsCompletionResponses = {
|
|
330
|
+
/**
|
|
331
|
+
* The chat stream
|
|
332
|
+
*/
|
|
333
|
+
200: {
|
|
334
|
+
error: string;
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
export type ChatsConversationsCompletionResponse = ChatsConversationsCompletionResponses[keyof ChatsConversationsCompletionResponses];
|
|
338
|
+
export type ChatsConversationsGenerateTitleData = {
|
|
339
|
+
body?: never;
|
|
340
|
+
path: {
|
|
341
|
+
chatId: string;
|
|
342
|
+
conversationId: string;
|
|
343
|
+
};
|
|
344
|
+
query?: never;
|
|
345
|
+
url: '/api/v1/chats/{chatId}/conversations/{conversationId}/title';
|
|
346
|
+
};
|
|
347
|
+
export type ChatsConversationsGenerateTitleErrors = {
|
|
348
|
+
/**
|
|
349
|
+
* Unauthorized – missing or invalid session/token. Authenticate via: (1) Convex JWT in Authorization header, or (2) API key via `Authorization: Bearer <api_key>` (keys with prefix `chat_`) or `x-api-key` header.
|
|
350
|
+
*/
|
|
351
|
+
401: {
|
|
352
|
+
error: string;
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
export type ChatsConversationsGenerateTitleError = ChatsConversationsGenerateTitleErrors[keyof ChatsConversationsGenerateTitleErrors];
|
|
356
|
+
export type ChatsConversationsGenerateTitleResponses = {
|
|
357
|
+
/**
|
|
358
|
+
* The generated title and summary
|
|
359
|
+
*/
|
|
360
|
+
200: {
|
|
361
|
+
title: string;
|
|
362
|
+
summary: string;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
export type ChatsConversationsGenerateTitleResponse = ChatsConversationsGenerateTitleResponses[keyof ChatsConversationsGenerateTitleResponses];
|
|
366
|
+
//# sourceMappingURL=types.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.gen.d.ts","sourceRoot":"","sources":["../../src/generated/types.gen.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,GAAG,MAAM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AChD;;OAEG;IACH,GAAG,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,qCAAqC,CAAC,MAAM,qCAAqC,CAAC,CAAC;AAEtI,MAAM,MAAM,wCAAwC,GAAG;IACnD;;OAEG;IACH,GAAG,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG,wCAAwC,CAAC,MAAM,wCAAwC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./generated";
|
|
2
|
+
import { ChatSDK as ChatSDKBase } from "./generated";
|
|
3
|
+
import { Config } from "./generated/client";
|
|
4
|
+
import { OperationId } from "./paths.gen";
|
|
5
|
+
export type { Config };
|
|
6
|
+
export type ChatSDK = InstanceType<typeof ChatSDKBase> & {
|
|
7
|
+
getUrl(operationId: OperationId, pathParams?: Record<string, string | undefined>): string;
|
|
8
|
+
};
|
|
9
|
+
export declare function getClient(config: Partial<Config>): ChatSDK;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAiC,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAmB,WAAW,EAAE,MAAM,aAAa,CAAC;AAE3D,YAAY,EAAE,MAAM,EAAE,CAAC;AAWvB,MAAM,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,GAAG;IACvD,MAAM,CACJ,WAAW,EAAE,WAAW,EACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC9C,MAAM,CAAC;CACX,CAAC;AAEF,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAU1D"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export * from "./generated";
|
|
2
|
+
import { ChatSDK as ChatSDKBase } from "./generated";
|
|
3
|
+
import { createClient as _createClient } from "./generated/client";
|
|
4
|
+
import { OPERATION_PATHS } from "./paths.gen";
|
|
5
|
+
function _getClientKey(config) {
|
|
6
|
+
return JSON.stringify({
|
|
7
|
+
base: config.baseUrl,
|
|
8
|
+
headers: config.headers,
|
|
9
|
+
credentials: config.credentials,
|
|
10
|
+
mode: config.mode,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function getClient(config) {
|
|
14
|
+
const key = _getClientKey(config);
|
|
15
|
+
try {
|
|
16
|
+
return addGetUrl(ChatSDKBase.__registry.get(key));
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
const client = _createClient(config);
|
|
20
|
+
const sdk = new ChatSDKBase({ client, key });
|
|
21
|
+
ChatSDKBase.__registry.set(sdk, key);
|
|
22
|
+
return addGetUrl(sdk);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function addGetUrl(sdk) {
|
|
26
|
+
const client = sdk.client;
|
|
27
|
+
sdk.getUrl = (operationId, pathParams) => {
|
|
28
|
+
return client.buildUrl({
|
|
29
|
+
baseUrl: client.getConfig?.()?.baseUrl ?? "",
|
|
30
|
+
url: OPERATION_PATHS[operationId],
|
|
31
|
+
path: pathParams,
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
return sdk;
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const OPERATION_PATHS: {
|
|
2
|
+
readonly "chats.get": "/api/v1/chats/{chatId}";
|
|
3
|
+
readonly "chats.completion": "/api/v1/chats/{chatId}/completion";
|
|
4
|
+
readonly "chats.conversations.list": "/api/v1/chats/{chatId}/conversations";
|
|
5
|
+
readonly "chats.conversations.create": "/api/v1/chats/{chatId}/conversations";
|
|
6
|
+
readonly "chats.conversations.get": "/api/v1/chats/{chatId}/conversations/{conversationId}";
|
|
7
|
+
readonly "chats.conversations.delete": "/api/v1/chats/{chatId}/conversations/{conversationId}";
|
|
8
|
+
readonly "chats.conversations.completion": "/api/v1/chats/{chatId}/conversations/{conversationId}/completion";
|
|
9
|
+
readonly "chats.conversations.generateTitle": "/api/v1/chats/{chatId}/conversations/{conversationId}/title";
|
|
10
|
+
};
|
|
11
|
+
export type OperationId = keyof typeof OPERATION_PATHS;
|
|
12
|
+
//# sourceMappingURL=paths.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.gen.d.ts","sourceRoot":"","sources":["../src/paths.gen.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;;;;;;CASlB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// This file is auto-generated. Do not edit.
|
|
2
|
+
// Run: pnpm generate
|
|
3
|
+
export const OPERATION_PATHS = {
|
|
4
|
+
"chats.get": "/api/v1/chats/{chatId}",
|
|
5
|
+
"chats.completion": "/api/v1/chats/{chatId}/completion",
|
|
6
|
+
"chats.conversations.list": "/api/v1/chats/{chatId}/conversations",
|
|
7
|
+
"chats.conversations.create": "/api/v1/chats/{chatId}/conversations",
|
|
8
|
+
"chats.conversations.get": "/api/v1/chats/{chatId}/conversations/{conversationId}",
|
|
9
|
+
"chats.conversations.delete": "/api/v1/chats/{chatId}/conversations/{conversationId}",
|
|
10
|
+
"chats.conversations.completion": "/api/v1/chats/{chatId}/conversations/{conversationId}/completion",
|
|
11
|
+
"chats.conversations.generateTitle": "/api/v1/chats/{chatId}/conversations/{conversationId}/title"
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chatsdk-dev/api-client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"types": "./dist/generated/client/index.d.ts",
|
|
15
|
+
"default": "./dist/generated/client/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@hey-api/openapi-ts": "latest",
|
|
20
|
+
"eslint": "^9.39.2",
|
|
21
|
+
"typescript": "5.9.3",
|
|
22
|
+
"@chatsdk-dev/eslint-config": "0.0.0",
|
|
23
|
+
"@chatsdk-dev/typescript-config": "0.0.0"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"dev": "tsc --watch",
|
|
28
|
+
"spec:pull": "bash ./scripts/pull-spec.sh",
|
|
29
|
+
"generate": "openapi-ts && node ./scripts/generate-paths.js",
|
|
30
|
+
"sync": "pnpm spec:pull && pnpm generate",
|
|
31
|
+
"check-types": "tsc --noEmit",
|
|
32
|
+
"lint": "eslint ."
|
|
33
|
+
}
|
|
34
|
+
}
|