@metronome/sdk 3.5.0 → 3.7.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 (307) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/bin/cli +12 -5
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts.map +1 -1
  11. package/client.js +11 -0
  12. package/client.js.map +1 -1
  13. package/client.mjs +11 -0
  14. package/client.mjs.map +1 -1
  15. package/core/api-promise.d.mts.map +1 -1
  16. package/core/api-promise.d.ts.map +1 -1
  17. package/core/api-promise.mjs.map +1 -1
  18. package/core/error.mjs.map +1 -1
  19. package/core/pagination.d.mts.map +1 -1
  20. package/core/pagination.d.ts.map +1 -1
  21. package/core/pagination.mjs.map +1 -1
  22. package/core/resource.d.mts.map +1 -1
  23. package/core/resource.d.ts.map +1 -1
  24. package/core/uploads.d.mts.map +1 -1
  25. package/core/uploads.d.ts.map +1 -1
  26. package/core/uploads.mjs.map +1 -1
  27. package/error.d.mts +1 -0
  28. package/error.d.mts.map +1 -1
  29. package/error.d.ts +1 -0
  30. package/error.d.ts.map +1 -1
  31. package/error.mjs +1 -0
  32. package/error.mjs.map +1 -1
  33. package/index.d.mts.map +1 -1
  34. package/index.d.ts.map +1 -1
  35. package/index.mjs.map +1 -1
  36. package/internal/detect-platform.mjs.map +1 -1
  37. package/internal/headers.mjs.map +1 -1
  38. package/internal/parse.d.mts.map +1 -1
  39. package/internal/parse.d.ts.map +1 -1
  40. package/internal/parse.mjs.map +1 -1
  41. package/internal/qs/formats.d.mts.map +1 -1
  42. package/internal/qs/formats.d.ts.map +1 -1
  43. package/internal/qs/index.d.mts +2 -2
  44. package/internal/qs/index.d.mts.map +1 -1
  45. package/internal/qs/index.d.ts +2 -2
  46. package/internal/qs/index.d.ts.map +1 -1
  47. package/internal/qs/index.mjs.map +1 -1
  48. package/internal/qs/stringify.d.mts.map +1 -1
  49. package/internal/qs/stringify.d.ts.map +1 -1
  50. package/internal/qs/stringify.mjs.map +1 -1
  51. package/internal/qs/utils.d.mts.map +1 -1
  52. package/internal/qs/utils.d.ts.map +1 -1
  53. package/internal/qs/utils.mjs.map +1 -1
  54. package/internal/request-options.d.mts.map +1 -1
  55. package/internal/request-options.d.ts.map +1 -1
  56. package/internal/shims.d.mts +6 -0
  57. package/internal/shims.d.mts.map +1 -1
  58. package/internal/shims.d.ts +6 -0
  59. package/internal/shims.d.ts.map +1 -1
  60. package/internal/to-file.d.mts.map +1 -1
  61. package/internal/to-file.d.ts.map +1 -1
  62. package/internal/to-file.mjs.map +1 -1
  63. package/internal/types.d.mts +10 -10
  64. package/internal/types.d.mts.map +1 -1
  65. package/internal/types.d.ts +10 -10
  66. package/internal/types.d.ts.map +1 -1
  67. package/internal/uploads.d.mts.map +1 -1
  68. package/internal/uploads.d.ts.map +1 -1
  69. package/internal/uploads.mjs.map +1 -1
  70. package/internal/utils/base64.mjs.map +1 -1
  71. package/internal/utils/log.d.mts.map +1 -1
  72. package/internal/utils/log.d.ts.map +1 -1
  73. package/internal/utils/log.js +2 -0
  74. package/internal/utils/log.js.map +1 -1
  75. package/internal/utils/log.mjs +2 -0
  76. package/internal/utils/log.mjs.map +1 -1
  77. package/internal/utils/path.mjs.map +1 -1
  78. package/internal/utils/query.mjs.map +1 -1
  79. package/internal/utils/values.mjs.map +1 -1
  80. package/internal/utils.d.mts.map +1 -1
  81. package/internal/utils.d.ts.map +1 -1
  82. package/internal/utils.mjs.map +1 -1
  83. package/package.json +1 -1
  84. package/pagination.d.mts +1 -0
  85. package/pagination.d.mts.map +1 -1
  86. package/pagination.d.ts +1 -0
  87. package/pagination.d.ts.map +1 -1
  88. package/pagination.mjs +1 -0
  89. package/pagination.mjs.map +1 -1
  90. package/resource.d.mts +1 -0
  91. package/resource.d.mts.map +1 -1
  92. package/resource.d.ts +1 -0
  93. package/resource.d.ts.map +1 -1
  94. package/resource.mjs +1 -0
  95. package/resource.mjs.map +1 -1
  96. package/resources/index.d.mts.map +1 -1
  97. package/resources/index.d.ts.map +1 -1
  98. package/resources/index.mjs.map +1 -1
  99. package/resources/shared.d.mts +321 -1
  100. package/resources/shared.d.mts.map +1 -1
  101. package/resources/shared.d.ts +321 -1
  102. package/resources/shared.d.ts.map +1 -1
  103. package/resources/v1/alerts.d.mts +1 -1
  104. package/resources/v1/alerts.d.mts.map +1 -1
  105. package/resources/v1/alerts.d.ts +1 -1
  106. package/resources/v1/alerts.d.ts.map +1 -1
  107. package/resources/v1/alerts.mjs.map +1 -1
  108. package/resources/v1/audit-logs.d.mts.map +1 -1
  109. package/resources/v1/audit-logs.d.ts.map +1 -1
  110. package/resources/v1/audit-logs.mjs.map +1 -1
  111. package/resources/v1/billable-metrics.d.mts.map +1 -1
  112. package/resources/v1/billable-metrics.d.ts.map +1 -1
  113. package/resources/v1/billable-metrics.mjs.map +1 -1
  114. package/resources/v1/contracts/contracts.d.mts +629 -143
  115. package/resources/v1/contracts/contracts.d.mts.map +1 -1
  116. package/resources/v1/contracts/contracts.d.ts +629 -143
  117. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  118. package/resources/v1/contracts/contracts.js +47 -2
  119. package/resources/v1/contracts/contracts.js.map +1 -1
  120. package/resources/v1/contracts/contracts.mjs +47 -2
  121. package/resources/v1/contracts/contracts.mjs.map +1 -1
  122. package/resources/v1/contracts/index.d.mts +1 -1
  123. package/resources/v1/contracts/index.d.mts.map +1 -1
  124. package/resources/v1/contracts/index.d.ts +1 -1
  125. package/resources/v1/contracts/index.d.ts.map +1 -1
  126. package/resources/v1/contracts/index.js.map +1 -1
  127. package/resources/v1/contracts/index.mjs.map +1 -1
  128. package/resources/v1/contracts/named-schedules.d.mts.map +1 -1
  129. package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
  130. package/resources/v1/contracts/named-schedules.mjs.map +1 -1
  131. package/resources/v1/contracts/products.d.mts +18 -0
  132. package/resources/v1/contracts/products.d.mts.map +1 -1
  133. package/resources/v1/contracts/products.d.ts +18 -0
  134. package/resources/v1/contracts/products.d.ts.map +1 -1
  135. package/resources/v1/contracts/products.mjs.map +1 -1
  136. package/resources/v1/contracts/rate-cards/index.d.mts.map +1 -1
  137. package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
  138. package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
  139. package/resources/v1/contracts/rate-cards/named-schedules.d.mts.map +1 -1
  140. package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
  141. package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
  142. package/resources/v1/contracts/rate-cards/product-orders.d.mts.map +1 -1
  143. package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
  144. package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
  145. package/resources/v1/contracts/rate-cards/rate-cards.d.mts.map +1 -1
  146. package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
  147. package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
  148. package/resources/v1/contracts/rate-cards/rates.d.mts.map +1 -1
  149. package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
  150. package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
  151. package/resources/v1/contracts/rate-cards.d.mts.map +1 -1
  152. package/resources/v1/contracts/rate-cards.d.ts.map +1 -1
  153. package/resources/v1/contracts/rate-cards.mjs.map +1 -1
  154. package/resources/v1/contracts.d.mts.map +1 -1
  155. package/resources/v1/contracts.d.ts.map +1 -1
  156. package/resources/v1/contracts.mjs.map +1 -1
  157. package/resources/v1/credit-grants.d.mts.map +1 -1
  158. package/resources/v1/credit-grants.d.ts.map +1 -1
  159. package/resources/v1/credit-grants.mjs.map +1 -1
  160. package/resources/v1/custom-fields.d.mts.map +1 -1
  161. package/resources/v1/custom-fields.d.ts.map +1 -1
  162. package/resources/v1/custom-fields.mjs.map +1 -1
  163. package/resources/v1/customers/alerts.d.mts +1 -1
  164. package/resources/v1/customers/alerts.d.mts.map +1 -1
  165. package/resources/v1/customers/alerts.d.ts +1 -1
  166. package/resources/v1/customers/alerts.d.ts.map +1 -1
  167. package/resources/v1/customers/alerts.mjs.map +1 -1
  168. package/resources/v1/customers/billing-config.d.mts.map +1 -1
  169. package/resources/v1/customers/billing-config.d.ts.map +1 -1
  170. package/resources/v1/customers/billing-config.mjs.map +1 -1
  171. package/resources/v1/customers/commits.d.mts.map +1 -1
  172. package/resources/v1/customers/commits.d.ts.map +1 -1
  173. package/resources/v1/customers/commits.mjs.map +1 -1
  174. package/resources/v1/customers/credits.d.mts.map +1 -1
  175. package/resources/v1/customers/credits.d.ts.map +1 -1
  176. package/resources/v1/customers/credits.mjs.map +1 -1
  177. package/resources/v1/customers/customers.d.mts.map +1 -1
  178. package/resources/v1/customers/customers.d.ts.map +1 -1
  179. package/resources/v1/customers/customers.mjs.map +1 -1
  180. package/resources/v1/customers/index.d.mts.map +1 -1
  181. package/resources/v1/customers/index.d.ts.map +1 -1
  182. package/resources/v1/customers/index.mjs.map +1 -1
  183. package/resources/v1/customers/invoices.d.mts +9 -0
  184. package/resources/v1/customers/invoices.d.mts.map +1 -1
  185. package/resources/v1/customers/invoices.d.ts +9 -0
  186. package/resources/v1/customers/invoices.d.ts.map +1 -1
  187. package/resources/v1/customers/invoices.mjs.map +1 -1
  188. package/resources/v1/customers/named-schedules.d.mts.map +1 -1
  189. package/resources/v1/customers/named-schedules.d.ts.map +1 -1
  190. package/resources/v1/customers/named-schedules.mjs.map +1 -1
  191. package/resources/v1/customers/plans.d.mts.map +1 -1
  192. package/resources/v1/customers/plans.d.ts.map +1 -1
  193. package/resources/v1/customers/plans.mjs.map +1 -1
  194. package/resources/v1/customers.d.mts.map +1 -1
  195. package/resources/v1/customers.d.ts.map +1 -1
  196. package/resources/v1/customers.mjs.map +1 -1
  197. package/resources/v1/dashboards.d.mts.map +1 -1
  198. package/resources/v1/dashboards.d.ts.map +1 -1
  199. package/resources/v1/dashboards.mjs.map +1 -1
  200. package/resources/v1/index.d.mts +1 -2
  201. package/resources/v1/index.d.mts.map +1 -1
  202. package/resources/v1/index.d.ts +1 -2
  203. package/resources/v1/index.d.ts.map +1 -1
  204. package/resources/v1/index.js +1 -3
  205. package/resources/v1/index.js.map +1 -1
  206. package/resources/v1/index.mjs +0 -1
  207. package/resources/v1/index.mjs.map +1 -1
  208. package/resources/v1/invoices.d.mts.map +1 -1
  209. package/resources/v1/invoices.d.ts.map +1 -1
  210. package/resources/v1/invoices.mjs.map +1 -1
  211. package/resources/v1/packages.d.mts +57 -5
  212. package/resources/v1/packages.d.mts.map +1 -1
  213. package/resources/v1/packages.d.ts +57 -5
  214. package/resources/v1/packages.d.ts.map +1 -1
  215. package/resources/v1/packages.js +3 -4
  216. package/resources/v1/packages.js.map +1 -1
  217. package/resources/v1/packages.mjs +3 -4
  218. package/resources/v1/packages.mjs.map +1 -1
  219. package/resources/v1/plans.d.mts.map +1 -1
  220. package/resources/v1/plans.d.ts.map +1 -1
  221. package/resources/v1/plans.mjs.map +1 -1
  222. package/resources/v1/pricing-units.d.mts.map +1 -1
  223. package/resources/v1/pricing-units.d.ts.map +1 -1
  224. package/resources/v1/pricing-units.mjs.map +1 -1
  225. package/resources/v1/services.d.mts.map +1 -1
  226. package/resources/v1/services.d.ts.map +1 -1
  227. package/resources/v1/services.mjs.map +1 -1
  228. package/resources/v1/settings/billing-providers.d.mts.map +1 -1
  229. package/resources/v1/settings/billing-providers.d.ts.map +1 -1
  230. package/resources/v1/settings/billing-providers.mjs.map +1 -1
  231. package/resources/v1/settings/index.d.mts.map +1 -1
  232. package/resources/v1/settings/index.d.ts.map +1 -1
  233. package/resources/v1/settings/index.mjs.map +1 -1
  234. package/resources/v1/settings/settings.d.mts.map +1 -1
  235. package/resources/v1/settings/settings.d.ts.map +1 -1
  236. package/resources/v1/settings/settings.mjs.map +1 -1
  237. package/resources/v1/settings.d.mts.map +1 -1
  238. package/resources/v1/settings.d.ts.map +1 -1
  239. package/resources/v1/settings.mjs.map +1 -1
  240. package/resources/v1/usage.d.mts.map +1 -1
  241. package/resources/v1/usage.d.ts.map +1 -1
  242. package/resources/v1/usage.mjs.map +1 -1
  243. package/resources/v1/v1.d.mts +2 -6
  244. package/resources/v1/v1.d.mts.map +1 -1
  245. package/resources/v1/v1.d.ts +2 -6
  246. package/resources/v1/v1.d.ts.map +1 -1
  247. package/resources/v1/v1.js +0 -4
  248. package/resources/v1/v1.js.map +1 -1
  249. package/resources/v1/v1.mjs +0 -4
  250. package/resources/v1/v1.mjs.map +1 -1
  251. package/resources/v1.d.mts.map +1 -1
  252. package/resources/v1.d.ts.map +1 -1
  253. package/resources/v1.mjs.map +1 -1
  254. package/resources/v2/contracts.d.mts +1431 -2
  255. package/resources/v2/contracts.d.mts.map +1 -1
  256. package/resources/v2/contracts.d.ts +1431 -2
  257. package/resources/v2/contracts.d.ts.map +1 -1
  258. package/resources/v2/contracts.mjs.map +1 -1
  259. package/resources/v2/index.d.mts.map +1 -1
  260. package/resources/v2/index.d.ts.map +1 -1
  261. package/resources/v2/index.mjs.map +1 -1
  262. package/resources/v2/v2.d.mts.map +1 -1
  263. package/resources/v2/v2.d.ts.map +1 -1
  264. package/resources/v2/v2.mjs.map +1 -1
  265. package/resources/v2.d.mts.map +1 -1
  266. package/resources/v2.d.ts.map +1 -1
  267. package/resources/v2.mjs.map +1 -1
  268. package/resources/webhooks.d.mts.map +1 -1
  269. package/resources/webhooks.d.ts.map +1 -1
  270. package/resources/webhooks.mjs.map +1 -1
  271. package/resources.d.mts.map +1 -1
  272. package/resources.d.ts.map +1 -1
  273. package/resources.mjs.map +1 -1
  274. package/src/client.ts +12 -0
  275. package/src/internal/types.ts +6 -8
  276. package/src/internal/utils/log.ts +2 -0
  277. package/src/resources/shared.ts +417 -1
  278. package/src/resources/v1/alerts.ts +1 -1
  279. package/src/resources/v1/contracts/contracts.ts +813 -156
  280. package/src/resources/v1/contracts/index.ts +2 -0
  281. package/src/resources/v1/contracts/products.ts +20 -0
  282. package/src/resources/v1/customers/alerts.ts +1 -1
  283. package/src/resources/v1/customers/invoices.ts +12 -0
  284. package/src/resources/v1/index.ts +2 -11
  285. package/src/resources/v1/packages.ts +81 -6
  286. package/src/resources/v1/v1.ts +4 -26
  287. package/src/resources/v2/contracts.ts +1881 -2
  288. package/src/version.ts +1 -1
  289. package/uploads.d.mts +1 -0
  290. package/uploads.d.mts.map +1 -1
  291. package/uploads.d.ts +1 -0
  292. package/uploads.d.ts.map +1 -1
  293. package/uploads.mjs +1 -0
  294. package/uploads.mjs.map +1 -1
  295. package/version.d.mts +1 -1
  296. package/version.d.ts +1 -1
  297. package/version.js +1 -1
  298. package/version.mjs +1 -1
  299. package/resources/v1/payments.d.mts +0 -127
  300. package/resources/v1/payments.d.mts.map +0 -1
  301. package/resources/v1/payments.d.ts +0 -127
  302. package/resources/v1/payments.d.ts.map +0 -1
  303. package/resources/v1/payments.js +0 -71
  304. package/resources/v1/payments.js.map +0 -1
  305. package/resources/v1/payments.mjs +0 -67
  306. package/resources/v1/payments.mjs.map +0 -1
  307. package/src/resources/v1/payments.ts +0 -187
@@ -183,6 +183,11 @@ export interface Commit {
183
183
  */
184
184
  specifiers?: Array<CommitSpecifier>;
185
185
 
186
+ /**
187
+ * Optional attributes controlling how this commit interacts with spend trackers.
188
+ */
189
+ spend_tracker_attributes?: Commit.SpendTrackerAttributes;
190
+
186
191
  /**
187
192
  * The subscription configuration for this commit, if it was generated from a
188
193
  * recurring commit with a subscription attached.
@@ -380,6 +385,17 @@ export namespace Commit {
380
385
  contract_id: string;
381
386
  }
382
387
 
388
+ /**
389
+ * Optional attributes controlling how this commit interacts with spend trackers.
390
+ */
391
+ export interface SpendTrackerAttributes {
392
+ /**
393
+ * If true, this commit is included in spend trackers with discounted set to
394
+ * DISCOUNTED_ONLY
395
+ */
396
+ counts_as_discounted: boolean;
397
+ }
398
+
383
399
  /**
384
400
  * The subscription configuration for this commit, if it was generated from a
385
401
  * recurring commit with a subscription attached.
@@ -532,6 +548,11 @@ export interface Contract {
532
548
 
533
549
  spend_threshold_configuration?: SpendThresholdConfiguration;
534
550
 
551
+ /**
552
+ * Spend trackers attached to this contract.
553
+ */
554
+ spend_trackers?: Array<Contract.SpendTracker>;
555
+
535
556
  /**
536
557
  * List of subscriptions on the contract.
537
558
  */
@@ -642,6 +663,39 @@ export namespace Contract {
642
663
  */
643
664
  configuration?: { [key: string]: unknown };
644
665
  }
666
+
667
+ export interface SpendTracker {
668
+ /**
669
+ * Human-readable identifier, unique per contract.
670
+ */
671
+ alias: string;
672
+
673
+ applicable_spend_specifiers: Array<SpendTracker.ApplicableSpendSpecifier>;
674
+
675
+ credit_type_id: string;
676
+
677
+ reset_frequency: 'BILLING_PERIOD';
678
+
679
+ accumulated_spend?: SpendTracker.AccumulatedSpend;
680
+ }
681
+
682
+ export namespace SpendTracker {
683
+ export interface ApplicableSpendSpecifier {
684
+ sources: Array<'THRESHOLD_RECHARGE' | 'MANUAL'>;
685
+
686
+ spend_type: 'COMMIT_PURCHASE';
687
+
688
+ discounted?: 'ANY' | 'DISCOUNTED_ONLY' | 'UNDISCOUNTED_ONLY';
689
+ }
690
+
691
+ export interface AccumulatedSpend {
692
+ amount: number;
693
+
694
+ period_ending_before: string;
695
+
696
+ period_starting_at: string;
697
+ }
698
+ }
645
699
  }
646
700
 
647
701
  export interface ContractV2 {
@@ -758,10 +812,15 @@ export interface ContractV2 {
758
812
 
759
813
  spend_threshold_configuration?: SpendThresholdConfigurationV2;
760
814
 
815
+ /**
816
+ * Spend trackers attached to this contract.
817
+ */
818
+ spend_trackers?: Array<ContractV2.SpendTracker>;
819
+
761
820
  /**
762
821
  * List of subscriptions on the contract.
763
822
  */
764
- subscriptions?: Array<Subscription>;
823
+ subscriptions?: Array<ContractV2.Subscription>;
765
824
 
766
825
  total_contract_value?: number;
767
826
 
@@ -895,6 +954,11 @@ export namespace ContractV2 {
895
954
  */
896
955
  specifiers?: Array<Shared.CommitSpecifier>;
897
956
 
957
+ /**
958
+ * Optional attributes controlling how this commit interacts with spend trackers.
959
+ */
960
+ spend_tracker_attributes?: Commit.SpendTrackerAttributes;
961
+
898
962
  /**
899
963
  * Attach a subscription to the recurring commit/credit.
900
964
  */
@@ -1082,6 +1146,17 @@ export namespace ContractV2 {
1082
1146
 
1083
1147
  contract_id: string;
1084
1148
  }
1149
+
1150
+ /**
1151
+ * Optional attributes controlling how this commit interacts with spend trackers.
1152
+ */
1153
+ export interface SpendTrackerAttributes {
1154
+ /**
1155
+ * If true, this commit is included in spend trackers with discounted set to
1156
+ * DISCOUNTED_ONLY
1157
+ */
1158
+ counts_as_discounted: boolean;
1159
+ }
1085
1160
  }
1086
1161
 
1087
1162
  export interface Override {
@@ -1227,6 +1302,8 @@ export namespace ContractV2 {
1227
1302
 
1228
1303
  applicable_product_tags?: Array<string>;
1229
1304
 
1305
+ archived_at?: string;
1306
+
1230
1307
  /**
1231
1308
  * The current balance of the credit or commit. This balance reflects the amount of
1232
1309
  * credit or commit that the customer has access to use at this moment - thus,
@@ -1855,6 +1932,163 @@ export namespace ContractV2 {
1855
1932
  reseller_contract_value?: number;
1856
1933
  }
1857
1934
  }
1935
+
1936
+ export interface SpendTracker {
1937
+ /**
1938
+ * Human-readable identifier, unique per contract.
1939
+ */
1940
+ alias: string;
1941
+
1942
+ applicable_spend_specifiers: Array<SpendTracker.ApplicableSpendSpecifier>;
1943
+
1944
+ credit_type_id: string;
1945
+
1946
+ reset_frequency: 'BILLING_PERIOD';
1947
+
1948
+ accumulated_spend?: SpendTracker.AccumulatedSpend;
1949
+ }
1950
+
1951
+ export namespace SpendTracker {
1952
+ export interface ApplicableSpendSpecifier {
1953
+ sources: Array<'THRESHOLD_RECHARGE' | 'MANUAL'>;
1954
+
1955
+ spend_type: 'COMMIT_PURCHASE';
1956
+
1957
+ discounted?: 'ANY' | 'DISCOUNTED_ONLY' | 'UNDISCOUNTED_ONLY';
1958
+ }
1959
+
1960
+ export interface AccumulatedSpend {
1961
+ amount: number;
1962
+
1963
+ period_ending_before: string;
1964
+
1965
+ period_starting_at: string;
1966
+ }
1967
+ }
1968
+
1969
+ export interface Subscription {
1970
+ /**
1971
+ * Previous, current, and next billing periods for the subscription.
1972
+ */
1973
+ billing_periods: Subscription.BillingPeriods;
1974
+
1975
+ collection_schedule: 'ADVANCE' | 'ARREARS';
1976
+
1977
+ proration: Subscription.Proration;
1978
+
1979
+ /**
1980
+ * Determines how the subscription's quantity is controlled. Defaults to
1981
+ * QUANTITY_ONLY. **QUANTITY_ONLY**: The subscription quantity is specified
1982
+ * directly on the subscription. `initial_quantity` must be provided with this
1983
+ * option. Compatible with recurring commits/credits that use POOLED allocation.
1984
+ * **SEAT_BASED**: Use when you want to pass specific seat identifiers (e.g. add
1985
+ * user_123) to increment and decrement a subscription quantity, rather than
1986
+ * directly providing the quantity. You must use a **SEAT_BASED** subscription to
1987
+ * use a linked recurring credit with an allocation per seat. `seat_config` must be
1988
+ * provided with this option.
1989
+ */
1990
+ quantity_management_mode: 'SEAT_BASED' | 'QUANTITY_ONLY';
1991
+
1992
+ /**
1993
+ * List of quantity schedule items for the subscription. Only includes the current
1994
+ * quantity and future quantity changes.
1995
+ */
1996
+ quantity_schedule: Array<Subscription.QuantitySchedule>;
1997
+
1998
+ starting_at: string;
1999
+
2000
+ subscription_rate: Subscription.SubscriptionRate;
2001
+
2002
+ id?: string;
2003
+
2004
+ /**
2005
+ * Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
2006
+ */
2007
+ custom_fields?: { [key: string]: string };
2008
+
2009
+ description?: string;
2010
+
2011
+ ending_before?: string;
2012
+
2013
+ fiat_credit_type_id?: string;
2014
+
2015
+ name?: string;
2016
+
2017
+ seat_config?: Subscription.SeatConfig;
2018
+ }
2019
+
2020
+ export namespace Subscription {
2021
+ /**
2022
+ * Previous, current, and next billing periods for the subscription.
2023
+ */
2024
+ export interface BillingPeriods {
2025
+ current?: BillingPeriods.Current;
2026
+
2027
+ next?: BillingPeriods.Next;
2028
+
2029
+ previous?: BillingPeriods.Previous;
2030
+ }
2031
+
2032
+ export namespace BillingPeriods {
2033
+ export interface Current {
2034
+ ending_before: string;
2035
+
2036
+ starting_at: string;
2037
+ }
2038
+
2039
+ export interface Next {
2040
+ ending_before: string;
2041
+
2042
+ starting_at: string;
2043
+ }
2044
+
2045
+ export interface Previous {
2046
+ ending_before: string;
2047
+
2048
+ starting_at: string;
2049
+ }
2050
+ }
2051
+
2052
+ export interface Proration {
2053
+ invoice_behavior: 'BILL_IMMEDIATELY' | 'BILL_ON_NEXT_COLLECTION_DATE';
2054
+
2055
+ is_prorated: boolean;
2056
+ }
2057
+
2058
+ export interface QuantitySchedule {
2059
+ quantity: number;
2060
+
2061
+ starting_at: string;
2062
+
2063
+ ending_before?: string;
2064
+ }
2065
+
2066
+ export interface SubscriptionRate {
2067
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
2068
+
2069
+ product: SubscriptionRate.Product;
2070
+ }
2071
+
2072
+ export namespace SubscriptionRate {
2073
+ export interface Product {
2074
+ id: string;
2075
+
2076
+ name: string;
2077
+ }
2078
+ }
2079
+
2080
+ export interface SeatConfig {
2081
+ /**
2082
+ * The property name, sent on usage events, that identifies the seat ID associated
2083
+ * with the usage event. For example, the property name might be seat_id or
2084
+ * user_id. The property must be set as a group key on billable metrics and a
2085
+ * presentation/pricing group key on contract products. This allows linked
2086
+ * recurring credits with an allocation per seat to be consumed by only one seat's
2087
+ * usage.
2088
+ */
2089
+ seat_group_key: string;
2090
+ }
2091
+ }
1858
2092
  }
1859
2093
 
1860
2094
  export interface ContractWithoutAmendments {
@@ -1932,6 +2166,11 @@ export interface ContractWithoutAmendments {
1932
2166
 
1933
2167
  spend_threshold_configuration?: SpendThresholdConfiguration;
1934
2168
 
2169
+ /**
2170
+ * Spend trackers attached to this contract.
2171
+ */
2172
+ spend_trackers?: Array<ContractWithoutAmendments.SpendTracker>;
2173
+
1935
2174
  /**
1936
2175
  * This field's availability is dependent on your client's configuration.
1937
2176
  */
@@ -2270,6 +2509,39 @@ export namespace ContractWithoutAmendments {
2270
2509
  reseller_contract_value?: number;
2271
2510
  }
2272
2511
 
2512
+ export interface SpendTracker {
2513
+ /**
2514
+ * Human-readable identifier, unique per contract.
2515
+ */
2516
+ alias: string;
2517
+
2518
+ applicable_spend_specifiers: Array<SpendTracker.ApplicableSpendSpecifier>;
2519
+
2520
+ credit_type_id: string;
2521
+
2522
+ reset_frequency: 'BILLING_PERIOD';
2523
+
2524
+ accumulated_spend?: SpendTracker.AccumulatedSpend;
2525
+ }
2526
+
2527
+ export namespace SpendTracker {
2528
+ export interface ApplicableSpendSpecifier {
2529
+ sources: Array<'THRESHOLD_RECHARGE' | 'MANUAL'>;
2530
+
2531
+ spend_type: 'COMMIT_PURCHASE';
2532
+
2533
+ discounted?: 'ANY' | 'DISCOUNTED_ONLY' | 'UNDISCOUNTED_ONLY';
2534
+ }
2535
+
2536
+ export interface AccumulatedSpend {
2537
+ amount: number;
2538
+
2539
+ period_ending_before: string;
2540
+
2541
+ period_starting_at: string;
2542
+ }
2543
+ }
2544
+
2273
2545
  export interface UsageFilter {
2274
2546
  current: Shared.BaseUsageFilter | null;
2275
2547
 
@@ -2949,6 +3221,8 @@ export interface PrepaidBalanceThresholdConfiguration {
2949
3221
  custom_credit_type_id?: string;
2950
3222
 
2951
3223
  discount_configuration?: PrepaidBalanceThresholdConfiguration.DiscountConfiguration;
3224
+
3225
+ threshold_balance_specifiers?: Array<PrepaidBalanceThresholdConfiguration.ThresholdBalanceSpecifier>;
2952
3226
  }
2953
3227
 
2954
3228
  export namespace PrepaidBalanceThresholdConfiguration {
@@ -2983,6 +3257,54 @@ export namespace PrepaidBalanceThresholdConfiguration {
2983
3257
  * (a 15% discount).
2984
3258
  */
2985
3259
  payment_fraction: number;
3260
+
3261
+ /**
3262
+ * If provided, the discount stops applying once the spend tracker has accumulated
3263
+ * this much spend in the billing period.
3264
+ */
3265
+ cap?: DiscountConfiguration.Cap;
3266
+ }
3267
+
3268
+ export namespace DiscountConfiguration {
3269
+ /**
3270
+ * If provided, the discount stops applying once the spend tracker has accumulated
3271
+ * this much spend in the billing period.
3272
+ */
3273
+ export interface Cap {
3274
+ /**
3275
+ * Accumulated spend ceiling above which the discount stops applying.
3276
+ */
3277
+ amount: number;
3278
+
3279
+ /**
3280
+ * Alias of the spend tracker this cap is measured against.
3281
+ */
3282
+ spend_tracker_alias: string;
3283
+ }
3284
+ }
3285
+
3286
+ export interface ThresholdBalanceSpecifier {
3287
+ exclude: Array<ThresholdBalanceSpecifier.Exclude>;
3288
+ }
3289
+
3290
+ export namespace ThresholdBalanceSpecifier {
3291
+ export interface Exclude {
3292
+ /**
3293
+ * If provided, balances with all the custom fields will not be considered when
3294
+ * evaluating threshold billing
3295
+ */
3296
+ custom_field_filters: Array<Exclude.CustomFieldFilter>;
3297
+ }
3298
+
3299
+ export namespace Exclude {
3300
+ export interface CustomFieldFilter {
3301
+ entity: 'Commit' | 'ContractCredit' | 'ContractCreditOrCommit';
3302
+
3303
+ key: string;
3304
+
3305
+ value: string;
3306
+ }
3307
+ }
2986
3308
  }
2987
3309
  }
2988
3310
 
@@ -3016,6 +3338,8 @@ export interface PrepaidBalanceThresholdConfigurationV2 {
3016
3338
  custom_credit_type_id?: string;
3017
3339
 
3018
3340
  discount_configuration?: PrepaidBalanceThresholdConfigurationV2.DiscountConfiguration;
3341
+
3342
+ threshold_balance_specifiers?: Array<PrepaidBalanceThresholdConfigurationV2.ThresholdBalanceSpecifier>;
3019
3343
  }
3020
3344
 
3021
3345
  export namespace PrepaidBalanceThresholdConfigurationV2 {
@@ -3052,6 +3376,50 @@ export namespace PrepaidBalanceThresholdConfigurationV2 {
3052
3376
  * (a 15% discount).
3053
3377
  */
3054
3378
  payment_fraction: number;
3379
+
3380
+ /**
3381
+ * If provided, the discount stops applying once the spend tracker has accumulated
3382
+ * this much spend in the billing period.
3383
+ */
3384
+ cap?: DiscountConfiguration.Cap;
3385
+ }
3386
+
3387
+ export namespace DiscountConfiguration {
3388
+ /**
3389
+ * If provided, the discount stops applying once the spend tracker has accumulated
3390
+ * this much spend in the billing period.
3391
+ */
3392
+ export interface Cap {
3393
+ /**
3394
+ * Accumulated spend ceiling above which the discount stops applying.
3395
+ */
3396
+ amount: number;
3397
+
3398
+ /**
3399
+ * Alias of the spend tracker this cap is measured against.
3400
+ */
3401
+ spend_tracker_alias: string;
3402
+ }
3403
+ }
3404
+
3405
+ export interface ThresholdBalanceSpecifier {
3406
+ exclude: Array<ThresholdBalanceSpecifier.Exclude>;
3407
+ }
3408
+
3409
+ export namespace ThresholdBalanceSpecifier {
3410
+ export interface Exclude {
3411
+ custom_field_filters: Array<Exclude.CustomFieldFilter>;
3412
+ }
3413
+
3414
+ export namespace Exclude {
3415
+ export interface CustomFieldFilter {
3416
+ entity: 'Commit' | 'ContractCredit' | 'ContractCreditOrCommit';
3417
+
3418
+ key: string;
3419
+
3420
+ value: string;
3421
+ }
3422
+ }
3055
3423
  }
3056
3424
  }
3057
3425
 
@@ -3286,6 +3654,30 @@ export namespace SpendThresholdConfiguration {
3286
3654
  * (a 15% discount).
3287
3655
  */
3288
3656
  payment_fraction: number;
3657
+
3658
+ /**
3659
+ * If provided, the discount stops applying once the spend tracker has accumulated
3660
+ * this much spend in the billing period.
3661
+ */
3662
+ cap?: DiscountConfiguration.Cap;
3663
+ }
3664
+
3665
+ export namespace DiscountConfiguration {
3666
+ /**
3667
+ * If provided, the discount stops applying once the spend tracker has accumulated
3668
+ * this much spend in the billing period.
3669
+ */
3670
+ export interface Cap {
3671
+ /**
3672
+ * Accumulated spend ceiling above which the discount stops applying.
3673
+ */
3674
+ amount: number;
3675
+
3676
+ /**
3677
+ * Alias of the spend tracker this cap is measured against.
3678
+ */
3679
+ spend_tracker_alias: string;
3680
+ }
3289
3681
  }
3290
3682
  }
3291
3683
 
@@ -3318,6 +3710,30 @@ export namespace SpendThresholdConfigurationV2 {
3318
3710
  * (a 15% discount).
3319
3711
  */
3320
3712
  payment_fraction: number;
3713
+
3714
+ /**
3715
+ * If provided, the discount stops applying once the spend tracker has accumulated
3716
+ * this much spend in the billing period.
3717
+ */
3718
+ cap?: DiscountConfiguration.Cap;
3719
+ }
3720
+
3721
+ export namespace DiscountConfiguration {
3722
+ /**
3723
+ * If provided, the discount stops applying once the spend tracker has accumulated
3724
+ * this much spend in the billing period.
3725
+ */
3726
+ export interface Cap {
3727
+ /**
3728
+ * Accumulated spend ceiling above which the discount stops applying.
3729
+ */
3730
+ amount: number;
3731
+
3732
+ /**
3733
+ * Alias of the spend tracker this cap is measured against.
3734
+ */
3735
+ spend_tracker_alias: string;
3736
+ }
3321
3737
  }
3322
3738
  }
3323
3739
 
@@ -229,7 +229,7 @@ export interface AlertCreateParams {
229
229
 
230
230
  export namespace AlertCreateParams {
231
231
  export interface CustomFieldFilter {
232
- entity: 'Contract' | 'Commit' | 'ContractCredit';
232
+ entity: 'Contract' | 'Commit' | 'ContractCredit' | 'ContractCreditOrCommit';
233
233
 
234
234
  key: string;
235
235