@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,469 @@
1
+ import * as Core from '@metronome/sdk/core';
2
+ import { APIResource } from '@metronome/sdk/resource';
3
+ import * as CreditGrantsAPI from '@metronome/sdk/resources/credit-grants';
4
+ import * as Shared from '@metronome/sdk/resources/shared';
5
+ export declare class CreditGrants extends APIResource {
6
+ /**
7
+ * Create a new credit grant
8
+ */
9
+ create(body: CreditGrantCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantCreateResponse>;
10
+ /**
11
+ * List credit grants. This list does not included voided grants.
12
+ */
13
+ list(params?: CreditGrantListParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantListResponse>;
14
+ list(options?: Core.RequestOptions): Core.APIPromise<CreditGrantListResponse>;
15
+ /**
16
+ * Edit an existing credit grant
17
+ */
18
+ edit(body: CreditGrantEditParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantEditResponse>;
19
+ /**
20
+ * List all pricing units (known in the API by the legacy term "credit types").
21
+ */
22
+ listCreditTypes(query?: CreditGrantListCreditTypesParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantListCreditTypesResponse>;
23
+ listCreditTypes(options?: Core.RequestOptions): Core.APIPromise<CreditGrantListCreditTypesResponse>;
24
+ /**
25
+ * Fetches a list of credit ledger entries. Returns lists of ledgers per customer.
26
+ * Ledger entries are returned in reverse chronological order. Ledger entries
27
+ * associated with voided credit grants are not included.
28
+ */
29
+ listEntries(params?: CreditGrantListEntriesParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantListEntriesResponse>;
30
+ listEntries(options?: Core.RequestOptions): Core.APIPromise<CreditGrantListEntriesResponse>;
31
+ /**
32
+ * Void a credit grant
33
+ */
34
+ void(body: CreditGrantVoidParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantVoidResponse>;
35
+ }
36
+ export interface CreditLedgerEntry {
37
+ /**
38
+ * an amount representing the change to the customer's credit balance
39
+ */
40
+ amount: number;
41
+ created_by: string;
42
+ /**
43
+ * the credit grant this entry is related to
44
+ */
45
+ credit_grant_id: string;
46
+ effective_at: string;
47
+ reason: string;
48
+ /**
49
+ * the running balance for this credit type at the time of the ledger entry,
50
+ * including all preceding charges
51
+ */
52
+ running_balance: number;
53
+ /**
54
+ * if this entry is a deduction, the Metronome ID of the invoice where the credit
55
+ * deduction was consumed; if this entry is a grant, the Metronome ID of the
56
+ * invoice where the grant's paid_amount was charged
57
+ */
58
+ invoice_id?: string | null;
59
+ }
60
+ export interface RolloverAmountMaxAmount {
61
+ /**
62
+ * Rollover up to a fixed amount of the original credit grant amount.
63
+ */
64
+ type: 'MAX_AMOUNT';
65
+ /**
66
+ * The maximum amount to rollover.
67
+ */
68
+ value: number;
69
+ }
70
+ export interface RolloverAmountMaxPercentage {
71
+ /**
72
+ * Rollover up to a percentage of the original credit grant amount.
73
+ */
74
+ type: 'MAX_PERCENTAGE';
75
+ /**
76
+ * The maximum percentage (0-1) of the original credit grant to rollover.
77
+ */
78
+ value: number;
79
+ }
80
+ export interface CreditGrantCreateResponse {
81
+ data: Shared.ID;
82
+ }
83
+ export interface CreditGrantListResponse {
84
+ data: Array<CreditGrantListResponse.Data>;
85
+ next_page: string | null;
86
+ }
87
+ export declare namespace CreditGrantListResponse {
88
+ interface Data {
89
+ /**
90
+ * the Metronome ID of the credit grant
91
+ */
92
+ id: string;
93
+ /**
94
+ * The effective balance of the grant as of the end of the customer's current
95
+ * billing period. Expiration deductions will be included only if the grant expires
96
+ * before the end of the current billing period.
97
+ */
98
+ balance: Data.Balance;
99
+ custom_fields: Record<string, string>;
100
+ /**
101
+ * the Metronome ID of the customer
102
+ */
103
+ customer_id: string;
104
+ deductions: Array<CreditGrantsAPI.CreditLedgerEntry>;
105
+ effective_at: string;
106
+ expires_at: string;
107
+ /**
108
+ * the amount of credits initially granted
109
+ */
110
+ grant_amount: Data.GrantAmount;
111
+ name: string;
112
+ /**
113
+ * the amount paid for this credit grant
114
+ */
115
+ paid_amount: Data.PaidAmount;
116
+ pending_deductions: Array<CreditGrantsAPI.CreditLedgerEntry>;
117
+ priority: number;
118
+ credit_grant_type?: string | null;
119
+ /**
120
+ * the Metronome ID of the invoice with the purchase charge for this credit grant,
121
+ * if applicable
122
+ */
123
+ invoice_id?: string | null;
124
+ /**
125
+ * The products which these credits will be applied to. (If unspecified, the
126
+ * credits will be applied to charges for all products.)
127
+ */
128
+ products?: Array<Data.Product>;
129
+ reason?: string | null;
130
+ /**
131
+ * Prevents the creation of duplicates. If a request to create a record is made
132
+ * with a previously used uniqueness key, a new record will not be created and the
133
+ * request will fail with a 409 error.
134
+ */
135
+ uniqueness_key?: string | null;
136
+ }
137
+ namespace Data {
138
+ /**
139
+ * The effective balance of the grant as of the end of the customer's current
140
+ * billing period. Expiration deductions will be included only if the grant expires
141
+ * before the end of the current billing period.
142
+ */
143
+ interface Balance {
144
+ /**
145
+ * The end_date of the customer's current billing period.
146
+ */
147
+ effective_at: string;
148
+ /**
149
+ * The grant's current balance including all posted deductions. If the grant has
150
+ * expired, this amount will be 0.
151
+ */
152
+ excluding_pending: number;
153
+ /**
154
+ * The grant's current balance including all posted and pending deductions. If the
155
+ * grant expires before the end of the customer's current billing period, this
156
+ * amount will be 0.
157
+ */
158
+ including_pending: number;
159
+ }
160
+ /**
161
+ * the amount of credits initially granted
162
+ */
163
+ interface GrantAmount {
164
+ amount: number;
165
+ /**
166
+ * the credit type for the amount granted
167
+ */
168
+ credit_type: Shared.CreditType;
169
+ }
170
+ /**
171
+ * the amount paid for this credit grant
172
+ */
173
+ interface PaidAmount {
174
+ amount: number;
175
+ /**
176
+ * the credit type for the amount paid
177
+ */
178
+ credit_type: Shared.CreditType;
179
+ }
180
+ interface Product {
181
+ id: string;
182
+ name: string;
183
+ }
184
+ }
185
+ }
186
+ export interface CreditGrantEditResponse {
187
+ data: Shared.ID;
188
+ }
189
+ export interface CreditGrantListCreditTypesResponse {
190
+ data: Array<CreditGrantListCreditTypesResponse.Data>;
191
+ next_page: string | null;
192
+ }
193
+ export declare namespace CreditGrantListCreditTypesResponse {
194
+ interface Data {
195
+ id?: string;
196
+ is_currency?: boolean;
197
+ name?: string;
198
+ }
199
+ }
200
+ export interface CreditGrantListEntriesResponse {
201
+ data: Array<CreditGrantListEntriesResponse.Data>;
202
+ next_page: string | null;
203
+ }
204
+ export declare namespace CreditGrantListEntriesResponse {
205
+ interface Data {
206
+ customer_id: string;
207
+ ledgers: Array<Data.Ledger>;
208
+ }
209
+ namespace Data {
210
+ interface Ledger {
211
+ credit_type: Shared.CreditType;
212
+ /**
213
+ * the effective balances at the end of the specified time window
214
+ */
215
+ ending_balance: Ledger.EndingBalance;
216
+ entries: Array<CreditGrantsAPI.CreditLedgerEntry>;
217
+ pending_entries: Array<CreditGrantsAPI.CreditLedgerEntry>;
218
+ starting_balance: Ledger.StartingBalance;
219
+ }
220
+ namespace Ledger {
221
+ /**
222
+ * the effective balances at the end of the specified time window
223
+ */
224
+ interface EndingBalance {
225
+ /**
226
+ * the ending_before request parameter (if supplied) or the current billing
227
+ * period's end date
228
+ */
229
+ effective_at: string;
230
+ /**
231
+ * the ending balance, including the balance of all grants that have not expired
232
+ * before the effective_at date and deductions that happened before the
233
+ * effective_at date
234
+ */
235
+ excluding_pending: number;
236
+ /**
237
+ * the excluding_pending balance plus any pending invoice deductions and
238
+ * expirations that will happen by the effective_at date
239
+ */
240
+ including_pending: number;
241
+ }
242
+ interface StartingBalance {
243
+ /**
244
+ * the starting_on request parameter (if supplied) or the first credit grant's
245
+ * effective_at date
246
+ */
247
+ effective_at: string;
248
+ /**
249
+ * the starting balance, including all posted grants, deductions, and expirations
250
+ * that happened at or before the effective_at timestamp
251
+ */
252
+ excluding_pending: number;
253
+ /**
254
+ * the excluding_pending balance plus any pending activity that has not been posted
255
+ * at the time of the query
256
+ */
257
+ including_pending: number;
258
+ }
259
+ }
260
+ }
261
+ }
262
+ export interface CreditGrantVoidResponse {
263
+ data: Shared.ID;
264
+ }
265
+ export interface CreditGrantCreateParams {
266
+ /**
267
+ * the Metronome ID of the customer
268
+ */
269
+ customer_id: string;
270
+ /**
271
+ * The credit grant will only apply to billing periods that end before this
272
+ * timestamp.
273
+ */
274
+ expires_at: string;
275
+ /**
276
+ * the amount of credits granted
277
+ */
278
+ grant_amount: CreditGrantCreateParams.GrantAmount;
279
+ /**
280
+ * the name of the credit grant as it will appear on invoices
281
+ */
282
+ name: string;
283
+ /**
284
+ * the amount paid for this credit grant
285
+ */
286
+ paid_amount: CreditGrantCreateParams.PaidAmount;
287
+ priority: number;
288
+ credit_grant_type?: string;
289
+ /**
290
+ * Custom fields to attach to the credit grant.
291
+ */
292
+ custom_fields?: Record<string, string>;
293
+ /**
294
+ * The credit grant will only apply to billing periods that end at or after this
295
+ * timestamp.
296
+ */
297
+ effective_at?: string;
298
+ /**
299
+ * The date to issue an invoice for the paid_amount.
300
+ */
301
+ invoice_date?: string;
302
+ /**
303
+ * The product(s) which these credits will be applied to. (If unspecified, the
304
+ * credits will be applied to charges for all products.). The array ordering
305
+ * specified here will be used to determine the order in which credits will be
306
+ * applied to invoice line items
307
+ */
308
+ product_ids?: Array<string>;
309
+ reason?: string;
310
+ /**
311
+ * Configure a rollover for this credit grant so if it expires it rolls over a
312
+ * configured amount to a new credit grant. This feature is currently opt-in only.
313
+ * Contact Metronome to be added to the beta.
314
+ */
315
+ rollover_settings?: CreditGrantCreateParams.RolloverSettings;
316
+ /**
317
+ * Prevents the creation of duplicates. If a request to create a record is made
318
+ * with a previously used uniqueness key, a new record will not be created and the
319
+ * request will fail with a 409 error.
320
+ */
321
+ uniqueness_key?: string;
322
+ }
323
+ export declare namespace CreditGrantCreateParams {
324
+ /**
325
+ * the amount of credits granted
326
+ */
327
+ interface GrantAmount {
328
+ amount: number;
329
+ credit_type_id: string;
330
+ }
331
+ /**
332
+ * the amount paid for this credit grant
333
+ */
334
+ interface PaidAmount {
335
+ amount: number;
336
+ credit_type_id: string;
337
+ }
338
+ /**
339
+ * Configure a rollover for this credit grant so if it expires it rolls over a
340
+ * configured amount to a new credit grant. This feature is currently opt-in only.
341
+ * Contact Metronome to be added to the beta.
342
+ */
343
+ interface RolloverSettings {
344
+ /**
345
+ * The date to expire the rollover credits.
346
+ */
347
+ expires_at: string;
348
+ /**
349
+ * The priority to give the rollover credit grant that gets created when a rollover
350
+ * happens.
351
+ */
352
+ priority: number;
353
+ /**
354
+ * Specify how much to rollover to the rollover credit grant
355
+ */
356
+ rollover_amount: CreditGrantsAPI.RolloverAmountMaxPercentage | CreditGrantsAPI.RolloverAmountMaxAmount;
357
+ }
358
+ }
359
+ export interface CreditGrantListParams {
360
+ /**
361
+ * Query param: Max number of results that should be returned
362
+ */
363
+ limit?: number;
364
+ /**
365
+ * Query param: Cursor that indicates where the next page of results should start.
366
+ */
367
+ next_page?: string;
368
+ /**
369
+ * Body param: An array of credit grant IDs. If this is specified, neither
370
+ * credit_type_ids nor customer_ids may be specified.
371
+ */
372
+ credit_grant_ids?: Array<string>;
373
+ /**
374
+ * Body param: An array of credit type IDs. This must not be specified if
375
+ * credit_grant_ids is specified.
376
+ */
377
+ credit_type_ids?: Array<string>;
378
+ /**
379
+ * Body param: An array of Metronome customer IDs. This must not be specified if
380
+ * credit_grant_ids is specified.
381
+ */
382
+ customer_ids?: Array<string>;
383
+ /**
384
+ * Body param: Only return credit grants that are effective before this timestamp
385
+ * (exclusive).
386
+ */
387
+ effective_before?: string;
388
+ /**
389
+ * Body param: Only return credit grants that expire at or after this timestamp.
390
+ */
391
+ not_expiring_before?: string;
392
+ }
393
+ export interface CreditGrantEditParams {
394
+ /**
395
+ * the ID of the credit grant
396
+ */
397
+ id: string;
398
+ /**
399
+ * the updated expiration date for the credit grant
400
+ */
401
+ expires_at?: string;
402
+ /**
403
+ * the updated name for the credit grant
404
+ */
405
+ name?: string;
406
+ }
407
+ export interface CreditGrantListCreditTypesParams {
408
+ /**
409
+ * Max number of results that should be returned
410
+ */
411
+ limit?: number;
412
+ /**
413
+ * Cursor that indicates where the next page of results should start.
414
+ */
415
+ next_page?: string;
416
+ }
417
+ export interface CreditGrantListEntriesParams {
418
+ /**
419
+ * Query param: Cursor that indicates where the next page of results should start.
420
+ */
421
+ next_page?: string;
422
+ /**
423
+ * Body param: A list of Metronome credit type IDs to fetch ledger entries for. If
424
+ * absent, ledger entries for all credit types will be returned.
425
+ */
426
+ credit_type_ids?: Array<string>;
427
+ /**
428
+ * Body param: A list of Metronome customer IDs to fetch ledger entries for. If
429
+ * absent, ledger entries for all customers will be returned.
430
+ */
431
+ customer_ids?: Array<string>;
432
+ /**
433
+ * Body param: If supplied, ledger entries will only be returned with an
434
+ * effective_at before this time. This timestamp must not be in the future. If no
435
+ * timestamp is supplied, all entries up to the start of the customer's next
436
+ * billing period will be returned.
437
+ */
438
+ ending_before?: string;
439
+ /**
440
+ * Body param: If supplied, only ledger entries effective at or after this time
441
+ * will be returned.
442
+ */
443
+ starting_on?: string;
444
+ }
445
+ export interface CreditGrantVoidParams {
446
+ id: string;
447
+ /**
448
+ * If true, void the purchase invoice associated with the grant
449
+ */
450
+ void_credit_purchase_invoice?: boolean;
451
+ }
452
+ export declare namespace CreditGrants {
453
+ export import CreditLedgerEntry = CreditGrantsAPI.CreditLedgerEntry;
454
+ export import RolloverAmountMaxAmount = CreditGrantsAPI.RolloverAmountMaxAmount;
455
+ export import RolloverAmountMaxPercentage = CreditGrantsAPI.RolloverAmountMaxPercentage;
456
+ export import CreditGrantCreateResponse = CreditGrantsAPI.CreditGrantCreateResponse;
457
+ export import CreditGrantListResponse = CreditGrantsAPI.CreditGrantListResponse;
458
+ export import CreditGrantEditResponse = CreditGrantsAPI.CreditGrantEditResponse;
459
+ export import CreditGrantListCreditTypesResponse = CreditGrantsAPI.CreditGrantListCreditTypesResponse;
460
+ export import CreditGrantListEntriesResponse = CreditGrantsAPI.CreditGrantListEntriesResponse;
461
+ export import CreditGrantVoidResponse = CreditGrantsAPI.CreditGrantVoidResponse;
462
+ export import CreditGrantCreateParams = CreditGrantsAPI.CreditGrantCreateParams;
463
+ export import CreditGrantListParams = CreditGrantsAPI.CreditGrantListParams;
464
+ export import CreditGrantEditParams = CreditGrantsAPI.CreditGrantEditParams;
465
+ export import CreditGrantListCreditTypesParams = CreditGrantsAPI.CreditGrantListCreditTypesParams;
466
+ export import CreditGrantListEntriesParams = CreditGrantsAPI.CreditGrantListEntriesParams;
467
+ export import CreditGrantVoidParams = CreditGrantsAPI.CreditGrantVoidParams;
468
+ }
469
+ //# sourceMappingURL=credit-grants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credit-grants.d.ts","sourceRoot":"","sources":["../src/resources/credit-grants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,eAAe,MAAM,wCAAwC,CAAC;AAC1E,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAE1D,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC;IAI7C;;OAEG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC;IAC3C,IAAI,CAAC,OAAO,CAAC,EAAE,I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IAC9F,MAAM,QAAQ,uBAAuB,GAAG,eAAe,CAAC,uBAAuB,CAAC;IAChF,MAAM,QAAQ,uBAAuB,GAAG,eAAe,CAAC,uBAAuB,CAAC;IAChF,MAAM,QAAQ,qBAAqB,GAAG,eAAe,CAAC,qBAAqB,CAAC;IAC5E,MAAM,QAAQ,qBAAqB,GAAG,eAAe,CAAC,qBAAqB,CAAC;IAC5E,MAAM,QAAQ,gCAAgC,GAAG,eAAe,CAAC,gCAAgC,CAAC;IAClG,MAAM,QAAQ,4BAA4B,GAAG,eAAe,CAAC,4BAA4B,CAAC;IAC1F,MAAM,QAAQ,qBAAqB,GAAG,eAAe,CAAC,qBAAqB,CAAC;CAC7E"}
@@ -0,0 +1,50 @@
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.CreditGrants = void 0;
5
+ const resource_1 = require("@metronome/sdk/resource");
6
+ const core_1 = require("@metronome/sdk/core");
7
+ class CreditGrants extends resource_1.APIResource {
8
+ /**
9
+ * Create a new credit grant
10
+ */
11
+ create(body, options) {
12
+ return this._client.post('/credits/createGrant', { body, ...options });
13
+ }
14
+ list(params = {}, options) {
15
+ if ((0, core_1.isRequestOptions)(params)) {
16
+ return this.list({}, params);
17
+ }
18
+ const { limit, next_page, ...body } = params;
19
+ return this._client.post('/credits/listGrants', { query: { limit, next_page }, body, ...options });
20
+ }
21
+ /**
22
+ * Edit an existing credit grant
23
+ */
24
+ edit(body, options) {
25
+ return this._client.post('/credits/editGrant', { body, ...options });
26
+ }
27
+ listCreditTypes(query = {}, options) {
28
+ if ((0, core_1.isRequestOptions)(query)) {
29
+ return this.listCreditTypes({}, query);
30
+ }
31
+ return this._client.get('/credit-types/list', { query, ...options });
32
+ }
33
+ listEntries(params = {}, options) {
34
+ if ((0, core_1.isRequestOptions)(params)) {
35
+ return this.listEntries({}, params);
36
+ }
37
+ const { next_page, ...body } = params;
38
+ return this._client.post('/credits/listEntries', { query: { next_page }, body, ...options });
39
+ }
40
+ /**
41
+ * Void a credit grant
42
+ */
43
+ void(body, options) {
44
+ return this._client.post('/credits/voidGrant', { body, ...options });
45
+ }
46
+ }
47
+ exports.CreditGrants = CreditGrants;
48
+ (function (CreditGrants) {
49
+ })(CreditGrants = exports.CreditGrants || (exports.CreditGrants = {}));
50
+ //# sourceMappingURL=credit-grants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credit-grants.js","sourceRoot":"","sources":["../src/resources/credit-grants.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAGtF,sDAAsD;AACtD,8CAAuD;AAIvD,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;OAEG;IACH,MAAM,CACJ,IAA6B,EAC7B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAUD,IAAI,CACF,SAAsD,EAAE,EACxD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,MAAM,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SAC9B;QACD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,IAA2B,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAUD,eAAe,CACb,QAAgE,EAAE,EAClE,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAYD,WAAW,CACT,SAA6D,EAAE,EAC/D,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,MAAM,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SACrC;QACD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,IAA2B,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF;AAlFD,oCAkFC;AAwgBD,WAAiB,YAAY;AAgB7B,CAAC,EAhBgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAgB5B"}
@@ -0,0 +1,46 @@
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 CreditGrants extends APIResource {
5
+ /**
6
+ * Create a new credit grant
7
+ */
8
+ create(body, options) {
9
+ return this._client.post('/credits/createGrant', { body, ...options });
10
+ }
11
+ list(params = {}, options) {
12
+ if (isRequestOptions(params)) {
13
+ return this.list({}, params);
14
+ }
15
+ const { limit, next_page, ...body } = params;
16
+ return this._client.post('/credits/listGrants', { query: { limit, next_page }, body, ...options });
17
+ }
18
+ /**
19
+ * Edit an existing credit grant
20
+ */
21
+ edit(body, options) {
22
+ return this._client.post('/credits/editGrant', { body, ...options });
23
+ }
24
+ listCreditTypes(query = {}, options) {
25
+ if (isRequestOptions(query)) {
26
+ return this.listCreditTypes({}, query);
27
+ }
28
+ return this._client.get('/credit-types/list', { query, ...options });
29
+ }
30
+ listEntries(params = {}, options) {
31
+ if (isRequestOptions(params)) {
32
+ return this.listEntries({}, params);
33
+ }
34
+ const { next_page, ...body } = params;
35
+ return this._client.post('/credits/listEntries', { query: { next_page }, body, ...options });
36
+ }
37
+ /**
38
+ * Void a credit grant
39
+ */
40
+ void(body, options) {
41
+ return this._client.post('/credits/voidGrant', { body, ...options });
42
+ }
43
+ }
44
+ (function (CreditGrants) {
45
+ })(CreditGrants || (CreditGrants = {}));
46
+ //# sourceMappingURL=credit-grants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credit-grants.mjs","sourceRoot":"","sources":["../src/resources/credit-grants.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,WAAW,EAAE,MAAM,yBAAyB;OAC9C,EAAE,gBAAgB,EAAE,MAAM,qBAAqB;AAItD,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;OAEG;IACH,MAAM,CACJ,IAA6B,EAC7B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAUD,IAAI,CACF,SAAsD,EAAE,EACxD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SAC9B;QACD,MAAM,EAAE,KAAK,EAAE,SAAS,EA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ACF;AAwgBD,WAAiB,YAAY;AAgB7B,CAAC,EAhBgB,YAAY,KAAZ,YAAY,QAgB5B"}
@@ -0,0 +1,82 @@
1
+ import * as Core from '@metronome/sdk/core';
2
+ import { APIResource } from '@metronome/sdk/resource';
3
+ import * as CustomFieldsAPI from '@metronome/sdk/resources/custom-fields';
4
+ export declare class CustomFields extends APIResource {
5
+ /**
6
+ * Add a key to the allow list for a given entity. There is a 100 character limit
7
+ * on custom field keys.
8
+ */
9
+ addKey(body: CustomFieldAddKeyParams, options?: Core.RequestOptions): Core.APIPromise<void>;
10
+ /**
11
+ * Deletes one or more custom fields on an instance of a Metronome entity.
12
+ */
13
+ deleteValues(body: CustomFieldDeleteValuesParams, options?: Core.RequestOptions): Core.APIPromise<void>;
14
+ /**
15
+ * List all active custom field keys, optionally filtered by entity type.
16
+ */
17
+ listKeys(params?: CustomFieldListKeysParams, options?: Core.RequestOptions): Core.APIPromise<CustomFieldListKeysResponse>;
18
+ listKeys(options?: Core.RequestOptions): Core.APIPromise<CustomFieldListKeysResponse>;
19
+ /**
20
+ * Remove a key from the allow list for a given entity.
21
+ */
22
+ removeKey(body: CustomFieldRemoveKeyParams, options?: Core.RequestOptions): Core.APIPromise<void>;
23
+ /**
24
+ * Sets one or more custom fields on an instance of a Metronome entity. If a
25
+ * key/value pair passed in this request matches one already set on the entity, its
26
+ * value will be overwritten. Any key/value pairs that exist on the entity that do
27
+ * not match those passed in this request will remain untouched. This endpoint is
28
+ * transactional and will update all key/value pairs or no key/value pairs. Partial
29
+ * updates are not supported. There is a 200 character limit on custom field
30
+ * values.
31
+ */
32
+ setValues(body: CustomFieldSetValuesParams, options?: Core.RequestOptions): Core.APIPromise<void>;
33
+ }
34
+ export interface CustomFieldListKeysResponse {
35
+ data: Array<CustomFieldListKeysResponse.Data>;
36
+ next_page: string | null;
37
+ }
38
+ export declare namespace CustomFieldListKeysResponse {
39
+ interface Data {
40
+ enforce_uniqueness: boolean;
41
+ entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
42
+ key: string;
43
+ }
44
+ }
45
+ export interface CustomFieldAddKeyParams {
46
+ enforce_uniqueness: boolean;
47
+ entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
48
+ key: string;
49
+ }
50
+ export interface CustomFieldDeleteValuesParams {
51
+ entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
52
+ entity_id: string;
53
+ keys: Array<string>;
54
+ }
55
+ export interface CustomFieldListKeysParams {
56
+ /**
57
+ * Query param: Cursor that indicates where the next page of results should start.
58
+ */
59
+ next_page?: string;
60
+ /**
61
+ * Body param: Optional list of entity types to return keys for
62
+ */
63
+ entities?: Array<'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge'>;
64
+ }
65
+ export interface CustomFieldRemoveKeyParams {
66
+ entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
67
+ key: string;
68
+ }
69
+ export interface CustomFieldSetValuesParams {
70
+ custom_fields: Record<string, string>;
71
+ entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
72
+ entity_id: string;
73
+ }
74
+ export declare namespace CustomFields {
75
+ export import CustomFieldListKeysResponse = CustomFieldsAPI.CustomFieldListKeysResponse;
76
+ export import CustomFieldAddKeyParams = CustomFieldsAPI.CustomFieldAddKeyParams;
77
+ export import CustomFieldDeleteValuesParams = CustomFieldsAPI.CustomFieldDeleteValuesParams;
78
+ export import CustomFieldListKeysParams = CustomFieldsAPI.CustomFieldListKeysParams;
79
+ export import CustomFieldRemoveKeyParams = CustomFieldsAPI.CustomFieldRemoveKeyParams;
80
+ export import CustomFieldSetValuesParams = CustomFieldsAPI.CustomFieldSetValuesParams;
81
+ }
82
+ //# sourceMappingURL=custom-fields.d.ts.map