@metronome/sdk 0.1.0-alpha.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 (284) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +201 -0
  3. package/README.md +313 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +90 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +237 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +868 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +837 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +53 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +143 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +127 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +210 -0
  87. package/index.d.ts +210 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +133 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +105 -0
  92. package/index.mjs.map +1 -0
  93. package/package.json +106 -0
  94. package/resource.d.ts +6 -0
  95. package/resource.d.ts.map +1 -0
  96. package/resource.js +11 -0
  97. package/resource.js.map +1 -0
  98. package/resource.mjs +7 -0
  99. package/resource.mjs.map +1 -0
  100. package/resources/alerts.d.ts +103 -0
  101. package/resources/alerts.d.ts.map +1 -0
  102. package/resources/alerts.js +23 -0
  103. package/resources/alerts.js.map +1 -0
  104. package/resources/alerts.mjs +19 -0
  105. package/resources/alerts.mjs.map +1 -0
  106. package/resources/audit-logs.d.ts +83 -0
  107. package/resources/audit-logs.d.ts.map +1 -0
  108. package/resources/audit-logs.js +18 -0
  109. package/resources/audit-logs.js.map +1 -0
  110. package/resources/audit-logs.mjs +14 -0
  111. package/resources/audit-logs.mjs.map +1 -0
  112. package/resources/billable-metrics.d.ts +236 -0
  113. package/resources/billable-metrics.d.ts.map +1 -0
  114. package/resources/billable-metrics.js +36 -0
  115. package/resources/billable-metrics.js.map +1 -0
  116. package/resources/billable-metrics.mjs +32 -0
  117. package/resources/billable-metrics.mjs.map +1 -0
  118. package/resources/credit-grants.d.ts +469 -0
  119. package/resources/credit-grants.d.ts.map +1 -0
  120. package/resources/credit-grants.js +50 -0
  121. package/resources/credit-grants.js.map +1 -0
  122. package/resources/credit-grants.mjs +46 -0
  123. package/resources/credit-grants.mjs.map +1 -0
  124. package/resources/custom-fields.d.ts +82 -0
  125. package/resources/custom-fields.d.ts.map +1 -0
  126. package/resources/custom-fields.js +66 -0
  127. package/resources/custom-fields.js.map +1 -0
  128. package/resources/custom-fields.mjs +62 -0
  129. package/resources/custom-fields.mjs.map +1 -0
  130. package/resources/customers/alerts.d.ts +146 -0
  131. package/resources/customers/alerts.d.ts.map +1 -0
  132. package/resources/customers/alerts.js +35 -0
  133. package/resources/customers/alerts.js.map +1 -0
  134. package/resources/customers/alerts.mjs +31 -0
  135. package/resources/customers/alerts.mjs.map +1 -0
  136. package/resources/customers/billing-config.d.ts +64 -0
  137. package/resources/customers/billing-config.d.ts.map +1 -0
  138. package/resources/customers/billing-config.js +37 -0
  139. package/resources/customers/billing-config.js.map +1 -0
  140. package/resources/customers/billing-config.mjs +33 -0
  141. package/resources/customers/billing-config.mjs.map +1 -0
  142. package/resources/customers/customers.d.ts +313 -0
  143. package/resources/customers/customers.d.ts.map +1 -0
  144. package/resources/customers/customers.js +116 -0
  145. package/resources/customers/customers.js.map +1 -0
  146. package/resources/customers/customers.mjs +89 -0
  147. package/resources/customers/customers.mjs.map +1 -0
  148. package/resources/customers/index.d.ts +6 -0
  149. package/resources/customers/index.d.ts.map +1 -0
  150. package/resources/customers/index.js +15 -0
  151. package/resources/customers/index.js.map +1 -0
  152. package/resources/customers/index.mjs +7 -0
  153. package/resources/customers/index.mjs.map +1 -0
  154. package/resources/customers/invoices.d.ts +331 -0
  155. package/resources/customers/invoices.d.ts.map +1 -0
  156. package/resources/customers/invoices.js +30 -0
  157. package/resources/customers/invoices.js.map +1 -0
  158. package/resources/customers/invoices.mjs +26 -0
  159. package/resources/customers/invoices.mjs.map +1 -0
  160. package/resources/customers/plans.d.ts +239 -0
  161. package/resources/customers/plans.d.ts.map +1 -0
  162. package/resources/customers/plans.js +41 -0
  163. package/resources/customers/plans.js.map +1 -0
  164. package/resources/customers/plans.mjs +37 -0
  165. package/resources/customers/plans.mjs.map +1 -0
  166. package/resources/dashboards.d.ts +61 -0
  167. package/resources/dashboards.d.ts.map +1 -0
  168. package/resources/dashboards.js +19 -0
  169. package/resources/dashboards.js.map +1 -0
  170. package/resources/dashboards.mjs +15 -0
  171. package/resources/dashboards.mjs.map +1 -0
  172. package/resources/index.d.ts +13 -0
  173. package/resources/index.d.ts.map +1 -0
  174. package/resources/index.js +42 -0
  175. package/resources/index.js.map +1 -0
  176. package/resources/index.mjs +14 -0
  177. package/resources/index.mjs.map +1 -0
  178. package/resources/plans.d.ts +217 -0
  179. package/resources/plans.d.ts.map +1 -0
  180. package/resources/plans.js +36 -0
  181. package/resources/plans.js.map +1 -0
  182. package/resources/plans.mjs +32 -0
  183. package/resources/plans.mjs.map +1 -0
  184. package/resources/services.d.ts +26 -0
  185. package/resources/services.d.ts.map +1 -0
  186. package/resources/services.js +20 -0
  187. package/resources/services.js.map +1 -0
  188. package/resources/services.mjs +16 -0
  189. package/resources/services.mjs.map +1 -0
  190. package/resources/shared.d.ts +540 -0
  191. package/resources/shared.d.ts.map +1 -0
  192. package/resources/shared.js +4 -0
  193. package/resources/shared.js.map +1 -0
  194. package/resources/shared.mjs +3 -0
  195. package/resources/shared.mjs.map +1 -0
  196. package/resources/usage.d.ts +182 -0
  197. package/resources/usage.d.ts.map +1 -0
  198. package/resources/usage.js +41 -0
  199. package/resources/usage.js.map +1 -0
  200. package/resources/usage.mjs +37 -0
  201. package/resources/usage.mjs.map +1 -0
  202. package/resources/webhooks.d.ts +22 -0
  203. package/resources/webhooks.d.ts.map +1 -0
  204. package/resources/webhooks.js +91 -0
  205. package/resources/webhooks.js.map +1 -0
  206. package/resources/webhooks.mjs +87 -0
  207. package/resources/webhooks.mjs.map +1 -0
  208. package/shims/node.d.ts +29 -0
  209. package/shims/node.d.ts.map +1 -0
  210. package/shims/node.js +31 -0
  211. package/shims/node.js.map +1 -0
  212. package/shims/node.mjs +5 -0
  213. package/shims/node.mjs.map +1 -0
  214. package/shims/web.d.ts +26 -0
  215. package/shims/web.d.ts.map +1 -0
  216. package/shims/web.js +31 -0
  217. package/shims/web.js.map +1 -0
  218. package/shims/web.mjs +5 -0
  219. package/shims/web.mjs.map +1 -0
  220. package/src/_shims/MultipartBody.ts +9 -0
  221. package/src/_shims/README.md +46 -0
  222. package/src/_shims/auto/runtime-bun.ts +4 -0
  223. package/src/_shims/auto/runtime-node.ts +4 -0
  224. package/src/_shims/auto/runtime.ts +4 -0
  225. package/src/_shims/auto/types-node.ts +4 -0
  226. package/src/_shims/auto/types.d.ts +101 -0
  227. package/src/_shims/auto/types.js +3 -0
  228. package/src/_shims/auto/types.mjs +3 -0
  229. package/src/_shims/bun-runtime.ts +14 -0
  230. package/src/_shims/index.d.ts +81 -0
  231. package/src/_shims/index.js +13 -0
  232. package/src/_shims/index.mjs +7 -0
  233. package/src/_shims/manual-types.d.ts +12 -0
  234. package/src/_shims/manual-types.js +3 -0
  235. package/src/_shims/manual-types.mjs +3 -0
  236. package/src/_shims/node-runtime.ts +83 -0
  237. package/src/_shims/node-types.d.ts +42 -0
  238. package/src/_shims/node-types.js +3 -0
  239. package/src/_shims/node-types.mjs +3 -0
  240. package/src/_shims/registry.ts +67 -0
  241. package/src/_shims/web-runtime.ts +103 -0
  242. package/src/_shims/web-types.d.ts +83 -0
  243. package/src/_shims/web-types.js +3 -0
  244. package/src/_shims/web-types.mjs +3 -0
  245. package/src/core.ts +1146 -0
  246. package/src/error.ts +146 -0
  247. package/src/index.ts +303 -0
  248. package/src/lib/.keep +4 -0
  249. package/src/resource.ts +11 -0
  250. package/src/resources/alerts.ts +144 -0
  251. package/src/resources/audit-logs.ts +116 -0
  252. package/src/resources/billable-metrics.ts +341 -0
  253. package/src/resources/credit-grants.ts +627 -0
  254. package/src/resources/custom-fields.ts +242 -0
  255. package/src/resources/customers/alerts.ts +214 -0
  256. package/src/resources/customers/billing-config.ts +183 -0
  257. package/src/resources/customers/customers.ts +500 -0
  258. package/src/resources/customers/index.ts +53 -0
  259. package/src/resources/customers/invoices.ts +533 -0
  260. package/src/resources/customers/plans.ts +363 -0
  261. package/src/resources/dashboards.ts +98 -0
  262. package/src/resources/index.ts +90 -0
  263. package/src/resources/plans.ts +333 -0
  264. package/src/resources/services.ts +35 -0
  265. package/src/resources/shared.ts +849 -0
  266. package/src/resources/usage.ts +245 -0
  267. package/src/resources/webhooks.ts +120 -0
  268. package/src/shims/node.ts +50 -0
  269. package/src/shims/web.ts +50 -0
  270. package/src/tsconfig.json +11 -0
  271. package/src/uploads.ts +248 -0
  272. package/src/version.ts +1 -0
  273. package/uploads.d.ts +75 -0
  274. package/uploads.d.ts.map +1 -0
  275. package/uploads.js +165 -0
  276. package/uploads.js.map +1 -0
  277. package/uploads.mjs +152 -0
  278. package/uploads.mjs.map +1 -0
  279. package/version.d.ts +2 -0
  280. package/version.d.ts.map +1 -0
  281. package/version.js +5 -0
  282. package/version.js.map +1 -0
  283. package/version.mjs +2 -0
  284. package/version.mjs.map +1 -0
@@ -0,0 +1,331 @@
1
+ import * as Core from '@metronome/sdk/core';
2
+ import { APIResource } from '@metronome/sdk/resource';
3
+ import * as InvoicesAPI from '@metronome/sdk/resources/customers/invoices';
4
+ import * as Shared from '@metronome/sdk/resources/shared';
5
+ export declare class Invoices extends APIResource {
6
+ /**
7
+ * Fetch a specific invoice for a given customer.
8
+ */
9
+ retrieve(customerId: string, invoiceId: string, query?: InvoiceRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<InvoiceRetrieveResponse>;
10
+ retrieve(customerId: string, invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<InvoiceRetrieveResponse>;
11
+ /**
12
+ * List all invoices for a given customer, optionally filtered by status, date
13
+ * range, and/or credit type.
14
+ */
15
+ list(customerId: string, query?: InvoiceListParams, options?: Core.RequestOptions): Core.APIPromise<InvoiceListResponse>;
16
+ list(customerId: string, options?: Core.RequestOptions): Core.APIPromise<InvoiceListResponse>;
17
+ /**
18
+ * Add a one time charge to the specified invoice
19
+ */
20
+ addCharge(customerId: string, body: InvoiceAddChargeParams, options?: Core.RequestOptions): Core.APIPromise<InvoiceAddChargeResponse>;
21
+ }
22
+ export interface Invoice {
23
+ id: string;
24
+ billable_status: 'billable' | 'unbillable';
25
+ credit_type: Shared.CreditType;
26
+ customer_id: string;
27
+ line_items: Array<Invoice.LineItem>;
28
+ status: string;
29
+ total: number;
30
+ type: string;
31
+ amendment_id?: string;
32
+ contract_custom_fields?: Record<string, string>;
33
+ contract_id?: string;
34
+ correction_record?: Invoice.CorrectionRecord;
35
+ /**
36
+ * When the invoice was created (UTC). This field is present for correction
37
+ * invoices only.
38
+ */
39
+ created_at?: string;
40
+ custom_fields?: Record<string, unknown>;
41
+ customer_custom_fields?: Record<string, string>;
42
+ /**
43
+ * End of the usage period this invoice covers (UTC)
44
+ */
45
+ end_timestamp?: string;
46
+ external_invoice?: Invoice.ExternalInvoice | null;
47
+ invoice_adjustments?: Array<Invoice.InvoiceAdjustment>;
48
+ /**
49
+ * When the invoice was issued (UTC)
50
+ */
51
+ issued_at?: string;
52
+ net_payment_terms_days?: number;
53
+ /**
54
+ * This field's availability is dependent on your client's configuration.
55
+ */
56
+ netsuite_sales_order_id?: string;
57
+ plan_custom_fields?: Record<string, string>;
58
+ plan_id?: string;
59
+ plan_name?: string;
60
+ /**
61
+ * only present for beta contract invoices with reseller royalties
62
+ */
63
+ reseller_royalty?: Invoice.ResellerRoyalty;
64
+ /**
65
+ * This field's availability is dependent on your client's configuration.
66
+ */
67
+ salesforce_opportunity_id?: string;
68
+ /**
69
+ * Beginning of the usage period this invoice covers (UTC)
70
+ */
71
+ start_timestamp?: string;
72
+ subtotal?: number;
73
+ }
74
+ export declare namespace Invoice {
75
+ interface LineItem {
76
+ credit_type: Shared.CreditType;
77
+ name: string;
78
+ total: number;
79
+ commit_custom_fields?: Record<string, string>;
80
+ /**
81
+ * only present for beta contract invoices
82
+ */
83
+ commit_id?: string;
84
+ /**
85
+ * only present for beta contract invoices. This field's availability is dependent
86
+ * on your client's configuration.
87
+ */
88
+ commit_netsuite_item_id?: string;
89
+ /**
90
+ * only present for beta contract invoices. This field's availability is dependent
91
+ * on your client's configuration.
92
+ */
93
+ commit_netsuite_sales_order_id?: string;
94
+ /**
95
+ * only present for beta contract invoices
96
+ */
97
+ commit_segment_id?: string;
98
+ /**
99
+ * only present for beta contract invoices
100
+ */
101
+ commit_type?: string;
102
+ custom_fields?: Record<string, string>;
103
+ /**
104
+ * only present for beta contract invoices
105
+ */
106
+ ending_before?: string;
107
+ group_key?: string;
108
+ group_value?: string | null;
109
+ /**
110
+ * only present for beta contract invoices
111
+ */
112
+ is_prorated?: boolean;
113
+ metadata?: string;
114
+ /**
115
+ * The end date for the billing period on the invoice.
116
+ */
117
+ netsuite_invoice_billing_end?: string;
118
+ /**
119
+ * The start date for the billing period on the invoice.
120
+ */
121
+ netsuite_invoice_billing_start?: string;
122
+ /**
123
+ * only present for beta contract invoices. This field's availability is dependent
124
+ * on your client's configuration.
125
+ */
126
+ netsuite_item_id?: string;
127
+ /**
128
+ * only present for beta contract invoices
129
+ */
130
+ postpaid_commit?: LineItem.PostpaidCommit;
131
+ /**
132
+ * if presentation groups are used, this will contain the values used to break down
133
+ * the line item
134
+ */
135
+ presentation_group_values?: Record<string, string | null>;
136
+ /**
137
+ * if pricing groups are used, this will contain the values used to calculate the
138
+ * price
139
+ */
140
+ pricing_group_values?: Record<string, string>;
141
+ product_custom_fields?: Record<string, string>;
142
+ product_id?: string;
143
+ product_type?: string;
144
+ professional_service_custom_fields?: Record<string, string>;
145
+ /**
146
+ * only present for beta contract invoices
147
+ */
148
+ professional_service_id?: string;
149
+ quantity?: number;
150
+ reseller_type?: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE';
151
+ scheduled_charge_custom_fields?: Record<string, string>;
152
+ /**
153
+ * only present for beta contract invoices
154
+ */
155
+ scheduled_charge_id?: string;
156
+ /**
157
+ * only present for beta contract invoices
158
+ */
159
+ starting_at?: string;
160
+ sub_line_items?: Array<LineItem.SubLineItem>;
161
+ /**
162
+ * only present for beta contract invoices
163
+ */
164
+ unit_price?: number;
165
+ }
166
+ namespace LineItem {
167
+ /**
168
+ * only present for beta contract invoices
169
+ */
170
+ interface PostpaidCommit {
171
+ id: string;
172
+ }
173
+ interface SubLineItem {
174
+ custom_fields: Record<string, string>;
175
+ name: string;
176
+ quantity: number;
177
+ subtotal: number;
178
+ charge_id?: string;
179
+ credit_grant_id?: string;
180
+ /**
181
+ * the unit price for this charge, present only if the charge is not tiered and the
182
+ * quantity is nonzero
183
+ */
184
+ price?: number;
185
+ tiers?: Array<SubLineItem.Tier>;
186
+ }
187
+ namespace SubLineItem {
188
+ interface Tier {
189
+ price: number;
190
+ quantity: number;
191
+ /**
192
+ * at what metric amount this tier begins
193
+ */
194
+ starting_at: number;
195
+ subtotal: number;
196
+ }
197
+ }
198
+ }
199
+ interface CorrectionRecord {
200
+ corrected_invoice_id: string;
201
+ memo: string;
202
+ reason: string;
203
+ corrected_external_invoice?: CorrectionRecord.CorrectedExternalInvoice;
204
+ }
205
+ namespace CorrectionRecord {
206
+ interface CorrectedExternalInvoice {
207
+ billing_provider_type: 'aws_marketplace' | 'stripe' | 'netsuite' | 'custom' | 'azure_marketplace' | 'quickbooks_online' | 'workday' | 'gcp_marketplace';
208
+ external_status?: 'DRAFT' | 'FINALIZED' | 'PAID' | 'UNCOLLECTIBLE' | 'VOID' | 'DELETED' | 'PAYMENT_FAILED' | 'INVALID_REQUEST_ERROR' | 'SKIPPED' | 'SENT' | 'QUEUED';
209
+ invoice_id?: string;
210
+ issued_at_timestamp?: string;
211
+ }
212
+ }
213
+ interface ExternalInvoice {
214
+ billing_provider_type: 'aws_marketplace' | 'stripe' | 'netsuite' | 'custom' | 'azure_marketplace' | 'quickbooks_online' | 'workday' | 'gcp_marketplace';
215
+ external_status?: 'DRAFT' | 'FINALIZED' | 'PAID' | 'UNCOLLECTIBLE' | 'VOID' | 'DELETED' | 'PAYMENT_FAILED' | 'INVALID_REQUEST_ERROR' | 'SKIPPED' | 'SENT' | 'QUEUED';
216
+ invoice_id?: string;
217
+ issued_at_timestamp?: string;
218
+ }
219
+ interface InvoiceAdjustment {
220
+ credit_type: Shared.CreditType;
221
+ name: string;
222
+ total: number;
223
+ credit_grant_id?: string;
224
+ }
225
+ /**
226
+ * only present for beta contract invoices with reseller royalties
227
+ */
228
+ interface ResellerRoyalty {
229
+ fraction: string;
230
+ netsuite_reseller_id: string;
231
+ reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE';
232
+ aws_options?: ResellerRoyalty.AwsOptions;
233
+ gcp_options?: ResellerRoyalty.GcpOptions;
234
+ }
235
+ namespace ResellerRoyalty {
236
+ interface AwsOptions {
237
+ aws_account_number?: string;
238
+ aws_offer_id?: string;
239
+ aws_payer_reference_id?: string;
240
+ }
241
+ interface GcpOptions {
242
+ gcp_account_id?: string;
243
+ gcp_offer_id?: string;
244
+ }
245
+ }
246
+ }
247
+ export interface InvoiceRetrieveResponse {
248
+ data: Invoice;
249
+ }
250
+ export interface InvoiceListResponse {
251
+ data: Array<Invoice>;
252
+ next_page: string | null;
253
+ }
254
+ export interface InvoiceAddChargeResponse {
255
+ }
256
+ export interface InvoiceRetrieveParams {
257
+ /**
258
+ * If set, all zero quantity line items will be filtered out of the response
259
+ */
260
+ skip_zero_qty_line_items?: boolean;
261
+ }
262
+ export interface InvoiceListParams {
263
+ /**
264
+ * Only return invoices for the specified credit type
265
+ */
266
+ credit_type_id?: string;
267
+ /**
268
+ * RFC 3339 timestamp (exclusive). Invoices will only be returned for billing
269
+ * periods that end before this time.
270
+ */
271
+ ending_before?: string;
272
+ /**
273
+ * Max number of results that should be returned
274
+ */
275
+ limit?: number;
276
+ /**
277
+ * Cursor that indicates where the next page of results should start.
278
+ */
279
+ next_page?: string;
280
+ /**
281
+ * If set, all zero quantity line items will be filtered out of the response
282
+ */
283
+ skip_zero_qty_line_items?: boolean;
284
+ /**
285
+ * Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to
286
+ * date_asc.
287
+ */
288
+ sort?: 'date_asc' | 'date_desc';
289
+ /**
290
+ * RFC 3339 timestamp (inclusive). Invoices will only be returned for billing
291
+ * periods that start at or after this time.
292
+ */
293
+ starting_on?: string;
294
+ /**
295
+ * Invoice status, e.g. DRAFT, FINALIZED, or VOID
296
+ */
297
+ status?: string;
298
+ }
299
+ export interface InvoiceAddChargeParams {
300
+ /**
301
+ * The Metronome ID of the charge to add to the invoice. Note that the charge must
302
+ * be on a product that is not on the current plan, and the product must have only
303
+ * fixed charges.
304
+ */
305
+ charge_id: string;
306
+ /**
307
+ * The Metronome ID of the customer plan to add the charge to.
308
+ */
309
+ customer_plan_id: string;
310
+ description: string;
311
+ /**
312
+ * The start_timestamp of the invoice to add the charge to.
313
+ */
314
+ invoice_start_timestamp: string;
315
+ /**
316
+ * The price of the charge. This price will match the currency on the invoice, e.g.
317
+ * USD cents.
318
+ */
319
+ price: number;
320
+ quantity: number;
321
+ }
322
+ export declare namespace Invoices {
323
+ export import Invoice = InvoicesAPI.Invoice;
324
+ export import InvoiceRetrieveResponse = InvoicesAPI.InvoiceRetrieveResponse;
325
+ export import InvoiceListResponse = InvoicesAPI.InvoiceListResponse;
326
+ export import InvoiceAddChargeResponse = InvoicesAPI.InvoiceAddChargeResponse;
327
+ export import InvoiceRetrieveParams = InvoicesAPI.InvoiceRetrieveParams;
328
+ export import InvoiceListParams = InvoicesAPI.InvoiceListParams;
329
+ export import InvoiceAddChargeParams = InvoicesAPI.InvoiceAddChargeParams;
330
+ }
331
+ //# sourceMappingURL=invoices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../../src/resources/customers/invoices.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,WAAW,MAAM,6CAA6C,CAAC;AAC3E,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAE1D,qBAAa,QAAS,SAAQ,WAAW;IACvC;;OAEG;IACH,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,qBAAqB,EAC7B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,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AAW,CAAC,mBAAmB,CAAC;IACpE,MAAM,QAAQ,wBAAwB,GAAG,WAAW,CAAC,wBAAwB,CAAC;IAC9E,MAAM,QAAQ,qBAAqB,GAAG,WAAW,CAAC,qBAAqB,CAAC;IACxE,MAAM,QAAQ,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;IAChE,MAAM,QAAQ,sBAAsB,GAAG,WAAW,CAAC,sBAAsB,CAAC;CAC3E"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Invoices = void 0;
5
+ const resource_1 = require("@metronome/sdk/resource");
6
+ const core_1 = require("@metronome/sdk/core");
7
+ class Invoices extends resource_1.APIResource {
8
+ retrieve(customerId, invoiceId, query = {}, options) {
9
+ if ((0, core_1.isRequestOptions)(query)) {
10
+ return this.retrieve(customerId, invoiceId, {}, query);
11
+ }
12
+ return this._client.get(`/customers/${customerId}/invoices/${invoiceId}`, { query, ...options });
13
+ }
14
+ list(customerId, query = {}, options) {
15
+ if ((0, core_1.isRequestOptions)(query)) {
16
+ return this.list(customerId, {}, query);
17
+ }
18
+ return this._client.get(`/customers/${customerId}/invoices`, { query, ...options });
19
+ }
20
+ /**
21
+ * Add a one time charge to the specified invoice
22
+ */
23
+ addCharge(customerId, body, options) {
24
+ return this._client.post(`/customers/${customerId}/addCharge`, { body, ...options });
25
+ }
26
+ }
27
+ exports.Invoices = Invoices;
28
+ (function (Invoices) {
29
+ })(Invoices = exports.Invoices || (exports.Invoices = {}));
30
+ //# sourceMappingURL=invoices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoices.js","sourceRoot":"","sources":["../../src/resources/customers/invoices.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAGtF,sDAAsD;AACtD,8CAAuD;AAIvD,MAAa,QAAS,SAAQ,sBAAW;IAevC,QAAQ,CACN,UAAkB,EAClB,SAAiB,EACjB,QAAqD,EAAE,EACvD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACxD;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,aAAa,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAYD,IAAI,CACF,UAAkB,EAClB,QAAiD,EAAE,EACnD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACzC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;IAED;;OAEG;IACH,SAAS,CACP,UAAkB,EAClB,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,UAAU,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;CACF;AA1DD,4BA0DC;AA0cD,WAAiB,QAAQ;AAQzB,CAAC,EARgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAQxB"}
@@ -0,0 +1,26 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from '@metronome/sdk/resource';
3
+ import { isRequestOptions } from '@metronome/sdk/core';
4
+ export class Invoices extends APIResource {
5
+ retrieve(customerId, invoiceId, query = {}, options) {
6
+ if (isRequestOptions(query)) {
7
+ return this.retrieve(customerId, invoiceId, {}, query);
8
+ }
9
+ return this._client.get(`/customers/${customerId}/invoices/${invoiceId}`, { query, ...options });
10
+ }
11
+ list(customerId, query = {}, options) {
12
+ if (isRequestOptions(query)) {
13
+ return this.list(customerId, {}, query);
14
+ }
15
+ return this._client.get(`/customers/${customerId}/invoices`, { query, ...options });
16
+ }
17
+ /**
18
+ * Add a one time charge to the specified invoice
19
+ */
20
+ addCharge(customerId, body, options) {
21
+ return this._client.post(`/customers/${customerId}/addCharge`, { body, ...options });
22
+ }
23
+ }
24
+ (function (Invoices) {
25
+ })(Invoices || (Invoices = {}));
26
+ //# sourceMappingURL=invoices.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoices.mjs","sourceRoot":"","sources":["../../src/resources/customers/invoices.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,WAAW,EAAE,MAAM,yBAAyB;OAC9C,EAAE,gBAAgB,EAAE,MAAM,qBAAqB;AAItD,MAAM,OAAO,QAAS,SAAQ,WAAW;IAevC,QAAQ,CACN,UAAkB,EAClB,SAAiB,EACjB,QAAqD,EAAE,EACvD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACxD;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,aAAa,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAYD,IAAI,CACF,UAAkB,EAClB,QAAiD,EAAE,EACnD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACzC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;IAED;;OAEG;IACH,SAAS,CACP,UAAkB,EAClB,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,UAAU,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;CACF;AA0cD,WAAiB,QAAQ;AAQzB,CAAC,EARgB,QAAQ,KAAR,QAAQ,QAQxB"}
@@ -0,0 +1,239 @@
1
+ import * as Core from '@metronome/sdk/core';
2
+ import { APIResource } from '@metronome/sdk/resource';
3
+ import * as PlansAPI from '@metronome/sdk/resources/customers/plans';
4
+ import * as Shared from '@metronome/sdk/resources/shared';
5
+ export declare class Plans extends APIResource {
6
+ /**
7
+ * List the given customer's plans in reverse-chronological order.
8
+ */
9
+ list(customerId: string, query?: PlanListParams, options?: Core.RequestOptions): Core.APIPromise<PlanListResponse>;
10
+ list(customerId: string, options?: Core.RequestOptions): Core.APIPromise<PlanListResponse>;
11
+ /**
12
+ * Associate an existing customer with a plan for a specified date range. See the
13
+ * [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments)
14
+ * for details on the price adjustments.
15
+ */
16
+ add(customerId: string, body: PlanAddParams, options?: Core.RequestOptions): Core.APIPromise<PlanAddResponse>;
17
+ /**
18
+ * Change the end date of a customer's plan.
19
+ */
20
+ end(customerId: string, customerPlanId: string, body?: PlanEndParams, options?: Core.RequestOptions): Core.APIPromise<PlanEndResponse>;
21
+ end(customerId: string, customerPlanId: string, options?: Core.RequestOptions): Core.APIPromise<PlanEndResponse>;
22
+ /**
23
+ * Lists a customer plans adjustments. See the
24
+ * [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments)
25
+ * for details.
26
+ */
27
+ listPriceAdjustments(customerId: string, customerPlanId: string, query?: PlanListPriceAdjustmentsParams, options?: Core.RequestOptions): Core.APIPromise<PlanListPriceAdjustmentsResponse>;
28
+ listPriceAdjustments(customerId: string, customerPlanId: string, options?: Core.RequestOptions): Core.APIPromise<PlanListPriceAdjustmentsResponse>;
29
+ }
30
+ export interface PlanListResponse {
31
+ data: Array<PlanListResponse.Data>;
32
+ next_page: string | null;
33
+ }
34
+ export declare namespace PlanListResponse {
35
+ interface Data {
36
+ /**
37
+ * the ID of the customer plan
38
+ */
39
+ id: string;
40
+ custom_fields: Record<string, string>;
41
+ plan_description: string;
42
+ /**
43
+ * the ID of the plan
44
+ */
45
+ plan_id: string;
46
+ plan_name: string;
47
+ starting_on: string;
48
+ ending_before?: string;
49
+ net_payment_terms_days?: number;
50
+ trial_info?: Data.TrialInfo;
51
+ }
52
+ namespace Data {
53
+ interface TrialInfo {
54
+ ending_before: string;
55
+ spending_caps: Array<TrialInfo.SpendingCap>;
56
+ }
57
+ namespace TrialInfo {
58
+ interface SpendingCap {
59
+ amount: number;
60
+ amount_remaining: number;
61
+ credit_type: Shared.CreditType;
62
+ }
63
+ }
64
+ }
65
+ }
66
+ export interface PlanAddResponse {
67
+ data: Shared.ID;
68
+ }
69
+ export interface PlanEndResponse {
70
+ }
71
+ export interface PlanListPriceAdjustmentsResponse {
72
+ data: Array<PlanListPriceAdjustmentsResponse.Data>;
73
+ next_page: string | null;
74
+ }
75
+ export declare namespace PlanListPriceAdjustmentsResponse {
76
+ interface Data {
77
+ charge_id: string;
78
+ charge_type: 'usage' | 'fixed' | 'composite' | 'minimum' | 'seat';
79
+ prices: Array<Data.Price>;
80
+ start_period: number;
81
+ quantity?: number;
82
+ }
83
+ namespace Data {
84
+ interface Price {
85
+ /**
86
+ * Determines how the value will be applied.
87
+ */
88
+ adjustment_type: 'fixed' | 'quantity' | 'percentage' | 'override';
89
+ /**
90
+ * Used in pricing tiers. Indicates at what metric value the price applies.
91
+ */
92
+ tier?: number;
93
+ value?: number;
94
+ }
95
+ }
96
+ }
97
+ export interface PlanListParams {
98
+ /**
99
+ * Max number of results that should be returned
100
+ */
101
+ limit?: number;
102
+ /**
103
+ * Cursor that indicates where the next page of results should start.
104
+ */
105
+ next_page?: string;
106
+ }
107
+ export interface PlanAddParams {
108
+ plan_id: string;
109
+ /**
110
+ * RFC 3339 timestamp for when the plan becomes active for this customer. Must be
111
+ * at 0:00 UTC (midnight).
112
+ */
113
+ starting_on: string;
114
+ /**
115
+ * RFC 3339 timestamp for when the plan ends (exclusive) for this customer. Must be
116
+ * at 0:00 UTC (midnight).
117
+ */
118
+ ending_before?: string;
119
+ /**
120
+ * Number of days after issuance of invoice after which the invoice is due (e.g.
121
+ * Net 30).
122
+ */
123
+ net_payment_terms_days?: number;
124
+ /**
125
+ * An optional list of overage rates that override the rates of the original plan
126
+ * configuration. These new rates will apply to all pricing ramps.
127
+ */
128
+ overage_rate_adjustments?: Array<PlanAddParams.OverageRateAdjustment>;
129
+ /**
130
+ * A list of price adjustments can be applied on top of the pricing in the plans.
131
+ * See the
132
+ * [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments)
133
+ * for details.
134
+ */
135
+ price_adjustments?: Array<PlanAddParams.PriceAdjustment>;
136
+ /**
137
+ * A custom trial can be set for the customer's plan. See the
138
+ * [trial configuration documentation](https://docs.metronome.com/provisioning/configure-trials/)
139
+ * for details.
140
+ */
141
+ trial_spec?: PlanAddParams.TrialSpec;
142
+ }
143
+ export declare namespace PlanAddParams {
144
+ interface OverageRateAdjustment {
145
+ custom_credit_type_id: string;
146
+ fiat_currency_credit_type_id: string;
147
+ /**
148
+ * The overage cost in fiat currency for each credit of the custom credit type.
149
+ */
150
+ to_fiat_conversion_factor: number;
151
+ }
152
+ interface PriceAdjustment {
153
+ adjustment_type: 'percentage' | 'fixed' | 'override' | 'quantity';
154
+ charge_id: string;
155
+ /**
156
+ * Used in price ramps. Indicates how many billing periods pass before the charge
157
+ * applies.
158
+ */
159
+ start_period: number;
160
+ /**
161
+ * the overridden quantity for a fixed charge
162
+ */
163
+ quantity?: number;
164
+ /**
165
+ * Used in pricing tiers. Indicates at what metric value the price applies.
166
+ */
167
+ tier?: number;
168
+ /**
169
+ * The amount of change to a price. Percentage and fixed adjustments can be
170
+ * positive or negative. Percentage-based adjustments should be decimals, e.g.
171
+ * -0.05 for a 5% discount.
172
+ */
173
+ value?: number;
174
+ }
175
+ /**
176
+ * A custom trial can be set for the customer's plan. See the
177
+ * [trial configuration documentation](https://docs.metronome.com/provisioning/configure-trials/)
178
+ * for details.
179
+ */
180
+ interface TrialSpec {
181
+ /**
182
+ * Length of the trial period in days.
183
+ */
184
+ length_in_days: number;
185
+ spending_cap?: TrialSpec.SpendingCap;
186
+ }
187
+ namespace TrialSpec {
188
+ interface SpendingCap {
189
+ /**
190
+ * The credit amount in the given denomination based on the credit type, e.g. US
191
+ * cents.
192
+ */
193
+ amount: number;
194
+ /**
195
+ * The credit type ID for the spending cap.
196
+ */
197
+ credit_type_id: string;
198
+ }
199
+ }
200
+ }
201
+ export interface PlanEndParams {
202
+ /**
203
+ * RFC 3339 timestamp for when the plan ends (exclusive) for this customer. Must be
204
+ * at 0:00 UTC (midnight). If not provided, the plan end date will be cleared.
205
+ */
206
+ ending_before?: string;
207
+ /**
208
+ * If true, plan end date can be before the last finalized invoice date. Any
209
+ * invoices generated after the plan end date will be voided.
210
+ */
211
+ void_invoices?: boolean;
212
+ /**
213
+ * Only applicable when void_invoices is set to true. If true, for every invoice
214
+ * that is voided we will also attempt to void/delete the stripe invoice (if any).
215
+ * Stripe invoices will be voided if finalized or deleted if still in draft state.
216
+ */
217
+ void_stripe_invoices?: boolean;
218
+ }
219
+ export interface PlanListPriceAdjustmentsParams {
220
+ /**
221
+ * Max number of results that should be returned
222
+ */
223
+ limit?: number;
224
+ /**
225
+ * Cursor that indicates where the next page of results should start.
226
+ */
227
+ next_page?: string;
228
+ }
229
+ export declare namespace Plans {
230
+ export import PlanListResponse = PlansAPI.PlanListResponse;
231
+ export import PlanAddResponse = PlansAPI.PlanAddResponse;
232
+ export import PlanEndResponse = PlansAPI.PlanEndResponse;
233
+ export import PlanListPriceAdjustmentsResponse = PlansAPI.PlanListPriceAdjustmentsResponse;
234
+ export import PlanListParams = PlansAPI.PlanListParams;
235
+ export import PlanAddParams = PlansAPI.PlanAddParams;
236
+ export import PlanEndParams = PlansAPI.PlanEndParams;
237
+ export import PlanListPriceAdjustmentsParams = PlansAPI.PlanListPriceAdjustmentsParams;
238
+ }
239
+ //# sourceMappingURL=plans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plans.d.ts","sourceRoot":"","sources":["../../src/resources/customers/plans.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,QAAQ,MAAM,0CAA0C,CAAC;AACrE,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAE1D,qBAAa,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,IAAI,CACF,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;IACpC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;IAY1F;;;;OAIG;IACH,GAAG,CACD,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,aAAa,EACnB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;IAInC;;OAEG;IACH,GAAG,CACD,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,IAAI,CAAC,EAAE,aAAa,EACpB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;IACnC,GAAG,CACD,UAAU,EAAE,MAAM,EAClB,cAAc,EA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