priceos 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1140 @@
1
+ import { Client } from 'openapi-fetch';
2
+
3
+ /**
4
+ * This file was auto-generated by openapi-typescript.
5
+ * Do not make direct changes to the file.
6
+ */
7
+
8
+ interface paths {
9
+ "/v1/customer": {
10
+ parameters: {
11
+ query?: never;
12
+ header?: never;
13
+ path?: never;
14
+ cookie?: never;
15
+ };
16
+ /**
17
+ * Get customer
18
+ * @description Fetch a customer by internal or Stripe ID.
19
+ */
20
+ get: {
21
+ parameters: {
22
+ query: {
23
+ /** @description Customer ID (internal or Stripe). */
24
+ customerId: string;
25
+ };
26
+ header: {
27
+ /** @description API key from your PriceOS dashboard. */
28
+ "x-api-key": string;
29
+ };
30
+ path?: never;
31
+ cookie?: never;
32
+ };
33
+ requestBody?: never;
34
+ responses: {
35
+ /** @description Customer lookup */
36
+ 200: {
37
+ headers: {
38
+ [name: string]: unknown;
39
+ };
40
+ content: {
41
+ "application/json": {
42
+ /** @description Customer ID (internal or Stripe). */
43
+ customerId?: string;
44
+ /** @description Stripe customer ID. */
45
+ stripeCustomerId?: string;
46
+ /** @description Customer name. */
47
+ name?: string;
48
+ /** @description Customer email address. */
49
+ email?: string;
50
+ /**
51
+ * @description Customer environment.
52
+ * @enum {string}
53
+ */
54
+ enviroment: "test" | "live";
55
+ /** @description Subscribed or assigned products. */
56
+ products: {
57
+ /** @description PriceOS product ID. */
58
+ id: string;
59
+ /** @description Product name. */
60
+ name: string;
61
+ /** @description Product version number. */
62
+ version: number;
63
+ /**
64
+ * @description Stripe subscription status (Stripe customers only).
65
+ * @enum {string}
66
+ */
67
+ status?: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
68
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
69
+ canceledAt?: number | null;
70
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
71
+ startedAt?: number;
72
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
73
+ currentPeriodStart?: number;
74
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
75
+ currentPeriodEnd?: number;
76
+ /** @description Prices tied to this product (Stripe customers only). */
77
+ prices?: {
78
+ /** @description Stripe price ID. */
79
+ stripePriceId: string;
80
+ /** @description Price quantity. */
81
+ quantity: number;
82
+ /** @description ISO currency code. */
83
+ currency: string;
84
+ /** @description Unit amount in the smallest currency unit. */
85
+ unitAmount: number;
86
+ /** @description Recurring interval, if any. */
87
+ recurringInterval: string | null;
88
+ /** @description Whether the price is active. */
89
+ isActive: boolean;
90
+ /** @description Whether this is the default price. */
91
+ isDefault: boolean;
92
+ /** @description Number of intervals between charges. */
93
+ recurringIntervalCount: number;
94
+ }[];
95
+ }[];
96
+ /** @description Map of feature keys to access entries. */
97
+ featureAccess: {
98
+ [key: string]: {
99
+ /**
100
+ * @description Feature access type.
101
+ * @enum {string}
102
+ */
103
+ type: "boolean";
104
+ /** @description Whether the customer has access. */
105
+ hasAccess: boolean;
106
+ } | {
107
+ /**
108
+ * @description Feature access type.
109
+ * @enum {string}
110
+ */
111
+ type: "limit";
112
+ /** @description Whether the customer has access. */
113
+ hasAccess: boolean;
114
+ /** @description Whether the feature is unlimited. */
115
+ isUnlimited: boolean;
116
+ /** @description Limit for the feature, when applicable. */
117
+ limit: number | null;
118
+ /** @description Usage consumed for the feature. */
119
+ used: number;
120
+ };
121
+ };
122
+ } | null;
123
+ };
124
+ };
125
+ /** @description Bad request */
126
+ 400: {
127
+ headers: {
128
+ [name: string]: unknown;
129
+ };
130
+ content: {
131
+ "application/json": {
132
+ /** @description Error message. */
133
+ error: string;
134
+ };
135
+ };
136
+ };
137
+ /** @description Unauthorized */
138
+ 401: {
139
+ headers: {
140
+ [name: string]: unknown;
141
+ };
142
+ content: {
143
+ "application/json": {
144
+ /** @description Error message. */
145
+ error: string;
146
+ };
147
+ };
148
+ };
149
+ /** @description Server error */
150
+ 500: {
151
+ headers: {
152
+ [name: string]: unknown;
153
+ };
154
+ content: {
155
+ "application/json": {
156
+ /** @description Error message. */
157
+ error: string;
158
+ };
159
+ };
160
+ };
161
+ };
162
+ };
163
+ /**
164
+ * Update customer
165
+ * @description Update a customer record.
166
+ */
167
+ put: {
168
+ parameters: {
169
+ query?: never;
170
+ header: {
171
+ /** @description API key from your PriceOS dashboard. */
172
+ "x-api-key": string;
173
+ };
174
+ path?: never;
175
+ cookie?: never;
176
+ };
177
+ requestBody: {
178
+ content: {
179
+ "application/json": {
180
+ /** @description Customer ID (internal or Stripe). */
181
+ customerId: string;
182
+ /** @description Customer name. */
183
+ name?: string;
184
+ /** @description Customer email address. */
185
+ email?: string;
186
+ /** @description Assigned product keys for non-Stripe customers. */
187
+ productKeys?: string[];
188
+ };
189
+ };
190
+ };
191
+ responses: {
192
+ /** @description Customer updated */
193
+ 200: {
194
+ headers: {
195
+ [name: string]: unknown;
196
+ };
197
+ content: {
198
+ "application/json": {
199
+ /** @description Customer ID (internal or Stripe). */
200
+ customerId?: string;
201
+ /** @description Stripe customer ID. */
202
+ stripeCustomerId?: string;
203
+ /** @description Customer name. */
204
+ name?: string;
205
+ /** @description Customer email address. */
206
+ email?: string;
207
+ /**
208
+ * @description Customer environment.
209
+ * @enum {string}
210
+ */
211
+ enviroment: "test" | "live";
212
+ /** @description Subscribed or assigned products. */
213
+ products: {
214
+ /** @description PriceOS product ID. */
215
+ id: string;
216
+ /** @description Product name. */
217
+ name: string;
218
+ /** @description Product version number. */
219
+ version: number;
220
+ /**
221
+ * @description Stripe subscription status (Stripe customers only).
222
+ * @enum {string}
223
+ */
224
+ status?: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
225
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
226
+ canceledAt?: number | null;
227
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
228
+ startedAt?: number;
229
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
230
+ currentPeriodStart?: number;
231
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
232
+ currentPeriodEnd?: number;
233
+ /** @description Prices tied to this product (Stripe customers only). */
234
+ prices?: {
235
+ /** @description Stripe price ID. */
236
+ stripePriceId: string;
237
+ /** @description Price quantity. */
238
+ quantity: number;
239
+ /** @description ISO currency code. */
240
+ currency: string;
241
+ /** @description Unit amount in the smallest currency unit. */
242
+ unitAmount: number;
243
+ /** @description Recurring interval, if any. */
244
+ recurringInterval: string | null;
245
+ /** @description Whether the price is active. */
246
+ isActive: boolean;
247
+ /** @description Whether this is the default price. */
248
+ isDefault: boolean;
249
+ /** @description Number of intervals between charges. */
250
+ recurringIntervalCount: number;
251
+ }[];
252
+ }[];
253
+ /** @description Map of feature keys to access entries. */
254
+ featureAccess: {
255
+ [key: string]: {
256
+ /**
257
+ * @description Feature access type.
258
+ * @enum {string}
259
+ */
260
+ type: "boolean";
261
+ /** @description Whether the customer has access. */
262
+ hasAccess: boolean;
263
+ } | {
264
+ /**
265
+ * @description Feature access type.
266
+ * @enum {string}
267
+ */
268
+ type: "limit";
269
+ /** @description Whether the customer has access. */
270
+ hasAccess: boolean;
271
+ /** @description Whether the feature is unlimited. */
272
+ isUnlimited: boolean;
273
+ /** @description Limit for the feature, when applicable. */
274
+ limit: number | null;
275
+ /** @description Usage consumed for the feature. */
276
+ used: number;
277
+ };
278
+ };
279
+ };
280
+ };
281
+ };
282
+ /** @description Bad request */
283
+ 400: {
284
+ headers: {
285
+ [name: string]: unknown;
286
+ };
287
+ content: {
288
+ "application/json": {
289
+ /** @description Error message. */
290
+ error: string;
291
+ };
292
+ };
293
+ };
294
+ /** @description Unauthorized */
295
+ 401: {
296
+ headers: {
297
+ [name: string]: unknown;
298
+ };
299
+ content: {
300
+ "application/json": {
301
+ /** @description Error message. */
302
+ error: string;
303
+ };
304
+ };
305
+ };
306
+ /** @description Not found */
307
+ 404: {
308
+ headers: {
309
+ [name: string]: unknown;
310
+ };
311
+ content: {
312
+ "application/json": {
313
+ /** @description Error message. */
314
+ error: string;
315
+ };
316
+ };
317
+ };
318
+ /** @description Server error */
319
+ 500: {
320
+ headers: {
321
+ [name: string]: unknown;
322
+ };
323
+ content: {
324
+ "application/json": {
325
+ /** @description Error message. */
326
+ error: string;
327
+ };
328
+ };
329
+ };
330
+ };
331
+ };
332
+ /**
333
+ * Create customer
334
+ * @description Create a customer record.
335
+ */
336
+ post: {
337
+ parameters: {
338
+ query?: never;
339
+ header: {
340
+ /** @description API key from your PriceOS dashboard. */
341
+ "x-api-key": string;
342
+ };
343
+ path?: never;
344
+ cookie?: never;
345
+ };
346
+ requestBody: {
347
+ content: {
348
+ "application/json": {
349
+ /** @description Customer ID (internal or Stripe). */
350
+ customerId: string;
351
+ /** @description Customer name. */
352
+ name?: string;
353
+ /** @description Customer email address. */
354
+ email?: string;
355
+ /** @description Assigned product keys for non-Stripe customers. */
356
+ productKeys?: string[];
357
+ };
358
+ };
359
+ };
360
+ responses: {
361
+ /** @description Customer created */
362
+ 201: {
363
+ headers: {
364
+ [name: string]: unknown;
365
+ };
366
+ content: {
367
+ "application/json": {
368
+ /** @description Customer ID (internal or Stripe). */
369
+ customerId?: string;
370
+ /** @description Stripe customer ID. */
371
+ stripeCustomerId?: string;
372
+ /** @description Customer name. */
373
+ name?: string;
374
+ /** @description Customer email address. */
375
+ email?: string;
376
+ /**
377
+ * @description Customer environment.
378
+ * @enum {string}
379
+ */
380
+ enviroment: "test" | "live";
381
+ /** @description Subscribed or assigned products. */
382
+ products: {
383
+ /** @description PriceOS product ID. */
384
+ id: string;
385
+ /** @description Product name. */
386
+ name: string;
387
+ /** @description Product version number. */
388
+ version: number;
389
+ /**
390
+ * @description Stripe subscription status (Stripe customers only).
391
+ * @enum {string}
392
+ */
393
+ status?: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
394
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
395
+ canceledAt?: number | null;
396
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
397
+ startedAt?: number;
398
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
399
+ currentPeriodStart?: number;
400
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
401
+ currentPeriodEnd?: number;
402
+ /** @description Prices tied to this product (Stripe customers only). */
403
+ prices?: {
404
+ /** @description Stripe price ID. */
405
+ stripePriceId: string;
406
+ /** @description Price quantity. */
407
+ quantity: number;
408
+ /** @description ISO currency code. */
409
+ currency: string;
410
+ /** @description Unit amount in the smallest currency unit. */
411
+ unitAmount: number;
412
+ /** @description Recurring interval, if any. */
413
+ recurringInterval: string | null;
414
+ /** @description Whether the price is active. */
415
+ isActive: boolean;
416
+ /** @description Whether this is the default price. */
417
+ isDefault: boolean;
418
+ /** @description Number of intervals between charges. */
419
+ recurringIntervalCount: number;
420
+ }[];
421
+ }[];
422
+ /** @description Map of feature keys to access entries. */
423
+ featureAccess: {
424
+ [key: string]: {
425
+ /**
426
+ * @description Feature access type.
427
+ * @enum {string}
428
+ */
429
+ type: "boolean";
430
+ /** @description Whether the customer has access. */
431
+ hasAccess: boolean;
432
+ } | {
433
+ /**
434
+ * @description Feature access type.
435
+ * @enum {string}
436
+ */
437
+ type: "limit";
438
+ /** @description Whether the customer has access. */
439
+ hasAccess: boolean;
440
+ /** @description Whether the feature is unlimited. */
441
+ isUnlimited: boolean;
442
+ /** @description Limit for the feature, when applicable. */
443
+ limit: number | null;
444
+ /** @description Usage consumed for the feature. */
445
+ used: number;
446
+ };
447
+ };
448
+ };
449
+ };
450
+ };
451
+ /** @description Bad request */
452
+ 400: {
453
+ headers: {
454
+ [name: string]: unknown;
455
+ };
456
+ content: {
457
+ "application/json": {
458
+ /** @description Error message. */
459
+ error: string;
460
+ };
461
+ };
462
+ };
463
+ /** @description Unauthorized */
464
+ 401: {
465
+ headers: {
466
+ [name: string]: unknown;
467
+ };
468
+ content: {
469
+ "application/json": {
470
+ /** @description Error message. */
471
+ error: string;
472
+ };
473
+ };
474
+ };
475
+ /** @description Conflict */
476
+ 409: {
477
+ headers: {
478
+ [name: string]: unknown;
479
+ };
480
+ content: {
481
+ "application/json": {
482
+ /** @description Error message. */
483
+ error: string;
484
+ };
485
+ };
486
+ };
487
+ /** @description Server error */
488
+ 500: {
489
+ headers: {
490
+ [name: string]: unknown;
491
+ };
492
+ content: {
493
+ "application/json": {
494
+ /** @description Error message. */
495
+ error: string;
496
+ };
497
+ };
498
+ };
499
+ };
500
+ };
501
+ /**
502
+ * Delete customer
503
+ * @description Delete a customer record.
504
+ */
505
+ delete: {
506
+ parameters: {
507
+ query: {
508
+ /** @description Customer ID (internal or Stripe). */
509
+ customerId: string;
510
+ };
511
+ header: {
512
+ /** @description API key from your PriceOS dashboard. */
513
+ "x-api-key": string;
514
+ };
515
+ path?: never;
516
+ cookie?: never;
517
+ };
518
+ requestBody?: never;
519
+ responses: {
520
+ /** @description Customer deleted */
521
+ 200: {
522
+ headers: {
523
+ [name: string]: unknown;
524
+ };
525
+ content: {
526
+ "application/json": {
527
+ /** @description Deleted customer record ID. */
528
+ id: string;
529
+ };
530
+ };
531
+ };
532
+ /** @description Bad request */
533
+ 400: {
534
+ headers: {
535
+ [name: string]: unknown;
536
+ };
537
+ content: {
538
+ "application/json": {
539
+ /** @description Error message. */
540
+ error: string;
541
+ };
542
+ };
543
+ };
544
+ /** @description Unauthorized */
545
+ 401: {
546
+ headers: {
547
+ [name: string]: unknown;
548
+ };
549
+ content: {
550
+ "application/json": {
551
+ /** @description Error message. */
552
+ error: string;
553
+ };
554
+ };
555
+ };
556
+ /** @description Not found */
557
+ 404: {
558
+ headers: {
559
+ [name: string]: unknown;
560
+ };
561
+ content: {
562
+ "application/json": {
563
+ /** @description Error message. */
564
+ error: string;
565
+ };
566
+ };
567
+ };
568
+ /** @description Server error */
569
+ 500: {
570
+ headers: {
571
+ [name: string]: unknown;
572
+ };
573
+ content: {
574
+ "application/json": {
575
+ /** @description Error message. */
576
+ error: string;
577
+ };
578
+ };
579
+ };
580
+ };
581
+ };
582
+ options?: never;
583
+ head?: never;
584
+ patch?: never;
585
+ trace?: never;
586
+ };
587
+ "/v1/customer/identify": {
588
+ parameters: {
589
+ query?: never;
590
+ header?: never;
591
+ path?: never;
592
+ cookie?: never;
593
+ };
594
+ get?: never;
595
+ put?: never;
596
+ /**
597
+ * Identify customer
598
+ * @description Link a Stripe customer ID to your internal customer ID. Use this endpoint to either link a customer you created earlier with a new stripe customer OR if you would rather identify customers with your own internal ID instead of using a stripe customer ID.
599
+ */
600
+ post: {
601
+ parameters: {
602
+ query?: never;
603
+ header: {
604
+ /** @description API key from your PriceOS dashboard. */
605
+ "x-api-key": string;
606
+ };
607
+ path?: never;
608
+ cookie?: never;
609
+ };
610
+ requestBody: {
611
+ content: {
612
+ "application/json": {
613
+ /** @description Customer ID (internal or Stripe). */
614
+ customerId: string;
615
+ /** @description Stripe customer ID. */
616
+ stripeCustomerId: string;
617
+ };
618
+ };
619
+ };
620
+ responses: {
621
+ /** @description Customer identified */
622
+ 200: {
623
+ headers: {
624
+ [name: string]: unknown;
625
+ };
626
+ content: {
627
+ "application/json": {
628
+ /** @description Customer ID (internal or Stripe). */
629
+ customerId?: string;
630
+ /** @description Stripe customer ID. */
631
+ stripeCustomerId?: string;
632
+ /** @description Customer name. */
633
+ name?: string;
634
+ /** @description Customer email address. */
635
+ email?: string;
636
+ /**
637
+ * @description Customer environment.
638
+ * @enum {string}
639
+ */
640
+ enviroment: "test" | "live";
641
+ /** @description Subscribed or assigned products. */
642
+ products: {
643
+ /** @description PriceOS product ID. */
644
+ id: string;
645
+ /** @description Product name. */
646
+ name: string;
647
+ /** @description Product version number. */
648
+ version: number;
649
+ /**
650
+ * @description Stripe subscription status (Stripe customers only).
651
+ * @enum {string}
652
+ */
653
+ status?: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
654
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
655
+ canceledAt?: number | null;
656
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
657
+ startedAt?: number;
658
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
659
+ currentPeriodStart?: number;
660
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
661
+ currentPeriodEnd?: number;
662
+ /** @description Prices tied to this product (Stripe customers only). */
663
+ prices?: {
664
+ /** @description Stripe price ID. */
665
+ stripePriceId: string;
666
+ /** @description Price quantity. */
667
+ quantity: number;
668
+ /** @description ISO currency code. */
669
+ currency: string;
670
+ /** @description Unit amount in the smallest currency unit. */
671
+ unitAmount: number;
672
+ /** @description Recurring interval, if any. */
673
+ recurringInterval: string | null;
674
+ /** @description Whether the price is active. */
675
+ isActive: boolean;
676
+ /** @description Whether this is the default price. */
677
+ isDefault: boolean;
678
+ /** @description Number of intervals between charges. */
679
+ recurringIntervalCount: number;
680
+ }[];
681
+ }[];
682
+ /** @description Map of feature keys to access entries. */
683
+ featureAccess: {
684
+ [key: string]: {
685
+ /**
686
+ * @description Feature access type.
687
+ * @enum {string}
688
+ */
689
+ type: "boolean";
690
+ /** @description Whether the customer has access. */
691
+ hasAccess: boolean;
692
+ } | {
693
+ /**
694
+ * @description Feature access type.
695
+ * @enum {string}
696
+ */
697
+ type: "limit";
698
+ /** @description Whether the customer has access. */
699
+ hasAccess: boolean;
700
+ /** @description Whether the feature is unlimited. */
701
+ isUnlimited: boolean;
702
+ /** @description Limit for the feature, when applicable. */
703
+ limit: number | null;
704
+ /** @description Usage consumed for the feature. */
705
+ used: number;
706
+ };
707
+ };
708
+ };
709
+ };
710
+ };
711
+ /** @description Bad request */
712
+ 400: {
713
+ headers: {
714
+ [name: string]: unknown;
715
+ };
716
+ content: {
717
+ "application/json": {
718
+ /** @description Error message. */
719
+ error: string;
720
+ };
721
+ };
722
+ };
723
+ /** @description Unauthorized */
724
+ 401: {
725
+ headers: {
726
+ [name: string]: unknown;
727
+ };
728
+ content: {
729
+ "application/json": {
730
+ /** @description Error message. */
731
+ error: string;
732
+ };
733
+ };
734
+ };
735
+ /** @description Not found */
736
+ 404: {
737
+ headers: {
738
+ [name: string]: unknown;
739
+ };
740
+ content: {
741
+ "application/json": {
742
+ /** @description Error message. */
743
+ error: string;
744
+ };
745
+ };
746
+ };
747
+ /** @description Conflict */
748
+ 409: {
749
+ headers: {
750
+ [name: string]: unknown;
751
+ };
752
+ content: {
753
+ "application/json": {
754
+ /** @description Error message. */
755
+ error: string;
756
+ };
757
+ };
758
+ };
759
+ /** @description Server error */
760
+ 500: {
761
+ headers: {
762
+ [name: string]: unknown;
763
+ };
764
+ content: {
765
+ "application/json": {
766
+ /** @description Error message. */
767
+ error: string;
768
+ };
769
+ };
770
+ };
771
+ };
772
+ };
773
+ delete?: never;
774
+ options?: never;
775
+ head?: never;
776
+ patch?: never;
777
+ trace?: never;
778
+ };
779
+ "/v1/feature-access": {
780
+ parameters: {
781
+ query?: never;
782
+ header?: never;
783
+ path?: never;
784
+ cookie?: never;
785
+ };
786
+ /**
787
+ * Get feature access
788
+ * @description Return feature access for a customer.
789
+ */
790
+ get: {
791
+ parameters: {
792
+ query: {
793
+ /** @description Customer ID (internal or Stripe). */
794
+ customerId: string;
795
+ };
796
+ header: {
797
+ /** @description API key from your PriceOS dashboard. */
798
+ "x-api-key": string;
799
+ };
800
+ path?: never;
801
+ cookie?: never;
802
+ };
803
+ requestBody?: never;
804
+ responses: {
805
+ /** @description Feature access lookup */
806
+ 200: {
807
+ headers: {
808
+ [name: string]: unknown;
809
+ };
810
+ content: {
811
+ /**
812
+ * @example {
813
+ * "api_calls": {
814
+ * "hasAccess": true,
815
+ * "type": "limit",
816
+ * "limit": 1000,
817
+ * "isUnlimited": false,
818
+ * "used": 120
819
+ * },
820
+ * "team_seats": {
821
+ * "hasAccess": true,
822
+ * "type": "boolean"
823
+ * }
824
+ * }
825
+ */
826
+ "application/json": {
827
+ [key: string]: {
828
+ /**
829
+ * @description Feature access type.
830
+ * @enum {string}
831
+ */
832
+ type: "boolean";
833
+ /** @description Whether the customer has access. */
834
+ hasAccess: boolean;
835
+ } | {
836
+ /**
837
+ * @description Feature access type.
838
+ * @enum {string}
839
+ */
840
+ type: "limit";
841
+ /** @description Whether the customer has access. */
842
+ hasAccess: boolean;
843
+ /** @description Whether the feature is unlimited. */
844
+ isUnlimited: boolean;
845
+ /** @description Limit for the feature, when applicable. */
846
+ limit: number | null;
847
+ /** @description Usage consumed for the feature. */
848
+ used: number;
849
+ };
850
+ };
851
+ };
852
+ };
853
+ /** @description Bad request */
854
+ 400: {
855
+ headers: {
856
+ [name: string]: unknown;
857
+ };
858
+ content: {
859
+ "application/json": {
860
+ /** @description Error message. */
861
+ error: string;
862
+ };
863
+ };
864
+ };
865
+ /** @description Unauthorized */
866
+ 401: {
867
+ headers: {
868
+ [name: string]: unknown;
869
+ };
870
+ content: {
871
+ "application/json": {
872
+ /** @description Error message. */
873
+ error: string;
874
+ };
875
+ };
876
+ };
877
+ /** @description Server error */
878
+ 500: {
879
+ headers: {
880
+ [name: string]: unknown;
881
+ };
882
+ content: {
883
+ "application/json": {
884
+ /** @description Error message. */
885
+ error: string;
886
+ };
887
+ };
888
+ };
889
+ };
890
+ };
891
+ put?: never;
892
+ post?: never;
893
+ delete?: never;
894
+ options?: never;
895
+ head?: never;
896
+ patch?: never;
897
+ trace?: never;
898
+ };
899
+ "/v1/features": {
900
+ parameters: {
901
+ query?: never;
902
+ header?: never;
903
+ path?: never;
904
+ cookie?: never;
905
+ };
906
+ /**
907
+ * Get features
908
+ * @description List features for the workspace.
909
+ */
910
+ get: {
911
+ parameters: {
912
+ query?: never;
913
+ header: {
914
+ /** @description API key from your PriceOS dashboard. */
915
+ "x-api-key": string;
916
+ };
917
+ path?: never;
918
+ cookie?: never;
919
+ };
920
+ requestBody?: never;
921
+ responses: {
922
+ /** @description Feature list */
923
+ 200: {
924
+ headers: {
925
+ [name: string]: unknown;
926
+ };
927
+ content: {
928
+ "application/json": {
929
+ /** @description Feature ID. */
930
+ id: string;
931
+ /** @description Feature key. */
932
+ featureKey: string;
933
+ /** @description Feature name. */
934
+ name: string;
935
+ /** @description Feature description. */
936
+ description: string | null;
937
+ /**
938
+ * @description Feature access type.
939
+ * @enum {string}
940
+ */
941
+ type: "boolean" | "limit";
942
+ /** @description Whether the feature tracks usage. */
943
+ tracksUsage: boolean;
944
+ /** @description Usage unit. */
945
+ usageUnit: string | null;
946
+ /**
947
+ * @description Usage reset interval.
948
+ * @enum {string}
949
+ */
950
+ usageResetInterval: "never" | "day" | "week" | "month" | "year";
951
+ /**
952
+ * @description Usage reset anchor.
953
+ * @enum {string}
954
+ */
955
+ usageResetAnchor: "billing_period" | "calendar";
956
+ }[];
957
+ };
958
+ };
959
+ /** @description Unauthorized */
960
+ 401: {
961
+ headers: {
962
+ [name: string]: unknown;
963
+ };
964
+ content: {
965
+ "application/json": {
966
+ /** @description Error message. */
967
+ error: string;
968
+ };
969
+ };
970
+ };
971
+ /** @description Server error */
972
+ 500: {
973
+ headers: {
974
+ [name: string]: unknown;
975
+ };
976
+ content: {
977
+ "application/json": {
978
+ /** @description Error message. */
979
+ error: string;
980
+ };
981
+ };
982
+ };
983
+ };
984
+ };
985
+ put?: never;
986
+ post?: never;
987
+ delete?: never;
988
+ options?: never;
989
+ head?: never;
990
+ patch?: never;
991
+ trace?: never;
992
+ };
993
+ "/v1/usage": {
994
+ parameters: {
995
+ query?: never;
996
+ header?: never;
997
+ path?: never;
998
+ cookie?: never;
999
+ };
1000
+ get?: never;
1001
+ put?: never;
1002
+ /**
1003
+ * Track usage
1004
+ * @description Record usage for a feature.
1005
+ */
1006
+ post: {
1007
+ parameters: {
1008
+ query?: never;
1009
+ header: {
1010
+ /** @description API key from your PriceOS dashboard. */
1011
+ "x-api-key": string;
1012
+ };
1013
+ path?: never;
1014
+ cookie?: never;
1015
+ };
1016
+ requestBody: {
1017
+ content: {
1018
+ "application/json": {
1019
+ /** @description Customer ID (internal or Stripe). */
1020
+ customerId: string;
1021
+ /** @description Feature key to track usage for. */
1022
+ featureKey: string;
1023
+ /** @description Usage amount to record. */
1024
+ amount: number;
1025
+ /** @description Optional idempotency key for the event. */
1026
+ idempotencyKey?: string;
1027
+ /** @description Unix timestamp (ms) when the event occurred. */
1028
+ occurredAt?: number;
1029
+ };
1030
+ };
1031
+ };
1032
+ responses: {
1033
+ /** @description Usage recorded */
1034
+ 200: {
1035
+ headers: {
1036
+ [name: string]: unknown;
1037
+ };
1038
+ content: {
1039
+ "application/json": {
1040
+ /** @description Whether the usage event was applied. */
1041
+ applied: boolean;
1042
+ /** @description Updated usage total, if applicable. */
1043
+ used: number | null;
1044
+ /** @description Reason the usage event was not applied. */
1045
+ reason?: string | null;
1046
+ };
1047
+ };
1048
+ };
1049
+ /** @description Bad request */
1050
+ 400: {
1051
+ headers: {
1052
+ [name: string]: unknown;
1053
+ };
1054
+ content: {
1055
+ "application/json": {
1056
+ /** @description Error message. */
1057
+ error: string;
1058
+ };
1059
+ };
1060
+ };
1061
+ /** @description Unauthorized */
1062
+ 401: {
1063
+ headers: {
1064
+ [name: string]: unknown;
1065
+ };
1066
+ content: {
1067
+ "application/json": {
1068
+ /** @description Error message. */
1069
+ error: string;
1070
+ };
1071
+ };
1072
+ };
1073
+ /** @description Not found */
1074
+ 404: {
1075
+ headers: {
1076
+ [name: string]: unknown;
1077
+ };
1078
+ content: {
1079
+ "application/json": {
1080
+ /** @description Error message. */
1081
+ error: string;
1082
+ };
1083
+ };
1084
+ };
1085
+ /** @description Server error */
1086
+ 500: {
1087
+ headers: {
1088
+ [name: string]: unknown;
1089
+ };
1090
+ content: {
1091
+ "application/json": {
1092
+ /** @description Error message. */
1093
+ error: string;
1094
+ };
1095
+ };
1096
+ };
1097
+ };
1098
+ };
1099
+ delete?: never;
1100
+ options?: never;
1101
+ head?: never;
1102
+ patch?: never;
1103
+ trace?: never;
1104
+ };
1105
+ }
1106
+
1107
+ type GetCustomerResponse = paths["/v1/customer"]["get"]["responses"][200]["content"]["application/json"];
1108
+ type UpdateCustomerBody = paths["/v1/customer"]["put"]["requestBody"]["content"]["application/json"];
1109
+ type UpdateCustomerResponse = paths["/v1/customer"]["put"]["responses"][200]["content"]["application/json"];
1110
+ type IdentifyCustomerBody = paths["/v1/customer/identify"]["post"]["requestBody"]["content"]["application/json"];
1111
+ type IdentifyCustomerResponse = paths["/v1/customer/identify"]["post"]["responses"][200]["content"]["application/json"];
1112
+ type GetFeatureAccessResponse = paths["/v1/feature-access"]["get"]["responses"][200]["content"]["application/json"];
1113
+ type TrackUsageBody = paths["/v1/usage"]["post"]["requestBody"]["content"]["application/json"];
1114
+ type TrackUsageResponse = paths["/v1/usage"]["post"]["responses"][200]["content"]["application/json"];
1115
+
1116
+ type PriceOSOptions = {
1117
+ baseUrl?: string;
1118
+ apiKey: string;
1119
+ fetch?: typeof fetch;
1120
+ userAgent?: string;
1121
+ };
1122
+ type PriceOSHttpClient = {
1123
+ raw: Client<paths>;
1124
+ getCustomer(customerId: string): Promise<GetCustomerResponse | null>;
1125
+ identifyCustomer(input: IdentifyCustomerBody): Promise<IdentifyCustomerResponse | null>;
1126
+ upsertCustomer(input: UpdateCustomerBody): Promise<UpdateCustomerResponse>;
1127
+ getFeatureAccess(customerId: string): Promise<GetFeatureAccessResponse>;
1128
+ trackUsage(input: TrackUsageBody): Promise<TrackUsageResponse>;
1129
+ };
1130
+ declare class PriceOSError extends Error {
1131
+ status?: number;
1132
+ details?: unknown;
1133
+ constructor(message: string, opts?: {
1134
+ status?: number;
1135
+ details?: unknown;
1136
+ });
1137
+ }
1138
+ declare function createHttpClient(opts: PriceOSOptions): PriceOSHttpClient;
1139
+
1140
+ export { type GetCustomerResponse, type GetFeatureAccessResponse, type IdentifyCustomerBody, type IdentifyCustomerResponse, PriceOSError, type PriceOSHttpClient, type PriceOSOptions, type TrackUsageBody, type TrackUsageResponse, type UpdateCustomerBody, type UpdateCustomerResponse, createHttpClient };