@metronome/sdk 3.4.1 → 3.6.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/README.md +2 -2
  3. package/bin/cli +12 -5
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js +11 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +11 -0
  9. package/client.mjs.map +1 -1
  10. package/internal/types.d.mts +6 -6
  11. package/internal/types.d.mts.map +1 -1
  12. package/internal/types.d.ts +6 -6
  13. package/internal/types.d.ts.map +1 -1
  14. package/internal/utils/env.js +2 -2
  15. package/internal/utils/env.js.map +1 -1
  16. package/internal/utils/env.mjs +2 -2
  17. package/internal/utils/env.mjs.map +1 -1
  18. package/internal/utils/log.d.mts.map +1 -1
  19. package/internal/utils/log.d.ts.map +1 -1
  20. package/internal/utils/log.js +2 -0
  21. package/internal/utils/log.js.map +1 -1
  22. package/internal/utils/log.mjs +2 -0
  23. package/internal/utils/log.mjs.map +1 -1
  24. package/package.json +1 -1
  25. package/resources/shared.d.mts +176 -7
  26. package/resources/shared.d.mts.map +1 -1
  27. package/resources/shared.d.ts +176 -7
  28. package/resources/shared.d.ts.map +1 -1
  29. package/resources/v1/alerts.d.mts +1 -1
  30. package/resources/v1/alerts.d.mts.map +1 -1
  31. package/resources/v1/alerts.d.ts +1 -1
  32. package/resources/v1/alerts.d.ts.map +1 -1
  33. package/resources/v1/contracts/contracts.d.mts +240 -166
  34. package/resources/v1/contracts/contracts.d.mts.map +1 -1
  35. package/resources/v1/contracts/contracts.d.ts +240 -166
  36. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  37. package/resources/v1/contracts/contracts.js +54 -2
  38. package/resources/v1/contracts/contracts.js.map +1 -1
  39. package/resources/v1/contracts/contracts.mjs +54 -2
  40. package/resources/v1/contracts/contracts.mjs.map +1 -1
  41. package/resources/v1/contracts/index.d.mts +1 -1
  42. package/resources/v1/contracts/index.d.mts.map +1 -1
  43. package/resources/v1/contracts/index.d.ts +1 -1
  44. package/resources/v1/contracts/index.d.ts.map +1 -1
  45. package/resources/v1/contracts/index.js.map +1 -1
  46. package/resources/v1/contracts/index.mjs.map +1 -1
  47. package/resources/v1/contracts/products.d.mts +18 -0
  48. package/resources/v1/contracts/products.d.mts.map +1 -1
  49. package/resources/v1/contracts/products.d.ts +18 -0
  50. package/resources/v1/contracts/products.d.ts.map +1 -1
  51. package/resources/v1/customers/alerts.d.mts +1 -1
  52. package/resources/v1/customers/alerts.d.mts.map +1 -1
  53. package/resources/v1/customers/alerts.d.ts +1 -1
  54. package/resources/v1/customers/alerts.d.ts.map +1 -1
  55. package/resources/v1/customers/invoices.d.mts +9 -0
  56. package/resources/v1/customers/invoices.d.mts.map +1 -1
  57. package/resources/v1/customers/invoices.d.ts +9 -0
  58. package/resources/v1/customers/invoices.d.ts.map +1 -1
  59. package/resources/v1/index.d.mts +1 -1
  60. package/resources/v1/index.d.mts.map +1 -1
  61. package/resources/v1/index.d.ts +1 -1
  62. package/resources/v1/index.d.ts.map +1 -1
  63. package/resources/v1/index.js.map +1 -1
  64. package/resources/v1/index.mjs.map +1 -1
  65. package/resources/v1/packages.d.mts +10 -10
  66. package/resources/v1/packages.d.mts.map +1 -1
  67. package/resources/v1/packages.d.ts +10 -10
  68. package/resources/v1/packages.d.ts.map +1 -1
  69. package/resources/v1/v1.d.mts +2 -2
  70. package/resources/v1/v1.d.mts.map +1 -1
  71. package/resources/v1/v1.d.ts +2 -2
  72. package/resources/v1/v1.d.ts.map +1 -1
  73. package/resources/v1/v1.js.map +1 -1
  74. package/resources/v1/v1.mjs.map +1 -1
  75. package/resources/v2/contracts.d.mts +163 -13
  76. package/resources/v2/contracts.d.mts.map +1 -1
  77. package/resources/v2/contracts.d.ts +163 -13
  78. package/resources/v2/contracts.d.ts.map +1 -1
  79. package/resources/webhooks.js +1 -1
  80. package/resources/webhooks.js.map +1 -1
  81. package/resources/webhooks.mjs +1 -1
  82. package/resources/webhooks.mjs.map +1 -1
  83. package/src/client.ts +12 -0
  84. package/src/internal/types.ts +6 -8
  85. package/src/internal/utils/env.ts +2 -2
  86. package/src/internal/utils/log.ts +2 -0
  87. package/src/resources/shared.ts +236 -7
  88. package/src/resources/v1/alerts.ts +1 -1
  89. package/src/resources/v1/contracts/contracts.ts +302 -183
  90. package/src/resources/v1/contracts/index.ts +2 -0
  91. package/src/resources/v1/contracts/products.ts +20 -0
  92. package/src/resources/v1/customers/alerts.ts +1 -1
  93. package/src/resources/v1/customers/invoices.ts +12 -0
  94. package/src/resources/v1/index.ts +2 -0
  95. package/src/resources/v1/packages.ts +14 -14
  96. package/src/resources/v1/v1.ts +4 -0
  97. package/src/resources/v2/contracts.ts +209 -15
  98. package/src/resources/webhooks.ts +1 -1
  99. package/src/version.ts +1 -1
  100. package/version.d.mts +1 -1
  101. package/version.d.ts +1 -1
  102. package/version.js +1 -1
  103. package/version.mjs +1 -1
@@ -58,8 +58,8 @@ export class Contracts extends APIResource {
58
58
  /**
59
59
  * Contracts define a customer's products, pricing, discounts, access duration, and
60
60
  * billing configuration. Contracts serve as the central billing agreement for both
61
- * PLG and Enterprise customers, you can automatically customers access to your
62
- * products and services directly from your product or CRM.
61
+ * PLG and Enterprise customers. You can automatically grant customers access to
62
+ * your products and services directly from your product or CRM.
63
63
  *
64
64
  * ### Use this endpoint to:
65
65
  *
@@ -411,6 +411,10 @@ export class Contracts extends APIResource {
411
411
  *
412
412
  * ### Usage guidelines:
413
413
  *
414
+ * - **Balance ledger details**: Use the
415
+ * [listBalances](https://docs.metronome.com/api-reference/credits-and-commits/list-balances)
416
+ * endpoint instead to understand detailed ledger drawdowns for each individual
417
+ * balance
414
418
  * - **Draft invoice handling**: Use `invoice_inclusion_mode` to control whether
415
419
  * pending draft invoice deductions are included (`FINALIZED_AND_DRAFT`, the
416
420
  * default) or excluded (`FINALIZED`) from the balance calculation
@@ -473,6 +477,9 @@ export class Contracts extends APIResource {
473
477
  *
474
478
  * ### Usage guidelines:
475
479
  *
480
+ * - Use the
481
+ * [getNetBalance](https://docs.metronome.com/api-reference/credits-and-commits/get-the-net-balance-of-a-customer)
482
+ * endpoint to retrieve a single combined current balance
476
483
  * - Date filtering: Use `effective_before` to include only balances with access
477
484
  * before a specific date (exclusive)
478
485
  * - Set `include_balance=true` for calculated balance amounts on each commit or
@@ -508,6 +515,55 @@ export class Contracts extends APIResource {
508
515
  );
509
516
  }
510
517
 
518
+ /**
519
+ * Retrieve detailed balance for seat-based credits and commits from the contract's
520
+ * subscriptions, broken down by individual seats.
521
+ *
522
+ * ### Use this endpoint to:
523
+ *
524
+ * - Display per-seat balance information in customer dashboards
525
+ * - Filter balance data by subscription or specific seats
526
+ *
527
+ * ### Key response fields:
528
+ *
529
+ * An array of seat balance objects containing:
530
+ *
531
+ * - Seat id
532
+ * - Balance: current total balance across all commits and credits
533
+ *
534
+ * ### Usage guidelines:
535
+ *
536
+ * - Date filtering: use `covering_date` OR `starting_at`/`ending_before` to filter
537
+ * balance data by time range
538
+ * - Set `include_credits_and_commits=true` for detailed commits and credits
539
+ * breakdown per seat
540
+ * - Set `include_ledgers=true` for detailed transaction history per commit/credit
541
+ * per seat
542
+ *
543
+ * @example
544
+ * ```ts
545
+ * const response = await client.v1.contracts.listSeatBalances(
546
+ * {
547
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
548
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
549
+ * covering_date: '2024-03-01T00:00:00.000Z',
550
+ * include_credits_and_commits: true,
551
+ * include_ledgers: true,
552
+ * limit: 25,
553
+ * subscription_ids: [
554
+ * '8deed800-1b7a-495d-a207-6c52bac54dc9',
555
+ * ],
556
+ * },
557
+ * );
558
+ * ```
559
+ */
560
+ listSeatBalances(
561
+ body: ContractListSeatBalancesParams,
562
+ options?: RequestOptions,
563
+ ): APIPromise<ContractListSeatBalancesResponse> {
564
+ return this._client.post('/v1/contracts/seatBalances/list', { body, ...options });
565
+ }
566
+
511
567
  /**
512
568
  * For a specific customer and contract, get the rates at a specific point in time.
513
569
  * This endpoint takes the contract's rate card into consideration, including
@@ -719,6 +775,178 @@ export namespace ContractGetNetBalanceResponse {
719
775
 
720
776
  export type ContractListBalancesResponse = Shared.Commit | Shared.Credit;
721
777
 
778
+ export interface ContractListSeatBalancesResponse {
779
+ data: Array<ContractListSeatBalancesResponse.Data>;
780
+
781
+ pagination: ContractListSeatBalancesResponse.Pagination;
782
+ }
783
+
784
+ export namespace ContractListSeatBalancesResponse {
785
+ export interface Data {
786
+ balances: Array<Data.Balance>;
787
+
788
+ /**
789
+ * The unique identifier for the seat
790
+ */
791
+ seat_id: string;
792
+
793
+ /**
794
+ * Array of commits applicable to this seat with their balances
795
+ */
796
+ commits?: Array<Data.Commit> | null;
797
+
798
+ /**
799
+ * Array of credits applicable to this seat with their balances
800
+ */
801
+ credits?: Array<Data.Credit>;
802
+ }
803
+
804
+ export namespace Data {
805
+ export interface Balance {
806
+ /**
807
+ * The total balance across all commits and credits for this seat, of this credit
808
+ * type.
809
+ */
810
+ balance: number;
811
+
812
+ credit_type_id: string;
813
+
814
+ /**
815
+ * The total initial balances of all commits and credits for this seat, of this
816
+ * credit type.
817
+ */
818
+ starting_balance: number;
819
+ }
820
+
821
+ export interface Commit {
822
+ /**
823
+ * The commit or credit ID
824
+ */
825
+ id: string;
826
+
827
+ /**
828
+ * The current balance for this commit for this specific seat
829
+ */
830
+ balance: number;
831
+
832
+ /**
833
+ * The datetime when the commit becomes active
834
+ */
835
+ start_date: string;
836
+
837
+ /**
838
+ * The datetime when the commit expires
839
+ */
840
+ end_date?: string | null;
841
+
842
+ /**
843
+ * Transaction history for this commit for this seat (only included if
844
+ * include_ledgers=true)
845
+ */
846
+ ledger_entries?: Array<Commit.LedgerEntry>;
847
+ }
848
+
849
+ export namespace Commit {
850
+ export interface LedgerEntry {
851
+ /**
852
+ * Amount of the ledger entry
853
+ */
854
+ amount: number;
855
+
856
+ /**
857
+ * The datetime when the ledger is created
858
+ */
859
+ timestamp: string;
860
+
861
+ /**
862
+ * Commit ledger type
863
+ */
864
+ type:
865
+ | 'PREPAID_COMMIT_SEGMENT_START'
866
+ | 'PREPAID_COMMIT_AUTOMATED_INVOICE_DEDUCTION'
867
+ | 'PREPAID_COMMIT_ROLLOVER'
868
+ | 'PREPAID_COMMIT_EXPIRATION'
869
+ | 'PREPAID_COMMIT_CANCELED'
870
+ | 'PREPAID_COMMIT_CREDITED'
871
+ | 'PREPAID_COMMIT_MANUAL'
872
+ | 'PREPAID_COMMIT_SEAT_BASED_ADJUSTMENT';
873
+ }
874
+ }
875
+
876
+ export interface Credit {
877
+ /**
878
+ * The credit ID
879
+ */
880
+ id: string;
881
+
882
+ /**
883
+ * The current balance for this credit for this specific seat
884
+ */
885
+ balance: number;
886
+
887
+ /**
888
+ * The datetime when the credit becomes active
889
+ */
890
+ start_date: string;
891
+
892
+ /**
893
+ * The datetime when the credit expires
894
+ */
895
+ end_date?: string | null;
896
+
897
+ /**
898
+ * Transaction history for this credit for this seat (only included if
899
+ * include_ledgers=true)
900
+ */
901
+ ledger_entries?: Array<Credit.LedgerEntry>;
902
+ }
903
+
904
+ export namespace Credit {
905
+ export interface LedgerEntry {
906
+ /**
907
+ * Amount of the ledger entry
908
+ */
909
+ amount: number;
910
+
911
+ /**
912
+ * The datetime when the ledger is created
913
+ */
914
+ timestamp: string;
915
+
916
+ /**
917
+ * Credit ledger type
918
+ */
919
+ type:
920
+ | 'CREDIT_SEGMENT_START'
921
+ | 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'
922
+ | 'CREDIT_EXPIRATION'
923
+ | 'CREDIT_CANCELED'
924
+ | 'CREDIT_CREDITED'
925
+ | 'CREDIT_MANUAL'
926
+ | 'CREDIT_SEAT_BASED_ADJUSTMENT'
927
+ | 'CREDIT_ROLLOVER';
928
+ }
929
+ }
930
+ }
931
+
932
+ export interface Pagination {
933
+ /**
934
+ * Number of seats available to fetch in the next page
935
+ */
936
+ seats_available_for_next_page: number;
937
+
938
+ /**
939
+ * Number of seats included in this response
940
+ */
941
+ seats_included: number;
942
+
943
+ /**
944
+ * Token to retrieve the next page of results. Null if no more pages available
945
+ */
946
+ next_page?: string | null;
947
+ }
948
+ }
949
+
722
950
  export interface ContractRetrieveRateScheduleResponse {
723
951
  data: Array<ContractRetrieveRateScheduleResponse.Data>;
724
952
 
@@ -865,7 +1093,7 @@ export interface ContractCreateParams {
865
1093
  /**
866
1094
  * If provided, provisions a customer on a package instead of creating a
867
1095
  * traditional contract. When specified, only customer_id, starting_at, package_id,
868
- * and uniqueness_key are allowed.
1096
+ * uniqueness_key, transition, and custom_fields are allowed.
869
1097
  */
870
1098
  package_id?: string;
871
1099
 
@@ -1031,11 +1259,6 @@ export namespace ContractCreateParams {
1031
1259
  */
1032
1260
  netsuite_sales_order_id?: string;
1033
1261
 
1034
- /**
1035
- * optionally payment gate this commit
1036
- */
1037
- payment_gate_config?: Commit.PaymentGateConfig;
1038
-
1039
1262
  /**
1040
1263
  * If multiple commits are applicable, the one with the lower priority will apply
1041
1264
  * first.
@@ -1197,83 +1420,6 @@ export namespace ContractCreateParams {
1197
1420
  unit_price?: number;
1198
1421
  }
1199
1422
  }
1200
-
1201
- /**
1202
- * optionally payment gate this commit
1203
- */
1204
- export interface PaymentGateConfig {
1205
- /**
1206
- * Gate access to the commit balance based on successful collection of payment.
1207
- * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
1208
- * facilitate payment using your own payment integration. Select NONE if you do not
1209
- * wish to payment gate the commit balance.
1210
- */
1211
- payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
1212
-
1213
- /**
1214
- * Only applicable if using PRECALCULATED as your tax type.
1215
- */
1216
- precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
1217
-
1218
- /**
1219
- * Only applicable if using STRIPE as your payment gate type.
1220
- */
1221
- stripe_config?: PaymentGateConfig.StripeConfig;
1222
-
1223
- /**
1224
- * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
1225
- * not wish Metronome to calculate tax on your behalf. Leaving this field blank
1226
- * will default to NONE.
1227
- */
1228
- tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
1229
- }
1230
-
1231
- export namespace PaymentGateConfig {
1232
- /**
1233
- * Only applicable if using PRECALCULATED as your tax type.
1234
- */
1235
- export interface PrecalculatedTaxConfig {
1236
- /**
1237
- * Amount of tax to be applied. This should be in the same currency and
1238
- * denomination as the commit's invoice schedule
1239
- */
1240
- tax_amount: number;
1241
-
1242
- /**
1243
- * Name of the tax to be applied. This may be used in an invoice line item
1244
- * description.
1245
- */
1246
- tax_name?: string;
1247
- }
1248
-
1249
- /**
1250
- * Only applicable if using STRIPE as your payment gate type.
1251
- */
1252
- export interface StripeConfig {
1253
- /**
1254
- * If left blank, will default to INVOICE
1255
- */
1256
- payment_type: 'INVOICE' | 'PAYMENT_INTENT';
1257
-
1258
- /**
1259
- * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
1260
- * your payment type.
1261
- */
1262
- invoice_metadata?: { [key: string]: string };
1263
-
1264
- /**
1265
- * If true, the payment will be made assuming the customer is present (i.e. on
1266
- * session).
1267
- *
1268
- * If false, the payment will be made assuming the customer is not present (i.e.
1269
- * off session). For cardholders from a country with an e-mandate requirement (e.g.
1270
- * India), the payment may be declined.
1271
- *
1272
- * If left blank, will default to false.
1273
- */
1274
- on_session_payment?: boolean;
1275
- }
1276
- }
1277
1423
  }
1278
1424
 
1279
1425
  export interface Credit {
@@ -1664,14 +1810,6 @@ export namespace ContractCreateParams {
1664
1810
  * commits created by the specified recurring commit ids.
1665
1811
  */
1666
1812
  recurring_commit_ids?: Array<string>;
1667
-
1668
- /**
1669
- * Can only be used for commit specific overrides. Must be used in conjunction with
1670
- * one of `product_id`, `product_tags`, `pricing_group_values`, or
1671
- * `presentation_group_values`. If provided, the override will only apply to
1672
- * credits created by the specified recurring credit ids.
1673
- */
1674
- recurring_credit_ids?: Array<string>;
1675
1813
  }
1676
1814
 
1677
1815
  /**
@@ -2665,11 +2803,6 @@ export namespace ContractAmendParams {
2665
2803
  */
2666
2804
  netsuite_sales_order_id?: string;
2667
2805
 
2668
- /**
2669
- * optionally payment gate this commit
2670
- */
2671
- payment_gate_config?: Commit.PaymentGateConfig;
2672
-
2673
2806
  /**
2674
2807
  * If multiple commits are applicable, the one with the lower priority will apply
2675
2808
  * first.
@@ -2831,83 +2964,6 @@ export namespace ContractAmendParams {
2831
2964
  unit_price?: number;
2832
2965
  }
2833
2966
  }
2834
-
2835
- /**
2836
- * optionally payment gate this commit
2837
- */
2838
- export interface PaymentGateConfig {
2839
- /**
2840
- * Gate access to the commit balance based on successful collection of payment.
2841
- * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
2842
- * facilitate payment using your own payment integration. Select NONE if you do not
2843
- * wish to payment gate the commit balance.
2844
- */
2845
- payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
2846
-
2847
- /**
2848
- * Only applicable if using PRECALCULATED as your tax type.
2849
- */
2850
- precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
2851
-
2852
- /**
2853
- * Only applicable if using STRIPE as your payment gate type.
2854
- */
2855
- stripe_config?: PaymentGateConfig.StripeConfig;
2856
-
2857
- /**
2858
- * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
2859
- * not wish Metronome to calculate tax on your behalf. Leaving this field blank
2860
- * will default to NONE.
2861
- */
2862
- tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
2863
- }
2864
-
2865
- export namespace PaymentGateConfig {
2866
- /**
2867
- * Only applicable if using PRECALCULATED as your tax type.
2868
- */
2869
- export interface PrecalculatedTaxConfig {
2870
- /**
2871
- * Amount of tax to be applied. This should be in the same currency and
2872
- * denomination as the commit's invoice schedule
2873
- */
2874
- tax_amount: number;
2875
-
2876
- /**
2877
- * Name of the tax to be applied. This may be used in an invoice line item
2878
- * description.
2879
- */
2880
- tax_name?: string;
2881
- }
2882
-
2883
- /**
2884
- * Only applicable if using STRIPE as your payment gate type.
2885
- */
2886
- export interface StripeConfig {
2887
- /**
2888
- * If left blank, will default to INVOICE
2889
- */
2890
- payment_type: 'INVOICE' | 'PAYMENT_INTENT';
2891
-
2892
- /**
2893
- * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
2894
- * your payment type.
2895
- */
2896
- invoice_metadata?: { [key: string]: string };
2897
-
2898
- /**
2899
- * If true, the payment will be made assuming the customer is present (i.e. on
2900
- * session).
2901
- *
2902
- * If false, the payment will be made assuming the customer is not present (i.e.
2903
- * off session). For cardholders from a country with an e-mandate requirement (e.g.
2904
- * India), the payment may be declined.
2905
- *
2906
- * If left blank, will default to false.
2907
- */
2908
- on_session_payment?: boolean;
2909
- }
2910
- }
2911
2967
  }
2912
2968
 
2913
2969
  export interface Credit {
@@ -3250,14 +3306,6 @@ export namespace ContractAmendParams {
3250
3306
  * commits created by the specified recurring commit ids.
3251
3307
  */
3252
3308
  recurring_commit_ids?: Array<string>;
3253
-
3254
- /**
3255
- * Can only be used for commit specific overrides. Must be used in conjunction with
3256
- * one of `product_id`, `product_tags`, `pricing_group_values`, or
3257
- * `presentation_group_values`. If provided, the override will only apply to
3258
- * credits created by the specified recurring credit ids.
3259
- */
3260
- recurring_credit_ids?: Array<string>;
3261
3309
  }
3262
3310
 
3263
3311
  /**
@@ -3667,6 +3715,75 @@ export interface ContractListBalancesParams extends BodyCursorPageParams {
3667
3715
  starting_at?: string;
3668
3716
  }
3669
3717
 
3718
+ export interface ContractListSeatBalancesParams {
3719
+ /**
3720
+ * The contract ID to retrieve seat balances for
3721
+ */
3722
+ contract_id: string;
3723
+
3724
+ /**
3725
+ * The customer ID to retrieve seat balances for
3726
+ */
3727
+ customer_id: string;
3728
+
3729
+ /**
3730
+ * Include only commits or credits with access that cover this specific date
3731
+ * (cannot be used with starting_at or ending_before).
3732
+ */
3733
+ covering_date?: string;
3734
+
3735
+ /**
3736
+ * Page token from a previous response to retrieve the next page
3737
+ */
3738
+ cursor?: string;
3739
+
3740
+ /**
3741
+ * Include only commits or credits with access effective on or before this date
3742
+ * (cannot be used with covering_date).
3743
+ */
3744
+ effective_before?: string;
3745
+
3746
+ /**
3747
+ * Include credits and commits in the response
3748
+ */
3749
+ include_credits_and_commits?: boolean;
3750
+
3751
+ /**
3752
+ * Include ledger entries for each commit and commit. `include_credits_and_commits`
3753
+ * must be set to `true` for `include_ledgers=true` to apply.
3754
+ */
3755
+ include_ledgers?: boolean;
3756
+
3757
+ /**
3758
+ * Maximum number of seats to return. Range: 1-100. Default: 25. When
3759
+ * `include_credits_and_commits = true`, if the total commits/credits across all
3760
+ * seats exceeds 100, a limit of 100 applies to the total credits and commits.
3761
+ * Seats are included greedily to maximize the number of seats returned. Example:
3762
+ * if seat 1 has 98 commits and seat 2 has 10 commits, both seats will be returned
3763
+ * (total: 108 commits). Each returned seat includes all of its associated credits
3764
+ * and commits.
3765
+ */
3766
+ limit?: number;
3767
+
3768
+ /**
3769
+ * Optional filter to only include specific seats.
3770
+ */
3771
+ seat_ids?: Array<string>;
3772
+
3773
+ /**
3774
+ * Include only commits or credits with access effective on or after this date
3775
+ * (cannot be used with covering_date).
3776
+ */
3777
+ starting_at?: string;
3778
+
3779
+ /**
3780
+ * Optional filter to only include seats from specific subscriptions. If
3781
+ * subscriptions ids are not mapped to SEAT_BASED subscriptions, error will be
3782
+ * returned.
3783
+ */
3784
+ subscription_ids?: Array<string>;
3785
+ }
3786
+
3670
3787
  export interface ContractRetrieveRateScheduleParams {
3671
3788
  /**
3672
3789
  * Body param: ID of the contract to get the rate schedule for.
@@ -3867,6 +3984,7 @@ export declare namespace Contracts {
3867
3984
  type ContractCreateHistoricalInvoicesResponse as ContractCreateHistoricalInvoicesResponse,
3868
3985
  type ContractGetNetBalanceResponse as ContractGetNetBalanceResponse,
3869
3986
  type ContractListBalancesResponse as ContractListBalancesResponse,
3987
+ type ContractListSeatBalancesResponse as ContractListSeatBalancesResponse,
3870
3988
  type ContractRetrieveRateScheduleResponse as ContractRetrieveRateScheduleResponse,
3871
3989
  type ContractRetrieveSubscriptionQuantityHistoryResponse as ContractRetrieveSubscriptionQuantityHistoryResponse,
3872
3990
  type ContractScheduleProServicesInvoiceResponse as ContractScheduleProServicesInvoiceResponse,
@@ -3881,6 +3999,7 @@ export declare namespace Contracts {
3881
3999
  type ContractCreateHistoricalInvoicesParams as ContractCreateHistoricalInvoicesParams,
3882
4000
  type ContractGetNetBalanceParams as ContractGetNetBalanceParams,
3883
4001
  type ContractListBalancesParams as ContractListBalancesParams,
4002
+ type ContractListSeatBalancesParams as ContractListSeatBalancesParams,
3884
4003
  type ContractRetrieveRateScheduleParams as ContractRetrieveRateScheduleParams,
3885
4004
  type ContractRetrieveSubscriptionQuantityHistoryParams as ContractRetrieveSubscriptionQuantityHistoryParams,
3886
4005
  type ContractScheduleProServicesInvoiceParams as ContractScheduleProServicesInvoiceParams,
@@ -10,6 +10,7 @@ export {
10
10
  type ContractCreateHistoricalInvoicesResponse,
11
11
  type ContractGetNetBalanceResponse,
12
12
  type ContractListBalancesResponse,
13
+ type ContractListSeatBalancesResponse,
13
14
  type ContractRetrieveRateScheduleResponse,
14
15
  type ContractRetrieveSubscriptionQuantityHistoryResponse,
15
16
  type ContractScheduleProServicesInvoiceResponse,
@@ -23,6 +24,7 @@ export {
23
24
  type ContractCreateHistoricalInvoicesParams,
24
25
  type ContractGetNetBalanceParams,
25
26
  type ContractListBalancesParams,
27
+ type ContractListSeatBalancesParams,
26
28
  type ContractRetrieveRateScheduleParams,
27
29
  type ContractRetrieveSubscriptionQuantityHistoryParams,
28
30
  type ContractScheduleProServicesInvoiceParams,
@@ -503,6 +503,16 @@ export interface ProductCreateParams {
503
503
  */
504
504
  quantity_rounding?: QuantityRounding | null;
505
505
 
506
+ /**
507
+ * Defines the breakdown behavior when calculating usage from SQL Billable Metrics.
508
+ * If set to 'service_period' (default), the usage will be evaluated once for all
509
+ * events the invoice service period and the usage will be applied at the last
510
+ * instant of the invoice. If set to 'hour', it will be broken down and evaluated
511
+ * for each hour. For most use cases, 'hour' is recommended. The setting has no
512
+ * effect for Streaming Billable Metrics.
513
+ */
514
+ sql_breakdown_granularity?: 'HOUR' | 'SERVICE_PERIOD';
515
+
506
516
  tags?: Array<string>;
507
517
  }
508
518
 
@@ -604,6 +614,16 @@ export interface ProductUpdateParams {
604
614
  */
605
615
  quantity_rounding?: QuantityRounding | null;
606
616
 
617
+ /**
618
+ * Defines the breakdown behavior when calculating usage from SQL Billable Metrics.
619
+ * If set to 'service_period' (default), the usage will be evaluated once for all
620
+ * events the invoice service period and the usage will be applied at the last
621
+ * instant of the invoice. If set to 'hour', it will be broken down and evaluated
622
+ * for each hour. For most use cases, 'hour' is recommended. The setting has no
623
+ * effect for Streaming Billable Metrics.
624
+ */
625
+ sql_breakdown_granularity?: 'HOUR' | 'SERVICE_PERIOD';
626
+
607
627
  /**
608
628
  * If not provided, defaults to product's current tags
609
629
  */
@@ -302,7 +302,7 @@ export namespace CustomerAlert {
302
302
 
303
303
  export namespace Alert {
304
304
  export interface CustomFieldFilter {
305
- entity: 'Contract' | 'Commit' | 'ContractCredit';
305
+ entity: 'Contract' | 'Commit' | 'ContractCredit' | 'ContractCreditOrCommit';
306
306
 
307
307
  key: string;
308
308
 
@@ -365,6 +365,8 @@ export interface Invoice {
365
365
 
366
366
  plan_name?: string;
367
367
 
368
+ regenerated_from_invoice_id?: string;
369
+
368
370
  /**
369
371
  * Only present for contract invoices with reseller royalties.
370
372
  */
@@ -1007,6 +1009,11 @@ export interface InvoiceListParams extends CursorPageParams {
1007
1009
  */
1008
1010
  customer_id: string;
1009
1011
 
1012
+ /**
1013
+ * Query param: Only return invoices for the specified contract
1014
+ */
1015
+ contract_id?: string;
1016
+
1010
1017
  /**
1011
1018
  * Query param: Only return invoices for the specified credit type
1012
1019
  */
@@ -1040,6 +1047,11 @@ export interface InvoiceListParams extends CursorPageParams {
1040
1047
  * Query param: Invoice status, e.g. DRAFT, FINALIZED, or VOID
1041
1048
  */
1042
1049
  status?: string;
1050
+
1051
+ /**
1052
+ * Query param: Filter invoices by type. Defaults to returning all invoice types.
1053
+ */
1054
+ type?: 'USAGE' | 'USAGE_CONSOLIDATED' | 'SCHEDULED';
1043
1055
  }
1044
1056
 
1045
1057
  export interface InvoiceAddChargeParams {
@@ -35,6 +35,7 @@ export {
35
35
  type ContractCreateHistoricalInvoicesResponse,
36
36
  type ContractGetNetBalanceResponse,
37
37
  type ContractListBalancesResponse,
38
+ type ContractListSeatBalancesResponse,
38
39
  type ContractRetrieveRateScheduleResponse,
39
40
  type ContractRetrieveSubscriptionQuantityHistoryResponse,
40
41
  type ContractScheduleProServicesInvoiceResponse,
@@ -48,6 +49,7 @@ export {
48
49
  type ContractCreateHistoricalInvoicesParams,
49
50
  type ContractGetNetBalanceParams,
50
51
  type ContractListBalancesParams,
52
+ type ContractListSeatBalancesParams,
51
53
  type ContractRetrieveRateScheduleParams,
52
54
  type ContractRetrieveSubscriptionQuantityHistoryParams,
53
55
  type ContractScheduleProServicesInvoiceParams,