@zdrops/ai-assistants-sdk 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/dist/index.cjs +401 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +551 -0
- package/dist/index.d.ts +551 -0
- package/dist/index.js +373 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
interface components {
|
|
2
|
+
schemas: {
|
|
3
|
+
RegisterDto: {
|
|
4
|
+
/** @example user@example.com */
|
|
5
|
+
email: string;
|
|
6
|
+
/** @example John */
|
|
7
|
+
firstName: string;
|
|
8
|
+
/** @example Doe */
|
|
9
|
+
lastName: string;
|
|
10
|
+
};
|
|
11
|
+
MessageResponseDto: {
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
LoginDto: {
|
|
15
|
+
/** @example user@example.com */
|
|
16
|
+
email: string;
|
|
17
|
+
};
|
|
18
|
+
/** @enum {string} */
|
|
19
|
+
OtpType: "registration" | "login" | "email_change";
|
|
20
|
+
VerifyOtpDto: {
|
|
21
|
+
/** @example user@example.com */
|
|
22
|
+
email: string;
|
|
23
|
+
/** @example 123456 */
|
|
24
|
+
code: string;
|
|
25
|
+
/** @example login */
|
|
26
|
+
type: components["schemas"]["OtpType"];
|
|
27
|
+
};
|
|
28
|
+
/** @enum {string} */
|
|
29
|
+
UserRole: "user" | "admin";
|
|
30
|
+
UserResponseDto: {
|
|
31
|
+
/** Format: uuid */
|
|
32
|
+
id: string;
|
|
33
|
+
/** @example user@example.com */
|
|
34
|
+
email: string;
|
|
35
|
+
/** @example John */
|
|
36
|
+
firstName: Record<string, never> | null;
|
|
37
|
+
/** @example Doe */
|
|
38
|
+
lastName: Record<string, never> | null;
|
|
39
|
+
role: components["schemas"]["UserRole"];
|
|
40
|
+
/** Format: date-time */
|
|
41
|
+
createdAt: string;
|
|
42
|
+
/** Format: date-time */
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
};
|
|
45
|
+
AuthResponseDto: {
|
|
46
|
+
accessToken: string;
|
|
47
|
+
refreshToken: string;
|
|
48
|
+
user: components["schemas"]["UserResponseDto"];
|
|
49
|
+
/** @description True if the user was just created and has no profile yet */
|
|
50
|
+
isNewUser: boolean;
|
|
51
|
+
};
|
|
52
|
+
GoogleAuthDto: {
|
|
53
|
+
/** @description Google ID token from frontend Sign-In */
|
|
54
|
+
idToken: string;
|
|
55
|
+
};
|
|
56
|
+
RefreshTokenDto: {
|
|
57
|
+
refreshToken: string;
|
|
58
|
+
};
|
|
59
|
+
TokensResponseDto: {
|
|
60
|
+
accessToken: string;
|
|
61
|
+
refreshToken: string;
|
|
62
|
+
};
|
|
63
|
+
UpdateProfileDto: {
|
|
64
|
+
/** @example John */
|
|
65
|
+
firstName?: string;
|
|
66
|
+
/** @example Doe */
|
|
67
|
+
lastName?: string;
|
|
68
|
+
};
|
|
69
|
+
RequestEmailChangeDto: {
|
|
70
|
+
/** @example new@example.com */
|
|
71
|
+
newEmail: string;
|
|
72
|
+
};
|
|
73
|
+
ConfirmEmailChangeDto: {
|
|
74
|
+
/** @example 123456 */
|
|
75
|
+
code: string;
|
|
76
|
+
/** @example new@example.com */
|
|
77
|
+
newEmail: string;
|
|
78
|
+
};
|
|
79
|
+
/** @enum {string} */
|
|
80
|
+
PlanType: "one_time";
|
|
81
|
+
PlanResponseDto: {
|
|
82
|
+
/** Format: uuid */
|
|
83
|
+
id: string;
|
|
84
|
+
/** Format: date-time */
|
|
85
|
+
createdAt: string;
|
|
86
|
+
/** Format: date-time */
|
|
87
|
+
updatedAt: string;
|
|
88
|
+
/** @example Pro Plan */
|
|
89
|
+
name: string;
|
|
90
|
+
/** @example Best plan for professionals */
|
|
91
|
+
description: Record<string, never> | null;
|
|
92
|
+
type: components["schemas"]["PlanType"];
|
|
93
|
+
/** @example 100 */
|
|
94
|
+
credits: number;
|
|
95
|
+
/** @example 999 */
|
|
96
|
+
priceCents: number;
|
|
97
|
+
/** @example usd */
|
|
98
|
+
currency: string;
|
|
99
|
+
isActive: boolean;
|
|
100
|
+
/** @example 0 */
|
|
101
|
+
sortOrder: number;
|
|
102
|
+
/**
|
|
103
|
+
* @example {
|
|
104
|
+
* "feature": "unlimited"
|
|
105
|
+
* }
|
|
106
|
+
*/
|
|
107
|
+
metadata?: Record<string, never>;
|
|
108
|
+
};
|
|
109
|
+
CreditBalanceResponseDto: {
|
|
110
|
+
/** @example 500 */
|
|
111
|
+
balance: number;
|
|
112
|
+
};
|
|
113
|
+
/** @enum {string} */
|
|
114
|
+
CreditTransactionType: "purchase" | "welcome" | "deduction" | "refund" | "adjustment";
|
|
115
|
+
CreditTransactionResponseDto: {
|
|
116
|
+
/** Format: uuid */
|
|
117
|
+
id: string;
|
|
118
|
+
/** Format: date-time */
|
|
119
|
+
createdAt: string;
|
|
120
|
+
/** Format: date-time */
|
|
121
|
+
updatedAt: string;
|
|
122
|
+
/** Format: uuid */
|
|
123
|
+
userId: string;
|
|
124
|
+
type: components["schemas"]["CreditTransactionType"];
|
|
125
|
+
/** @example 100 */
|
|
126
|
+
amount: number;
|
|
127
|
+
/** @example 600 */
|
|
128
|
+
balanceAfter: number;
|
|
129
|
+
referenceType: Record<string, never> | null;
|
|
130
|
+
/** Format: uuid */
|
|
131
|
+
referenceId: Record<string, never> | null;
|
|
132
|
+
description: Record<string, never> | null;
|
|
133
|
+
};
|
|
134
|
+
PurchaseCreditsDto: {
|
|
135
|
+
/** Format: uuid */
|
|
136
|
+
planId: string;
|
|
137
|
+
};
|
|
138
|
+
CreditBalanceEntityResponseDto: {
|
|
139
|
+
/** Format: uuid */
|
|
140
|
+
id: string;
|
|
141
|
+
/** Format: date-time */
|
|
142
|
+
createdAt: string;
|
|
143
|
+
/** Format: date-time */
|
|
144
|
+
updatedAt: string;
|
|
145
|
+
/** Format: uuid */
|
|
146
|
+
userId: string;
|
|
147
|
+
/** @example 500 */
|
|
148
|
+
balance: number;
|
|
149
|
+
};
|
|
150
|
+
PurchaseCreditsResponseDto: {
|
|
151
|
+
transaction: components["schemas"]["CreditTransactionResponseDto"];
|
|
152
|
+
balance: components["schemas"]["CreditBalanceEntityResponseDto"];
|
|
153
|
+
};
|
|
154
|
+
BillingResponseDto: {
|
|
155
|
+
/** Format: uuid */
|
|
156
|
+
id: string;
|
|
157
|
+
/** Format: date-time */
|
|
158
|
+
createdAt: string;
|
|
159
|
+
/** Format: date-time */
|
|
160
|
+
updatedAt: string;
|
|
161
|
+
/** @example John */
|
|
162
|
+
firstName: string;
|
|
163
|
+
/** @example Doe */
|
|
164
|
+
lastName: string;
|
|
165
|
+
/** @example Acme Inc. */
|
|
166
|
+
companyName?: Record<string, never> | null;
|
|
167
|
+
/** @example US123456789 */
|
|
168
|
+
taxId?: Record<string, never> | null;
|
|
169
|
+
/** @example 123 Main St */
|
|
170
|
+
street: string;
|
|
171
|
+
/** @example Suite 100 */
|
|
172
|
+
street2?: Record<string, never> | null;
|
|
173
|
+
/** @example New York */
|
|
174
|
+
city: string;
|
|
175
|
+
/** @example NY */
|
|
176
|
+
state?: Record<string, never> | null;
|
|
177
|
+
/** @example 10001 */
|
|
178
|
+
postalCode: string;
|
|
179
|
+
/**
|
|
180
|
+
* @description ISO 3166-1 alpha-2 country code
|
|
181
|
+
* @example US
|
|
182
|
+
*/
|
|
183
|
+
country: string;
|
|
184
|
+
/** @example +1-555-123-4567 */
|
|
185
|
+
phone?: Record<string, never> | null;
|
|
186
|
+
};
|
|
187
|
+
UpsertBillingDto: {
|
|
188
|
+
/** @example John */
|
|
189
|
+
firstName: string;
|
|
190
|
+
/** @example Doe */
|
|
191
|
+
lastName: string;
|
|
192
|
+
/** @example Acme Inc. */
|
|
193
|
+
companyName?: string;
|
|
194
|
+
/** @example US123456789 */
|
|
195
|
+
taxId?: string;
|
|
196
|
+
/** @example 123 Main St */
|
|
197
|
+
street: string;
|
|
198
|
+
/** @example Suite 100 */
|
|
199
|
+
street2?: string;
|
|
200
|
+
/** @example New York */
|
|
201
|
+
city: string;
|
|
202
|
+
/** @example NY */
|
|
203
|
+
state?: string;
|
|
204
|
+
/** @example 10001 */
|
|
205
|
+
postalCode: string;
|
|
206
|
+
/**
|
|
207
|
+
* @description ISO 3166-1 alpha-2 country code
|
|
208
|
+
* @example US
|
|
209
|
+
*/
|
|
210
|
+
country: string;
|
|
211
|
+
/** @example +1-555-123-4567 */
|
|
212
|
+
phone?: string;
|
|
213
|
+
};
|
|
214
|
+
PreferenceResponseDto: {
|
|
215
|
+
/** @example travel */
|
|
216
|
+
appKey: string;
|
|
217
|
+
/**
|
|
218
|
+
* @example {
|
|
219
|
+
* "theme": "dark",
|
|
220
|
+
* "language": "en"
|
|
221
|
+
* }
|
|
222
|
+
*/
|
|
223
|
+
preferences: Record<string, never>;
|
|
224
|
+
/** Format: date-time */
|
|
225
|
+
createdAt: string;
|
|
226
|
+
/** Format: date-time */
|
|
227
|
+
updatedAt: string;
|
|
228
|
+
};
|
|
229
|
+
UpdatePreferencesDto: {
|
|
230
|
+
/**
|
|
231
|
+
* @example {
|
|
232
|
+
* "theme": "dark",
|
|
233
|
+
* "language": "en"
|
|
234
|
+
* }
|
|
235
|
+
*/
|
|
236
|
+
preferences: Record<string, never>;
|
|
237
|
+
};
|
|
238
|
+
CreateConversationDto: {
|
|
239
|
+
title?: string;
|
|
240
|
+
/** @example travel */
|
|
241
|
+
appKey: string;
|
|
242
|
+
metadata?: Record<string, never>;
|
|
243
|
+
};
|
|
244
|
+
ConversationResponseDto: {
|
|
245
|
+
/** Format: uuid */
|
|
246
|
+
id: string;
|
|
247
|
+
/** Format: date-time */
|
|
248
|
+
createdAt: string;
|
|
249
|
+
/** Format: date-time */
|
|
250
|
+
updatedAt: string;
|
|
251
|
+
/** Format: uuid */
|
|
252
|
+
userId: string;
|
|
253
|
+
title?: Record<string, never> | null;
|
|
254
|
+
/** @example travel */
|
|
255
|
+
appKey: string;
|
|
256
|
+
/** @enum {string} */
|
|
257
|
+
status: "active" | "archived";
|
|
258
|
+
metadata: Record<string, never>;
|
|
259
|
+
lastMessageAt?: Record<string, never> | null;
|
|
260
|
+
/** @description Base64-encoded hero image data */
|
|
261
|
+
heroImageData?: Record<string, never> | null;
|
|
262
|
+
/** @description MIME type of the hero image */
|
|
263
|
+
heroMimeType?: Record<string, never> | null;
|
|
264
|
+
};
|
|
265
|
+
AddMessageDto: {
|
|
266
|
+
content: string;
|
|
267
|
+
metadata?: Record<string, never>;
|
|
268
|
+
};
|
|
269
|
+
ConversationMessageResponseDto: {
|
|
270
|
+
/** Format: uuid */
|
|
271
|
+
id: string;
|
|
272
|
+
/** Format: date-time */
|
|
273
|
+
createdAt: string;
|
|
274
|
+
/** Format: date-time */
|
|
275
|
+
updatedAt: string;
|
|
276
|
+
/** Format: uuid */
|
|
277
|
+
conversationId: string;
|
|
278
|
+
/** @enum {string} */
|
|
279
|
+
role: "user" | "assistant" | "system";
|
|
280
|
+
content: string;
|
|
281
|
+
metadata: Record<string, never>;
|
|
282
|
+
tokenCount?: Record<string, never> | null;
|
|
283
|
+
};
|
|
284
|
+
GenerateDto: {
|
|
285
|
+
content: string;
|
|
286
|
+
/** @default false */
|
|
287
|
+
isRefinement: boolean;
|
|
288
|
+
/** @example en */
|
|
289
|
+
locale?: string;
|
|
290
|
+
};
|
|
291
|
+
TriggerImageDto: {
|
|
292
|
+
/** @example hero */
|
|
293
|
+
slot: string;
|
|
294
|
+
/** @example Soft watercolour sketch of Reykjavik harbour, warm golden light */
|
|
295
|
+
prompt: string;
|
|
296
|
+
};
|
|
297
|
+
ImageStatusResponseDto: {
|
|
298
|
+
/** Format: uuid */
|
|
299
|
+
id: string;
|
|
300
|
+
/** Format: date-time */
|
|
301
|
+
createdAt: string;
|
|
302
|
+
/** Format: date-time */
|
|
303
|
+
updatedAt: string;
|
|
304
|
+
/** Format: uuid */
|
|
305
|
+
messageId: string;
|
|
306
|
+
/** @example hero */
|
|
307
|
+
slot: string;
|
|
308
|
+
/** @enum {string} */
|
|
309
|
+
status: "idle" | "generating" | "ready" | "failed";
|
|
310
|
+
prompt: string;
|
|
311
|
+
imageData?: Record<string, never> | null;
|
|
312
|
+
mimeType?: Record<string, never> | null;
|
|
313
|
+
error?: Record<string, never> | null;
|
|
314
|
+
attempts: number;
|
|
315
|
+
};
|
|
316
|
+
CreateCheckoutDto: {
|
|
317
|
+
/** Format: uuid */
|
|
318
|
+
planId: string;
|
|
319
|
+
/** @example https://app.example.com/payment/success */
|
|
320
|
+
returnUrl: string;
|
|
321
|
+
/** @example https://app.example.com/payment/cancel */
|
|
322
|
+
cancelUrl: string;
|
|
323
|
+
};
|
|
324
|
+
CheckoutResponseDto: {
|
|
325
|
+
/** Format: uuid */
|
|
326
|
+
paymentId: string;
|
|
327
|
+
/** @example https://pay.whitegallo.com/session/xyz */
|
|
328
|
+
redirectUrl: string;
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
responses: never;
|
|
332
|
+
parameters: never;
|
|
333
|
+
requestBodies: never;
|
|
334
|
+
headers: never;
|
|
335
|
+
pathItems: never;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
type RegisterDto = components["schemas"]["RegisterDto"];
|
|
339
|
+
type LoginDto = components["schemas"]["LoginDto"];
|
|
340
|
+
type VerifyOtpDto = components["schemas"]["VerifyOtpDto"];
|
|
341
|
+
type RefreshTokenDto = components["schemas"]["RefreshTokenDto"];
|
|
342
|
+
type UpdateProfileDto = components["schemas"]["UpdateProfileDto"];
|
|
343
|
+
type RequestEmailChangeDto = components["schemas"]["RequestEmailChangeDto"];
|
|
344
|
+
type ConfirmEmailChangeDto = components["schemas"]["ConfirmEmailChangeDto"];
|
|
345
|
+
type PurchaseCreditsDto = components["schemas"]["PurchaseCreditsDto"];
|
|
346
|
+
type UpsertBillingDto = components["schemas"]["UpsertBillingDto"];
|
|
347
|
+
type UpdatePreferencesDto = components["schemas"]["UpdatePreferencesDto"];
|
|
348
|
+
type CreateConversationDto = components["schemas"]["CreateConversationDto"];
|
|
349
|
+
type AddMessageDto = components["schemas"]["AddMessageDto"];
|
|
350
|
+
type GenerateDto = components["schemas"]["GenerateDto"];
|
|
351
|
+
type TriggerImageDto = components["schemas"]["TriggerImageDto"];
|
|
352
|
+
type CreateCheckoutDto = components["schemas"]["CreateCheckoutDto"];
|
|
353
|
+
type MessageResponseDto = components["schemas"]["MessageResponseDto"];
|
|
354
|
+
type StartAuthResponseDto = MessageResponseDto & {
|
|
355
|
+
type: OtpType;
|
|
356
|
+
};
|
|
357
|
+
type AuthResponseDto = components["schemas"]["AuthResponseDto"];
|
|
358
|
+
type TokensResponseDto = components["schemas"]["TokensResponseDto"];
|
|
359
|
+
type UserResponseDto = components["schemas"]["UserResponseDto"];
|
|
360
|
+
type PlanResponseDto = components["schemas"]["PlanResponseDto"];
|
|
361
|
+
type CreditBalanceResponseDto = components["schemas"]["CreditBalanceResponseDto"];
|
|
362
|
+
type CreditTransactionResponseDto = components["schemas"]["CreditTransactionResponseDto"];
|
|
363
|
+
type PurchaseCreditsResponseDto = components["schemas"]["PurchaseCreditsResponseDto"];
|
|
364
|
+
type CreditBalanceEntityResponseDto = components["schemas"]["CreditBalanceEntityResponseDto"];
|
|
365
|
+
type BillingResponseDto = components["schemas"]["BillingResponseDto"];
|
|
366
|
+
type PreferenceResponseDto = components["schemas"]["PreferenceResponseDto"];
|
|
367
|
+
type ConversationResponseDto = components["schemas"]["ConversationResponseDto"] & {
|
|
368
|
+
heroImageData?: string | null;
|
|
369
|
+
heroMimeType?: string | null;
|
|
370
|
+
};
|
|
371
|
+
type ConversationMessageResponseDto = components["schemas"]["ConversationMessageResponseDto"];
|
|
372
|
+
type ImageStatusResponseDto = components["schemas"]["ImageStatusResponseDto"];
|
|
373
|
+
type CheckoutResponseDto = components["schemas"]["CheckoutResponseDto"];
|
|
374
|
+
type OtpType = components["schemas"]["OtpType"];
|
|
375
|
+
type UserRole = components["schemas"]["UserRole"];
|
|
376
|
+
type PlanType = components["schemas"]["PlanType"];
|
|
377
|
+
type CreditTransactionType = components["schemas"]["CreditTransactionType"];
|
|
378
|
+
type ConversationStatus = ConversationResponseDto["status"];
|
|
379
|
+
type MessageRole = ConversationMessageResponseDto["role"];
|
|
380
|
+
type ImageGenerationStatus = ImageStatusResponseDto["status"];
|
|
381
|
+
|
|
382
|
+
interface HttpClientConfig {
|
|
383
|
+
baseUrl: string;
|
|
384
|
+
tenantKey: string;
|
|
385
|
+
getAccessToken: () => string | null;
|
|
386
|
+
getRefreshToken: () => string | null;
|
|
387
|
+
onTokenRefreshed: (tokens: TokensResponseDto) => void | Promise<void>;
|
|
388
|
+
fetch?: typeof globalThis.fetch;
|
|
389
|
+
}
|
|
390
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
391
|
+
interface RequestOptions {
|
|
392
|
+
body?: unknown;
|
|
393
|
+
query?: Record<string, string | number | boolean | undefined | null>;
|
|
394
|
+
authenticated?: boolean;
|
|
395
|
+
}
|
|
396
|
+
declare class HttpClient {
|
|
397
|
+
private config;
|
|
398
|
+
private refreshPromise;
|
|
399
|
+
private readonly baseUrl;
|
|
400
|
+
private readonly fetchFn;
|
|
401
|
+
constructor(config: HttpClientConfig);
|
|
402
|
+
private buildAndFetch;
|
|
403
|
+
private throwIfError;
|
|
404
|
+
private request;
|
|
405
|
+
private attemptTokenRefresh;
|
|
406
|
+
private doRefresh;
|
|
407
|
+
get<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
408
|
+
post<T>(path: string, body?: unknown, options?: Omit<RequestOptions, "body">): Promise<T>;
|
|
409
|
+
patch<T>(path: string, body?: unknown, options?: Omit<RequestOptions, "body">): Promise<T>;
|
|
410
|
+
put<T>(path: string, body?: unknown, options?: Omit<RequestOptions, "body">): Promise<T>;
|
|
411
|
+
delete<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
412
|
+
rawRequest(method: HttpMethod, path: string, options?: RequestOptions): Promise<Response>;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
declare class AuthResource {
|
|
416
|
+
private http;
|
|
417
|
+
constructor(http: HttpClient);
|
|
418
|
+
register(data: RegisterDto): Promise<MessageResponseDto>;
|
|
419
|
+
login(data: LoginDto): Promise<MessageResponseDto>;
|
|
420
|
+
startAuth(data: LoginDto): Promise<StartAuthResponseDto>;
|
|
421
|
+
verifyOtp(data: VerifyOtpDto): Promise<AuthResponseDto>;
|
|
422
|
+
refresh(data: RefreshTokenDto): Promise<TokensResponseDto>;
|
|
423
|
+
logout(): Promise<void>;
|
|
424
|
+
getProfile(): Promise<UserResponseDto>;
|
|
425
|
+
updateProfile(data: UpdateProfileDto): Promise<UserResponseDto>;
|
|
426
|
+
deleteAccount(): Promise<void>;
|
|
427
|
+
requestEmailChange(data: RequestEmailChangeDto): Promise<MessageResponseDto>;
|
|
428
|
+
confirmEmailChange(data: ConfirmEmailChangeDto): Promise<MessageResponseDto>;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
declare class PlansResource {
|
|
432
|
+
private http;
|
|
433
|
+
constructor(http: HttpClient);
|
|
434
|
+
list(query?: {
|
|
435
|
+
type?: PlanType;
|
|
436
|
+
}): Promise<PlanResponseDto[]>;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare class CreditsResource {
|
|
440
|
+
private http;
|
|
441
|
+
constructor(http: HttpClient);
|
|
442
|
+
getBalance(): Promise<CreditBalanceResponseDto>;
|
|
443
|
+
getTransactions(query?: {
|
|
444
|
+
cursor?: string;
|
|
445
|
+
limit?: number;
|
|
446
|
+
type?: CreditTransactionType;
|
|
447
|
+
}): Promise<CreditTransactionResponseDto[]>;
|
|
448
|
+
purchase(data: PurchaseCreditsDto): Promise<PurchaseCreditsResponseDto>;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
declare class BillingResource {
|
|
452
|
+
private http;
|
|
453
|
+
constructor(http: HttpClient);
|
|
454
|
+
get(): Promise<BillingResponseDto>;
|
|
455
|
+
upsert(data: UpsertBillingDto): Promise<BillingResponseDto>;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
declare class PreferencesResource {
|
|
459
|
+
private http;
|
|
460
|
+
constructor(http: HttpClient);
|
|
461
|
+
getAll(): Promise<PreferenceResponseDto[]>;
|
|
462
|
+
getByAppKey(appKey: string): Promise<PreferenceResponseDto>;
|
|
463
|
+
upsert(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto>;
|
|
464
|
+
remove(appKey: string): Promise<void>;
|
|
465
|
+
merge(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto>;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
declare class ConversationsResource {
|
|
469
|
+
private http;
|
|
470
|
+
constructor(http: HttpClient);
|
|
471
|
+
create(data: CreateConversationDto): Promise<ConversationResponseDto>;
|
|
472
|
+
list(query?: {
|
|
473
|
+
cursor?: string;
|
|
474
|
+
limit?: number;
|
|
475
|
+
status?: ConversationStatus;
|
|
476
|
+
appKey?: string;
|
|
477
|
+
}): Promise<ConversationResponseDto[]>;
|
|
478
|
+
get(id: string): Promise<ConversationResponseDto>;
|
|
479
|
+
archive(id: string): Promise<ConversationResponseDto>;
|
|
480
|
+
listMessages(conversationId: string, query?: {
|
|
481
|
+
cursor?: string;
|
|
482
|
+
limit?: number;
|
|
483
|
+
}): Promise<ConversationMessageResponseDto[]>;
|
|
484
|
+
addMessage(conversationId: string, data: AddMessageDto): Promise<ConversationMessageResponseDto>;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
interface GenerationDoneData {
|
|
488
|
+
messageId: string;
|
|
489
|
+
usage?: {
|
|
490
|
+
inputTokens: number;
|
|
491
|
+
outputTokens: number;
|
|
492
|
+
};
|
|
493
|
+
structuredOutput?: Record<string, unknown>;
|
|
494
|
+
}
|
|
495
|
+
interface SseStreamOptions {
|
|
496
|
+
onTextDelta?: (text: string) => void;
|
|
497
|
+
onDone?: (data: GenerationDoneData) => void;
|
|
498
|
+
onError?: (error: string) => void;
|
|
499
|
+
signal?: AbortSignal;
|
|
500
|
+
}
|
|
501
|
+
declare class GenerationResource {
|
|
502
|
+
private http;
|
|
503
|
+
constructor(http: HttpClient);
|
|
504
|
+
generate(conversationId: string, data: GenerateDto, options?: SseStreamOptions): Promise<string>;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
declare class ImagesResource {
|
|
508
|
+
private http;
|
|
509
|
+
constructor(http: HttpClient);
|
|
510
|
+
trigger(messageId: string, data: TriggerImageDto): Promise<ImageStatusResponseDto>;
|
|
511
|
+
getAll(messageId: string): Promise<ImageStatusResponseDto[]>;
|
|
512
|
+
getBySlot(messageId: string, slot: string): Promise<ImageStatusResponseDto>;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
declare class PaymentsResource {
|
|
516
|
+
private http;
|
|
517
|
+
constructor(http: HttpClient);
|
|
518
|
+
checkout(data: CreateCheckoutDto): Promise<CheckoutResponseDto>;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
interface ClientOptions {
|
|
522
|
+
baseUrl: string;
|
|
523
|
+
tenantKey: string;
|
|
524
|
+
accessToken?: string;
|
|
525
|
+
refreshToken?: string;
|
|
526
|
+
onTokenRefreshed?: (tokens: TokensResponseDto) => void | Promise<void>;
|
|
527
|
+
fetch?: typeof globalThis.fetch;
|
|
528
|
+
}
|
|
529
|
+
interface AiAssistantsClient {
|
|
530
|
+
auth: AuthResource;
|
|
531
|
+
plans: PlansResource;
|
|
532
|
+
credits: CreditsResource;
|
|
533
|
+
billing: BillingResource;
|
|
534
|
+
preferences: PreferencesResource;
|
|
535
|
+
conversations: ConversationsResource;
|
|
536
|
+
generation: GenerationResource;
|
|
537
|
+
images: ImagesResource;
|
|
538
|
+
payments: PaymentsResource;
|
|
539
|
+
setAccessToken(token: string): void;
|
|
540
|
+
setRefreshToken(token: string): void;
|
|
541
|
+
}
|
|
542
|
+
declare function createClient(options: ClientOptions): AiAssistantsClient;
|
|
543
|
+
|
|
544
|
+
declare class ApiError extends Error {
|
|
545
|
+
readonly statusCode: number;
|
|
546
|
+
readonly code: string;
|
|
547
|
+
readonly requestId?: string | undefined;
|
|
548
|
+
constructor(statusCode: number, code: string, message: string | string[], requestId?: string | undefined);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export { type AddMessageDto, type AiAssistantsClient, ApiError, type AuthResponseDto, type BillingResponseDto, type CheckoutResponseDto, type ClientOptions, type ConfirmEmailChangeDto, type ConversationMessageResponseDto, type ConversationResponseDto, type ConversationStatus, type CreateCheckoutDto, type CreateConversationDto, type CreditBalanceEntityResponseDto, type CreditBalanceResponseDto, type CreditTransactionResponseDto, type CreditTransactionType, type GenerateDto, type GenerationDoneData, type ImageGenerationStatus, type ImageStatusResponseDto, type LoginDto, type MessageResponseDto, type MessageRole, type OtpType, type PlanResponseDto, type PlanType, type PreferenceResponseDto, type PurchaseCreditsDto, type PurchaseCreditsResponseDto, type RefreshTokenDto, type RegisterDto, type RequestEmailChangeDto, type SseStreamOptions, type StartAuthResponseDto, type TokensResponseDto, type TriggerImageDto, type UpdatePreferencesDto, type UpdateProfileDto, type UpsertBillingDto, type UserResponseDto, type UserRole, type VerifyOtpDto, createClient };
|