@robosystems/client 0.1.10

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/sdk.gen.ts ADDED
@@ -0,0 +1,2449 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type { Options as ClientOptions, TDataShape, Client } from './client';
4
+ import type { RegisterUserData, RegisterUserResponses, RegisterUserErrors, LoginUserData, LoginUserResponses, LoginUserErrors, LogoutUserData, LogoutUserResponses, LogoutUserErrors, GetCurrentAuthUserData, GetCurrentAuthUserResponses, GetCurrentAuthUserErrors, RefreshSessionData, RefreshSessionResponses, RefreshSessionErrors, GenerateSsoTokenData, GenerateSsoTokenResponses, GenerateSsoTokenErrors, SsoLoginData, SsoLoginResponses, SsoLoginErrors, SsoTokenExchangeData, SsoTokenExchangeResponses, SsoTokenExchangeErrors, CompleteSsoAuthData, CompleteSsoAuthResponses, CompleteSsoAuthErrors, GetCaptchaConfigData, GetCaptchaConfigResponses, GetPasswordPolicyData, GetPasswordPolicyResponses, CheckPasswordStrengthData, CheckPasswordStrengthResponses, CheckPasswordStrengthErrors, GetServiceStatusData, GetServiceStatusResponses, GetMcpHealthData, GetMcpHealthResponses, GetCurrentUserData, GetCurrentUserResponses, GetCurrentUserErrors, UpdateUserData, UpdateUserResponses, UpdateUserErrors, GetUserGraphsData, GetUserGraphsResponses, GetUserGraphsErrors, SelectUserGraphData, SelectUserGraphResponses, SelectUserGraphErrors, GetAllCreditSummariesData, GetAllCreditSummariesResponses, GetAllCreditSummariesErrors, UpdateUserPasswordData, UpdateUserPasswordResponses, UpdateUserPasswordErrors, ListUserApiKeysData, ListUserApiKeysResponses, ListUserApiKeysErrors, CreateUserApiKeyData, CreateUserApiKeyResponses, CreateUserApiKeyErrors, RevokeUserApiKeyData, RevokeUserApiKeyResponses, RevokeUserApiKeyErrors, UpdateUserApiKeyData, UpdateUserApiKeyResponses, UpdateUserApiKeyErrors, GetUserLimitsData, GetUserLimitsResponses, GetUserLimitsErrors, GetUserUsageData, GetUserUsageResponses, GetUserUsageErrors, GetUserUsageOverviewData, GetUserUsageOverviewResponses, GetUserUsageOverviewErrors, GetDetailedUserAnalyticsData, GetDetailedUserAnalyticsResponses, GetDetailedUserAnalyticsErrors, GetUserSharedSubscriptionsData, GetUserSharedSubscriptionsResponses, GetUserSharedSubscriptionsErrors, SubscribeToSharedRepositoryData, SubscribeToSharedRepositoryResponses, SubscribeToSharedRepositoryErrors, UpgradeSharedRepositorySubscriptionData, UpgradeSharedRepositorySubscriptionResponses, UpgradeSharedRepositorySubscriptionErrors, CancelSharedRepositorySubscriptionData, CancelSharedRepositorySubscriptionResponses, CancelSharedRepositorySubscriptionErrors, GetSharedRepositoryCreditsData, GetSharedRepositoryCreditsResponses, GetSharedRepositoryCreditsErrors, GetRepositoryCreditsData, GetRepositoryCreditsResponses, GetRepositoryCreditsErrors, GetConnectionOptionsData, GetConnectionOptionsResponses, GetConnectionOptionsErrors, ListConnectionsData, ListConnectionsResponses, ListConnectionsErrors, CreateConnectionData, CreateConnectionResponses, CreateConnectionErrors, DeleteConnectionData, DeleteConnectionResponses, DeleteConnectionErrors, GetConnectionData, GetConnectionResponses, GetConnectionErrors, SyncConnectionData, SyncConnectionResponses, SyncConnectionErrors, CreateLinkTokenData, CreateLinkTokenResponses, CreateLinkTokenErrors, ExchangeLinkTokenData, ExchangeLinkTokenResponses, ExchangeLinkTokenErrors, InitOAuthData, InitOAuthResponses, InitOAuthErrors, OauthCallbackData, OauthCallbackResponses, OauthCallbackErrors, QueryFinancialAgentData, QueryFinancialAgentResponses, QueryFinancialAgentErrors, ListMcpToolsData, ListMcpToolsResponses, ListMcpToolsErrors, CallMcpToolData, CallMcpToolResponses, CallMcpToolErrors, CreateBackupData, CreateBackupResponses, CreateBackupErrors, ListBackupsData, ListBackupsResponses, ListBackupsErrors, ExportBackupData, ExportBackupResponses, ExportBackupErrors, RestoreBackupData, RestoreBackupResponses, RestoreBackupErrors, GetBackupStatsData, GetBackupStatsResponses, GetBackupStatsErrors, KuzuBackupHealthData, KuzuBackupHealthResponses, KuzuBackupHealthErrors, GetBackupDownloadUrlData, GetBackupDownloadUrlResponses, GetBackupDownloadUrlErrors, GetGraphMetricsData, GetGraphMetricsResponses, GetGraphMetricsErrors, GetGraphUsageStatsData, GetGraphUsageStatsResponses, GetGraphUsageStatsErrors, ExecuteCypherQueryData, ExecuteCypherQueryResponses, ExecuteCypherQueryErrors, GetGraphSchemaInfoData, GetGraphSchemaInfoResponses, GetGraphSchemaInfoErrors, ValidateSchemaData, ValidateSchemaResponses, ValidateSchemaErrors, ExportGraphSchemaData, ExportGraphSchemaResponses, ExportGraphSchemaErrors, ListSchemaExtensionsData, ListSchemaExtensionsResponses, ListSchemaExtensionsErrors, GetCurrentGraphBillData, GetCurrentGraphBillResponses, GetCurrentGraphBillErrors, GetGraphMonthlyBillData, GetGraphMonthlyBillResponses, GetGraphMonthlyBillErrors, GetGraphBillingHistoryData, GetGraphBillingHistoryResponses, GetGraphBillingHistoryErrors, GetGraphUsageDetailsData, GetGraphUsageDetailsResponses, GetGraphUsageDetailsErrors, GetGraphPricingInfoV1GraphIdBillingPricingGetData, GetGraphPricingInfoV1GraphIdBillingPricingGetResponses, GetGraphPricingInfoV1GraphIdBillingPricingGetErrors, UpgradeGraphSubscriptionV1GraphIdBillingSubscriptionUpgradePostData, UpgradeGraphSubscriptionV1GraphIdBillingSubscriptionUpgradePostResponses, UpgradeGraphSubscriptionV1GraphIdBillingSubscriptionUpgradePostErrors, GetGraphSubscriptionV1GraphIdBillingSubscriptionGetData, GetGraphSubscriptionV1GraphIdBillingSubscriptionGetResponses, GetGraphSubscriptionV1GraphIdBillingSubscriptionGetErrors, GetAvailableSubscriptionPlansV1GraphIdBillingAvailablePlansGetData, GetAvailableSubscriptionPlansV1GraphIdBillingAvailablePlansGetResponses, GetAvailableSubscriptionPlansV1GraphIdBillingAvailablePlansGetErrors, GetCreditBillingInfoV1GraphIdBillingCreditsGetData, GetCreditBillingInfoV1GraphIdBillingCreditsGetResponses, GetCreditBillingInfoV1GraphIdBillingCreditsGetErrors, GetCreditSummaryData, GetCreditSummaryResponses, GetCreditSummaryErrors, ListCreditTransactionsData, ListCreditTransactionsResponses, ListCreditTransactionsErrors, CheckCreditBalanceData, CheckCreditBalanceResponses, CheckCreditBalanceErrors, GetStorageUsageData, GetStorageUsageResponses, GetStorageUsageErrors, CheckStorageLimitsData, CheckStorageLimitsResponses, CheckStorageLimitsErrors, GetDatabaseHealthData, GetDatabaseHealthResponses, GetDatabaseHealthErrors, GetDatabaseInfoData, GetDatabaseInfoResponses, GetDatabaseInfoErrors, CreateGraphData, CreateGraphResponses, CreateGraphErrors, GetAvailableExtensionsData, GetAvailableExtensionsResponses, GetServiceOfferingsData, GetServiceOfferingsResponses, GetServiceOfferingsErrors, StreamOperationEventsData, StreamOperationEventsResponses, StreamOperationEventsErrors, GetOperationStatusData, GetOperationStatusResponses, GetOperationStatusErrors, CancelOperationData, CancelOperationResponses, CancelOperationErrors } from './types.gen';
5
+ import { client as _heyApiClient } from './client.gen';
6
+
7
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
8
+ /**
9
+ * You can provide a client instance returned by `createClient()` instead of
10
+ * individual options. This might be also useful if you want to implement a
11
+ * custom client.
12
+ */
13
+ client?: Client;
14
+ /**
15
+ * You can pass arbitrary values through the `meta` object. This can be
16
+ * used to access values that aren't defined as part of the SDK function.
17
+ */
18
+ meta?: Record<string, unknown>;
19
+ };
20
+
21
+ /**
22
+ * Register New User
23
+ * Register a new user account with email and password. Security controls vary by environment: CAPTCHA and email verification are disabled in development for API testing, but required in production.
24
+ */
25
+ export const registerUser = <ThrowOnError extends boolean = false>(options: Options<RegisterUserData, ThrowOnError>) => {
26
+ return (options.client ?? _heyApiClient).post<RegisterUserResponses, RegisterUserErrors, ThrowOnError>({
27
+ url: '/v1/auth/register',
28
+ ...options,
29
+ headers: {
30
+ 'Content-Type': 'application/json',
31
+ ...options.headers
32
+ }
33
+ });
34
+ };
35
+
36
+ /**
37
+ * User Login
38
+ * Authenticate user with email and password.
39
+ */
40
+ export const loginUser = <ThrowOnError extends boolean = false>(options: Options<LoginUserData, ThrowOnError>) => {
41
+ return (options.client ?? _heyApiClient).post<LoginUserResponses, LoginUserErrors, ThrowOnError>({
42
+ url: '/v1/auth/login',
43
+ ...options,
44
+ headers: {
45
+ 'Content-Type': 'application/json',
46
+ ...options.headers
47
+ }
48
+ });
49
+ };
50
+
51
+ /**
52
+ * User Logout
53
+ * Logout user and invalidate session.
54
+ */
55
+ export const logoutUser = <ThrowOnError extends boolean = false>(options?: Options<LogoutUserData, ThrowOnError>) => {
56
+ return (options?.client ?? _heyApiClient).post<LogoutUserResponses, LogoutUserErrors, ThrowOnError>({
57
+ url: '/v1/auth/logout',
58
+ ...options
59
+ });
60
+ };
61
+
62
+ /**
63
+ * Get Current User
64
+ * Get current authenticated user from session.
65
+ */
66
+ export const getCurrentAuthUser = <ThrowOnError extends boolean = false>(options?: Options<GetCurrentAuthUserData, ThrowOnError>) => {
67
+ return (options?.client ?? _heyApiClient).get<GetCurrentAuthUserResponses, GetCurrentAuthUserErrors, ThrowOnError>({
68
+ url: '/v1/auth/me',
69
+ ...options
70
+ });
71
+ };
72
+
73
+ /**
74
+ * Refresh Session
75
+ * Refresh user session and extend authentication token.
76
+ */
77
+ export const refreshSession = <ThrowOnError extends boolean = false>(options?: Options<RefreshSessionData, ThrowOnError>) => {
78
+ return (options?.client ?? _heyApiClient).post<RefreshSessionResponses, RefreshSessionErrors, ThrowOnError>({
79
+ url: '/v1/auth/refresh',
80
+ ...options
81
+ });
82
+ };
83
+
84
+ /**
85
+ * Generate SSO Token
86
+ * Generate a temporary SSO token for cross-app authentication.
87
+ */
88
+ export const generateSsoToken = <ThrowOnError extends boolean = false>(options?: Options<GenerateSsoTokenData, ThrowOnError>) => {
89
+ return (options?.client ?? _heyApiClient).post<GenerateSsoTokenResponses, GenerateSsoTokenErrors, ThrowOnError>({
90
+ url: '/v1/auth/sso-token',
91
+ ...options
92
+ });
93
+ };
94
+
95
+ /**
96
+ * SSO Login
97
+ * Authenticate user with SSO token and establish session.
98
+ */
99
+ export const ssoLogin = <ThrowOnError extends boolean = false>(options: Options<SsoLoginData, ThrowOnError>) => {
100
+ return (options.client ?? _heyApiClient).post<SsoLoginResponses, SsoLoginErrors, ThrowOnError>({
101
+ url: '/v1/auth/sso-login',
102
+ ...options,
103
+ headers: {
104
+ 'Content-Type': 'application/json',
105
+ ...options.headers
106
+ }
107
+ });
108
+ };
109
+
110
+ /**
111
+ * SSO Token Exchange
112
+ * Exchange SSO token for secure session handoff to target application.
113
+ */
114
+ export const ssoTokenExchange = <ThrowOnError extends boolean = false>(options: Options<SsoTokenExchangeData, ThrowOnError>) => {
115
+ return (options.client ?? _heyApiClient).post<SsoTokenExchangeResponses, SsoTokenExchangeErrors, ThrowOnError>({
116
+ url: '/v1/auth/sso-exchange',
117
+ ...options,
118
+ headers: {
119
+ 'Content-Type': 'application/json',
120
+ ...options.headers
121
+ }
122
+ });
123
+ };
124
+
125
+ /**
126
+ * Complete SSO Authentication
127
+ * Complete SSO authentication using session ID from secure handoff.
128
+ */
129
+ export const completeSsoAuth = <ThrowOnError extends boolean = false>(options: Options<CompleteSsoAuthData, ThrowOnError>) => {
130
+ return (options.client ?? _heyApiClient).post<CompleteSsoAuthResponses, CompleteSsoAuthErrors, ThrowOnError>({
131
+ url: '/v1/auth/sso-complete',
132
+ ...options,
133
+ headers: {
134
+ 'Content-Type': 'application/json',
135
+ ...options.headers
136
+ }
137
+ });
138
+ };
139
+
140
+ /**
141
+ * Get CAPTCHA Configuration
142
+ * Get CAPTCHA configuration including site key and whether CAPTCHA is required.
143
+ */
144
+ export const getCaptchaConfig = <ThrowOnError extends boolean = false>(options?: Options<GetCaptchaConfigData, ThrowOnError>) => {
145
+ return (options?.client ?? _heyApiClient).get<GetCaptchaConfigResponses, unknown, ThrowOnError>({
146
+ url: '/v1/auth/captcha/config',
147
+ ...options
148
+ });
149
+ };
150
+
151
+ /**
152
+ * Get Password Policy
153
+ * Get current password policy requirements for frontend validation
154
+ */
155
+ export const getPasswordPolicy = <ThrowOnError extends boolean = false>(options?: Options<GetPasswordPolicyData, ThrowOnError>) => {
156
+ return (options?.client ?? _heyApiClient).get<GetPasswordPolicyResponses, unknown, ThrowOnError>({
157
+ url: '/v1/auth/password/policy',
158
+ ...options
159
+ });
160
+ };
161
+
162
+ /**
163
+ * Check Password Strength
164
+ * Check password strength and get validation feedback
165
+ */
166
+ export const checkPasswordStrength = <ThrowOnError extends boolean = false>(options: Options<CheckPasswordStrengthData, ThrowOnError>) => {
167
+ return (options.client ?? _heyApiClient).post<CheckPasswordStrengthResponses, CheckPasswordStrengthErrors, ThrowOnError>({
168
+ url: '/v1/auth/password/check',
169
+ ...options,
170
+ headers: {
171
+ 'Content-Type': 'application/json',
172
+ ...options.headers
173
+ }
174
+ });
175
+ };
176
+
177
+ /**
178
+ * Health Check
179
+ * Service health check endpoint for monitoring and load balancers
180
+ */
181
+ export const getServiceStatus = <ThrowOnError extends boolean = false>(options?: Options<GetServiceStatusData, ThrowOnError>) => {
182
+ return (options?.client ?? _heyApiClient).get<GetServiceStatusResponses, unknown, ThrowOnError>({
183
+ url: '/v1/status',
184
+ ...options
185
+ });
186
+ };
187
+
188
+ /**
189
+ * MCP System Health Check
190
+ * Basic health check for MCP system components
191
+ */
192
+ export const getMcpHealth = <ThrowOnError extends boolean = false>(options?: Options<GetMcpHealthData, ThrowOnError>) => {
193
+ return (options?.client ?? _heyApiClient).get<GetMcpHealthResponses, unknown, ThrowOnError>({
194
+ security: [
195
+ {
196
+ name: 'X-API-Key',
197
+ type: 'apiKey'
198
+ },
199
+ {
200
+ scheme: 'bearer',
201
+ type: 'http'
202
+ }
203
+ ],
204
+ url: '/v1/mcp/health',
205
+ ...options
206
+ });
207
+ };
208
+
209
+ /**
210
+ * Get Current User
211
+ * Returns information about the currently authenticated user.
212
+ */
213
+ export const getCurrentUser = <ThrowOnError extends boolean = false>(options?: Options<GetCurrentUserData, ThrowOnError>) => {
214
+ return (options?.client ?? _heyApiClient).get<GetCurrentUserResponses, GetCurrentUserErrors, ThrowOnError>({
215
+ security: [
216
+ {
217
+ name: 'X-API-Key',
218
+ type: 'apiKey'
219
+ },
220
+ {
221
+ scheme: 'bearer',
222
+ type: 'http'
223
+ }
224
+ ],
225
+ url: '/v1/user',
226
+ ...options
227
+ });
228
+ };
229
+
230
+ /**
231
+ * Update User Profile
232
+ * Update the current user's profile information.
233
+ */
234
+ export const updateUser = <ThrowOnError extends boolean = false>(options: Options<UpdateUserData, ThrowOnError>) => {
235
+ return (options.client ?? _heyApiClient).put<UpdateUserResponses, UpdateUserErrors, ThrowOnError>({
236
+ security: [
237
+ {
238
+ name: 'X-API-Key',
239
+ type: 'apiKey'
240
+ },
241
+ {
242
+ scheme: 'bearer',
243
+ type: 'http'
244
+ }
245
+ ],
246
+ url: '/v1/user',
247
+ ...options,
248
+ headers: {
249
+ 'Content-Type': 'application/json',
250
+ ...options.headers
251
+ }
252
+ });
253
+ };
254
+
255
+ /**
256
+ * Get User Graphs
257
+ * Get all graph databases accessible to the current user.
258
+ */
259
+ export const getUserGraphs = <ThrowOnError extends boolean = false>(options?: Options<GetUserGraphsData, ThrowOnError>) => {
260
+ return (options?.client ?? _heyApiClient).get<GetUserGraphsResponses, GetUserGraphsErrors, ThrowOnError>({
261
+ security: [
262
+ {
263
+ name: 'X-API-Key',
264
+ type: 'apiKey'
265
+ },
266
+ {
267
+ scheme: 'bearer',
268
+ type: 'http'
269
+ }
270
+ ],
271
+ url: '/v1/user/graphs',
272
+ ...options
273
+ });
274
+ };
275
+
276
+ /**
277
+ * Select User Graph
278
+ * Select a specific graph as the active graph for the user.
279
+ */
280
+ export const selectUserGraph = <ThrowOnError extends boolean = false>(options: Options<SelectUserGraphData, ThrowOnError>) => {
281
+ return (options.client ?? _heyApiClient).post<SelectUserGraphResponses, SelectUserGraphErrors, ThrowOnError>({
282
+ security: [
283
+ {
284
+ name: 'X-API-Key',
285
+ type: 'apiKey'
286
+ },
287
+ {
288
+ scheme: 'bearer',
289
+ type: 'http'
290
+ }
291
+ ],
292
+ url: '/v1/user/graphs/select/{graph_id}',
293
+ ...options
294
+ });
295
+ };
296
+
297
+ /**
298
+ * Get All Credit Summaries
299
+ * Get credit summaries for all graphs owned by the user.
300
+ *
301
+ * This endpoint provides a consolidated view of credit usage across
302
+ * all graphs where the user has access, helping to monitor overall
303
+ * credit consumption and plan usage.
304
+ *
305
+ * No credits are consumed for viewing summaries.
306
+ */
307
+ export const getAllCreditSummaries = <ThrowOnError extends boolean = false>(options?: Options<GetAllCreditSummariesData, ThrowOnError>) => {
308
+ return (options?.client ?? _heyApiClient).get<GetAllCreditSummariesResponses, GetAllCreditSummariesErrors, ThrowOnError>({
309
+ security: [
310
+ {
311
+ name: 'X-API-Key',
312
+ type: 'apiKey'
313
+ },
314
+ {
315
+ scheme: 'bearer',
316
+ type: 'http'
317
+ }
318
+ ],
319
+ url: '/v1/user/credits/summary',
320
+ ...options
321
+ });
322
+ };
323
+
324
+ /**
325
+ * Update Password
326
+ * Update the current user's password.
327
+ */
328
+ export const updateUserPassword = <ThrowOnError extends boolean = false>(options: Options<UpdateUserPasswordData, ThrowOnError>) => {
329
+ return (options.client ?? _heyApiClient).put<UpdateUserPasswordResponses, UpdateUserPasswordErrors, ThrowOnError>({
330
+ security: [
331
+ {
332
+ name: 'X-API-Key',
333
+ type: 'apiKey'
334
+ },
335
+ {
336
+ scheme: 'bearer',
337
+ type: 'http'
338
+ }
339
+ ],
340
+ url: '/v1/user/password',
341
+ ...options,
342
+ headers: {
343
+ 'Content-Type': 'application/json',
344
+ ...options.headers
345
+ }
346
+ });
347
+ };
348
+
349
+ /**
350
+ * List API Keys
351
+ * Get all API keys for the current user.
352
+ */
353
+ export const listUserApiKeys = <ThrowOnError extends boolean = false>(options?: Options<ListUserApiKeysData, ThrowOnError>) => {
354
+ return (options?.client ?? _heyApiClient).get<ListUserApiKeysResponses, ListUserApiKeysErrors, ThrowOnError>({
355
+ security: [
356
+ {
357
+ name: 'X-API-Key',
358
+ type: 'apiKey'
359
+ },
360
+ {
361
+ scheme: 'bearer',
362
+ type: 'http'
363
+ }
364
+ ],
365
+ url: '/v1/user/api-keys',
366
+ ...options
367
+ });
368
+ };
369
+
370
+ /**
371
+ * Create API Key
372
+ * Create a new API key for the current user.
373
+ */
374
+ export const createUserApiKey = <ThrowOnError extends boolean = false>(options: Options<CreateUserApiKeyData, ThrowOnError>) => {
375
+ return (options.client ?? _heyApiClient).post<CreateUserApiKeyResponses, CreateUserApiKeyErrors, ThrowOnError>({
376
+ security: [
377
+ {
378
+ name: 'X-API-Key',
379
+ type: 'apiKey'
380
+ },
381
+ {
382
+ scheme: 'bearer',
383
+ type: 'http'
384
+ }
385
+ ],
386
+ url: '/v1/user/api-keys',
387
+ ...options,
388
+ headers: {
389
+ 'Content-Type': 'application/json',
390
+ ...options.headers
391
+ }
392
+ });
393
+ };
394
+
395
+ /**
396
+ * Revoke API Key
397
+ * Revoke (deactivate) an API key.
398
+ */
399
+ export const revokeUserApiKey = <ThrowOnError extends boolean = false>(options: Options<RevokeUserApiKeyData, ThrowOnError>) => {
400
+ return (options.client ?? _heyApiClient).delete<RevokeUserApiKeyResponses, RevokeUserApiKeyErrors, ThrowOnError>({
401
+ security: [
402
+ {
403
+ name: 'X-API-Key',
404
+ type: 'apiKey'
405
+ },
406
+ {
407
+ scheme: 'bearer',
408
+ type: 'http'
409
+ }
410
+ ],
411
+ url: '/v1/user/api-keys/{api_key_id}',
412
+ ...options
413
+ });
414
+ };
415
+
416
+ /**
417
+ * Update API Key
418
+ * Update an API key's name or description.
419
+ */
420
+ export const updateUserApiKey = <ThrowOnError extends boolean = false>(options: Options<UpdateUserApiKeyData, ThrowOnError>) => {
421
+ return (options.client ?? _heyApiClient).put<UpdateUserApiKeyResponses, UpdateUserApiKeyErrors, ThrowOnError>({
422
+ security: [
423
+ {
424
+ name: 'X-API-Key',
425
+ type: 'apiKey'
426
+ },
427
+ {
428
+ scheme: 'bearer',
429
+ type: 'http'
430
+ }
431
+ ],
432
+ url: '/v1/user/api-keys/{api_key_id}',
433
+ ...options,
434
+ headers: {
435
+ 'Content-Type': 'application/json',
436
+ ...options.headers
437
+ }
438
+ });
439
+ };
440
+
441
+ /**
442
+ * Get user limits
443
+ * Retrieve current limits and restrictions for the authenticated user
444
+ */
445
+ export const getUserLimits = <ThrowOnError extends boolean = false>(options?: Options<GetUserLimitsData, ThrowOnError>) => {
446
+ return (options?.client ?? _heyApiClient).get<GetUserLimitsResponses, GetUserLimitsErrors, ThrowOnError>({
447
+ security: [
448
+ {
449
+ name: 'X-API-Key',
450
+ type: 'apiKey'
451
+ },
452
+ {
453
+ scheme: 'bearer',
454
+ type: 'http'
455
+ }
456
+ ],
457
+ url: '/v1/user/limits',
458
+ ...options
459
+ });
460
+ };
461
+
462
+ /**
463
+ * Get user usage statistics
464
+ * Retrieve current usage statistics and remaining limits for the authenticated user
465
+ */
466
+ export const getUserUsage = <ThrowOnError extends boolean = false>(options?: Options<GetUserUsageData, ThrowOnError>) => {
467
+ return (options?.client ?? _heyApiClient).get<GetUserUsageResponses, GetUserUsageErrors, ThrowOnError>({
468
+ security: [
469
+ {
470
+ name: 'X-API-Key',
471
+ type: 'apiKey'
472
+ },
473
+ {
474
+ scheme: 'bearer',
475
+ type: 'http'
476
+ }
477
+ ],
478
+ url: '/v1/user/limits/usage',
479
+ ...options
480
+ });
481
+ };
482
+
483
+ /**
484
+ * Get User Usage Overview
485
+ * Get a high-level overview of usage statistics for the current user.
486
+ */
487
+ export const getUserUsageOverview = <ThrowOnError extends boolean = false>(options?: Options<GetUserUsageOverviewData, ThrowOnError>) => {
488
+ return (options?.client ?? _heyApiClient).get<GetUserUsageOverviewResponses, GetUserUsageOverviewErrors, ThrowOnError>({
489
+ security: [
490
+ {
491
+ name: 'X-API-Key',
492
+ type: 'apiKey'
493
+ },
494
+ {
495
+ scheme: 'bearer',
496
+ type: 'http'
497
+ }
498
+ ],
499
+ url: '/v1/user/analytics/overview',
500
+ ...options
501
+ });
502
+ };
503
+
504
+ /**
505
+ * Get Detailed User Analytics
506
+ * Get comprehensive analytics for the current user including API usage and recent activity.
507
+ */
508
+ export const getDetailedUserAnalytics = <ThrowOnError extends boolean = false>(options?: Options<GetDetailedUserAnalyticsData, ThrowOnError>) => {
509
+ return (options?.client ?? _heyApiClient).get<GetDetailedUserAnalyticsResponses, GetDetailedUserAnalyticsErrors, ThrowOnError>({
510
+ security: [
511
+ {
512
+ name: 'X-API-Key',
513
+ type: 'apiKey'
514
+ },
515
+ {
516
+ scheme: 'bearer',
517
+ type: 'http'
518
+ }
519
+ ],
520
+ url: '/v1/user/analytics/detailed',
521
+ ...options
522
+ });
523
+ };
524
+
525
+ /**
526
+ * Get User Subscriptions
527
+ * Retrieve user's current shared repository subscriptions with detailed information
528
+ */
529
+ export const getUserSharedSubscriptions = <ThrowOnError extends boolean = false>(options?: Options<GetUserSharedSubscriptionsData, ThrowOnError>) => {
530
+ return (options?.client ?? _heyApiClient).get<GetUserSharedSubscriptionsResponses, GetUserSharedSubscriptionsErrors, ThrowOnError>({
531
+ security: [
532
+ {
533
+ name: 'X-API-Key',
534
+ type: 'apiKey'
535
+ },
536
+ {
537
+ scheme: 'bearer',
538
+ type: 'http'
539
+ }
540
+ ],
541
+ url: '/v1/user/subscriptions/shared-repositories',
542
+ ...options
543
+ });
544
+ };
545
+
546
+ /**
547
+ * Subscribe to Shared Repository
548
+ * Create a new subscription to a shared repository add-on with specified tier
549
+ */
550
+ export const subscribeToSharedRepository = <ThrowOnError extends boolean = false>(options: Options<SubscribeToSharedRepositoryData, ThrowOnError>) => {
551
+ return (options.client ?? _heyApiClient).post<SubscribeToSharedRepositoryResponses, SubscribeToSharedRepositoryErrors, ThrowOnError>({
552
+ security: [
553
+ {
554
+ name: 'X-API-Key',
555
+ type: 'apiKey'
556
+ },
557
+ {
558
+ scheme: 'bearer',
559
+ type: 'http'
560
+ }
561
+ ],
562
+ url: '/v1/user/subscriptions/shared-repositories/subscribe',
563
+ ...options,
564
+ headers: {
565
+ 'Content-Type': 'application/json',
566
+ ...options.headers
567
+ }
568
+ });
569
+ };
570
+
571
+ /**
572
+ * Upgrade Subscription Tier
573
+ * Upgrade a subscription to a higher tier with immediate credit adjustment
574
+ */
575
+ export const upgradeSharedRepositorySubscription = <ThrowOnError extends boolean = false>(options: Options<UpgradeSharedRepositorySubscriptionData, ThrowOnError>) => {
576
+ return (options.client ?? _heyApiClient).put<UpgradeSharedRepositorySubscriptionResponses, UpgradeSharedRepositorySubscriptionErrors, ThrowOnError>({
577
+ security: [
578
+ {
579
+ name: 'X-API-Key',
580
+ type: 'apiKey'
581
+ },
582
+ {
583
+ scheme: 'bearer',
584
+ type: 'http'
585
+ }
586
+ ],
587
+ url: '/v1/user/subscriptions/shared-repositories/{subscription_id}/upgrade',
588
+ ...options,
589
+ headers: {
590
+ 'Content-Type': 'application/json',
591
+ ...options.headers
592
+ }
593
+ });
594
+ };
595
+
596
+ /**
597
+ * Cancel Subscription
598
+ * Cancel a shared repository subscription and disable associated credit pool
599
+ */
600
+ export const cancelSharedRepositorySubscription = <ThrowOnError extends boolean = false>(options: Options<CancelSharedRepositorySubscriptionData, ThrowOnError>) => {
601
+ return (options.client ?? _heyApiClient).delete<CancelSharedRepositorySubscriptionResponses, CancelSharedRepositorySubscriptionErrors, ThrowOnError>({
602
+ security: [
603
+ {
604
+ name: 'X-API-Key',
605
+ type: 'apiKey'
606
+ },
607
+ {
608
+ scheme: 'bearer',
609
+ type: 'http'
610
+ }
611
+ ],
612
+ url: '/v1/user/subscriptions/shared-repositories/{subscription_id}',
613
+ ...options
614
+ });
615
+ };
616
+
617
+ /**
618
+ * Get Credit Balances
619
+ * Retrieve credit balances for all shared repository subscriptions
620
+ */
621
+ export const getSharedRepositoryCredits = <ThrowOnError extends boolean = false>(options?: Options<GetSharedRepositoryCreditsData, ThrowOnError>) => {
622
+ return (options?.client ?? _heyApiClient).get<GetSharedRepositoryCreditsResponses, GetSharedRepositoryCreditsErrors, ThrowOnError>({
623
+ security: [
624
+ {
625
+ name: 'X-API-Key',
626
+ type: 'apiKey'
627
+ },
628
+ {
629
+ scheme: 'bearer',
630
+ type: 'http'
631
+ }
632
+ ],
633
+ url: '/v1/user/subscriptions/shared-repositories/credits',
634
+ ...options
635
+ });
636
+ };
637
+
638
+ /**
639
+ * Get Repository Credits
640
+ * Get credit balance for a specific shared repository type
641
+ */
642
+ export const getRepositoryCredits = <ThrowOnError extends boolean = false>(options: Options<GetRepositoryCreditsData, ThrowOnError>) => {
643
+ return (options.client ?? _heyApiClient).get<GetRepositoryCreditsResponses, GetRepositoryCreditsErrors, ThrowOnError>({
644
+ security: [
645
+ {
646
+ name: 'X-API-Key',
647
+ type: 'apiKey'
648
+ },
649
+ {
650
+ scheme: 'bearer',
651
+ type: 'http'
652
+ }
653
+ ],
654
+ url: '/v1/user/subscriptions/shared-repositories/credits/{repository_type}',
655
+ ...options
656
+ });
657
+ };
658
+
659
+ /**
660
+ * List Connection Options
661
+ * Get metadata about all available data connection providers.
662
+ *
663
+ * This endpoint returns comprehensive information about each supported provider:
664
+ *
665
+ * **SEC EDGAR**: Public entity financial filings
666
+ * - No authentication required (public data)
667
+ * - 10-K, 10-Q, 8-K reports with XBRL data
668
+ * - Historical and real-time filing access
669
+ *
670
+ * **QuickBooks Online**: Full accounting system integration
671
+ * - OAuth 2.0 authentication
672
+ * - Chart of accounts, transactions, trial balance
673
+ * - Real-time sync capabilities
674
+ *
675
+ * **Plaid**: Bank account connections
676
+ * - Secure bank authentication via Plaid Link
677
+ * - Transaction history and balances
678
+ * - Multi-account support
679
+ *
680
+ * No credits are consumed for viewing connection options.
681
+ */
682
+ export const getConnectionOptions = <ThrowOnError extends boolean = false>(options: Options<GetConnectionOptionsData, ThrowOnError>) => {
683
+ return (options.client ?? _heyApiClient).get<GetConnectionOptionsResponses, GetConnectionOptionsErrors, ThrowOnError>({
684
+ security: [
685
+ {
686
+ name: 'X-API-Key',
687
+ type: 'apiKey'
688
+ },
689
+ {
690
+ scheme: 'bearer',
691
+ type: 'http'
692
+ }
693
+ ],
694
+ url: '/v1/{graph_id}/connections/options',
695
+ ...options
696
+ });
697
+ };
698
+
699
+ /**
700
+ * List Connections
701
+ * List all data connections in the graph.
702
+ *
703
+ * Returns active and inactive connections with their current status.
704
+ * Connections can be filtered by:
705
+ * - **Entity**: Show connections for a specific entity
706
+ * - **Provider**: Filter by connection type (sec, quickbooks, plaid)
707
+ *
708
+ * Each connection shows:
709
+ * - Current sync status and health
710
+ * - Last successful sync timestamp
711
+ * - Configuration metadata
712
+ * - Error messages if any
713
+ *
714
+ * No credits are consumed for listing connections.
715
+ */
716
+ export const listConnections = <ThrowOnError extends boolean = false>(options: Options<ListConnectionsData, ThrowOnError>) => {
717
+ return (options.client ?? _heyApiClient).get<ListConnectionsResponses, ListConnectionsErrors, ThrowOnError>({
718
+ security: [
719
+ {
720
+ name: 'X-API-Key',
721
+ type: 'apiKey'
722
+ },
723
+ {
724
+ scheme: 'bearer',
725
+ type: 'http'
726
+ }
727
+ ],
728
+ url: '/v1/{graph_id}/connections',
729
+ ...options
730
+ });
731
+ };
732
+
733
+ /**
734
+ * Create Connection
735
+ * Create a new data connection for external system integration.
736
+ *
737
+ * This endpoint initiates connections to external data sources:
738
+ *
739
+ * **SEC Connections**:
740
+ * - Provide entity CIK for automatic filing retrieval
741
+ * - No authentication needed
742
+ * - Begins immediate data sync
743
+ *
744
+ * **QuickBooks Connections**:
745
+ * - Returns OAuth URL for authorization
746
+ * - Requires admin permissions in QuickBooks
747
+ * - Complete with OAuth callback
748
+ *
749
+ * **Plaid Connections**:
750
+ * - Returns Plaid Link token
751
+ * - User completes bank authentication
752
+ * - Exchange public token for access
753
+ *
754
+ * Credit consumption:
755
+ * - Base cost: 5.0 credits
756
+ * - Multiplied by graph tier
757
+ * - Additional credits consumed during data sync
758
+ */
759
+ export const createConnection = <ThrowOnError extends boolean = false>(options: Options<CreateConnectionData, ThrowOnError>) => {
760
+ return (options.client ?? _heyApiClient).post<CreateConnectionResponses, CreateConnectionErrors, ThrowOnError>({
761
+ security: [
762
+ {
763
+ name: 'X-API-Key',
764
+ type: 'apiKey'
765
+ },
766
+ {
767
+ scheme: 'bearer',
768
+ type: 'http'
769
+ }
770
+ ],
771
+ url: '/v1/{graph_id}/connections',
772
+ ...options,
773
+ headers: {
774
+ 'Content-Type': 'application/json',
775
+ ...options.headers
776
+ }
777
+ });
778
+ };
779
+
780
+ /**
781
+ * Delete Connection
782
+ * Delete a data connection and clean up related resources.
783
+ *
784
+ * This operation:
785
+ * - Removes the connection configuration
786
+ * - Preserves any imported data in the graph
787
+ * - Performs provider-specific cleanup
788
+ * - Revokes stored credentials
789
+ *
790
+ * Credit consumption:
791
+ * - Base cost: 2.0 credits
792
+ * - Multiplied by graph tier
793
+ *
794
+ * Only users with admin role can delete connections.
795
+ */
796
+ export const deleteConnection = <ThrowOnError extends boolean = false>(options: Options<DeleteConnectionData, ThrowOnError>) => {
797
+ return (options.client ?? _heyApiClient).delete<DeleteConnectionResponses, DeleteConnectionErrors, ThrowOnError>({
798
+ security: [
799
+ {
800
+ name: 'X-API-Key',
801
+ type: 'apiKey'
802
+ },
803
+ {
804
+ scheme: 'bearer',
805
+ type: 'http'
806
+ }
807
+ ],
808
+ url: '/v1/{graph_id}/connections/{connection_id}',
809
+ ...options
810
+ });
811
+ };
812
+
813
+ /**
814
+ * Get Connection
815
+ * Get detailed information about a specific connection.
816
+ *
817
+ * Returns comprehensive connection details including:
818
+ * - Current status and health indicators
819
+ * - Authentication state
820
+ * - Sync history and statistics
821
+ * - Error details if any
822
+ * - Provider-specific metadata
823
+ *
824
+ * No credits are consumed for viewing connection details.
825
+ */
826
+ export const getConnection = <ThrowOnError extends boolean = false>(options: Options<GetConnectionData, ThrowOnError>) => {
827
+ return (options.client ?? _heyApiClient).get<GetConnectionResponses, GetConnectionErrors, ThrowOnError>({
828
+ security: [
829
+ {
830
+ name: 'X-API-Key',
831
+ type: 'apiKey'
832
+ },
833
+ {
834
+ scheme: 'bearer',
835
+ type: 'http'
836
+ }
837
+ ],
838
+ url: '/v1/{graph_id}/connections/{connection_id}',
839
+ ...options
840
+ });
841
+ };
842
+
843
+ /**
844
+ * Sync Connection
845
+ * Trigger a data synchronization for the connection.
846
+ *
847
+ * Initiates data sync based on provider type:
848
+ *
849
+ * **SEC Sync**:
850
+ * - Downloads latest filings from EDGAR
851
+ * - Parses XBRL data and updates graph
852
+ * - Typically completes in 5-10 minutes
853
+ *
854
+ * **QuickBooks Sync**:
855
+ * - Fetches latest transactions and balances
856
+ * - Updates chart of accounts
857
+ * - Generates fresh trial balance
858
+ * - Duration depends on data volume
859
+ *
860
+ * **Plaid Sync**:
861
+ * - Retrieves recent bank transactions
862
+ * - Updates account balances
863
+ * - Categorizes new transactions
864
+ *
865
+ * Credit consumption:
866
+ * - Base cost: 20.0 credits
867
+ * - Multiplied by graph tier
868
+ * - Additional credits may be consumed during processing
869
+ *
870
+ * Returns a task ID for monitoring sync progress.
871
+ */
872
+ export const syncConnection = <ThrowOnError extends boolean = false>(options: Options<SyncConnectionData, ThrowOnError>) => {
873
+ return (options.client ?? _heyApiClient).post<SyncConnectionResponses, SyncConnectionErrors, ThrowOnError>({
874
+ security: [
875
+ {
876
+ name: 'X-API-Key',
877
+ type: 'apiKey'
878
+ },
879
+ {
880
+ scheme: 'bearer',
881
+ type: 'http'
882
+ }
883
+ ],
884
+ url: '/v1/{graph_id}/connections/{connection_id}/sync',
885
+ ...options,
886
+ headers: {
887
+ 'Content-Type': 'application/json',
888
+ ...options.headers
889
+ }
890
+ });
891
+ };
892
+
893
+ /**
894
+ * Create Link Token
895
+ * Create a link token for embedded authentication providers.
896
+ *
897
+ * This endpoint generates a temporary token used to initialize embedded authentication UI.
898
+ *
899
+ * Currently supported providers:
900
+ * - **Plaid**: Bank account connections with real-time transaction access
901
+ *
902
+ * The link token:
903
+ * - Expires after 4 hours
904
+ * - Is single-use only
905
+ * - Must be used with the matching frontend SDK
906
+ * - Includes user and entity context
907
+ *
908
+ * No credits are consumed for creating link tokens.
909
+ */
910
+ export const createLinkToken = <ThrowOnError extends boolean = false>(options: Options<CreateLinkTokenData, ThrowOnError>) => {
911
+ return (options.client ?? _heyApiClient).post<CreateLinkTokenResponses, CreateLinkTokenErrors, ThrowOnError>({
912
+ security: [
913
+ {
914
+ name: 'X-API-Key',
915
+ type: 'apiKey'
916
+ },
917
+ {
918
+ scheme: 'bearer',
919
+ type: 'http'
920
+ }
921
+ ],
922
+ url: '/v1/{graph_id}/connections/link/token',
923
+ ...options,
924
+ headers: {
925
+ 'Content-Type': 'application/json',
926
+ ...options.headers
927
+ }
928
+ });
929
+ };
930
+
931
+ /**
932
+ * Exchange Link Token
933
+ * Exchange a public token for permanent access credentials.
934
+ *
935
+ * This completes the embedded authentication flow after user authorization.
936
+ *
937
+ * The exchange process:
938
+ * 1. Validates the temporary public token
939
+ * 2. Exchanges it for permanent access credentials
940
+ * 3. Updates the connection with account information
941
+ * 4. Optionally triggers initial data sync
942
+ *
943
+ * Supported providers:
944
+ * - **Plaid**: Exchanges Plaid Link public token for access token
945
+ *
946
+ * Security:
947
+ * - Public tokens expire after 30 minutes
948
+ * - Each token can only be exchanged once
949
+ * - Full audit trail is maintained
950
+ *
951
+ * No credits are consumed for token exchange.
952
+ */
953
+ export const exchangeLinkToken = <ThrowOnError extends boolean = false>(options: Options<ExchangeLinkTokenData, ThrowOnError>) => {
954
+ return (options.client ?? _heyApiClient).post<ExchangeLinkTokenResponses, ExchangeLinkTokenErrors, ThrowOnError>({
955
+ security: [
956
+ {
957
+ name: 'X-API-Key',
958
+ type: 'apiKey'
959
+ },
960
+ {
961
+ scheme: 'bearer',
962
+ type: 'http'
963
+ }
964
+ ],
965
+ url: '/v1/{graph_id}/connections/link/exchange',
966
+ ...options,
967
+ headers: {
968
+ 'Content-Type': 'application/json',
969
+ ...options.headers
970
+ }
971
+ });
972
+ };
973
+
974
+ /**
975
+ * Init Oauth
976
+ * Initialize OAuth flow for a connection.
977
+ *
978
+ * This generates an authorization URL that the frontend should redirect the user to.
979
+ * Currently supports: QuickBooks
980
+ */
981
+ export const initOAuth = <ThrowOnError extends boolean = false>(options: Options<InitOAuthData, ThrowOnError>) => {
982
+ return (options.client ?? _heyApiClient).post<InitOAuthResponses, InitOAuthErrors, ThrowOnError>({
983
+ security: [
984
+ {
985
+ name: 'X-API-Key',
986
+ type: 'apiKey'
987
+ },
988
+ {
989
+ scheme: 'bearer',
990
+ type: 'http'
991
+ }
992
+ ],
993
+ url: '/v1/{graph_id}/connections/oauth/init',
994
+ ...options,
995
+ headers: {
996
+ 'Content-Type': 'application/json',
997
+ ...options.headers
998
+ }
999
+ });
1000
+ };
1001
+
1002
+ /**
1003
+ * OAuth Callback
1004
+ * Handle OAuth callback from provider after user authorization.
1005
+ *
1006
+ * This endpoint completes the OAuth flow:
1007
+ * 1. Validates the OAuth state parameter
1008
+ * 2. Exchanges authorization code for access tokens
1009
+ * 3. Stores tokens securely
1010
+ * 4. Updates connection status
1011
+ * 5. Optionally triggers initial sync
1012
+ *
1013
+ * Supported providers:
1014
+ * - **QuickBooks**: Accounting data integration
1015
+ *
1016
+ * Security measures:
1017
+ * - State validation prevents CSRF attacks
1018
+ * - User context is verified
1019
+ * - Tokens are encrypted before storage
1020
+ * - Full audit trail is maintained
1021
+ *
1022
+ * No credits are consumed for OAuth callbacks.
1023
+ */
1024
+ export const oauthCallback = <ThrowOnError extends boolean = false>(options: Options<OauthCallbackData, ThrowOnError>) => {
1025
+ return (options.client ?? _heyApiClient).post<OauthCallbackResponses, OauthCallbackErrors, ThrowOnError>({
1026
+ security: [
1027
+ {
1028
+ name: 'X-API-Key',
1029
+ type: 'apiKey'
1030
+ },
1031
+ {
1032
+ scheme: 'bearer',
1033
+ type: 'http'
1034
+ }
1035
+ ],
1036
+ url: '/v1/{graph_id}/connections/oauth/callback/{provider}',
1037
+ ...options,
1038
+ headers: {
1039
+ 'Content-Type': 'application/json',
1040
+ ...options.headers
1041
+ }
1042
+ });
1043
+ };
1044
+
1045
+ /**
1046
+ * Query Financial Agent
1047
+ * AI-powered financial analysis with direct access to graph data.
1048
+ *
1049
+ * This endpoint provides intelligent financial analysis using an AI agent that can:
1050
+ * - Analyze entity financial statements and SEC filings
1051
+ * - Review QuickBooks transactions and accounting data
1052
+ * - Perform multi-period trend analysis
1053
+ * - Generate insights from balance sheets and income statements
1054
+ * - Answer complex financial queries with contextual understanding
1055
+ *
1056
+ * **Execution Modes:**
1057
+ * - **Quick Analysis** (default): Synchronous responses for simple queries (1-2 tool calls)
1058
+ * - **Extended Analysis**: Asynchronous processing for complex research (returns operation_id for SSE monitoring)
1059
+ *
1060
+ * **Extended Analysis Monitoring:**
1061
+ * For complex queries, connect to the SSE stream for real-time progress:
1062
+ * ```javascript
1063
+ * const eventSource = new EventSource('/v1/operations/{operation_id}/stream');
1064
+ * eventSource.onmessage = (event) => {
1065
+ * const data = JSON.parse(event.data);
1066
+ * console.log('Analysis:', data.message);
1067
+ * };
1068
+ * ```
1069
+ *
1070
+ * **SSE Connection Limits:**
1071
+ * - Maximum 5 concurrent SSE connections per user
1072
+ * - Rate limited to 10 new connections per minute
1073
+ * - Automatic circuit breaker for Redis failures
1074
+ * - Graceful degradation with fallback to polling if SSE unavailable
1075
+ *
1076
+ * **Events Emitted:**
1077
+ * - `operation_started`: Analysis begins
1078
+ * - `operation_progress`: Tool calls, analysis steps
1079
+ * - `operation_completed`: Final comprehensive analysis
1080
+ * - `operation_error`: Analysis failed
1081
+ *
1082
+ * **Error Handling:**
1083
+ * - `429 Too Many Requests`: SSE connection limit exceeded
1084
+ * - `503 Service Unavailable`: SSE system temporarily disabled
1085
+ * - Fallback to status polling endpoint if SSE unavailable
1086
+ *
1087
+ * **Credit Consumption:**
1088
+ * - Variable based on complexity: 3-60 credits
1089
+ * - Simple queries: 3-15 credits
1090
+ * - Complex analysis: 15-60 credits
1091
+ * - Multiplied by graph tier (standard=1x, enterprise=2x, premium=4x)
1092
+ *
1093
+ * The agent automatically determines query complexity or you can force extended analysis.
1094
+ */
1095
+ export const queryFinancialAgent = <ThrowOnError extends boolean = false>(options: Options<QueryFinancialAgentData, ThrowOnError>) => {
1096
+ return (options.client ?? _heyApiClient).post<QueryFinancialAgentResponses, QueryFinancialAgentErrors, ThrowOnError>({
1097
+ security: [
1098
+ {
1099
+ name: 'X-API-Key',
1100
+ type: 'apiKey'
1101
+ },
1102
+ {
1103
+ scheme: 'bearer',
1104
+ type: 'http'
1105
+ }
1106
+ ],
1107
+ url: '/v1/{graph_id}/agent',
1108
+ ...options,
1109
+ headers: {
1110
+ 'Content-Type': 'application/json',
1111
+ ...options.headers
1112
+ }
1113
+ });
1114
+ };
1115
+
1116
+ /**
1117
+ * List MCP Tools
1118
+ * Get available Model Context Protocol tools for graph analysis.
1119
+ *
1120
+ * This endpoint returns a comprehensive list of MCP tools optimized for AI agents:
1121
+ * - Tool schemas with detailed parameter documentation
1122
+ * - Context-aware descriptions based on graph type
1123
+ * - Capability indicators for streaming and progress
1124
+ *
1125
+ * The tool list is customized based on:
1126
+ * - Graph type (shared repository vs user graph)
1127
+ * - User permissions and subscription tier
1128
+ * - Backend capabilities (Kuzu, Neo4j, etc.)
1129
+ *
1130
+ * Credit consumption:
1131
+ * - Listing tools is FREE to encourage exploration
1132
+ * - Tool execution costs vary by operation complexity
1133
+ */
1134
+ export const listMcpTools = <ThrowOnError extends boolean = false>(options: Options<ListMcpToolsData, ThrowOnError>) => {
1135
+ return (options.client ?? _heyApiClient).get<ListMcpToolsResponses, ListMcpToolsErrors, ThrowOnError>({
1136
+ security: [
1137
+ {
1138
+ name: 'X-API-Key',
1139
+ type: 'apiKey'
1140
+ },
1141
+ {
1142
+ scheme: 'bearer',
1143
+ type: 'http'
1144
+ }
1145
+ ],
1146
+ url: '/v1/{graph_id}/mcp/tools',
1147
+ ...options
1148
+ });
1149
+ };
1150
+
1151
+ /**
1152
+ * Execute MCP Tool
1153
+ * Execute an MCP tool with intelligent response optimization.
1154
+ *
1155
+ * This endpoint automatically selects the best execution strategy based on:
1156
+ * - Tool type and estimated complexity
1157
+ * - Client capabilities (AI agent detection)
1158
+ * - System load and queue status
1159
+ * - Graph type (shared repository vs user graph)
1160
+ *
1161
+ * **Response Formats:**
1162
+ * - **JSON**: Direct response for small/fast operations
1163
+ * - **SSE**: Server-Sent Events for progress monitoring
1164
+ * - **NDJSON**: Newline-delimited JSON for streaming
1165
+ * - **Queued**: Asynchronous execution with status monitoring
1166
+ *
1167
+ * **SSE Streaming Support:**
1168
+ * - Maximum 5 concurrent SSE connections per user
1169
+ * - Rate limited to 10 new connections per minute
1170
+ * - Automatic circuit breaker for Redis failures
1171
+ * - Graceful degradation to direct response if SSE unavailable
1172
+ * - Progress events for long-running operations
1173
+ *
1174
+ * **AI Agent Optimization:**
1175
+ * The Node.js MCP client transparently handles all response formats,
1176
+ * presenting a unified interface to AI agents. Streaming responses are
1177
+ * automatically aggregated for seamless consumption.
1178
+ *
1179
+ * **Error Handling:**
1180
+ * - `429 Too Many Requests`: Connection limit or rate limit exceeded
1181
+ * - `503 Service Unavailable`: SSE system temporarily disabled
1182
+ * - `408 Request Timeout`: Tool execution exceeded timeout
1183
+ * - Clients should implement exponential backoff on errors
1184
+ *
1185
+ * **Credit Consumption:**
1186
+ * - Simple tools: 2-5 credits
1187
+ * - Schema tools: 5-10 credits
1188
+ * - Query tools: 10-50 credits (based on complexity)
1189
+ * - Multiplied by graph tier
1190
+ */
1191
+ export const callMcpTool = <ThrowOnError extends boolean = false>(options: Options<CallMcpToolData, ThrowOnError>) => {
1192
+ return (options.client ?? _heyApiClient).post<CallMcpToolResponses, CallMcpToolErrors, ThrowOnError>({
1193
+ security: [
1194
+ {
1195
+ name: 'X-API-Key',
1196
+ type: 'apiKey'
1197
+ },
1198
+ {
1199
+ scheme: 'bearer',
1200
+ type: 'http'
1201
+ }
1202
+ ],
1203
+ url: '/v1/{graph_id}/mcp/call-tool',
1204
+ ...options,
1205
+ headers: {
1206
+ 'Content-Type': 'application/json',
1207
+ ...options.headers
1208
+ }
1209
+ });
1210
+ };
1211
+
1212
+ /**
1213
+ * Create Backup
1214
+ * Create a backup of the graph database.
1215
+ *
1216
+ * Creates a complete backup of the Kuzu database (.kuzu file) with:
1217
+ * - **Format**: Full database backup only (complete .kuzu file)
1218
+ * - **Compression**: Always enabled for optimal storage
1219
+ * - **Encryption**: Optional AES-256 encryption for security
1220
+ * - **Retention**: Configurable retention period (1-2555 days)
1221
+ *
1222
+ * **Backup Features:**
1223
+ * - **Complete Backup**: Full database file backup
1224
+ * - **Consistency**: Point-in-time consistent snapshot
1225
+ * - **Download Support**: Unencrypted backups can be downloaded
1226
+ * - **Restore Support**: Future support for encrypted backup restoration
1227
+ *
1228
+ * **Progress Monitoring:**
1229
+ * Use the returned operation_id to connect to the SSE stream:
1230
+ * ```javascript
1231
+ * const eventSource = new EventSource('/v1/operations/{operation_id}/stream');
1232
+ * eventSource.addEventListener('operation_progress', (event) => {
1233
+ * const data = JSON.parse(event.data);
1234
+ * console.log('Backup progress:', data.progress_percent + '%');
1235
+ * });
1236
+ * ```
1237
+ *
1238
+ * **SSE Connection Limits:**
1239
+ * - Maximum 5 concurrent SSE connections per user
1240
+ * - Rate limited to 10 new connections per minute
1241
+ * - Automatic circuit breaker for Redis failures
1242
+ * - Graceful degradation if event system unavailable
1243
+ *
1244
+ * **Important Notes:**
1245
+ * - Only full_dump format is supported (no CSV/JSON exports)
1246
+ * - Compression is always enabled
1247
+ * - Encrypted backups cannot be downloaded (security measure)
1248
+ * - All backups are stored securely in cloud storage
1249
+ *
1250
+ * **Credit Consumption:**
1251
+ * - Base cost: 25.0 credits
1252
+ * - Large databases (>10GB): 50.0 credits
1253
+ * - Multiplied by graph tier
1254
+ *
1255
+ * Returns operation details for SSE monitoring.
1256
+ */
1257
+ export const createBackup = <ThrowOnError extends boolean = false>(options: Options<CreateBackupData, ThrowOnError>) => {
1258
+ return (options.client ?? _heyApiClient).post<CreateBackupResponses, CreateBackupErrors, ThrowOnError>({
1259
+ security: [
1260
+ {
1261
+ name: 'X-API-Key',
1262
+ type: 'apiKey'
1263
+ },
1264
+ {
1265
+ scheme: 'bearer',
1266
+ type: 'http'
1267
+ }
1268
+ ],
1269
+ url: '/v1/{graph_id}/backup/create',
1270
+ ...options,
1271
+ headers: {
1272
+ 'Content-Type': 'application/json',
1273
+ ...options.headers
1274
+ }
1275
+ });
1276
+ };
1277
+
1278
+ /**
1279
+ * List Kuzu graph backups
1280
+ * List all backups for the specified graph database
1281
+ */
1282
+ export const listBackups = <ThrowOnError extends boolean = false>(options: Options<ListBackupsData, ThrowOnError>) => {
1283
+ return (options.client ?? _heyApiClient).get<ListBackupsResponses, ListBackupsErrors, ThrowOnError>({
1284
+ security: [
1285
+ {
1286
+ name: 'X-API-Key',
1287
+ type: 'apiKey'
1288
+ },
1289
+ {
1290
+ scheme: 'bearer',
1291
+ type: 'http'
1292
+ }
1293
+ ],
1294
+ url: '/v1/{graph_id}/backup/list',
1295
+ ...options
1296
+ });
1297
+ };
1298
+
1299
+ /**
1300
+ * Export Kuzu backup for download
1301
+ * Export a backup file for download (only available for non-encrypted, compressed .kuzu backups)
1302
+ */
1303
+ export const exportBackup = <ThrowOnError extends boolean = false>(options: Options<ExportBackupData, ThrowOnError>) => {
1304
+ return (options.client ?? _heyApiClient).post<ExportBackupResponses, ExportBackupErrors, ThrowOnError>({
1305
+ security: [
1306
+ {
1307
+ name: 'X-API-Key',
1308
+ type: 'apiKey'
1309
+ },
1310
+ {
1311
+ scheme: 'bearer',
1312
+ type: 'http'
1313
+ }
1314
+ ],
1315
+ url: '/v1/{graph_id}/backup/export',
1316
+ ...options,
1317
+ headers: {
1318
+ 'Content-Type': 'application/json',
1319
+ ...options.headers
1320
+ }
1321
+ });
1322
+ };
1323
+
1324
+ /**
1325
+ * Restore Encrypted Backup
1326
+ * Restore a graph database from an encrypted backup.
1327
+ *
1328
+ * Restores a complete Kuzu database from an encrypted backup:
1329
+ * - **Format**: Only full_dump backups can be restored
1330
+ * - **Encryption**: Only encrypted backups can be restored (security requirement)
1331
+ * - **System Backup**: Creates automatic backup of existing database before restore
1332
+ * - **Verification**: Optionally verifies database integrity after restore
1333
+ *
1334
+ * **Restore Features:**
1335
+ * - **Atomic Operation**: Complete replacement of database
1336
+ * - **Rollback Protection**: System backup created before restore
1337
+ * - **Data Integrity**: Verification ensures successful restore
1338
+ * - **Security**: Only encrypted backups to prevent data tampering
1339
+ *
1340
+ * **Progress Monitoring:**
1341
+ * Use the returned operation_id to connect to the SSE stream:
1342
+ * ```javascript
1343
+ * const eventSource = new EventSource('/v1/operations/{operation_id}/stream');
1344
+ * eventSource.addEventListener('operation_progress', (event) => {
1345
+ * const data = JSON.parse(event.data);
1346
+ * console.log('Restore progress:', data.message);
1347
+ * });
1348
+ * ```
1349
+ *
1350
+ * **SSE Connection Limits:**
1351
+ * - Maximum 5 concurrent SSE connections per user
1352
+ * - Rate limited to 10 new connections per minute
1353
+ * - Automatic circuit breaker for Redis failures
1354
+ * - Graceful degradation if event system unavailable
1355
+ *
1356
+ * **Important Notes:**
1357
+ * - Only encrypted backups can be restored (security measure)
1358
+ * - Existing database is backed up to S3 before restore
1359
+ * - Restore is a destructive operation - existing data is replaced
1360
+ * - System backups are stored separately for recovery
1361
+ *
1362
+ * **Credit Consumption:**
1363
+ * - Base cost: 100.0 credits
1364
+ * - Large databases (>10GB): 200.0 credits
1365
+ * - Multiplied by graph tier
1366
+ *
1367
+ * Returns operation details for SSE monitoring.
1368
+ */
1369
+ export const restoreBackup = <ThrowOnError extends boolean = false>(options: Options<RestoreBackupData, ThrowOnError>) => {
1370
+ return (options.client ?? _heyApiClient).post<RestoreBackupResponses, RestoreBackupErrors, ThrowOnError>({
1371
+ security: [
1372
+ {
1373
+ name: 'X-API-Key',
1374
+ type: 'apiKey'
1375
+ },
1376
+ {
1377
+ scheme: 'bearer',
1378
+ type: 'http'
1379
+ }
1380
+ ],
1381
+ url: '/v1/{graph_id}/backup/restore',
1382
+ ...options,
1383
+ headers: {
1384
+ 'Content-Type': 'application/json',
1385
+ ...options.headers
1386
+ }
1387
+ });
1388
+ };
1389
+
1390
+ /**
1391
+ * Get backup statistics
1392
+ * Get comprehensive backup statistics for the specified graph database
1393
+ */
1394
+ export const getBackupStats = <ThrowOnError extends boolean = false>(options: Options<GetBackupStatsData, ThrowOnError>) => {
1395
+ return (options.client ?? _heyApiClient).get<GetBackupStatsResponses, GetBackupStatsErrors, ThrowOnError>({
1396
+ security: [
1397
+ {
1398
+ name: 'X-API-Key',
1399
+ type: 'apiKey'
1400
+ },
1401
+ {
1402
+ scheme: 'bearer',
1403
+ type: 'http'
1404
+ }
1405
+ ],
1406
+ url: '/v1/{graph_id}/backup/stats',
1407
+ ...options
1408
+ });
1409
+ };
1410
+
1411
+ /**
1412
+ * Check Kuzu backup system health
1413
+ * Check the health status of the Kuzu backup system
1414
+ */
1415
+ export const kuzuBackupHealth = <ThrowOnError extends boolean = false>(options: Options<KuzuBackupHealthData, ThrowOnError>) => {
1416
+ return (options.client ?? _heyApiClient).get<KuzuBackupHealthResponses, KuzuBackupHealthErrors, ThrowOnError>({
1417
+ security: [
1418
+ {
1419
+ name: 'X-API-Key',
1420
+ type: 'apiKey'
1421
+ },
1422
+ {
1423
+ scheme: 'bearer',
1424
+ type: 'http'
1425
+ }
1426
+ ],
1427
+ url: '/v1/{graph_id}/backup/health',
1428
+ ...options
1429
+ });
1430
+ };
1431
+
1432
+ /**
1433
+ * Get temporary download URL for backup
1434
+ * Generate a temporary download URL for a backup (unencrypted, compressed .kuzu files only)
1435
+ */
1436
+ export const getBackupDownloadUrl = <ThrowOnError extends boolean = false>(options: Options<GetBackupDownloadUrlData, ThrowOnError>) => {
1437
+ return (options.client ?? _heyApiClient).get<GetBackupDownloadUrlResponses, GetBackupDownloadUrlErrors, ThrowOnError>({
1438
+ security: [
1439
+ {
1440
+ name: 'X-API-Key',
1441
+ type: 'apiKey'
1442
+ },
1443
+ {
1444
+ scheme: 'bearer',
1445
+ type: 'http'
1446
+ }
1447
+ ],
1448
+ url: '/v1/{graph_id}/backup/{backup_id}/download-url',
1449
+ ...options
1450
+ });
1451
+ };
1452
+
1453
+ /**
1454
+ * Get Graph Metrics
1455
+ * Get comprehensive metrics for the graph database.
1456
+ *
1457
+ * Provides detailed analytics including:
1458
+ * - **Node Statistics**: Counts by type (Entity, Report, Account, Transaction)
1459
+ * - **Relationship Metrics**: Connection counts and patterns
1460
+ * - **Data Quality**: Completeness scores and validation results
1461
+ * - **Performance Metrics**: Query response times and database health
1462
+ * - **Storage Analytics**: Database size and growth trends
1463
+ *
1464
+ * This data helps with:
1465
+ * - Monitoring data completeness
1466
+ * - Identifying data quality issues
1467
+ * - Capacity planning
1468
+ * - Performance optimization
1469
+ *
1470
+ * Credit consumption:
1471
+ * - Base cost: 15.0 credits
1472
+ * - Multiplied by graph tier (standard=1x, enterprise=2x, premium=4x)
1473
+ */
1474
+ export const getGraphMetrics = <ThrowOnError extends boolean = false>(options: Options<GetGraphMetricsData, ThrowOnError>) => {
1475
+ return (options.client ?? _heyApiClient).get<GetGraphMetricsResponses, GetGraphMetricsErrors, ThrowOnError>({
1476
+ security: [
1477
+ {
1478
+ name: 'X-API-Key',
1479
+ type: 'apiKey'
1480
+ },
1481
+ {
1482
+ scheme: 'bearer',
1483
+ type: 'http'
1484
+ }
1485
+ ],
1486
+ url: '/v1/{graph_id}/analytics',
1487
+ ...options
1488
+ });
1489
+ };
1490
+
1491
+ /**
1492
+ * Get Usage Statistics
1493
+ * Get detailed usage statistics for the graph.
1494
+ *
1495
+ * Provides temporal usage patterns including:
1496
+ * - **Query Volume**: API calls per day/hour
1497
+ * - **Credit Consumption**: Usage patterns and trends
1498
+ * - **Operation Breakdown**: Usage by operation type
1499
+ * - **User Activity**: Access patterns by user role
1500
+ * - **Peak Usage Times**: Identify high-activity periods
1501
+ *
1502
+ * Time ranges available:
1503
+ * - Last 24 hours (hourly breakdown)
1504
+ * - Last 7 days (daily breakdown)
1505
+ * - Last 30 days (daily breakdown)
1506
+ * - Custom date ranges
1507
+ *
1508
+ * Useful for:
1509
+ * - Capacity planning
1510
+ * - Cost optimization
1511
+ * - Usage trend analysis
1512
+ * - Performance tuning
1513
+ *
1514
+ * Credit consumption:
1515
+ * - Base cost: 10.0 credits
1516
+ * - Multiplied by graph tier
1517
+ */
1518
+ export const getGraphUsageStats = <ThrowOnError extends boolean = false>(options: Options<GetGraphUsageStatsData, ThrowOnError>) => {
1519
+ return (options.client ?? _heyApiClient).get<GetGraphUsageStatsResponses, GetGraphUsageStatsErrors, ThrowOnError>({
1520
+ security: [
1521
+ {
1522
+ name: 'X-API-Key',
1523
+ type: 'apiKey'
1524
+ },
1525
+ {
1526
+ scheme: 'bearer',
1527
+ type: 'http'
1528
+ }
1529
+ ],
1530
+ url: '/v1/{graph_id}/analytics/usage',
1531
+ ...options
1532
+ });
1533
+ };
1534
+
1535
+ /**
1536
+ * Execute Cypher Query
1537
+ * Execute a Cypher query with intelligent response optimization.
1538
+ *
1539
+ * This endpoint automatically selects the best execution strategy based on:
1540
+ * - Query characteristics (size, complexity)
1541
+ * - Client capabilities (SSE, NDJSON, JSON)
1542
+ * - System load (queue status, concurrent queries)
1543
+ * - User preferences (mode parameter, headers)
1544
+ *
1545
+ * **Response Modes:**
1546
+ * - `auto` (default): Intelligent automatic selection
1547
+ * - `sync`: Force synchronous JSON response (best for testing)
1548
+ * - `async`: Force queued response with polling URLs
1549
+ * - `stream`: Force streaming response (SSE or NDJSON)
1550
+ *
1551
+ * **Client Detection:**
1552
+ * - Automatically detects testing tools (Postman, Swagger UI)
1553
+ * - Adjusts behavior for better interactive experience
1554
+ * - Respects Accept and Prefer headers for capabilities
1555
+ *
1556
+ * **Streaming Support (SSE):**
1557
+ * - Real-time events with progress updates
1558
+ * - Maximum 5 concurrent SSE connections per user
1559
+ * - Rate limited to 10 new connections per minute
1560
+ * - Automatic circuit breaker for Redis failures
1561
+ * - Graceful degradation if event system unavailable
1562
+ * - 30-second keepalive to prevent timeouts
1563
+ *
1564
+ * **Streaming Support (NDJSON):**
1565
+ * - Efficient line-delimited JSON for large results
1566
+ * - Automatic chunking (configurable 10-10000 rows)
1567
+ * - No connection limits (stateless streaming)
1568
+ *
1569
+ * **Queue Management:**
1570
+ * - Automatic queuing under high load
1571
+ * - SSE-based queue monitoring (no polling needed)
1572
+ * - Priority based on subscription tier
1573
+ * - Queue position updates via SSE events
1574
+ *
1575
+ * **Error Handling:**
1576
+ * - `429 Too Many Requests`: Rate limit or connection limit exceeded
1577
+ * - `503 Service Unavailable`: Circuit breaker open or SSE disabled
1578
+ * - Clients should implement exponential backoff
1579
+ *
1580
+ * **Credit Consumption:**
1581
+ * - Variable based on query complexity: 1-50 credits
1582
+ * - Streaming queries charged per 1000 rows
1583
+ * - Queue position based on subscription tier
1584
+ */
1585
+ export const executeCypherQuery = <ThrowOnError extends boolean = false>(options: Options<ExecuteCypherQueryData, ThrowOnError>) => {
1586
+ return (options.client ?? _heyApiClient).post<ExecuteCypherQueryResponses, ExecuteCypherQueryErrors, ThrowOnError>({
1587
+ security: [
1588
+ {
1589
+ name: 'X-API-Key',
1590
+ type: 'apiKey'
1591
+ },
1592
+ {
1593
+ scheme: 'bearer',
1594
+ type: 'http'
1595
+ }
1596
+ ],
1597
+ url: '/v1/{graph_id}/query',
1598
+ ...options,
1599
+ headers: {
1600
+ 'Content-Type': 'application/json',
1601
+ ...options.headers
1602
+ }
1603
+ });
1604
+ };
1605
+
1606
+ /**
1607
+ * Get Runtime Graph Schema Information
1608
+ * Get runtime schema information for the specified graph database.
1609
+ *
1610
+ * This endpoint inspects the actual graph database structure and returns:
1611
+ * - **Node Labels**: All node types currently in the database
1612
+ * - **Relationship Types**: All relationship types currently in the database
1613
+ * - **Node Properties**: Properties for each node type (limited to first 10 for performance)
1614
+ *
1615
+ * This is different from custom schema management - it shows what actually exists in the database,
1616
+ * useful for understanding the current graph structure before writing queries.
1617
+ *
1618
+ * Credit consumption:
1619
+ * - Base cost: 2.0 credits
1620
+ * - Multiplied by graph tier (standard=1x, enterprise=2x, premium=4x)
1621
+ * - Schema information is cached for performance
1622
+ */
1623
+ export const getGraphSchemaInfo = <ThrowOnError extends boolean = false>(options: Options<GetGraphSchemaInfoData, ThrowOnError>) => {
1624
+ return (options.client ?? _heyApiClient).get<GetGraphSchemaInfoResponses, GetGraphSchemaInfoErrors, ThrowOnError>({
1625
+ security: [
1626
+ {
1627
+ name: 'X-API-Key',
1628
+ type: 'apiKey'
1629
+ },
1630
+ {
1631
+ scheme: 'bearer',
1632
+ type: 'http'
1633
+ }
1634
+ ],
1635
+ url: '/v1/{graph_id}/schema/info',
1636
+ ...options
1637
+ });
1638
+ };
1639
+
1640
+ /**
1641
+ * Validate Schema
1642
+ * Validate a custom schema definition before deployment.
1643
+ *
1644
+ * This endpoint performs comprehensive validation including:
1645
+ * - **Structure Validation**: Ensures proper JSON/YAML format
1646
+ * - **Type Checking**: Validates data types (STRING, INT, DOUBLE, etc.)
1647
+ * - **Constraint Verification**: Checks primary keys and unique constraints
1648
+ * - **Relationship Integrity**: Validates node references in relationships
1649
+ * - **Naming Conventions**: Ensures valid identifiers
1650
+ * - **Compatibility**: Checks against existing extensions if specified
1651
+ *
1652
+ * Supported formats:
1653
+ * - JSON schema definitions
1654
+ * - YAML schema definitions
1655
+ * - Direct dictionary format
1656
+ *
1657
+ * Validation helps prevent:
1658
+ * - Schema deployment failures
1659
+ * - Data integrity issues
1660
+ * - Performance problems
1661
+ * - Naming conflicts
1662
+ *
1663
+ * Credit consumption:
1664
+ * - Base cost: 5.0 credits
1665
+ * - Multiplied by graph tier
1666
+ */
1667
+ export const validateSchema = <ThrowOnError extends boolean = false>(options: Options<ValidateSchemaData, ThrowOnError>) => {
1668
+ return (options.client ?? _heyApiClient).post<ValidateSchemaResponses, ValidateSchemaErrors, ThrowOnError>({
1669
+ security: [
1670
+ {
1671
+ name: 'X-API-Key',
1672
+ type: 'apiKey'
1673
+ },
1674
+ {
1675
+ scheme: 'bearer',
1676
+ type: 'http'
1677
+ }
1678
+ ],
1679
+ url: '/v1/{graph_id}/schema/validate',
1680
+ ...options,
1681
+ headers: {
1682
+ 'Content-Type': 'application/json',
1683
+ ...options.headers
1684
+ }
1685
+ });
1686
+ };
1687
+
1688
+ /**
1689
+ * Export Graph Schema
1690
+ * Export the schema of an existing graph in JSON, YAML, or Cypher format
1691
+ */
1692
+ export const exportGraphSchema = <ThrowOnError extends boolean = false>(options: Options<ExportGraphSchemaData, ThrowOnError>) => {
1693
+ return (options.client ?? _heyApiClient).get<ExportGraphSchemaResponses, ExportGraphSchemaErrors, ThrowOnError>({
1694
+ security: [
1695
+ {
1696
+ name: 'X-API-Key',
1697
+ type: 'apiKey'
1698
+ },
1699
+ {
1700
+ scheme: 'bearer',
1701
+ type: 'http'
1702
+ }
1703
+ ],
1704
+ url: '/v1/{graph_id}/schema/export',
1705
+ ...options
1706
+ });
1707
+ };
1708
+
1709
+ /**
1710
+ * List Available Schema Extensions
1711
+ * Get list of available schema extensions and compatibility groups
1712
+ */
1713
+ export const listSchemaExtensions = <ThrowOnError extends boolean = false>(options: Options<ListSchemaExtensionsData, ThrowOnError>) => {
1714
+ return (options.client ?? _heyApiClient).get<ListSchemaExtensionsResponses, ListSchemaExtensionsErrors, ThrowOnError>({
1715
+ security: [
1716
+ {
1717
+ name: 'X-API-Key',
1718
+ type: 'apiKey'
1719
+ },
1720
+ {
1721
+ scheme: 'bearer',
1722
+ type: 'http'
1723
+ }
1724
+ ],
1725
+ url: '/v1/{graph_id}/schema/extensions',
1726
+ ...options
1727
+ });
1728
+ };
1729
+
1730
+ /**
1731
+ * Get Current Bill
1732
+ * Get current month's billing details for the graph.
1733
+ *
1734
+ * Returns comprehensive billing information including:
1735
+ * - **Credit Usage**: Consumed vs. allocated credits
1736
+ * - **Storage Charges**: Current storage usage and costs
1737
+ * - **Subscription Tier**: Current plan and features
1738
+ * - **Pro-rated Charges**: If plan changed mid-month
1739
+ * - **Estimated Total**: Current charges to date
1740
+ *
1741
+ * Billing calculations are updated hourly. Storage is measured in GB-months.
1742
+ *
1743
+ * ℹ️ No credits are consumed for viewing billing information.
1744
+ */
1745
+ export const getCurrentGraphBill = <ThrowOnError extends boolean = false>(options: Options<GetCurrentGraphBillData, ThrowOnError>) => {
1746
+ return (options.client ?? _heyApiClient).get<GetCurrentGraphBillResponses, GetCurrentGraphBillErrors, ThrowOnError>({
1747
+ security: [
1748
+ {
1749
+ name: 'X-API-Key',
1750
+ type: 'apiKey'
1751
+ },
1752
+ {
1753
+ scheme: 'bearer',
1754
+ type: 'http'
1755
+ }
1756
+ ],
1757
+ url: '/v1/{graph_id}/billing/current',
1758
+ ...options
1759
+ });
1760
+ };
1761
+
1762
+ /**
1763
+ * Get Monthly Bill
1764
+ * Get billing details for a specific month.
1765
+ *
1766
+ * Retrieve historical billing information for any previous month.
1767
+ * Useful for:
1768
+ * - Reconciling past charges
1769
+ * - Tracking usage trends
1770
+ * - Expense reporting
1771
+ * - Budget analysis
1772
+ *
1773
+ * Returns the same detailed breakdown as the current bill endpoint.
1774
+ *
1775
+ * ℹ️ No credits are consumed for viewing billing history.
1776
+ */
1777
+ export const getGraphMonthlyBill = <ThrowOnError extends boolean = false>(options: Options<GetGraphMonthlyBillData, ThrowOnError>) => {
1778
+ return (options.client ?? _heyApiClient).get<GetGraphMonthlyBillResponses, GetGraphMonthlyBillErrors, ThrowOnError>({
1779
+ security: [
1780
+ {
1781
+ name: 'X-API-Key',
1782
+ type: 'apiKey'
1783
+ },
1784
+ {
1785
+ scheme: 'bearer',
1786
+ type: 'http'
1787
+ }
1788
+ ],
1789
+ url: '/v1/{graph_id}/billing/history/{year}/{month}',
1790
+ ...options
1791
+ });
1792
+ };
1793
+
1794
+ /**
1795
+ * Get Billing History
1796
+ * Get billing history for the graph.
1797
+ *
1798
+ * Returns a chronological list of monthly bills, perfect for:
1799
+ * - Tracking spending trends over time
1800
+ * - Identifying usage patterns
1801
+ * - Budget forecasting
1802
+ * - Financial reporting
1803
+ *
1804
+ * Each month includes:
1805
+ * - Credit usage and overages
1806
+ * - Storage charges
1807
+ * - Total charges
1808
+ * - Usage metrics
1809
+ *
1810
+ * ℹ️ No credits are consumed for viewing billing history.
1811
+ */
1812
+ export const getGraphBillingHistory = <ThrowOnError extends boolean = false>(options: Options<GetGraphBillingHistoryData, ThrowOnError>) => {
1813
+ return (options.client ?? _heyApiClient).get<GetGraphBillingHistoryResponses, GetGraphBillingHistoryErrors, ThrowOnError>({
1814
+ security: [
1815
+ {
1816
+ name: 'X-API-Key',
1817
+ type: 'apiKey'
1818
+ },
1819
+ {
1820
+ scheme: 'bearer',
1821
+ type: 'http'
1822
+ }
1823
+ ],
1824
+ url: '/v1/{graph_id}/billing/history',
1825
+ ...options
1826
+ });
1827
+ };
1828
+
1829
+ /**
1830
+ * Get Usage Details
1831
+ * Get detailed usage metrics for the graph.
1832
+ *
1833
+ * Provides granular usage information including:
1834
+ * - **Daily Credit Consumption**: Track credit usage patterns
1835
+ * - **Storage Growth**: Monitor database size over time
1836
+ * - **Operation Breakdown**: Credits by operation type
1837
+ * - **Peak Usage Times**: Identify high-activity periods
1838
+ * - **API Call Volumes**: Request counts and patterns
1839
+ *
1840
+ * Useful for:
1841
+ * - Optimizing credit consumption
1842
+ * - Capacity planning
1843
+ * - Usage trend analysis
1844
+ * - Cost optimization
1845
+ *
1846
+ * ℹ️ No credits are consumed for viewing usage details.
1847
+ */
1848
+ export const getGraphUsageDetails = <ThrowOnError extends boolean = false>(options: Options<GetGraphUsageDetailsData, ThrowOnError>) => {
1849
+ return (options.client ?? _heyApiClient).get<GetGraphUsageDetailsResponses, GetGraphUsageDetailsErrors, ThrowOnError>({
1850
+ security: [
1851
+ {
1852
+ name: 'X-API-Key',
1853
+ type: 'apiKey'
1854
+ },
1855
+ {
1856
+ scheme: 'bearer',
1857
+ type: 'http'
1858
+ }
1859
+ ],
1860
+ url: '/v1/{graph_id}/billing/usage',
1861
+ ...options
1862
+ });
1863
+ };
1864
+
1865
+ /**
1866
+ * Get Graph Pricing Info
1867
+ * Get pricing information for a specific graph database.
1868
+ */
1869
+ export const getGraphPricingInfoV1GraphIdBillingPricingGet = <ThrowOnError extends boolean = false>(options: Options<GetGraphPricingInfoV1GraphIdBillingPricingGetData, ThrowOnError>) => {
1870
+ return (options.client ?? _heyApiClient).get<GetGraphPricingInfoV1GraphIdBillingPricingGetResponses, GetGraphPricingInfoV1GraphIdBillingPricingGetErrors, ThrowOnError>({
1871
+ security: [
1872
+ {
1873
+ name: 'X-API-Key',
1874
+ type: 'apiKey'
1875
+ },
1876
+ {
1877
+ scheme: 'bearer',
1878
+ type: 'http'
1879
+ }
1880
+ ],
1881
+ url: '/v1/{graph_id}/billing/pricing',
1882
+ ...options
1883
+ });
1884
+ };
1885
+
1886
+ /**
1887
+ * Upgrade Graph Subscription
1888
+ * Upgrade subscription for a specific graph database.
1889
+ */
1890
+ export const upgradeGraphSubscriptionV1GraphIdBillingSubscriptionUpgradePost = <ThrowOnError extends boolean = false>(options: Options<UpgradeGraphSubscriptionV1GraphIdBillingSubscriptionUpgradePostData, ThrowOnError>) => {
1891
+ return (options.client ?? _heyApiClient).post<UpgradeGraphSubscriptionV1GraphIdBillingSubscriptionUpgradePostResponses, UpgradeGraphSubscriptionV1GraphIdBillingSubscriptionUpgradePostErrors, ThrowOnError>({
1892
+ security: [
1893
+ {
1894
+ name: 'X-API-Key',
1895
+ type: 'apiKey'
1896
+ },
1897
+ {
1898
+ scheme: 'bearer',
1899
+ type: 'http'
1900
+ }
1901
+ ],
1902
+ url: '/v1/{graph_id}/billing/subscription/upgrade',
1903
+ ...options,
1904
+ headers: {
1905
+ 'Content-Type': 'application/json',
1906
+ ...options.headers
1907
+ }
1908
+ });
1909
+ };
1910
+
1911
+ /**
1912
+ * Get Graph Subscription
1913
+ * Get current subscription for a graph database.
1914
+ */
1915
+ export const getGraphSubscriptionV1GraphIdBillingSubscriptionGet = <ThrowOnError extends boolean = false>(options: Options<GetGraphSubscriptionV1GraphIdBillingSubscriptionGetData, ThrowOnError>) => {
1916
+ return (options.client ?? _heyApiClient).get<GetGraphSubscriptionV1GraphIdBillingSubscriptionGetResponses, GetGraphSubscriptionV1GraphIdBillingSubscriptionGetErrors, ThrowOnError>({
1917
+ security: [
1918
+ {
1919
+ name: 'X-API-Key',
1920
+ type: 'apiKey'
1921
+ },
1922
+ {
1923
+ scheme: 'bearer',
1924
+ type: 'http'
1925
+ }
1926
+ ],
1927
+ url: '/v1/{graph_id}/billing/subscription',
1928
+ ...options
1929
+ });
1930
+ };
1931
+
1932
+ /**
1933
+ * Get Available Subscription Plans
1934
+ * Get available subscription plans for upgrade.
1935
+ */
1936
+ export const getAvailableSubscriptionPlansV1GraphIdBillingAvailablePlansGet = <ThrowOnError extends boolean = false>(options: Options<GetAvailableSubscriptionPlansV1GraphIdBillingAvailablePlansGetData, ThrowOnError>) => {
1937
+ return (options.client ?? _heyApiClient).get<GetAvailableSubscriptionPlansV1GraphIdBillingAvailablePlansGetResponses, GetAvailableSubscriptionPlansV1GraphIdBillingAvailablePlansGetErrors, ThrowOnError>({
1938
+ security: [
1939
+ {
1940
+ name: 'X-API-Key',
1941
+ type: 'apiKey'
1942
+ },
1943
+ {
1944
+ scheme: 'bearer',
1945
+ type: 'http'
1946
+ }
1947
+ ],
1948
+ url: '/v1/{graph_id}/billing/available-plans',
1949
+ ...options
1950
+ });
1951
+ };
1952
+
1953
+ /**
1954
+ * Get Credit Billing Info
1955
+ * Get credit-based billing information for a specific graph.
1956
+ *
1957
+ * This endpoint provides comprehensive credit usage and billing information
1958
+ * without consuming credits (for billing transparency).
1959
+ */
1960
+ export const getCreditBillingInfoV1GraphIdBillingCreditsGet = <ThrowOnError extends boolean = false>(options: Options<GetCreditBillingInfoV1GraphIdBillingCreditsGetData, ThrowOnError>) => {
1961
+ return (options.client ?? _heyApiClient).get<GetCreditBillingInfoV1GraphIdBillingCreditsGetResponses, GetCreditBillingInfoV1GraphIdBillingCreditsGetErrors, ThrowOnError>({
1962
+ security: [
1963
+ {
1964
+ name: 'X-API-Key',
1965
+ type: 'apiKey'
1966
+ },
1967
+ {
1968
+ scheme: 'bearer',
1969
+ type: 'http'
1970
+ }
1971
+ ],
1972
+ url: '/v1/{graph_id}/billing/credits',
1973
+ ...options
1974
+ });
1975
+ };
1976
+
1977
+ /**
1978
+ * Get Credit Summary
1979
+ * Retrieve comprehensive credit usage summary for the specified graph.
1980
+ *
1981
+ * This endpoint provides:
1982
+ * - Current credit balance and monthly allocation
1983
+ * - Credit consumption metrics for the current month
1984
+ * - Graph tier and credit multiplier information
1985
+ * - Usage percentage to help monitor credit consumption
1986
+ *
1987
+ * No credits are consumed for checking credit status.
1988
+ */
1989
+ export const getCreditSummary = <ThrowOnError extends boolean = false>(options: Options<GetCreditSummaryData, ThrowOnError>) => {
1990
+ return (options.client ?? _heyApiClient).get<GetCreditSummaryResponses, GetCreditSummaryErrors, ThrowOnError>({
1991
+ security: [
1992
+ {
1993
+ name: 'X-API-Key',
1994
+ type: 'apiKey'
1995
+ },
1996
+ {
1997
+ scheme: 'bearer',
1998
+ type: 'http'
1999
+ }
2000
+ ],
2001
+ url: '/v1/{graph_id}/credits/summary',
2002
+ ...options
2003
+ });
2004
+ };
2005
+
2006
+ /**
2007
+ * List Credit Transactions
2008
+ * Retrieve detailed credit transaction history for the specified graph.
2009
+ *
2010
+ * This enhanced endpoint provides:
2011
+ * - Detailed transaction records with idempotency information
2012
+ * - Summary by operation type to identify high-consumption operations
2013
+ * - Date range filtering for analysis
2014
+ * - Metadata search capabilities
2015
+ *
2016
+ * Transaction types include:
2017
+ * - ALLOCATION: Monthly credit allocations
2018
+ * - CONSUMPTION: Credit usage for operations
2019
+ * - BONUS: Bonus credits added by admins
2020
+ * - REFUND: Credit refunds
2021
+ *
2022
+ * No credits are consumed for viewing transaction history.
2023
+ */
2024
+ export const listCreditTransactions = <ThrowOnError extends boolean = false>(options: Options<ListCreditTransactionsData, ThrowOnError>) => {
2025
+ return (options.client ?? _heyApiClient).get<ListCreditTransactionsResponses, ListCreditTransactionsErrors, ThrowOnError>({
2026
+ security: [
2027
+ {
2028
+ name: 'X-API-Key',
2029
+ type: 'apiKey'
2030
+ },
2031
+ {
2032
+ scheme: 'bearer',
2033
+ type: 'http'
2034
+ }
2035
+ ],
2036
+ url: '/v1/{graph_id}/credits/transactions',
2037
+ ...options
2038
+ });
2039
+ };
2040
+
2041
+ /**
2042
+ * Check Credit Balance
2043
+ * Check if the graph has sufficient credits for a planned operation.
2044
+ *
2045
+ * This endpoint allows you to verify credit availability before performing
2046
+ * an operation, helping prevent failed operations due to insufficient credits.
2047
+ *
2048
+ * The check considers:
2049
+ * - Base operation cost
2050
+ * - Graph tier multiplier
2051
+ * - Current credit balance
2052
+ *
2053
+ * No credits are consumed for checking availability.
2054
+ */
2055
+ export const checkCreditBalance = <ThrowOnError extends boolean = false>(options: Options<CheckCreditBalanceData, ThrowOnError>) => {
2056
+ return (options.client ?? _heyApiClient).post<CheckCreditBalanceResponses, CheckCreditBalanceErrors, ThrowOnError>({
2057
+ security: [
2058
+ {
2059
+ name: 'X-API-Key',
2060
+ type: 'apiKey'
2061
+ },
2062
+ {
2063
+ scheme: 'bearer',
2064
+ type: 'http'
2065
+ }
2066
+ ],
2067
+ url: '/v1/{graph_id}/credits/check',
2068
+ ...options,
2069
+ headers: {
2070
+ 'Content-Type': 'application/json',
2071
+ ...options.headers
2072
+ }
2073
+ });
2074
+ };
2075
+
2076
+ /**
2077
+ * Get Storage Usage
2078
+ * Get storage usage history for a graph.
2079
+ *
2080
+ * Returns detailed storage usage information including:
2081
+ * - Daily average storage consumption
2082
+ * - Storage trends over time
2083
+ * - Credit costs for storage
2084
+ * - Current storage billing information
2085
+ *
2086
+ * This endpoint helps users understand their storage patterns
2087
+ * and associated credit costs.
2088
+ */
2089
+ export const getStorageUsage = <ThrowOnError extends boolean = false>(options: Options<GetStorageUsageData, ThrowOnError>) => {
2090
+ return (options.client ?? _heyApiClient).get<GetStorageUsageResponses, GetStorageUsageErrors, ThrowOnError>({
2091
+ security: [
2092
+ {
2093
+ name: 'X-API-Key',
2094
+ type: 'apiKey'
2095
+ },
2096
+ {
2097
+ scheme: 'bearer',
2098
+ type: 'http'
2099
+ }
2100
+ ],
2101
+ url: '/v1/{graph_id}/credits/storage/usage',
2102
+ ...options
2103
+ });
2104
+ };
2105
+
2106
+ /**
2107
+ * Check Storage Limits
2108
+ * Check storage limits and usage for a graph.
2109
+ *
2110
+ * Returns comprehensive storage limit information including:
2111
+ * - Current storage usage
2112
+ * - Effective limit (override or default)
2113
+ * - Usage percentage and warnings
2114
+ * - Recommendations for limit management
2115
+ *
2116
+ * This endpoint helps users monitor storage usage and plan for potential
2117
+ * limit increases. No credits are consumed for checking storage limits.
2118
+ */
2119
+ export const checkStorageLimits = <ThrowOnError extends boolean = false>(options: Options<CheckStorageLimitsData, ThrowOnError>) => {
2120
+ return (options.client ?? _heyApiClient).get<CheckStorageLimitsResponses, CheckStorageLimitsErrors, ThrowOnError>({
2121
+ security: [
2122
+ {
2123
+ name: 'X-API-Key',
2124
+ type: 'apiKey'
2125
+ },
2126
+ {
2127
+ scheme: 'bearer',
2128
+ type: 'http'
2129
+ }
2130
+ ],
2131
+ url: '/v1/{graph_id}/credits/storage/limits',
2132
+ ...options
2133
+ });
2134
+ };
2135
+
2136
+ /**
2137
+ * Database Health Check
2138
+ * Get comprehensive health information for the graph database.
2139
+ *
2140
+ * Returns detailed health metrics including:
2141
+ * - **Connection Status**: Database connectivity and responsiveness
2142
+ * - **Performance Metrics**: Query execution times and throughput
2143
+ * - **Resource Usage**: Memory and storage utilization
2144
+ * - **Error Monitoring**: Recent error rates and patterns
2145
+ * - **Uptime Statistics**: Service availability metrics
2146
+ *
2147
+ * Health indicators:
2148
+ * - **Status**: healthy, degraded, or unhealthy
2149
+ * - **Query Performance**: Average execution times
2150
+ * - **Error Rates**: Recent failure percentages
2151
+ * - **Resource Usage**: Memory and storage consumption
2152
+ * - **Alerts**: Active warnings or issues
2153
+ *
2154
+ * This endpoint provides essential monitoring data for operational visibility.
2155
+ */
2156
+ export const getDatabaseHealth = <ThrowOnError extends boolean = false>(options: Options<GetDatabaseHealthData, ThrowOnError>) => {
2157
+ return (options.client ?? _heyApiClient).get<GetDatabaseHealthResponses, GetDatabaseHealthErrors, ThrowOnError>({
2158
+ security: [
2159
+ {
2160
+ name: 'X-API-Key',
2161
+ type: 'apiKey'
2162
+ },
2163
+ {
2164
+ scheme: 'bearer',
2165
+ type: 'http'
2166
+ }
2167
+ ],
2168
+ url: '/v1/{graph_id}/status/health',
2169
+ ...options
2170
+ });
2171
+ };
2172
+
2173
+ /**
2174
+ * Database Information
2175
+ * Get comprehensive database information and statistics.
2176
+ *
2177
+ * Returns detailed database metrics including:
2178
+ * - **Database Metadata**: Name, path, size, and timestamps
2179
+ * - **Schema Information**: Node labels, relationship types, and counts
2180
+ * - **Storage Statistics**: Database size and usage metrics
2181
+ * - **Data Composition**: Node and relationship counts
2182
+ * - **Backup Information**: Available backups and last backup date
2183
+ * - **Configuration**: Read-only status and schema version
2184
+ *
2185
+ * Database statistics:
2186
+ * - **Size**: Storage usage in bytes and MB
2187
+ * - **Content**: Node and relationship counts
2188
+ * - **Schema**: Available labels and relationship types
2189
+ * - **Backup Status**: Backup availability and recency
2190
+ * - **Timestamps**: Creation and modification dates
2191
+ *
2192
+ * This endpoint provides essential database information for capacity planning and monitoring.
2193
+ */
2194
+ export const getDatabaseInfo = <ThrowOnError extends boolean = false>(options: Options<GetDatabaseInfoData, ThrowOnError>) => {
2195
+ return (options.client ?? _heyApiClient).get<GetDatabaseInfoResponses, GetDatabaseInfoErrors, ThrowOnError>({
2196
+ security: [
2197
+ {
2198
+ name: 'X-API-Key',
2199
+ type: 'apiKey'
2200
+ },
2201
+ {
2202
+ scheme: 'bearer',
2203
+ type: 'http'
2204
+ }
2205
+ ],
2206
+ url: '/v1/{graph_id}/status/info',
2207
+ ...options
2208
+ });
2209
+ };
2210
+
2211
+ /**
2212
+ * Create New Graph Database
2213
+ * Create a new graph database with specified schema and optionally an initial entity.
2214
+ *
2215
+ * This endpoint starts an asynchronous graph creation operation and returns
2216
+ * connection details for monitoring progress via Server-Sent Events (SSE).
2217
+ *
2218
+ * **Operation Types:**
2219
+ * - **Generic Graph**: Creates empty graph with schema extensions
2220
+ * - **Entity Graph**: Creates graph with initial entity data
2221
+ *
2222
+ * **Monitoring Progress:**
2223
+ * Use the returned `operation_id` to connect to the SSE stream:
2224
+ * ```javascript
2225
+ * const eventSource = new EventSource('/v1/operations/{operation_id}/stream');
2226
+ * eventSource.onmessage = (event) => {
2227
+ * const data = JSON.parse(event.data);
2228
+ * console.log('Progress:', data.progress_percent + '%');
2229
+ * };
2230
+ * ```
2231
+ *
2232
+ * **SSE Connection Limits:**
2233
+ * - Maximum 5 concurrent SSE connections per user
2234
+ * - Rate limited to 10 new connections per minute
2235
+ * - Automatic circuit breaker for Redis failures
2236
+ * - Graceful degradation if event system unavailable
2237
+ *
2238
+ * **Events Emitted:**
2239
+ * - `operation_started`: Graph creation begins
2240
+ * - `operation_progress`: Schema loading, database setup, etc.
2241
+ * - `operation_completed`: Graph ready with connection details
2242
+ * - `operation_error`: Creation failed with error details
2243
+ *
2244
+ * **Error Handling:**
2245
+ * - `429 Too Many Requests`: SSE connection limit exceeded
2246
+ * - `503 Service Unavailable`: SSE system temporarily disabled
2247
+ * - Clients should implement exponential backoff on errors
2248
+ *
2249
+ * **Response includes:**
2250
+ * - `operation_id`: Unique identifier for monitoring
2251
+ * - `_links.stream`: SSE endpoint for real-time updates
2252
+ * - `_links.status`: Point-in-time status check endpoint
2253
+ */
2254
+ export const createGraph = <ThrowOnError extends boolean = false>(options: Options<CreateGraphData, ThrowOnError>) => {
2255
+ return (options.client ?? _heyApiClient).post<CreateGraphResponses, CreateGraphErrors, ThrowOnError>({
2256
+ security: [
2257
+ {
2258
+ name: 'X-API-Key',
2259
+ type: 'apiKey'
2260
+ },
2261
+ {
2262
+ scheme: 'bearer',
2263
+ type: 'http'
2264
+ }
2265
+ ],
2266
+ url: '/v1/create/graph',
2267
+ ...options,
2268
+ headers: {
2269
+ 'Content-Type': 'application/json',
2270
+ ...options.headers
2271
+ }
2272
+ });
2273
+ };
2274
+
2275
+ /**
2276
+ * Get Available Schema Extensions
2277
+ * List all available schema extensions for graph creation
2278
+ */
2279
+ export const getAvailableExtensions = <ThrowOnError extends boolean = false>(options?: Options<GetAvailableExtensionsData, ThrowOnError>) => {
2280
+ return (options?.client ?? _heyApiClient).get<GetAvailableExtensionsResponses, unknown, ThrowOnError>({
2281
+ security: [
2282
+ {
2283
+ name: 'X-API-Key',
2284
+ type: 'apiKey'
2285
+ },
2286
+ {
2287
+ scheme: 'bearer',
2288
+ type: 'http'
2289
+ }
2290
+ ],
2291
+ url: '/v1/create/graph/available-extensions',
2292
+ ...options
2293
+ });
2294
+ };
2295
+
2296
+ /**
2297
+ * Get Service Offerings
2298
+ * Get comprehensive information about all subscription offerings.
2299
+ *
2300
+ * This endpoint provides complete information about both graph database subscriptions
2301
+ * and shared repository subscriptions. This is the primary endpoint for frontend
2302
+ * applications to display subscription options.
2303
+ *
2304
+ * Includes:
2305
+ * - Graph subscription tiers (trial, standard, enterprise, premium)
2306
+ * - Shared repository subscriptions (SEC, industry, economic data)
2307
+ * - Operation costs and credit information
2308
+ * - Features and capabilities for each tier
2309
+ * - Enabled/disabled status for repositories
2310
+ *
2311
+ * All data comes from the config-based systems to ensure accuracy with backend behavior.
2312
+ *
2313
+ * No authentication required - this is public service information.
2314
+ */
2315
+ export const getServiceOfferings = <ThrowOnError extends boolean = false>(options?: Options<GetServiceOfferingsData, ThrowOnError>) => {
2316
+ return (options?.client ?? _heyApiClient).get<GetServiceOfferingsResponses, GetServiceOfferingsErrors, ThrowOnError>({
2317
+ url: '/v1/offering',
2318
+ ...options
2319
+ });
2320
+ };
2321
+
2322
+ /**
2323
+ * Stream Operation Events
2324
+ * Stream real-time events for an operation using Server-Sent Events (SSE).
2325
+ *
2326
+ * This endpoint provides real-time monitoring for all non-immediate operations including:
2327
+ * - Graph creation and management
2328
+ * - Agent analysis processing
2329
+ * - Database backups and restores
2330
+ * - Data synchronization tasks
2331
+ *
2332
+ * **Event Types:**
2333
+ * - `operation_started`: Operation began execution
2334
+ * - `operation_progress`: Progress update with details
2335
+ * - `operation_completed`: Operation finished successfully
2336
+ * - `operation_error`: Operation failed with error details
2337
+ * - `operation_cancelled`: Operation was cancelled
2338
+ *
2339
+ * **Features:**
2340
+ * - **Event Replay**: Use `from_sequence` parameter to replay missed events
2341
+ * - **Automatic Reconnection**: Client can reconnect and resume from last seen event
2342
+ * - **Real-time Updates**: Live progress updates during execution
2343
+ * - **Timeout Handling**: 30-second keepalive messages prevent connection timeouts
2344
+ * - **Graceful Degradation**: Automatic fallback if Redis is unavailable
2345
+ *
2346
+ * **Connection Limits:**
2347
+ * - Maximum 5 concurrent SSE connections per user
2348
+ * - Rate limited to 10 new connections per minute
2349
+ * - Automatic cleanup of stale connections
2350
+ * - Circuit breaker protection for Redis failures
2351
+ *
2352
+ * **Client Usage:**
2353
+ * ```javascript
2354
+ * const eventSource = new EventSource('/v1/operations/abc123/stream');
2355
+ * eventSource.onmessage = (event) => {
2356
+ * const data = JSON.parse(event.data);
2357
+ * console.log('Progress:', data);
2358
+ * };
2359
+ * eventSource.onerror = (error) => {
2360
+ * // Handle connection errors or rate limits
2361
+ * console.error('SSE Error:', error);
2362
+ * };
2363
+ * ```
2364
+ *
2365
+ * **Error Handling:**
2366
+ * - `429 Too Many Requests`: Connection limit or rate limit exceeded
2367
+ * - `503 Service Unavailable`: SSE system temporarily disabled
2368
+ * - Clients should implement exponential backoff on errors
2369
+ *
2370
+ * **No credits are consumed for SSE connections.**
2371
+ */
2372
+ export const streamOperationEvents = <ThrowOnError extends boolean = false>(options: Options<StreamOperationEventsData, ThrowOnError>) => {
2373
+ return (options.client ?? _heyApiClient).get<StreamOperationEventsResponses, StreamOperationEventsErrors, ThrowOnError>({
2374
+ security: [
2375
+ {
2376
+ name: 'X-API-Key',
2377
+ type: 'apiKey'
2378
+ },
2379
+ {
2380
+ scheme: 'bearer',
2381
+ type: 'http'
2382
+ }
2383
+ ],
2384
+ url: '/v1/operations/{operation_id}/stream',
2385
+ ...options
2386
+ });
2387
+ };
2388
+
2389
+ /**
2390
+ * Get Operation Status
2391
+ * Get current status and metadata for an operation.
2392
+ *
2393
+ * Returns detailed information including:
2394
+ * - Current status (pending, running, completed, failed, cancelled)
2395
+ * - Creation and update timestamps
2396
+ * - Operation type and associated graph
2397
+ * - Result data (for completed operations)
2398
+ * - Error details (for failed operations)
2399
+ *
2400
+ * This endpoint provides a point-in-time status check, while the `/stream` endpoint
2401
+ * provides real-time updates. Use this for polling or initial status checks.
2402
+ *
2403
+ * **No credits are consumed for status checks.**
2404
+ */
2405
+ export const getOperationStatus = <ThrowOnError extends boolean = false>(options: Options<GetOperationStatusData, ThrowOnError>) => {
2406
+ return (options.client ?? _heyApiClient).get<GetOperationStatusResponses, GetOperationStatusErrors, ThrowOnError>({
2407
+ security: [
2408
+ {
2409
+ name: 'X-API-Key',
2410
+ type: 'apiKey'
2411
+ },
2412
+ {
2413
+ scheme: 'bearer',
2414
+ type: 'http'
2415
+ }
2416
+ ],
2417
+ url: '/v1/operations/{operation_id}/status',
2418
+ ...options
2419
+ });
2420
+ };
2421
+
2422
+ /**
2423
+ * Cancel Operation
2424
+ * Cancel a pending or running operation.
2425
+ *
2426
+ * Cancels the specified operation if it's still in progress. Once cancelled,
2427
+ * the operation cannot be resumed and will emit a cancellation event to any
2428
+ * active SSE connections.
2429
+ *
2430
+ * **Note**: Completed or already failed operations cannot be cancelled.
2431
+ *
2432
+ * **No credits are consumed for cancellation requests.**
2433
+ */
2434
+ export const cancelOperation = <ThrowOnError extends boolean = false>(options: Options<CancelOperationData, ThrowOnError>) => {
2435
+ return (options.client ?? _heyApiClient).delete<CancelOperationResponses, CancelOperationErrors, ThrowOnError>({
2436
+ security: [
2437
+ {
2438
+ name: 'X-API-Key',
2439
+ type: 'apiKey'
2440
+ },
2441
+ {
2442
+ scheme: 'bearer',
2443
+ type: 'http'
2444
+ }
2445
+ ],
2446
+ url: '/v1/operations/{operation_id}',
2447
+ ...options
2448
+ });
2449
+ };