@metronome/sdk 2.0.0 → 2.1.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 (153) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/package.json +1 -1
  3. package/resources/shared.d.mts +46 -20
  4. package/resources/shared.d.mts.map +1 -1
  5. package/resources/shared.d.ts +46 -20
  6. package/resources/shared.d.ts.map +1 -1
  7. package/resources/v1/contracts/contracts.d.mts +37 -12
  8. package/resources/v1/contracts/contracts.d.mts.map +1 -1
  9. package/resources/v1/contracts/contracts.d.ts +37 -12
  10. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  11. package/resources/v1/contracts/contracts.js +1 -1
  12. package/resources/v1/contracts/contracts.js.map +1 -1
  13. package/resources/v1/contracts/contracts.mjs +1 -1
  14. package/resources/v1/contracts/contracts.mjs.map +1 -1
  15. package/resources/v1/credit-grants.d.mts +10 -5
  16. package/resources/v1/credit-grants.d.mts.map +1 -1
  17. package/resources/v1/credit-grants.d.ts +10 -5
  18. package/resources/v1/credit-grants.d.ts.map +1 -1
  19. package/resources/v1/credit-grants.js +10 -5
  20. package/resources/v1/credit-grants.js.map +1 -1
  21. package/resources/v1/credit-grants.mjs +10 -5
  22. package/resources/v1/credit-grants.mjs.map +1 -1
  23. package/resources/v1/customers/alerts.d.mts +1 -1
  24. package/resources/v1/customers/alerts.d.mts.map +1 -1
  25. package/resources/v1/customers/alerts.d.ts +1 -1
  26. package/resources/v1/customers/alerts.d.ts.map +1 -1
  27. package/resources/v1/customers/billing-config.d.mts +15 -7
  28. package/resources/v1/customers/billing-config.d.mts.map +1 -1
  29. package/resources/v1/customers/billing-config.d.ts +15 -7
  30. package/resources/v1/customers/billing-config.d.ts.map +1 -1
  31. package/resources/v1/customers/billing-config.js +6 -3
  32. package/resources/v1/customers/billing-config.js.map +1 -1
  33. package/resources/v1/customers/billing-config.mjs +6 -3
  34. package/resources/v1/customers/billing-config.mjs.map +1 -1
  35. package/resources/v1/customers/commits.d.mts +3 -2
  36. package/resources/v1/customers/commits.d.mts.map +1 -1
  37. package/resources/v1/customers/commits.d.ts +3 -2
  38. package/resources/v1/customers/commits.d.ts.map +1 -1
  39. package/resources/v1/customers/commits.js +2 -1
  40. package/resources/v1/customers/commits.js.map +1 -1
  41. package/resources/v1/customers/commits.mjs +2 -1
  42. package/resources/v1/customers/commits.mjs.map +1 -1
  43. package/resources/v1/customers/customers.d.mts +19 -11
  44. package/resources/v1/customers/customers.d.mts.map +1 -1
  45. package/resources/v1/customers/customers.d.ts +19 -11
  46. package/resources/v1/customers/customers.d.ts.map +1 -1
  47. package/resources/v1/customers/customers.js +5 -2
  48. package/resources/v1/customers/customers.js.map +1 -1
  49. package/resources/v1/customers/customers.mjs +5 -2
  50. package/resources/v1/customers/customers.mjs.map +1 -1
  51. package/resources/v1/customers/invoices.d.mts +52 -3
  52. package/resources/v1/customers/invoices.d.mts.map +1 -1
  53. package/resources/v1/customers/invoices.d.ts +52 -3
  54. package/resources/v1/customers/invoices.d.ts.map +1 -1
  55. package/resources/v1/customers/invoices.js +2 -1
  56. package/resources/v1/customers/invoices.js.map +1 -1
  57. package/resources/v1/customers/invoices.mjs +2 -1
  58. package/resources/v1/customers/invoices.mjs.map +1 -1
  59. package/resources/v1/customers/plans.d.mts +8 -4
  60. package/resources/v1/customers/plans.d.mts.map +1 -1
  61. package/resources/v1/customers/plans.d.ts +8 -4
  62. package/resources/v1/customers/plans.d.ts.map +1 -1
  63. package/resources/v1/customers/plans.js +8 -4
  64. package/resources/v1/customers/plans.js.map +1 -1
  65. package/resources/v1/customers/plans.mjs +8 -4
  66. package/resources/v1/customers/plans.mjs.map +1 -1
  67. package/resources/v1/index.d.mts +1 -0
  68. package/resources/v1/index.d.mts.map +1 -1
  69. package/resources/v1/index.d.ts +1 -0
  70. package/resources/v1/index.d.ts.map +1 -1
  71. package/resources/v1/index.js +3 -1
  72. package/resources/v1/index.js.map +1 -1
  73. package/resources/v1/index.mjs +1 -0
  74. package/resources/v1/index.mjs.map +1 -1
  75. package/resources/v1/payments.d.mts +1 -0
  76. package/resources/v1/payments.d.mts.map +1 -1
  77. package/resources/v1/payments.d.ts +1 -0
  78. package/resources/v1/payments.d.ts.map +1 -1
  79. package/resources/v1/plans.d.mts +8 -4
  80. package/resources/v1/plans.d.mts.map +1 -1
  81. package/resources/v1/plans.d.ts +8 -4
  82. package/resources/v1/plans.d.ts.map +1 -1
  83. package/resources/v1/plans.js +8 -4
  84. package/resources/v1/plans.js.map +1 -1
  85. package/resources/v1/plans.mjs +8 -4
  86. package/resources/v1/plans.mjs.map +1 -1
  87. package/resources/v1/settings/billing-providers.d.mts +103 -0
  88. package/resources/v1/settings/billing-providers.d.mts.map +1 -0
  89. package/resources/v1/settings/billing-providers.d.ts +103 -0
  90. package/resources/v1/settings/billing-providers.d.ts.map +1 -0
  91. package/resources/v1/settings/billing-providers.js +48 -0
  92. package/resources/v1/settings/billing-providers.js.map +1 -0
  93. package/resources/v1/settings/billing-providers.mjs +44 -0
  94. package/resources/v1/settings/billing-providers.mjs.map +1 -0
  95. package/resources/v1/settings/index.d.mts +3 -0
  96. package/resources/v1/settings/index.d.mts.map +1 -0
  97. package/resources/v1/settings/index.d.ts +3 -0
  98. package/resources/v1/settings/index.d.ts.map +1 -0
  99. package/resources/v1/settings/index.js +9 -0
  100. package/resources/v1/settings/index.js.map +1 -0
  101. package/resources/v1/settings/index.mjs +4 -0
  102. package/resources/v1/settings/index.mjs.map +1 -0
  103. package/resources/v1/settings/settings.d.mts +54 -0
  104. package/resources/v1/settings/settings.d.mts.map +1 -0
  105. package/resources/v1/settings/settings.d.ts +54 -0
  106. package/resources/v1/settings/settings.d.ts.map +1 -0
  107. package/resources/v1/settings/settings.js +39 -0
  108. package/resources/v1/settings/settings.js.map +1 -0
  109. package/resources/v1/settings/settings.mjs +34 -0
  110. package/resources/v1/settings/settings.mjs.map +1 -0
  111. package/resources/v1/settings.d.mts +2 -0
  112. package/resources/v1/settings.d.mts.map +1 -0
  113. package/resources/v1/settings.d.ts +2 -0
  114. package/resources/v1/settings.d.ts.map +1 -0
  115. package/resources/v1/settings.js +6 -0
  116. package/resources/v1/settings.js.map +1 -0
  117. package/resources/v1/settings.mjs +3 -0
  118. package/resources/v1/settings.mjs.map +1 -0
  119. package/resources/v1/v1.d.mts +4 -0
  120. package/resources/v1/v1.d.mts.map +1 -1
  121. package/resources/v1/v1.d.ts +4 -0
  122. package/resources/v1/v1.d.ts.map +1 -1
  123. package/resources/v1/v1.js +4 -0
  124. package/resources/v1/v1.js.map +1 -1
  125. package/resources/v1/v1.mjs +4 -0
  126. package/resources/v1/v1.mjs.map +1 -1
  127. package/resources/v2/contracts.d.mts +12 -3
  128. package/resources/v2/contracts.d.mts.map +1 -1
  129. package/resources/v2/contracts.d.ts +12 -3
  130. package/resources/v2/contracts.d.ts.map +1 -1
  131. package/src/resources/shared.ts +48 -20
  132. package/src/resources/v1/contracts/contracts.ts +38 -12
  133. package/src/resources/v1/credit-grants.ts +10 -5
  134. package/src/resources/v1/customers/alerts.ts +1 -0
  135. package/src/resources/v1/customers/billing-config.ts +18 -7
  136. package/src/resources/v1/customers/commits.ts +3 -2
  137. package/src/resources/v1/customers/customers.ts +22 -11
  138. package/src/resources/v1/customers/invoices.ts +68 -3
  139. package/src/resources/v1/customers/plans.ts +8 -4
  140. package/src/resources/v1/index.ts +5 -0
  141. package/src/resources/v1/payments.ts +2 -0
  142. package/src/resources/v1/plans.ts +8 -4
  143. package/src/resources/v1/settings/billing-providers.ts +139 -0
  144. package/src/resources/v1/settings/index.ts +14 -0
  145. package/src/resources/v1/settings/settings.ts +87 -0
  146. package/src/resources/v1/settings.ts +3 -0
  147. package/src/resources/v1/v1.ts +14 -0
  148. package/src/resources/v2/contracts.ts +13 -3
  149. package/src/version.ts +1 -1
  150. package/version.d.mts +1 -1
  151. package/version.d.ts +1 -1
  152. package/version.js +1 -1
  153. package/version.mjs +1 -1
@@ -248,7 +248,8 @@ export class Customers extends APIResource {
248
248
  /**
249
249
  * Fetch daily pending costs for the specified customer, broken down by credit type
250
250
  * and line items. Note: this is not supported for customers whose plan includes a
251
- * UNIQUE-type billable metric.
251
+ * UNIQUE-type billable metric. This is a Plans (deprecated) endpoint. New clients
252
+ * should implement using Contracts.
252
253
  *
253
254
  * @example
254
255
  * ```ts
@@ -280,7 +281,8 @@ export class Customers extends APIResource {
280
281
  * Preview how a set of events will affect a customer's invoices. Generates draft
281
282
  * invoices for a customer using their current contract configuration and the
282
283
  * provided events. This is useful for testing how new events will affect the
283
- * customer's invoices before they are actually processed.
284
+ * customer's invoices before they are actually processed. Customers on contracts
285
+ * with SQL billable metrics are not supported.
284
286
  *
285
287
  * @example
286
288
  * ```ts
@@ -293,6 +295,7 @@ export class Customers extends APIResource {
293
295
  * properties: { cpu_hours: 100, memory_gb_hours: 200 },
294
296
  * },
295
297
  * ],
298
+ * mode: 'replace',
296
299
  * });
297
300
  * ```
298
301
  */
@@ -728,7 +731,8 @@ export namespace CustomerRetrieveBillingConfigurationsResponse {
728
731
  | 'azure_marketplace'
729
732
  | 'quickbooks_online'
730
733
  | 'workday'
731
- | 'gcp_marketplace';
734
+ | 'gcp_marketplace'
735
+ | 'metronome';
732
736
 
733
737
  /**
734
738
  * Configuration for the billing provider. The structure of this object is specific
@@ -799,7 +803,8 @@ export namespace CustomerCreateParams {
799
803
  | 'azure_marketplace'
800
804
  | 'quickbooks_online'
801
805
  | 'workday'
802
- | 'gcp_marketplace';
806
+ | 'gcp_marketplace'
807
+ | 'metronome';
803
808
 
804
809
  /**
805
810
  * True if the aws_product_code is a SAAS subscription product, false otherwise.
@@ -835,6 +840,10 @@ export namespace CustomerCreateParams {
835
840
  | 'us-west-1'
836
841
  | 'us-west-2';
837
842
 
843
+ /**
844
+ * The collection method for the customer's invoices. NOTE:
845
+ * `auto_charge_payment_intent` and `manually_charge_payment_intent` are in beta.
846
+ */
838
847
  stripe_collection_method?:
839
848
  | 'charge_automatically'
840
849
  | 'send_invoice'
@@ -952,20 +961,21 @@ export interface CustomerPreviewEventsParams {
952
961
  customer_id: string;
953
962
 
954
963
  /**
955
- * Body param:
964
+ * Body param: Array of usage events to include in the preview calculation. Must
965
+ * contain at least one event in `merge` mode.
956
966
  */
957
967
  events: Array<CustomerPreviewEventsParams.Event>;
958
968
 
959
969
  /**
960
- * Body param: If set to "replace", the preview will be generated as if those were
961
- * the only events for the specified customer. If set to "merge", the events will
962
- * be merged with any existing events for the specified customer. Defaults to
963
- * "replace".
970
+ * Body param: Controls how the provided events are combined with existing usage
971
+ * data. Use `replace` to calculate the preview as if these are the only events for
972
+ * the customer, ignoring all historical usage. Use `merge` to combine these events
973
+ * with the customer's existing usage. Defaults to `replace`.
964
974
  */
965
975
  mode?: 'replace' | 'merge';
966
976
 
967
977
  /**
968
- * Body param: If set, all zero quantity line items will be filtered out of the
978
+ * Body param: When `true`, line items with zero quantity are excluded from the
969
979
  * response.
970
980
  */
971
981
  skip_zero_qty_line_items?: boolean;
@@ -1014,7 +1024,8 @@ export namespace CustomerSetBillingConfigurationsParams {
1014
1024
  | 'azure_marketplace'
1015
1025
  | 'quickbooks_online'
1016
1026
  | 'workday'
1017
- | 'gcp_marketplace';
1027
+ | 'gcp_marketplace'
1028
+ | 'metronome';
1018
1029
 
1019
1030
  customer_id: string;
1020
1031
 
@@ -133,7 +133,8 @@ export class Invoices extends APIResource {
133
133
  }
134
134
 
135
135
  /**
136
- * Add a one time charge to the specified invoice
136
+ * Add a one time charge to the specified invoice. This is a Plans (deprecated)
137
+ * endpoint. New clients should implement using Contracts.
137
138
  *
138
139
  * @example
139
140
  * ```ts
@@ -297,6 +298,12 @@ export interface Invoice {
297
298
  */
298
299
  billable_status?: unknown;
299
300
 
301
+ /**
302
+ * Account hierarchy M3 - Required on invoices with type USAGE_CONSOLIDATED. List
303
+ * of constituent invoices that were consolidated to create this invoice.
304
+ */
305
+ constituent_invoices?: Array<Invoice.ConstituentInvoice>;
306
+
300
307
  /**
301
308
  * Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
302
309
  */
@@ -340,6 +347,12 @@ export interface Invoice {
340
347
  */
341
348
  netsuite_sales_order_id?: string;
342
349
 
350
+ /**
351
+ * Account hierarchy M3 - Required for account hierarchy usage invoices. An object
352
+ * containing the contract and customer UUIDs that pay for this invoice.
353
+ */
354
+ payer?: Invoice.Payer;
355
+
343
356
  /**
344
357
  * Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
345
358
  */
@@ -484,6 +497,13 @@ export namespace Invoice {
484
497
 
485
498
  netsuite_item_id?: string;
486
499
 
500
+ /**
501
+ * Account hierarchy M3 - Present on line items from invoices with type
502
+ * USAGE_CONSOLIDATED. Indicates the original customer, contract, invoice and line
503
+ * item from which this line item was copied.
504
+ */
505
+ origin?: LineItem.Origin;
506
+
487
507
  /**
488
508
  * Only present for line items paying for a postpaid commit true-up.
489
509
  */
@@ -584,6 +604,21 @@ export namespace Invoice {
584
604
  type: 'PREPAID' | 'POSTPAID' | 'CREDIT';
585
605
  }
586
606
 
607
+ /**
608
+ * Account hierarchy M3 - Present on line items from invoices with type
609
+ * USAGE_CONSOLIDATED. Indicates the original customer, contract, invoice and line
610
+ * item from which this line item was copied.
611
+ */
612
+ export interface Origin {
613
+ contract_id: string;
614
+
615
+ customer_id: string;
616
+
617
+ invoice_id: string;
618
+
619
+ line_item_id: string;
620
+ }
621
+
587
622
  /**
588
623
  * Only present for line items paying for a postpaid commit true-up.
589
624
  */
@@ -667,6 +702,14 @@ export namespace Invoice {
667
702
  }
668
703
  }
669
704
 
705
+ export interface ConstituentInvoice {
706
+ contract_id: string;
707
+
708
+ customer_id: string;
709
+
710
+ invoice_id: string;
711
+ }
712
+
670
713
  export interface CorrectionRecord {
671
714
  corrected_invoice_id: string;
672
715
 
@@ -687,7 +730,13 @@ export namespace Invoice {
687
730
  | 'azure_marketplace'
688
731
  | 'quickbooks_online'
689
732
  | 'workday'
690
- | 'gcp_marketplace';
733
+ | 'gcp_marketplace'
734
+ | 'metronome';
735
+
736
+ /**
737
+ * Error message from the billing provider, if available.
738
+ */
739
+ billing_provider_error?: string;
691
740
 
692
741
  external_status?:
693
742
  | 'DRAFT'
@@ -759,7 +808,13 @@ export namespace Invoice {
759
808
  | 'azure_marketplace'
760
809
  | 'quickbooks_online'
761
810
  | 'workday'
762
- | 'gcp_marketplace';
811
+ | 'gcp_marketplace'
812
+ | 'metronome';
813
+
814
+ /**
815
+ * Error message from the billing provider, if available.
816
+ */
817
+ billing_provider_error?: string;
763
818
 
764
819
  external_status?:
765
820
  | 'DRAFT'
@@ -836,6 +891,16 @@ export namespace Invoice {
836
891
  credit_grant_id?: string;
837
892
  }
838
893
 
894
+ /**
895
+ * Account hierarchy M3 - Required for account hierarchy usage invoices. An object
896
+ * containing the contract and customer UUIDs that pay for this invoice.
897
+ */
898
+ export interface Payer {
899
+ contract_id: string;
900
+
901
+ customer_id: string;
902
+ }
903
+
839
904
  /**
840
905
  * Only present for contract invoices with reseller royalties.
841
906
  */
@@ -9,7 +9,8 @@ import { path } from '../../../internal/utils/path';
9
9
 
10
10
  export class Plans extends APIResource {
11
11
  /**
12
- * List the given customer's plans in reverse-chronological order.
12
+ * List the given customer's plans in reverse-chronological order. This is a Plans
13
+ * (deprecated) endpoint. New clients should implement using Contracts.
13
14
  *
14
15
  * @example
15
16
  * ```ts
@@ -35,7 +36,8 @@ export class Plans extends APIResource {
35
36
  /**
36
37
  * Associate an existing customer with a plan for a specified date range. See the
37
38
  * [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
38
- * for details on the price adjustments.
39
+ * for details on the price adjustments. This is a Plans (deprecated) endpoint. New
40
+ * clients should implement using Contracts.
39
41
  *
40
42
  * @example
41
43
  * ```ts
@@ -53,7 +55,8 @@ export class Plans extends APIResource {
53
55
  }
54
56
 
55
57
  /**
56
- * Change the end date of a customer's plan.
58
+ * Change the end date of a customer's plan. This is a Plans (deprecated) endpoint.
59
+ * New clients should implement using Contracts.
57
60
  *
58
61
  * @example
59
62
  * ```ts
@@ -75,7 +78,8 @@ export class Plans extends APIResource {
75
78
  /**
76
79
  * Lists a customer plans adjustments. See the
77
80
  * [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
78
- * for details.
81
+ * for details. This is a Plans (deprecated) endpoint. New clients should implement
82
+ * using Contracts.
79
83
  *
80
84
  * @example
81
85
  * ```ts
@@ -154,6 +154,11 @@ export {
154
154
  type PricingUnitListResponsesCursorPage,
155
155
  } from './pricing-units';
156
156
  export { Services, type ServiceListResponse } from './services';
157
+ export {
158
+ Settings,
159
+ type SettingUpsertAvalaraCredentialsResponse,
160
+ type SettingUpsertAvalaraCredentialsParams,
161
+ } from './settings/index';
157
162
  export {
158
163
  Usage,
159
164
  type UsageListResponse,
@@ -112,6 +112,8 @@ export namespace Payment {
112
112
  payment_intent_id: string;
113
113
 
114
114
  error?: Stripe.Error;
115
+
116
+ payment_method_id?: string;
115
117
  }
116
118
 
117
119
  export namespace Stripe {
@@ -10,7 +10,8 @@ import { path } from '../../internal/utils/path';
10
10
 
11
11
  export class Plans extends APIResource {
12
12
  /**
13
- * List all available plans.
13
+ * List all available plans. This is a Plans (deprecated) endpoint. New clients
14
+ * should implement using Contracts.
14
15
  *
15
16
  * @example
16
17
  * ```ts
@@ -28,7 +29,8 @@ export class Plans extends APIResource {
28
29
  }
29
30
 
30
31
  /**
31
- * Fetch high level details of a specific plan.
32
+ * Fetch high level details of a specific plan. This is a Plans (deprecated)
33
+ * endpoint. New clients should implement using Contracts.
32
34
  *
33
35
  * @example
34
36
  * ```ts
@@ -43,7 +45,8 @@ export class Plans extends APIResource {
43
45
  }
44
46
 
45
47
  /**
46
- * Fetches a list of charges of a specific plan.
48
+ * Fetches a list of charges of a specific plan. This is a Plans (deprecated)
49
+ * endpoint. New clients should implement using Contracts.
47
50
  *
48
51
  * @example
49
52
  * ```ts
@@ -69,7 +72,8 @@ export class Plans extends APIResource {
69
72
 
70
73
  /**
71
74
  * Fetches a list of customers on a specific plan (by default, only currently
72
- * active plans are included)
75
+ * active plans are included). This is a Plans (deprecated) endpoint. New clients
76
+ * should implement using Contracts.
73
77
  *
74
78
  * @example
75
79
  * ```ts
@@ -0,0 +1,139 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { APIPromise } from '../../../core/api-promise';
5
+ import { RequestOptions } from '../../../internal/request-options';
6
+
7
+ export class BillingProviders extends APIResource {
8
+ /**
9
+ * Set up account-level configuration for a billing provider. Once configured,
10
+ * individual contracts across customers can be mapped to this configuration using
11
+ * the returned delivery_method_id.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const billingProvider =
16
+ * await client.v1.settings.billingProviders.create({
17
+ * billing_provider: 'aws_marketplace',
18
+ * configuration: {
19
+ * aws_external_id:
20
+ * '47b4f6b7-e297-42e8-b175-331d933b402c',
21
+ * aws_iam_role_arn: 'arn:aws:iam::test',
22
+ * },
23
+ * delivery_method: 'direct_to_billing_provider',
24
+ * });
25
+ * ```
26
+ */
27
+ create(
28
+ body: BillingProviderCreateParams,
29
+ options?: RequestOptions,
30
+ ): APIPromise<BillingProviderCreateResponse> {
31
+ return this._client.post('/v1/setUpBillingProvider', { body, ...options });
32
+ }
33
+
34
+ /**
35
+ * Lists all configured billing providers and their delivery method configurations
36
+ * for your account. Returns provider details, delivery method IDs, and
37
+ * configuration settings needed for mapping individual customer contracts to
38
+ * billing integrations.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const billingProviders =
43
+ * await client.v1.settings.billingProviders.list({
44
+ * next_page: 'af26878a-de62-4a0d-9b77-3936f7c2b6d6',
45
+ * });
46
+ * ```
47
+ */
48
+ list(
49
+ body: BillingProviderListParams | null | undefined = {},
50
+ options?: RequestOptions,
51
+ ): APIPromise<BillingProviderListResponse> {
52
+ return this._client.post('/v1/listConfiguredBillingProviders', { body, ...options });
53
+ }
54
+ }
55
+
56
+ export interface BillingProviderCreateResponse {
57
+ data: BillingProviderCreateResponse.Data;
58
+ }
59
+
60
+ export namespace BillingProviderCreateResponse {
61
+ export interface Data {
62
+ delivery_method_id: string;
63
+ }
64
+ }
65
+
66
+ export interface BillingProviderListResponse {
67
+ data: Array<BillingProviderListResponse.Data>;
68
+
69
+ next_page?: string | null;
70
+ }
71
+
72
+ export namespace BillingProviderListResponse {
73
+ export interface Data {
74
+ /**
75
+ * The billing provider set for this configuration.
76
+ */
77
+ billing_provider:
78
+ | 'aws_marketplace'
79
+ | 'stripe'
80
+ | 'netsuite'
81
+ | 'custom'
82
+ | 'azure_marketplace'
83
+ | 'quickbooks_online'
84
+ | 'workday'
85
+ | 'gcp_marketplace'
86
+ | 'metronome';
87
+
88
+ /**
89
+ * The method to use for delivering invoices to this customer.
90
+ */
91
+ delivery_method: 'direct_to_billing_provider' | 'aws_sqs' | 'tackle' | 'aws_sns';
92
+
93
+ /**
94
+ * Configuration for the delivery method. The structure of this object is specific
95
+ * to the delivery method. Some configuration may be omitted for security reasons.
96
+ */
97
+ delivery_method_configuration: { [key: string]: unknown };
98
+
99
+ /**
100
+ * ID of the delivery method to use for this customer.
101
+ */
102
+ delivery_method_id: string;
103
+ }
104
+ }
105
+
106
+ export interface BillingProviderCreateParams {
107
+ /**
108
+ * The billing provider set for this configuration.
109
+ */
110
+ billing_provider: 'aws_marketplace' | 'azure_marketplace';
111
+
112
+ /**
113
+ * Account-level configuration for the billing provider. The structure of this
114
+ * object is specific to the billing provider and delivery provider combination.
115
+ * See examples below.
116
+ */
117
+ configuration: { [key: string]: unknown };
118
+
119
+ /**
120
+ * The method to use for delivering invoices for this configuration.
121
+ */
122
+ delivery_method: 'direct_to_billing_provider' | 'aws_sqs' | 'aws_sns';
123
+ }
124
+
125
+ export interface BillingProviderListParams {
126
+ /**
127
+ * The cursor to the next page of results
128
+ */
129
+ next_page?: string | null;
130
+ }
131
+
132
+ export declare namespace BillingProviders {
133
+ export {
134
+ type BillingProviderCreateResponse as BillingProviderCreateResponse,
135
+ type BillingProviderListResponse as BillingProviderListResponse,
136
+ type BillingProviderCreateParams as BillingProviderCreateParams,
137
+ type BillingProviderListParams as BillingProviderListParams,
138
+ };
139
+ }
@@ -0,0 +1,14 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ BillingProviders,
5
+ type BillingProviderCreateResponse,
6
+ type BillingProviderListResponse,
7
+ type BillingProviderCreateParams,
8
+ type BillingProviderListParams,
9
+ } from './billing-providers';
10
+ export {
11
+ Settings,
12
+ type SettingUpsertAvalaraCredentialsResponse,
13
+ type SettingUpsertAvalaraCredentialsParams,
14
+ } from './settings';
@@ -0,0 +1,87 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as BillingProvidersAPI from './billing-providers';
5
+ import {
6
+ BillingProviderCreateParams,
7
+ BillingProviderCreateResponse,
8
+ BillingProviderListParams,
9
+ BillingProviderListResponse,
10
+ BillingProviders,
11
+ } from './billing-providers';
12
+ import { APIPromise } from '../../../core/api-promise';
13
+ import { RequestOptions } from '../../../internal/request-options';
14
+
15
+ export class Settings extends APIResource {
16
+ billingProviders: BillingProvidersAPI.BillingProviders = new BillingProvidersAPI.BillingProviders(
17
+ this._client,
18
+ );
19
+
20
+ /**
21
+ * Set the Avalara credentials for some specified `delivery_method_ids`, which can
22
+ * be found in the `/listConfiguredBillingProviders` response. This maps the
23
+ * Avalara credentials to the appropriate billing entity. These credentials are
24
+ * only used for PLG Invoicing today.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const response =
29
+ * await client.v1.settings.upsertAvalaraCredentials({
30
+ * avalara_environment: 'PRODUCTION',
31
+ * avalara_password: 'my_password_123',
32
+ * avalara_username: 'test@metronome.com',
33
+ * delivery_method_ids: [
34
+ * '9a906ebb-fbc7-42e8-8e29-53bfd2db3aca',
35
+ * ],
36
+ * });
37
+ * ```
38
+ */
39
+ upsertAvalaraCredentials(
40
+ body: SettingUpsertAvalaraCredentialsParams,
41
+ options?: RequestOptions,
42
+ ): APIPromise<SettingUpsertAvalaraCredentialsResponse> {
43
+ return this._client.post('/v1/upsertAvalaraCredentials', { body, ...options });
44
+ }
45
+ }
46
+
47
+ export interface SettingUpsertAvalaraCredentialsResponse {}
48
+
49
+ export interface SettingUpsertAvalaraCredentialsParams {
50
+ /**
51
+ * The Avalara environment to use (SANDBOX or PRODUCTION).
52
+ */
53
+ avalara_environment: 'PRODUCTION' | 'SANDBOX';
54
+
55
+ /**
56
+ * The password for the Avalara account.
57
+ */
58
+ avalara_password: string;
59
+
60
+ /**
61
+ * The username for the Avalara account.
62
+ */
63
+ avalara_username: string;
64
+
65
+ /**
66
+ * The delivery method IDs of the billing provider configurations to update, can be
67
+ * found in the response of the `/listConfiguredBillingProviders` endpoint.
68
+ */
69
+ delivery_method_ids: Array<string>;
70
+ }
71
+
72
+ Settings.BillingProviders = BillingProviders;
73
+
74
+ export declare namespace Settings {
75
+ export {
76
+ type SettingUpsertAvalaraCredentialsResponse as SettingUpsertAvalaraCredentialsResponse,
77
+ type SettingUpsertAvalaraCredentialsParams as SettingUpsertAvalaraCredentialsParams,
78
+ };
79
+
80
+ export {
81
+ BillingProviders as BillingProviders,
82
+ type BillingProviderCreateResponse as BillingProviderCreateResponse,
83
+ type BillingProviderListResponse as BillingProviderListResponse,
84
+ type BillingProviderCreateParams as BillingProviderCreateParams,
85
+ type BillingProviderListParams as BillingProviderListParams,
86
+ };
87
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './settings/index';
@@ -177,6 +177,12 @@ import {
177
177
  CustomerUpdateConfigParams,
178
178
  Customers,
179
179
  } from './customers/customers';
180
+ import * as SettingsAPI from './settings/settings';
181
+ import {
182
+ SettingUpsertAvalaraCredentialsParams,
183
+ SettingUpsertAvalaraCredentialsResponse,
184
+ Settings,
185
+ } from './settings/settings';
180
186
 
181
187
  export class V1 extends APIResource {
182
188
  alerts: AlertsAPI.Alerts = new AlertsAPI.Alerts(this._client);
@@ -193,6 +199,7 @@ export class V1 extends APIResource {
193
199
  invoices: InvoicesAPI.Invoices = new InvoicesAPI.Invoices(this._client);
194
200
  contracts: ContractsAPI.Contracts = new ContractsAPI.Contracts(this._client);
195
201
  payments: PaymentsAPI.Payments = new PaymentsAPI.Payments(this._client);
202
+ settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client);
196
203
  }
197
204
 
198
205
  V1.Alerts = Alerts;
@@ -209,6 +216,7 @@ V1.Services = Services;
209
216
  V1.Invoices = Invoices;
210
217
  V1.Contracts = Contracts;
211
218
  V1.Payments = Payments;
219
+ V1.Settings = Settings;
212
220
 
213
221
  export declare namespace V1 {
214
222
  export {
@@ -390,4 +398,10 @@ export declare namespace V1 {
390
398
  type PaymentAttemptParams as PaymentAttemptParams,
391
399
  type PaymentCancelParams as PaymentCancelParams,
392
400
  };
401
+
402
+ export {
403
+ Settings as Settings,
404
+ type SettingUpsertAvalaraCredentialsResponse as SettingUpsertAvalaraCredentialsResponse,
405
+ type SettingUpsertAvalaraCredentialsParams as SettingUpsertAvalaraCredentialsParams,
406
+ };
393
407
  }
@@ -1701,7 +1701,8 @@ export namespace ContractEditParams {
1701
1701
  | 'azure_marketplace'
1702
1702
  | 'quickbooks_online'
1703
1703
  | 'workday'
1704
- | 'gcp_marketplace';
1704
+ | 'gcp_marketplace'
1705
+ | 'metronome';
1705
1706
 
1706
1707
  billing_provider_configuration_id?: string;
1707
1708
 
@@ -2610,7 +2611,9 @@ export namespace ContractEditParams {
2610
2611
  subscription_id: string;
2611
2612
 
2612
2613
  /**
2613
- * If set to POOLED, allocation added per seat is pooled across the account.
2614
+ * If set to POOLED, allocation added per seat is pooled across the account. (BETA)
2615
+ * If set to INDIVIDUAL, each seat in the subscription will have its own
2616
+ * allocation.
2614
2617
  */
2615
2618
  allocation?: 'POOLED' | 'INDIVIDUAL';
2616
2619
  }
@@ -2773,7 +2776,9 @@ export namespace ContractEditParams {
2773
2776
  subscription_id: string;
2774
2777
 
2775
2778
  /**
2776
- * If set to POOLED, allocation added per seat is pooled across the account.
2779
+ * If set to POOLED, allocation added per seat is pooled across the account. (BETA)
2780
+ * If set to INDIVIDUAL, each seat in the subscription will have its own
2781
+ * allocation.
2777
2782
  */
2778
2783
  allocation?: 'POOLED' | 'INDIVIDUAL';
2779
2784
  }
@@ -2994,6 +2999,11 @@ export namespace ContractEditParams {
2994
2999
  * QUANTITY_ONLY. **QUANTITY_ONLY**: The subscription quantity is specified
2995
3000
  * directly on the subscription. `initial_quantity` must be provided with this
2996
3001
  * option. Compatible with recurring commits/credits that use POOLED allocation.
3002
+ * **SEAT_BASED**: (BETA) Use when you want to pass specific seat identifiers (e.g.
3003
+ * add user_123) to increment and decrement a subscription quantity, rather than
3004
+ * directly providing the quantity. You must use a **SEAT_BASED** subscription to
3005
+ * use a linked recurring credit with an allocation per seat. `seat_config` must be
3006
+ * provided with this option.
2997
3007
  */
2998
3008
  quantity_management_mode?: 'SEAT_BASED' | 'QUANTITY_ONLY';
2999
3009
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.0.0'; // x-release-please-version
1
+ export const VERSION = '2.1.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.0";
1
+ export declare const VERSION = "2.1.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.0";
1
+ export declare const VERSION = "2.1.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.0.0'; // x-release-please-version
4
+ exports.VERSION = '2.1.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.0.0'; // x-release-please-version
1
+ export const VERSION = '2.1.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map