@commet/node 5.0.0 → 5.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.
package/dist/index.d.ts CHANGED
@@ -441,6 +441,282 @@ declare class CustomersResource {
441
441
  list(params?: ListCustomersParams): Promise<ApiResponse<Customer[]>>;
442
442
  }
443
443
 
444
+ type PlanID = `plan_${string}`;
445
+ type BillingInterval = "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
446
+ type FeatureType = "boolean" | "usage" | "seats" | "quota";
447
+ interface PlanPrice {
448
+ billingInterval: BillingInterval;
449
+ price: number;
450
+ isDefault: boolean;
451
+ trialDays: number;
452
+ }
453
+ interface PlanFeature {
454
+ code: string;
455
+ name: string;
456
+ type: FeatureType;
457
+ unitName: string | null;
458
+ enabled?: boolean;
459
+ includedAmount?: number;
460
+ unlimited?: boolean;
461
+ overageEnabled?: boolean;
462
+ overageUnitPrice?: number;
463
+ }
464
+ interface Plan {
465
+ id: PlanID;
466
+ object: "plan";
467
+ livemode: boolean;
468
+ code: string;
469
+ name: string;
470
+ description: string | null;
471
+ isPublic: boolean;
472
+ isFree: boolean;
473
+ isDefault: boolean;
474
+ sortOrder: number;
475
+ prices: PlanPrice[];
476
+ features: PlanFeature[];
477
+ createdAt: string;
478
+ }
479
+ interface PlanDetailPrice {
480
+ billingInterval: BillingInterval;
481
+ price: number;
482
+ isDefault: boolean;
483
+ trialDays: number;
484
+ introOffer: {
485
+ enabled: boolean;
486
+ discountType: "percentage" | "amount" | null;
487
+ discountValue: number | null;
488
+ durationCycles: number | null;
489
+ } | null;
490
+ }
491
+ interface PlanDetailFeature extends PlanFeature {
492
+ overage: {
493
+ enabled: boolean;
494
+ model: "per_unit" | null;
495
+ unitPrice: number | null;
496
+ } | null;
497
+ }
498
+ interface PlanDetail {
499
+ id: PlanID;
500
+ object: "plan";
501
+ livemode: boolean;
502
+ code: string;
503
+ name: string;
504
+ description: string | null;
505
+ isPublic: boolean;
506
+ isDefault: boolean;
507
+ sortOrder: number;
508
+ prices: PlanDetailPrice[];
509
+ features: PlanDetailFeature[];
510
+ createdAt: string;
511
+ updatedAt: string;
512
+ }
513
+ interface ListPlansParams extends ListParams {
514
+ includePrivate?: boolean;
515
+ }
516
+ interface PlanManage {
517
+ id: string;
518
+ object: "plan";
519
+ livemode: boolean;
520
+ name: string;
521
+ code: string;
522
+ description: string | null;
523
+ consumptionModel: string | null;
524
+ isPublic: boolean;
525
+ isDefault: boolean;
526
+ isFree: boolean;
527
+ blockOnExhaustion: boolean;
528
+ sortOrder: number;
529
+ planGroupId: string | null;
530
+ metadata: Record<string, unknown> | null;
531
+ createdAt: string;
532
+ updatedAt: string;
533
+ }
534
+ interface PlanFeatureManageBase {
535
+ planId: string;
536
+ featureId: string;
537
+ enabled: boolean;
538
+ includedAmount: number | null;
539
+ unlimited: boolean;
540
+ overageEnabled: boolean;
541
+ creditsPerUnit: number | null;
542
+ }
543
+ interface FixedPricingFeatureManage extends PlanFeatureManageBase {
544
+ pricingMode: "fixed";
545
+ overageUnitPrice: number | null;
546
+ margin: null;
547
+ }
548
+ interface AiModelPricingFeatureManage extends PlanFeatureManageBase {
549
+ pricingMode: "ai_model";
550
+ margin: number;
551
+ overageUnitPrice: null;
552
+ }
553
+ type PlanFeatureManage = FixedPricingFeatureManage | AiModelPricingFeatureManage;
554
+ interface PlanPriceManage {
555
+ id: string;
556
+ object: "plan_price";
557
+ livemode: boolean;
558
+ planId: string;
559
+ billingInterval: BillingInterval;
560
+ price: number;
561
+ isDefault: boolean;
562
+ trialDays: number;
563
+ includedBalance: number | null;
564
+ includedCredits: number | null;
565
+ introOfferEnabled: boolean;
566
+ introOfferDiscountType: "percentage" | "amount" | null;
567
+ introOfferDiscountValue: number | null;
568
+ introOfferDurationCycles: number | null;
569
+ createdAt: string;
570
+ updatedAt: string;
571
+ }
572
+ interface RegionalPriceResult {
573
+ priceId: string;
574
+ overrides: Array<{
575
+ currency: string;
576
+ price: number;
577
+ }>;
578
+ }
579
+ interface DeleteResult {
580
+ id: string;
581
+ deleted: true;
582
+ }
583
+ interface RemoveResult {
584
+ id: string;
585
+ removed: true;
586
+ }
587
+ interface CreatePlanParams {
588
+ name: string;
589
+ code: string;
590
+ description?: string;
591
+ consumptionModel?: "metered" | "credits" | "balance";
592
+ isPublic?: boolean;
593
+ isFree?: boolean;
594
+ blockOnExhaustion?: boolean;
595
+ planGroupId?: string;
596
+ metadata?: Record<string, unknown>;
597
+ }
598
+ interface UpdatePlanParams {
599
+ id: string;
600
+ name?: string;
601
+ description?: string;
602
+ metadata?: Record<string, unknown>;
603
+ isPublic?: boolean;
604
+ }
605
+ interface DeletePlanParams {
606
+ id: string;
607
+ }
608
+ interface SetVisibilityParams {
609
+ id: string;
610
+ isPublic: boolean;
611
+ }
612
+ interface AddPlanFeatureBase {
613
+ planId: string;
614
+ featureId: string;
615
+ enabled?: boolean;
616
+ includedAmount?: number;
617
+ unlimited?: boolean;
618
+ overageEnabled?: boolean;
619
+ creditsPerUnit?: number | null;
620
+ }
621
+ interface AddFixedPricingFeatureParams extends AddPlanFeatureBase {
622
+ pricingMode?: "fixed";
623
+ overageUnitPrice?: number;
624
+ }
625
+ interface AddAiModelPricingFeatureParams extends AddPlanFeatureBase {
626
+ pricingMode: "ai_model";
627
+ margin: number;
628
+ }
629
+ type AddPlanFeatureParams = AddFixedPricingFeatureParams | AddAiModelPricingFeatureParams;
630
+ interface UpdatePlanFeatureBase {
631
+ planId: string;
632
+ featureId: string;
633
+ enabled?: boolean;
634
+ includedAmount?: number;
635
+ unlimited?: boolean;
636
+ overageEnabled?: boolean;
637
+ creditsPerUnit?: number | null;
638
+ }
639
+ interface UpdateFixedPricingFeatureParams extends UpdatePlanFeatureBase {
640
+ pricingMode?: "fixed";
641
+ overageUnitPrice?: number;
642
+ }
643
+ interface UpdateAiModelPricingFeatureParams extends UpdatePlanFeatureBase {
644
+ pricingMode: "ai_model";
645
+ margin?: number;
646
+ }
647
+ type UpdatePlanFeatureParams = UpdateFixedPricingFeatureParams | UpdateAiModelPricingFeatureParams;
648
+ interface RemovePlanFeatureParams {
649
+ planId: string;
650
+ featureId: string;
651
+ }
652
+ interface AddPlanPriceParams {
653
+ planId: string;
654
+ billingInterval: BillingInterval;
655
+ price: number;
656
+ trialDays?: number;
657
+ isDefault?: boolean;
658
+ includedBalance?: number;
659
+ includedCredits?: number;
660
+ introOfferEnabled?: boolean;
661
+ introOfferDiscountType?: "percentage" | "amount";
662
+ introOfferDiscountValue?: number;
663
+ introOfferDurationCycles?: number;
664
+ }
665
+ interface UpdatePlanPriceParams {
666
+ planId: string;
667
+ priceId: string;
668
+ price?: number;
669
+ isDefault?: boolean;
670
+ trialDays?: number;
671
+ includedBalance?: number;
672
+ includedCredits?: number;
673
+ introOfferEnabled?: boolean;
674
+ introOfferDiscountType?: "percentage" | "amount" | null;
675
+ introOfferDiscountValue?: number | null;
676
+ introOfferDurationCycles?: number | null;
677
+ }
678
+ interface DeletePlanPriceParams {
679
+ planId: string;
680
+ priceId: string;
681
+ }
682
+ interface SetDefaultPriceParams {
683
+ planId: string;
684
+ priceId: string;
685
+ }
686
+ interface SetRegionalPricesParams {
687
+ planId: string;
688
+ priceId: string;
689
+ overrides: Array<{
690
+ currency: string;
691
+ price: number;
692
+ }>;
693
+ }
694
+ interface DeleteRegionalPricesParams {
695
+ planId: string;
696
+ priceId: string;
697
+ }
698
+ declare class PlansResource {
699
+ private httpClient;
700
+ constructor(httpClient: CommetHTTPClient);
701
+ list(params?: ListPlansParams): Promise<ApiResponse<Plan[]>>;
702
+ get(params: {
703
+ id: string;
704
+ }): Promise<ApiResponse<PlanDetail>>;
705
+ create(params: CreatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
706
+ update(params: UpdatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
707
+ delete(params: DeletePlanParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
708
+ setVisibility(params: SetVisibilityParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
709
+ addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
710
+ updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
711
+ removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<RemoveResult>>;
712
+ addPrice(params: AddPlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
713
+ updatePrice(params: UpdatePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
714
+ deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
715
+ setDefaultPrice(params: SetDefaultPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
716
+ setRegionalPrices(params: SetRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<RegionalPriceResult>>;
717
+ deleteRegionalPrices(params: DeleteRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
718
+ }
719
+
444
720
  interface GetFeatureParams {
445
721
  customerId: CustomerID;
446
722
  code: string;
@@ -457,7 +733,7 @@ interface FeatureAccess {
457
733
  livemode: boolean;
458
734
  code: string;
459
735
  name: string;
460
- type: "boolean" | "usage" | "seats";
736
+ type: FeatureType;
461
737
  allowed: boolean;
462
738
  enabled?: boolean;
463
739
  current?: number;
@@ -465,6 +741,7 @@ interface FeatureAccess {
465
741
  remaining?: number;
466
742
  overage?: number;
467
743
  overageUnitPrice?: number;
744
+ billedQuantity?: number;
468
745
  unlimited?: boolean;
469
746
  overageEnabled?: boolean;
470
747
  }
@@ -479,7 +756,7 @@ interface Feature {
479
756
  livemode: boolean;
480
757
  name: string;
481
758
  code: string;
482
- type: "boolean" | "usage" | "seats";
759
+ type: FeatureType;
483
760
  description: string | null;
484
761
  unitName: string | null;
485
762
  createdAt: string;
@@ -488,7 +765,7 @@ interface Feature {
488
765
  interface CreateFeatureParams {
489
766
  code: string;
490
767
  name: string;
491
- type: "boolean" | "usage" | "seats";
768
+ type: FeatureType;
492
769
  description?: string;
493
770
  unitName?: string;
494
771
  }
@@ -604,376 +881,100 @@ interface ListInvoicesParams {
604
881
  interface GetInvoiceParams {
605
882
  id: string;
606
883
  }
607
- interface CreateAdjustmentParams {
608
- customerId: string;
609
- amount: number;
610
- description?: string;
611
- metadata?: Record<string, unknown>;
612
- }
613
- interface GetDownloadUrlParams {
614
- id: string;
615
- }
616
- interface SendInvoiceParams {
617
- id: string;
618
- }
619
- interface UpdateInvoiceStatusParams {
620
- id: string;
621
- status: string;
622
- }
623
- declare class InvoicesResource {
624
- private httpClient;
625
- constructor(httpClient: CommetHTTPClient);
626
- list(params?: ListInvoicesParams): Promise<ApiResponse<InvoiceListItem[]>>;
627
- get(params: GetInvoiceParams): Promise<ApiResponse<InvoiceDetail>>;
628
- /** Negative amount creates a credit. */
629
- createAdjustment(params: CreateAdjustmentParams, options?: RequestOptions): Promise<ApiResponse<CreateAdjustmentResult>>;
630
- /** Signed URL, expires after 7 days. */
631
- getDownloadUrl(params: GetDownloadUrlParams): Promise<ApiResponse<InvoiceDownloadResult>>;
632
- send(params: SendInvoiceParams, options?: RequestOptions): Promise<ApiResponse<InvoiceSendResult>>;
633
- /** Only outstanding invoices can be changed to paid or void. */
634
- updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<ApiResponse<InvoiceStatusResult>>;
635
- }
636
-
637
- interface PlanGroup {
638
- id: string;
639
- object: "plan_group";
640
- livemode: boolean;
641
- name: string;
642
- description: string | null;
643
- isPublic: boolean;
644
- createdAt: string;
645
- updatedAt: string;
646
- }
647
- interface PlanGroupDetail extends PlanGroup {
648
- plans: Array<{
649
- id: string;
650
- code: string;
651
- name: string;
652
- sortOrder: number;
653
- }>;
654
- }
655
- interface ListPlanGroupsParams {
656
- limit?: number;
657
- cursor?: string;
658
- }
659
- interface GetPlanGroupParams {
660
- id: string;
661
- }
662
- interface CreatePlanGroupParams {
663
- name: string;
664
- description?: string;
665
- isPublic?: boolean;
666
- }
667
- interface UpdatePlanGroupParams {
668
- id: string;
669
- name?: string;
670
- description?: string;
671
- isPublic?: boolean;
672
- }
673
- interface DeletePlanGroupParams {
674
- id: string;
675
- }
676
- interface AddPlanToGroupParams {
677
- id: string;
678
- planId: string;
679
- sortOrder?: number;
680
- }
681
- interface RemovePlanFromGroupParams {
682
- id: string;
683
- planId: string;
684
- }
685
- interface ReorderPlansParams {
686
- id: string;
687
- planIds: string[];
688
- }
689
- declare class PlanGroupsResource {
690
- private httpClient;
691
- constructor(httpClient: CommetHTTPClient);
692
- list(params?: ListPlanGroupsParams): Promise<ApiResponse<PlanGroup[]>>;
693
- get(params: GetPlanGroupParams): Promise<ApiResponse<PlanGroupDetail>>;
694
- create(params: CreatePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroup>>;
695
- update(params: UpdatePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroup>>;
696
- /** Plans in the group are unlinked, not deleted. */
697
- delete(params: DeletePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<void>>;
698
- addPlan(params: AddPlanToGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroupDetail>>;
699
- removePlan(params: RemovePlanFromGroupParams, options?: RequestOptions): Promise<ApiResponse<void>>;
700
- reorderPlans(params: ReorderPlansParams, options?: RequestOptions): Promise<ApiResponse<PlanGroupDetail>>;
701
- }
702
-
703
- type PlanID = `plan_${string}`;
704
- type BillingInterval = "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
705
- type FeatureType = "boolean" | "usage" | "seats";
706
- interface PlanPrice {
707
- billingInterval: BillingInterval;
708
- price: number;
709
- isDefault: boolean;
710
- trialDays: number;
711
- }
712
- interface PlanFeature {
713
- code: string;
714
- name: string;
715
- type: FeatureType;
716
- unitName: string | null;
717
- enabled?: boolean;
718
- includedAmount?: number;
719
- unlimited?: boolean;
720
- overageEnabled?: boolean;
721
- overageUnitPrice?: number;
722
- }
723
- interface Plan {
724
- id: PlanID;
725
- object: "plan";
726
- livemode: boolean;
727
- code: string;
728
- name: string;
729
- description: string | null;
730
- isPublic: boolean;
731
- isFree: boolean;
732
- isDefault: boolean;
733
- sortOrder: number;
734
- prices: PlanPrice[];
735
- features: PlanFeature[];
736
- createdAt: string;
737
- }
738
- interface PlanDetailPrice {
739
- billingInterval: BillingInterval;
740
- price: number;
741
- isDefault: boolean;
742
- trialDays: number;
743
- introOffer: {
744
- enabled: boolean;
745
- discountType: "percentage" | "amount" | null;
746
- discountValue: number | null;
747
- durationCycles: number | null;
748
- } | null;
749
- }
750
- interface PlanDetailFeature extends PlanFeature {
751
- overage: {
752
- enabled: boolean;
753
- model: "per_unit" | null;
754
- unitPrice: number | null;
755
- } | null;
756
- }
757
- interface PlanDetail {
758
- id: PlanID;
759
- object: "plan";
760
- livemode: boolean;
761
- code: string;
762
- name: string;
763
- description: string | null;
764
- isPublic: boolean;
765
- isDefault: boolean;
766
- sortOrder: number;
767
- prices: PlanDetailPrice[];
768
- features: PlanDetailFeature[];
769
- createdAt: string;
770
- updatedAt: string;
771
- }
772
- interface ListPlansParams extends ListParams {
773
- includePrivate?: boolean;
774
- }
775
- interface PlanManage {
776
- id: string;
777
- object: "plan";
778
- livemode: boolean;
779
- name: string;
780
- code: string;
781
- description: string | null;
782
- consumptionModel: string | null;
783
- isPublic: boolean;
784
- isDefault: boolean;
785
- isFree: boolean;
786
- blockOnExhaustion: boolean;
787
- sortOrder: number;
788
- planGroupId: string | null;
789
- metadata: Record<string, unknown> | null;
790
- createdAt: string;
791
- updatedAt: string;
884
+ interface CreateAdjustmentParams {
885
+ customerId: string;
886
+ amount: number;
887
+ description?: string;
888
+ metadata?: Record<string, unknown>;
792
889
  }
793
- interface PlanFeatureManageBase {
794
- planId: string;
795
- featureId: string;
796
- enabled: boolean;
797
- includedAmount: number | null;
798
- unlimited: boolean;
799
- overageEnabled: boolean;
800
- creditsPerUnit: number | null;
890
+ interface GetDownloadUrlParams {
891
+ id: string;
801
892
  }
802
- interface FixedPricingFeatureManage extends PlanFeatureManageBase {
803
- pricingMode: "fixed";
804
- overageUnitPrice: number | null;
805
- margin: null;
893
+ interface SendInvoiceParams {
894
+ id: string;
806
895
  }
807
- interface AiModelPricingFeatureManage extends PlanFeatureManageBase {
808
- pricingMode: "ai_model";
809
- margin: number;
810
- overageUnitPrice: null;
896
+ interface UpdateInvoiceStatusParams {
897
+ id: string;
898
+ status: string;
811
899
  }
812
- type PlanFeatureManage = FixedPricingFeatureManage | AiModelPricingFeatureManage;
813
- interface PlanPriceManage {
900
+ declare class InvoicesResource {
901
+ private httpClient;
902
+ constructor(httpClient: CommetHTTPClient);
903
+ list(params?: ListInvoicesParams): Promise<ApiResponse<InvoiceListItem[]>>;
904
+ get(params: GetInvoiceParams): Promise<ApiResponse<InvoiceDetail>>;
905
+ /** Negative amount creates a credit. */
906
+ createAdjustment(params: CreateAdjustmentParams, options?: RequestOptions): Promise<ApiResponse<CreateAdjustmentResult>>;
907
+ /** Signed URL, expires after 7 days. */
908
+ getDownloadUrl(params: GetDownloadUrlParams): Promise<ApiResponse<InvoiceDownloadResult>>;
909
+ send(params: SendInvoiceParams, options?: RequestOptions): Promise<ApiResponse<InvoiceSendResult>>;
910
+ /** Only outstanding invoices can be changed to paid or void. */
911
+ updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<ApiResponse<InvoiceStatusResult>>;
912
+ }
913
+
914
+ interface PlanGroup {
814
915
  id: string;
815
- object: "plan_price";
916
+ object: "plan_group";
816
917
  livemode: boolean;
817
- planId: string;
818
- billingInterval: BillingInterval;
819
- price: number;
820
- isDefault: boolean;
821
- trialDays: number;
822
- includedBalance: number | null;
823
- includedCredits: number | null;
824
- introOfferEnabled: boolean;
825
- introOfferDiscountType: "percentage" | "amount" | null;
826
- introOfferDiscountValue: number | null;
827
- introOfferDurationCycles: number | null;
918
+ name: string;
919
+ description: string | null;
920
+ isPublic: boolean;
828
921
  createdAt: string;
829
922
  updatedAt: string;
830
923
  }
831
- interface RegionalPriceResult {
832
- priceId: string;
833
- overrides: Array<{
834
- currency: string;
835
- price: number;
924
+ interface PlanGroupDetail extends PlanGroup {
925
+ plans: Array<{
926
+ id: string;
927
+ code: string;
928
+ name: string;
929
+ sortOrder: number;
836
930
  }>;
837
931
  }
838
- interface DeleteResult {
839
- id: string;
840
- deleted: true;
932
+ interface ListPlanGroupsParams {
933
+ limit?: number;
934
+ cursor?: string;
841
935
  }
842
- interface RemoveResult {
936
+ interface GetPlanGroupParams {
843
937
  id: string;
844
- removed: true;
845
938
  }
846
- interface CreatePlanParams {
939
+ interface CreatePlanGroupParams {
847
940
  name: string;
848
- code: string;
849
941
  description?: string;
850
- consumptionModel?: "metered" | "credits" | "balance";
851
942
  isPublic?: boolean;
852
- isFree?: boolean;
853
- blockOnExhaustion?: boolean;
854
- planGroupId?: string;
855
- metadata?: Record<string, unknown>;
856
943
  }
857
- interface UpdatePlanParams {
944
+ interface UpdatePlanGroupParams {
858
945
  id: string;
859
946
  name?: string;
860
947
  description?: string;
861
- metadata?: Record<string, unknown>;
862
948
  isPublic?: boolean;
863
949
  }
864
- interface DeletePlanParams {
950
+ interface DeletePlanGroupParams {
865
951
  id: string;
866
952
  }
867
- interface SetVisibilityParams {
953
+ interface AddPlanToGroupParams {
868
954
  id: string;
869
- isPublic: boolean;
870
- }
871
- interface AddPlanFeatureBase {
872
- planId: string;
873
- featureId: string;
874
- enabled?: boolean;
875
- includedAmount?: number;
876
- unlimited?: boolean;
877
- overageEnabled?: boolean;
878
- creditsPerUnit?: number | null;
879
- }
880
- interface AddFixedPricingFeatureParams extends AddPlanFeatureBase {
881
- pricingMode?: "fixed";
882
- overageUnitPrice?: number;
883
- }
884
- interface AddAiModelPricingFeatureParams extends AddPlanFeatureBase {
885
- pricingMode: "ai_model";
886
- margin: number;
887
- }
888
- type AddPlanFeatureParams = AddFixedPricingFeatureParams | AddAiModelPricingFeatureParams;
889
- interface UpdatePlanFeatureBase {
890
- planId: string;
891
- featureId: string;
892
- enabled?: boolean;
893
- includedAmount?: number;
894
- unlimited?: boolean;
895
- overageEnabled?: boolean;
896
- creditsPerUnit?: number | null;
897
- }
898
- interface UpdateFixedPricingFeatureParams extends UpdatePlanFeatureBase {
899
- pricingMode?: "fixed";
900
- overageUnitPrice?: number;
901
- }
902
- interface UpdateAiModelPricingFeatureParams extends UpdatePlanFeatureBase {
903
- pricingMode: "ai_model";
904
- margin?: number;
905
- }
906
- type UpdatePlanFeatureParams = UpdateFixedPricingFeatureParams | UpdateAiModelPricingFeatureParams;
907
- interface RemovePlanFeatureParams {
908
- planId: string;
909
- featureId: string;
910
- }
911
- interface AddPlanPriceParams {
912
- planId: string;
913
- billingInterval: BillingInterval;
914
- price: number;
915
- trialDays?: number;
916
- isDefault?: boolean;
917
- includedBalance?: number;
918
- includedCredits?: number;
919
- introOfferEnabled?: boolean;
920
- introOfferDiscountType?: "percentage" | "amount";
921
- introOfferDiscountValue?: number;
922
- introOfferDurationCycles?: number;
923
- }
924
- interface UpdatePlanPriceParams {
925
- planId: string;
926
- priceId: string;
927
- price?: number;
928
- isDefault?: boolean;
929
- trialDays?: number;
930
- includedBalance?: number;
931
- includedCredits?: number;
932
- introOfferEnabled?: boolean;
933
- introOfferDiscountType?: "percentage" | "amount" | null;
934
- introOfferDiscountValue?: number | null;
935
- introOfferDurationCycles?: number | null;
936
- }
937
- interface DeletePlanPriceParams {
938
- planId: string;
939
- priceId: string;
940
- }
941
- interface SetDefaultPriceParams {
942
955
  planId: string;
943
- priceId: string;
956
+ sortOrder?: number;
944
957
  }
945
- interface SetRegionalPricesParams {
958
+ interface RemovePlanFromGroupParams {
959
+ id: string;
946
960
  planId: string;
947
- priceId: string;
948
- overrides: Array<{
949
- currency: string;
950
- price: number;
951
- }>;
952
961
  }
953
- interface DeleteRegionalPricesParams {
954
- planId: string;
955
- priceId: string;
962
+ interface ReorderPlansParams {
963
+ id: string;
964
+ planIds: string[];
956
965
  }
957
- declare class PlansResource {
966
+ declare class PlanGroupsResource {
958
967
  private httpClient;
959
968
  constructor(httpClient: CommetHTTPClient);
960
- list(params?: ListPlansParams): Promise<ApiResponse<Plan[]>>;
961
- get(params: {
962
- id: string;
963
- }): Promise<ApiResponse<PlanDetail>>;
964
- create(params: CreatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
965
- update(params: UpdatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
966
- delete(params: DeletePlanParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
967
- setVisibility(params: SetVisibilityParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
968
- addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
969
- updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
970
- removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<RemoveResult>>;
971
- addPrice(params: AddPlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
972
- updatePrice(params: UpdatePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
973
- deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
974
- setDefaultPrice(params: SetDefaultPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
975
- setRegionalPrices(params: SetRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<RegionalPriceResult>>;
976
- deleteRegionalPrices(params: DeleteRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
969
+ list(params?: ListPlanGroupsParams): Promise<ApiResponse<PlanGroup[]>>;
970
+ get(params: GetPlanGroupParams): Promise<ApiResponse<PlanGroupDetail>>;
971
+ create(params: CreatePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroup>>;
972
+ update(params: UpdatePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroup>>;
973
+ /** Plans in the group are unlinked, not deleted. */
974
+ delete(params: DeletePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<void>>;
975
+ addPlan(params: AddPlanToGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroupDetail>>;
976
+ removePlan(params: RemovePlanFromGroupParams, options?: RequestOptions): Promise<ApiResponse<void>>;
977
+ reorderPlans(params: ReorderPlansParams, options?: RequestOptions): Promise<ApiResponse<PlanGroupDetail>>;
977
978
  }
978
979
 
979
980
  interface PortalAccess {
@@ -1045,6 +1046,57 @@ declare class PromoCodesResource {
1045
1046
  update(params: UpdatePromoCodeParams, options?: RequestOptions): Promise<ApiResponse<PromoCodeDetail>>;
1046
1047
  }
1047
1048
 
1049
+ interface QuotaEvent {
1050
+ id: string;
1051
+ customerId: CustomerID;
1052
+ featureCode: string;
1053
+ previousBalance: number;
1054
+ newBalance: number;
1055
+ ts: string;
1056
+ createdAt: string;
1057
+ }
1058
+ interface QuotaAllowance {
1059
+ featureCode: string;
1060
+ current: number;
1061
+ included: number;
1062
+ remaining: number | null;
1063
+ billedQuantity?: number;
1064
+ unlimited: boolean;
1065
+ overageEnabled: boolean;
1066
+ asOf: string | null;
1067
+ }
1068
+ interface AddQuotaParams {
1069
+ customerId: CustomerID;
1070
+ featureCode: string;
1071
+ count?: number;
1072
+ }
1073
+ interface SetQuotaParams {
1074
+ customerId: CustomerID;
1075
+ featureCode: string;
1076
+ count: number;
1077
+ }
1078
+ interface RemoveQuotaParams {
1079
+ customerId: CustomerID;
1080
+ featureCode: string;
1081
+ count?: number;
1082
+ }
1083
+ interface GetQuotaParams {
1084
+ customerId: CustomerID;
1085
+ featureCode: string;
1086
+ }
1087
+ interface GetAllQuotaParams {
1088
+ customerId: CustomerID;
1089
+ }
1090
+ declare class QuotaResource {
1091
+ private httpClient;
1092
+ constructor(httpClient: CommetHTTPClient);
1093
+ add(params: AddQuotaParams, options?: RequestOptions): Promise<ApiResponse<QuotaEvent>>;
1094
+ set(params: SetQuotaParams, options?: RequestOptions): Promise<ApiResponse<QuotaEvent>>;
1095
+ remove(params: RemoveQuotaParams, options?: RequestOptions): Promise<ApiResponse<QuotaEvent>>;
1096
+ get(params: GetQuotaParams): Promise<ApiResponse<QuotaAllowance>>;
1097
+ getAll(params: GetAllQuotaParams): Promise<ApiResponse<QuotaAllowance[]>>;
1098
+ }
1099
+
1048
1100
  interface SeatEvent {
1049
1101
  id: string;
1050
1102
  object: "seat";
@@ -1106,7 +1158,7 @@ type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" |
1106
1158
  interface FeatureSummary {
1107
1159
  code: string;
1108
1160
  name: string;
1109
- type: "boolean" | "usage" | "seats";
1161
+ type: FeatureType;
1110
1162
  enabled?: boolean;
1111
1163
  usage?: {
1112
1164
  current: number;
@@ -1519,6 +1571,8 @@ interface WebhookPayload {
1519
1571
  event: WebhookEvent;
1520
1572
  timestamp: string;
1521
1573
  organizationId: string;
1574
+ mode: "live" | "sandbox";
1575
+ apiVersion: string;
1522
1576
  data: WebhookData;
1523
1577
  }
1524
1578
  /**
@@ -1530,7 +1584,6 @@ interface WebhookPayload {
1530
1584
  * granting access.
1531
1585
  */
1532
1586
  interface WebhookData {
1533
- id?: string;
1534
1587
  publicId?: string;
1535
1588
  subscriptionId?: string;
1536
1589
  customerId?: string;
@@ -1559,12 +1612,13 @@ interface VerifyAndParseParams {
1559
1612
  }
1560
1613
  interface WebhookEndpoint {
1561
1614
  id: string;
1562
- object: "webhook_endpoint";
1615
+ object: "webhook";
1563
1616
  livemode: boolean;
1564
1617
  url: string;
1565
1618
  events: string[];
1566
1619
  description: string | null;
1567
1620
  isActive: boolean;
1621
+ apiVersion: string | null;
1568
1622
  createdAt: string;
1569
1623
  }
1570
1624
  interface WebhookEndpointCreated extends WebhookEndpoint {
@@ -1572,6 +1626,7 @@ interface WebhookEndpointCreated extends WebhookEndpoint {
1572
1626
  }
1573
1627
  interface WebhookTestResult {
1574
1628
  success: boolean;
1629
+ deliveryId: string;
1575
1630
  deliveredAt: string;
1576
1631
  }
1577
1632
  interface ListWebhooksParams {
@@ -1582,6 +1637,18 @@ interface CreateWebhookParams {
1582
1637
  url: string;
1583
1638
  events: string[];
1584
1639
  description?: string;
1640
+ apiVersion?: string;
1641
+ }
1642
+ interface GetWebhookParams {
1643
+ id: string;
1644
+ }
1645
+ interface UpdateWebhookParams {
1646
+ id: string;
1647
+ url?: string;
1648
+ events?: string[];
1649
+ description?: string | null;
1650
+ isActive?: boolean;
1651
+ apiVersion?: string;
1585
1652
  }
1586
1653
  interface DeleteWebhookParams {
1587
1654
  id: string;
@@ -1598,8 +1665,9 @@ declare class Webhooks {
1598
1665
  /** Verifies signature and parses JSON in one step. Returns null if invalid. */
1599
1666
  verifyAndParse(params: VerifyAndParseParams): WebhookPayload | null;
1600
1667
  list(params?: ListWebhooksParams, options?: RequestOptions): Promise<ApiResponse<WebhookEndpoint[]>>;
1601
- /** Response includes `secretKey` which is only returned once. */
1602
1668
  create(params: CreateWebhookParams, options?: RequestOptions): Promise<ApiResponse<WebhookEndpointCreated>>;
1669
+ get(params: GetWebhookParams, options?: RequestOptions): Promise<ApiResponse<WebhookEndpoint>>;
1670
+ update(params: UpdateWebhookParams, options?: RequestOptions): Promise<ApiResponse<WebhookEndpoint>>;
1603
1671
  delete(params: DeleteWebhookParams, options?: RequestOptions): Promise<ApiResponse<{
1604
1672
  id: string;
1605
1673
  deleted: true;
@@ -1619,6 +1687,7 @@ declare class Commet<_TConfig = unknown> {
1619
1687
  readonly plans: PlansResource;
1620
1688
  readonly portal: PortalResource;
1621
1689
  readonly promoCodes: PromoCodesResource;
1690
+ readonly quota: QuotaResource;
1622
1691
  readonly seats: SeatsResource;
1623
1692
  readonly subscriptions: SubscriptionsResource;
1624
1693
  readonly transactions: TransactionsResource;
@@ -1633,4 +1702,4 @@ declare function registerIntegration(name: string, version: string): void;
1633
1702
  declare const API_VERSION = "2026-05-25";
1634
1703
  declare const SDK_VERSION: string;
1635
1704
 
1636
- export { API_VERSION, type ActivateAddonParams, type ActivateAddonResult, type ActiveAddon, type ActiveSubscription, type AddAiModelPricingFeatureParams, type AddFixedPricingFeatureParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddSeatsParams, type Addon, type AdjustBalanceParams, type AdjustBalanceResult, type AiModelPricingFeatureManage, type ApiErrorDetail, type ApiKey, type ApiKeyCreated, type ApiResponse, type BalanceAddon, type BillingConfig, type BillingInterval, type BooleanAddon, type CanUseFeatureParams, type CanUseResult, type CancelParams, type CancellationSummary, type ChangePlanParams, type ChangePlanResult, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CreateAddonParams, type CreateAdjustmentParams, type CreateAdjustmentResult, type CreateApiKeyParams, type CreateBalanceAddonParams, type CreateBooleanAddonParams, type CreateCreditPackParams, type CreateCreditsAddonParams, type CreateParams as CreateCustomerParams, type CreateFeatureParams, type CreateMeteredAddonParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedSubscription, type CreditPack, type CreditPackDetail, type CreditsAddon, type Currency, type Customer, type CustomerAddress, type CustomerID, type BatchResult as CustomersBatchResult, type DeactivateAddonParams, type DeactivateAddonResult, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteResult, type DeleteWebhookParams, type DiscountSummary, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureSummary, type FeatureType, type FixedPricingFeatureManage, type GetActiveParams, type GetAddonParams, type GetAllBalancesParams, type GetBalanceParams, type GetCustomerParams, type GetDownloadUrlParams, type GetFeatureParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPromoCodeParams, type GetTransactionParams, type GetUrlParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type InvoiceDetail, type InvoiceDownloadResult, type InvoiceLineItem, type InvoiceListItem, type InvoiceSendResult, type InvoiceStatusResult, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeaturesParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type MeteredAddon, type PaginatedList, type PaginatedResponse, type Plan, type PlanDef, type PlanDetail, type PlanFeature, type PlanFeatureManage, type PlanFeatureValue, type PlanGroup, type PlanGroupDetail, type PlanID, type PlanManage, type PlanPrice, type PlanPriceManage, type PortalAccess, type PreviewChangeParams, type PreviewChangeResult, type PriceDef, type PromoCode, type PromoCodeDetail, type PurchaseCreditsParams, type PurchaseCreditsResult, type RefundTransactionParams, type RegionalPriceResult, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveResult, type RemoveSeatsParams, type ReorderPlansParams, type RequestOptions, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatEvent, type SendInvoiceParams, type SetAllSeatsParams, type SetDefaultPriceParams, type SetRegionalPricesParams, type SetSeatsParams, type SetVisibilityParams, type Subscription, type SubscriptionListItem, type SubscriptionStatus, type TestWebhookParams, type TopupBalanceParams, type TopupBalanceResult, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type TransactionDetail, type TransactionListItem, type TransactionRefundResult, type TransactionRetryResult, type UncancelParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateParams as UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
1705
+ export { API_VERSION, type ActivateAddonParams, type ActivateAddonResult, type ActiveAddon, type ActiveSubscription, type AddAiModelPricingFeatureParams, type AddFixedPricingFeatureParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type Addon, type AdjustBalanceParams, type AdjustBalanceResult, type AiModelPricingFeatureManage, type ApiErrorDetail, type ApiKey, type ApiKeyCreated, type ApiResponse, type BalanceAddon, type BillingConfig, type BillingInterval, type BooleanAddon, type CanUseFeatureParams, type CanUseResult, type CancelParams, type CancellationSummary, type ChangePlanParams, type ChangePlanResult, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CreateAddonParams, type CreateAdjustmentParams, type CreateAdjustmentResult, type CreateApiKeyParams, type CreateBalanceAddonParams, type CreateBooleanAddonParams, type CreateCreditPackParams, type CreateCreditsAddonParams, type CreateParams as CreateCustomerParams, type CreateFeatureParams, type CreateMeteredAddonParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedSubscription, type CreditPack, type CreditPackDetail, type CreditsAddon, type Currency, type Customer, type CustomerAddress, type CustomerID, type BatchResult as CustomersBatchResult, type DeactivateAddonParams, type DeactivateAddonResult, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteResult, type DeleteWebhookParams, type DiscountSummary, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureSummary, type FeatureType, type FixedPricingFeatureManage, type GetActiveParams, type GetAddonParams, type GetAllBalancesParams, type GetAllQuotaParams, type GetBalanceParams, type GetCustomerParams, type GetDownloadUrlParams, type GetFeatureParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPromoCodeParams, type GetQuotaParams, type GetTransactionParams, type GetUrlParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type InvoiceDetail, type InvoiceDownloadResult, type InvoiceLineItem, type InvoiceListItem, type InvoiceSendResult, type InvoiceStatusResult, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeaturesParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type MeteredAddon, type PaginatedList, type PaginatedResponse, type Plan, type PlanDef, type PlanDetail, type PlanFeature, type PlanFeatureManage, type PlanFeatureValue, type PlanGroup, type PlanGroupDetail, type PlanID, type PlanManage, type PlanPrice, type PlanPriceManage, type PortalAccess, type PreviewChangeParams, type PreviewChangeResult, type PriceDef, type PromoCode, type PromoCodeDetail, type PurchaseCreditsParams, type PurchaseCreditsResult, type QuotaAllowance, type QuotaEvent, type RefundTransactionParams, type RegionalPriceResult, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveResult, type RemoveSeatsParams, type ReorderPlansParams, type RequestOptions, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatEvent, type SendInvoiceParams, type SetAllSeatsParams, type SetDefaultPriceParams, type SetQuotaParams, type SetRegionalPricesParams, type SetSeatsParams, type SetVisibilityParams, type Subscription, type SubscriptionListItem, type SubscriptionStatus, type TestWebhookParams, type TopupBalanceParams, type TopupBalanceResult, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type TransactionDetail, type TransactionListItem, type TransactionRefundResult, type TransactionRetryResult, type UncancelParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateParams as UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };