@oriva/sdk 0.1.0 → 0.2.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.
@@ -1,48 +1,52 @@
1
1
  export type ClientOptions = {
2
2
  baseUrl: 'https://api.oriva.io' | 'http://localhost:3002' | (string & {});
3
3
  };
4
- export type AuthSessionResponse = {
5
- user: {
6
- id: string;
7
- email: string | null;
8
- display_name: string | null;
9
- username: string | null;
10
- subscription_tier: string;
11
- created_at: string;
12
- };
13
- access_token: string;
14
- refresh_token: string;
15
- expires_in: number;
16
- };
17
- export type AuthProfileResponse = {
4
+ export type UserMe = {
18
5
  ok: boolean;
19
6
  success: boolean;
20
7
  data: {
21
8
  id: string;
22
- email: string | null;
9
+ username: string | null;
23
10
  displayName: string;
11
+ email: string | null;
12
+ bio: string | null;
13
+ location: string | null;
14
+ website: string | null;
24
15
  avatar: string | null;
25
- authType: string;
26
- permissions: Array<string>;
27
- lastLogin: string;
28
- accountStatus: string;
29
- twoFactorEnabled: boolean;
30
- emailVerified: boolean;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ apiKeyInfo: {
19
+ keyId: string;
20
+ name: string;
21
+ userId: string;
22
+ permissions: Array<string>;
23
+ usageCount: number;
24
+ };
31
25
  };
32
26
  };
33
- export type RawProfileResponse = {
34
- id: string;
35
- display_name: string | null;
36
- username: string | null;
37
- bio: string | null;
38
- avatar_url: string | null;
39
- location: string | null;
40
- website_url: string | null;
41
- };
42
- export type TokenRefreshResponse = {
43
- access_token: string;
44
- refresh_token: string;
45
- expires_in: number;
27
+ export type AnalyticsSummary = {
28
+ ok: boolean;
29
+ success: boolean;
30
+ data: {
31
+ overview: {
32
+ totalEntries: number;
33
+ totalResponses: number;
34
+ totalGroups: number;
35
+ installedApps: number;
36
+ };
37
+ metrics: {
38
+ entriesGrowth: string;
39
+ responseGrowth: string;
40
+ groupActivity: string;
41
+ appUsage: string;
42
+ };
43
+ recentActivity: Array<unknown>;
44
+ timeRange: {
45
+ start: string;
46
+ end: string;
47
+ };
48
+ };
49
+ message?: string;
46
50
  };
47
51
  export type ProfileSummary = {
48
52
  profileId: string;
@@ -82,52 +86,48 @@ export type GroupMember = {
82
86
  joinedAt: string;
83
87
  avatar: string | null;
84
88
  };
85
- export type UserMe = {
86
- ok: boolean;
87
- success: boolean;
88
- data: {
89
+ export type AuthSessionResponse = {
90
+ user: {
89
91
  id: string;
90
- username: string | null;
91
- displayName: string;
92
92
  email: string | null;
93
- bio: string | null;
94
- location: string | null;
95
- website: string | null;
96
- avatar: string | null;
97
- createdAt: string;
98
- updatedAt: string;
99
- apiKeyInfo: {
100
- keyId: string;
101
- name: string;
102
- userId: string;
103
- permissions: Array<string>;
104
- usageCount: number;
105
- };
93
+ display_name: string | null;
94
+ username: string | null;
95
+ subscription_tier: string;
96
+ created_at: string;
106
97
  };
98
+ access_token: string;
99
+ refresh_token: string;
100
+ expires_in: number;
107
101
  };
108
- export type AnalyticsSummary = {
102
+ export type AuthProfileResponse = {
109
103
  ok: boolean;
110
104
  success: boolean;
111
105
  data: {
112
- overview: {
113
- totalEntries: number;
114
- totalResponses: number;
115
- totalGroups: number;
116
- installedApps: number;
117
- };
118
- metrics: {
119
- entriesGrowth: string;
120
- responseGrowth: string;
121
- groupActivity: string;
122
- appUsage: string;
123
- };
124
- recentActivity: Array<unknown>;
125
- timeRange: {
126
- start: string;
127
- end: string;
128
- };
106
+ id: string;
107
+ email: string | null;
108
+ displayName: string;
109
+ avatar: string | null;
110
+ authType: string;
111
+ permissions: Array<string>;
112
+ lastLogin: string;
113
+ accountStatus: string;
114
+ twoFactorEnabled: boolean;
115
+ emailVerified: boolean;
129
116
  };
130
- message?: string;
117
+ };
118
+ export type RawProfileResponse = {
119
+ id: string;
120
+ display_name: string | null;
121
+ username: string | null;
122
+ bio: string | null;
123
+ avatar_url: string | null;
124
+ location: string | null;
125
+ website_url: string | null;
126
+ };
127
+ export type TokenRefreshResponse = {
128
+ access_token: string;
129
+ refresh_token: string;
130
+ expires_in: number;
131
131
  };
132
132
  export type TeamMember = {
133
133
  profileId: string;
@@ -256,243 +256,82 @@ export type PersonalTokenList = {
256
256
  success: true;
257
257
  data: Array<PersonalTokenSummary>;
258
258
  };
259
- export type RegisterData = {
260
- body?: {
261
- email: string;
262
- password: string;
263
- name?: string;
264
- username?: string;
265
- preferences?: unknown;
266
- };
267
- path?: never;
268
- query?: never;
269
- url: '/api/v1/auth/register';
270
- };
271
- export type RegisterErrors = {
272
- /**
273
- * Validation error — weak password or invalid email
274
- */
275
- 400: unknown;
276
- /**
277
- * Email already registered
278
- */
279
- 409: unknown;
280
- };
281
- export type RegisterResponses = {
282
- /**
283
- * User registered and session created
284
- */
285
- 201: AuthSessionResponse;
286
- };
287
- export type RegisterResponse = RegisterResponses[keyof RegisterResponses];
288
- export type LoginData = {
289
- body?: {
290
- email: string;
291
- password: string;
292
- };
259
+ export type GetCurrentUserData = {
260
+ body?: never;
293
261
  path?: never;
294
262
  query?: never;
295
- url: '/api/v1/auth/login';
263
+ url: '/api/v1/user/me';
296
264
  };
297
- export type LoginErrors = {
298
- /**
299
- * Validation error — missing email or password
300
- */
301
- 400: unknown;
265
+ export type GetCurrentUserErrors = {
302
266
  /**
303
- * Invalid credentials
267
+ * Invalid or missing API key
304
268
  */
305
269
  401: unknown;
306
270
  };
307
- export type LoginResponses = {
271
+ export type GetCurrentUserResponses = {
308
272
  /**
309
- * Login successful
273
+ * Current user
310
274
  */
311
- 200: AuthSessionResponse;
275
+ 200: UserMe;
312
276
  };
313
- export type LoginResponse = LoginResponses[keyof LoginResponses];
314
- export type LogoutData = {
277
+ export type GetCurrentUserResponse = GetCurrentUserResponses[keyof GetCurrentUserResponses];
278
+ export type GetAnalyticsSummaryData = {
315
279
  body?: never;
316
280
  path?: never;
317
281
  query?: never;
318
- url: '/api/v1/auth/logout';
282
+ url: '/api/v1/analytics/summary';
319
283
  };
320
- export type LogoutErrors = {
284
+ export type GetAnalyticsSummaryErrors = {
321
285
  /**
322
- * Missing authorization header
286
+ * Invalid or missing API key
323
287
  */
324
288
  401: unknown;
325
289
  };
326
- export type LogoutResponses = {
290
+ export type GetAnalyticsSummaryResponses = {
327
291
  /**
328
- * Logged out
292
+ * Analytics summary
329
293
  */
330
- 204: void;
294
+ 200: AnalyticsSummary;
331
295
  };
332
- export type LogoutResponse = LogoutResponses[keyof LogoutResponses];
333
- export type RefreshTokenData = {
334
- body?: {
335
- refresh_token: string;
336
- };
296
+ export type GetAnalyticsSummaryResponse = GetAnalyticsSummaryResponses[keyof GetAnalyticsSummaryResponses];
297
+ export type ListProfilesData = {
298
+ body?: never;
337
299
  path?: never;
338
300
  query?: never;
339
- url: '/api/v1/auth/token/refresh';
301
+ url: '/api/v1/profiles/available';
340
302
  };
341
- export type RefreshTokenErrors = {
342
- /**
343
- * Validation error — missing refresh_token
344
- */
345
- 400: unknown;
303
+ export type ListProfilesErrors = {
346
304
  /**
347
- * Invalid or expired refresh token
305
+ * Invalid or missing API key
348
306
  */
349
307
  401: unknown;
350
308
  };
351
- export type RefreshTokenResponses = {
309
+ export type ListProfilesResponses = {
352
310
  /**
353
- * New tokens issued
311
+ * Available profiles
354
312
  */
355
- 200: TokenRefreshResponse;
313
+ 200: {
314
+ ok: boolean;
315
+ success: boolean;
316
+ data: Array<ProfileSummary>;
317
+ };
356
318
  };
357
- export type RefreshTokenResponse = RefreshTokenResponses[keyof RefreshTokenResponses];
358
- export type GetAuthProfileData = {
319
+ export type ListProfilesResponse = ListProfilesResponses[keyof ListProfilesResponses];
320
+ export type GetActiveProfileData = {
359
321
  body?: never;
360
322
  path?: never;
361
323
  query?: never;
362
- url: '/api/v1/auth/profile';
324
+ url: '/api/v1/profiles/active';
363
325
  };
364
- export type GetAuthProfileErrors = {
326
+ export type GetActiveProfileErrors = {
365
327
  /**
366
- * Unauthorized
328
+ * Invalid or missing API key
367
329
  */
368
330
  401: unknown;
369
331
  };
370
- export type GetAuthProfileResponses = {
332
+ export type GetActiveProfileResponses = {
371
333
  /**
372
- * Auth profile
373
- */
374
- 200: AuthProfileResponse;
375
- };
376
- export type GetAuthProfileResponse = GetAuthProfileResponses[keyof GetAuthProfileResponses];
377
- export type PatchAuthProfileData = {
378
- body?: {
379
- name?: string;
380
- bio?: string;
381
- avatar_url?: string;
382
- location?: string;
383
- website_url?: string;
384
- };
385
- path?: never;
386
- query?: never;
387
- url: '/api/v1/auth/profile';
388
- };
389
- export type PatchAuthProfileErrors = {
390
- /**
391
- * No fields provided
392
- */
393
- 400: unknown;
394
- /**
395
- * Unauthorized
396
- */
397
- 401: unknown;
398
- };
399
- export type PatchAuthProfileResponses = {
400
- /**
401
- * Updated profile row
402
- */
403
- 200: RawProfileResponse;
404
- };
405
- export type PatchAuthProfileResponse = PatchAuthProfileResponses[keyof PatchAuthProfileResponses];
406
- export type PutAuthProfileData = {
407
- body?: {
408
- name?: string;
409
- bio?: string;
410
- avatar_url?: string;
411
- location?: string;
412
- website_url?: string;
413
- preferences?: {
414
- [key: string]: unknown;
415
- };
416
- data_retention_days?: number;
417
- };
418
- path?: never;
419
- query?: never;
420
- url: '/api/v1/auth/profile';
421
- };
422
- export type PutAuthProfileErrors = {
423
- /**
424
- * No fields provided, or data_retention_days < 30
425
- */
426
- 400: unknown;
427
- /**
428
- * Unauthorized
429
- */
430
- 401: unknown;
431
- };
432
- export type PutAuthProfileResponses = {
433
- /**
434
- * Updated profile row
435
- */
436
- 200: RawProfileResponse;
437
- };
438
- export type PutAuthProfileResponse = PutAuthProfileResponses[keyof PutAuthProfileResponses];
439
- export type DeleteAccountData = {
440
- body?: never;
441
- path?: never;
442
- query?: never;
443
- url: '/api/v1/auth/account';
444
- };
445
- export type DeleteAccountErrors = {
446
- /**
447
- * Unauthorized
448
- */
449
- 401: unknown;
450
- };
451
- export type DeleteAccountResponses = {
452
- /**
453
- * Account deleted
454
- */
455
- 204: void;
456
- };
457
- export type DeleteAccountResponse = DeleteAccountResponses[keyof DeleteAccountResponses];
458
- export type ListProfilesData = {
459
- body?: never;
460
- path?: never;
461
- query?: never;
462
- url: '/api/v1/profiles/available';
463
- };
464
- export type ListProfilesErrors = {
465
- /**
466
- * Invalid or missing API key
467
- */
468
- 401: unknown;
469
- };
470
- export type ListProfilesResponses = {
471
- /**
472
- * Available profiles
473
- */
474
- 200: {
475
- ok: boolean;
476
- success: boolean;
477
- data: Array<ProfileSummary>;
478
- };
479
- };
480
- export type ListProfilesResponse = ListProfilesResponses[keyof ListProfilesResponses];
481
- export type GetActiveProfileData = {
482
- body?: never;
483
- path?: never;
484
- query?: never;
485
- url: '/api/v1/profiles/active';
486
- };
487
- export type GetActiveProfileErrors = {
488
- /**
489
- * Invalid or missing API key
490
- */
491
- 401: unknown;
492
- };
493
- export type GetActiveProfileResponses = {
494
- /**
495
- * Active profile
334
+ * Active profile
496
335
  */
497
336
  200: {
498
337
  ok: boolean;
@@ -623,44 +462,205 @@ export type ListGroupMembersResponses = {
623
462
  };
624
463
  };
625
464
  export type ListGroupMembersResponse = ListGroupMembersResponses[keyof ListGroupMembersResponses];
626
- export type GetCurrentUserData = {
465
+ export type RegisterData = {
466
+ body?: {
467
+ email: string;
468
+ password: string;
469
+ name?: string;
470
+ username?: string;
471
+ preferences?: unknown;
472
+ };
473
+ path?: never;
474
+ query?: never;
475
+ url: '/api/v1/auth/register';
476
+ };
477
+ export type RegisterErrors = {
478
+ /**
479
+ * Validation error — weak password or invalid email
480
+ */
481
+ 400: unknown;
482
+ /**
483
+ * Email already registered
484
+ */
485
+ 409: unknown;
486
+ };
487
+ export type RegisterResponses = {
488
+ /**
489
+ * User registered and session created
490
+ */
491
+ 201: AuthSessionResponse;
492
+ };
493
+ export type RegisterResponse = RegisterResponses[keyof RegisterResponses];
494
+ export type LoginData = {
495
+ body?: {
496
+ email: string;
497
+ password: string;
498
+ };
499
+ path?: never;
500
+ query?: never;
501
+ url: '/api/v1/auth/login';
502
+ };
503
+ export type LoginErrors = {
504
+ /**
505
+ * Validation error — missing email or password
506
+ */
507
+ 400: unknown;
508
+ /**
509
+ * Invalid credentials
510
+ */
511
+ 401: unknown;
512
+ };
513
+ export type LoginResponses = {
514
+ /**
515
+ * Login successful
516
+ */
517
+ 200: AuthSessionResponse;
518
+ };
519
+ export type LoginResponse = LoginResponses[keyof LoginResponses];
520
+ export type LogoutData = {
627
521
  body?: never;
628
522
  path?: never;
629
523
  query?: never;
630
- url: '/api/v1/user/me';
524
+ url: '/api/v1/auth/logout';
631
525
  };
632
- export type GetCurrentUserErrors = {
526
+ export type LogoutErrors = {
633
527
  /**
634
- * Invalid or missing API key
528
+ * Missing authorization header
635
529
  */
636
530
  401: unknown;
637
531
  };
638
- export type GetCurrentUserResponses = {
532
+ export type LogoutResponses = {
639
533
  /**
640
- * Current user
534
+ * Logged out
641
535
  */
642
- 200: UserMe;
536
+ 204: void;
643
537
  };
644
- export type GetCurrentUserResponse = GetCurrentUserResponses[keyof GetCurrentUserResponses];
645
- export type GetAnalyticsSummaryData = {
538
+ export type LogoutResponse = LogoutResponses[keyof LogoutResponses];
539
+ export type RefreshTokenData = {
540
+ body?: {
541
+ refresh_token: string;
542
+ };
543
+ path?: never;
544
+ query?: never;
545
+ url: '/api/v1/auth/token/refresh';
546
+ };
547
+ export type RefreshTokenErrors = {
548
+ /**
549
+ * Validation error — missing refresh_token
550
+ */
551
+ 400: unknown;
552
+ /**
553
+ * Invalid or expired refresh token
554
+ */
555
+ 401: unknown;
556
+ };
557
+ export type RefreshTokenResponses = {
558
+ /**
559
+ * New tokens issued
560
+ */
561
+ 200: TokenRefreshResponse;
562
+ };
563
+ export type RefreshTokenResponse = RefreshTokenResponses[keyof RefreshTokenResponses];
564
+ export type GetAuthProfileData = {
646
565
  body?: never;
647
566
  path?: never;
648
567
  query?: never;
649
- url: '/api/v1/analytics/summary';
568
+ url: '/api/v1/auth/profile';
650
569
  };
651
- export type GetAnalyticsSummaryErrors = {
570
+ export type GetAuthProfileErrors = {
652
571
  /**
653
- * Invalid or missing API key
572
+ * Unauthorized
654
573
  */
655
574
  401: unknown;
656
575
  };
657
- export type GetAnalyticsSummaryResponses = {
576
+ export type GetAuthProfileResponses = {
658
577
  /**
659
- * Analytics summary
578
+ * Auth profile
660
579
  */
661
- 200: AnalyticsSummary;
580
+ 200: AuthProfileResponse;
662
581
  };
663
- export type GetAnalyticsSummaryResponse = GetAnalyticsSummaryResponses[keyof GetAnalyticsSummaryResponses];
582
+ export type GetAuthProfileResponse = GetAuthProfileResponses[keyof GetAuthProfileResponses];
583
+ export type PatchAuthProfileData = {
584
+ body?: {
585
+ name?: string;
586
+ bio?: string;
587
+ avatar_url?: string;
588
+ location?: string;
589
+ website_url?: string;
590
+ };
591
+ path?: never;
592
+ query?: never;
593
+ url: '/api/v1/auth/profile';
594
+ };
595
+ export type PatchAuthProfileErrors = {
596
+ /**
597
+ * No fields provided
598
+ */
599
+ 400: unknown;
600
+ /**
601
+ * Unauthorized
602
+ */
603
+ 401: unknown;
604
+ };
605
+ export type PatchAuthProfileResponses = {
606
+ /**
607
+ * Updated profile row
608
+ */
609
+ 200: RawProfileResponse;
610
+ };
611
+ export type PatchAuthProfileResponse = PatchAuthProfileResponses[keyof PatchAuthProfileResponses];
612
+ export type PutAuthProfileData = {
613
+ body?: {
614
+ name?: string;
615
+ bio?: string;
616
+ avatar_url?: string;
617
+ location?: string;
618
+ website_url?: string;
619
+ preferences?: {
620
+ [key: string]: unknown;
621
+ };
622
+ data_retention_days?: number;
623
+ };
624
+ path?: never;
625
+ query?: never;
626
+ url: '/api/v1/auth/profile';
627
+ };
628
+ export type PutAuthProfileErrors = {
629
+ /**
630
+ * No fields provided, or data_retention_days < 30
631
+ */
632
+ 400: unknown;
633
+ /**
634
+ * Unauthorized
635
+ */
636
+ 401: unknown;
637
+ };
638
+ export type PutAuthProfileResponses = {
639
+ /**
640
+ * Updated profile row
641
+ */
642
+ 200: RawProfileResponse;
643
+ };
644
+ export type PutAuthProfileResponse = PutAuthProfileResponses[keyof PutAuthProfileResponses];
645
+ export type DeleteAccountData = {
646
+ body?: never;
647
+ path?: never;
648
+ query?: never;
649
+ url: '/api/v1/auth/account';
650
+ };
651
+ export type DeleteAccountErrors = {
652
+ /**
653
+ * Unauthorized
654
+ */
655
+ 401: unknown;
656
+ };
657
+ export type DeleteAccountResponses = {
658
+ /**
659
+ * Account deleted
660
+ */
661
+ 204: void;
662
+ };
663
+ export type DeleteAccountResponse = DeleteAccountResponses[keyof DeleteAccountResponses];
664
664
  export type ListSessionsData = {
665
665
  body?: never;
666
666
  path?: never;