orb-billing 4.74.0 → 5.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 (166) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/core.d.ts +7 -4
  3. package/core.d.ts.map +1 -1
  4. package/core.js +16 -9
  5. package/core.js.map +1 -1
  6. package/core.mjs +16 -9
  7. package/core.mjs.map +1 -1
  8. package/index.d.mts +151 -14
  9. package/index.d.ts +151 -14
  10. package/index.d.ts.map +1 -1
  11. package/index.js +6 -5
  12. package/index.js.map +1 -1
  13. package/index.mjs +9 -8
  14. package/index.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/resource.d.ts +1 -1
  17. package/resource.d.ts.map +1 -1
  18. package/resource.js.map +1 -1
  19. package/resource.mjs.map +1 -1
  20. package/resources/alerts.d.ts +20 -88
  21. package/resources/alerts.d.ts.map +1 -1
  22. package/resources/alerts.js.map +1 -1
  23. package/resources/alerts.mjs.map +1 -1
  24. package/resources/beta/beta.d.ts +9 -7313
  25. package/resources/beta/beta.d.ts.map +1 -1
  26. package/resources/beta/beta.js.map +1 -1
  27. package/resources/beta/beta.mjs.map +1 -1
  28. package/resources/beta/external-plan-id.d.ts +7 -7074
  29. package/resources/beta/external-plan-id.d.ts.map +1 -1
  30. package/resources/beta/external-plan-id.js.map +1 -1
  31. package/resources/beta/external-plan-id.mjs.map +1 -1
  32. package/resources/credit-notes.d.ts +64 -164
  33. package/resources/credit-notes.d.ts.map +1 -1
  34. package/resources/credit-notes.js +28 -6
  35. package/resources/credit-notes.js.map +1 -1
  36. package/resources/credit-notes.mjs +27 -4
  37. package/resources/credit-notes.mjs.map +1 -1
  38. package/resources/customers/balance-transactions.d.ts +5 -32
  39. package/resources/customers/balance-transactions.d.ts.map +1 -1
  40. package/resources/customers/balance-transactions.js.map +1 -1
  41. package/resources/customers/balance-transactions.mjs.map +1 -1
  42. package/resources/customers/costs.d.ts +19 -97
  43. package/resources/customers/costs.d.ts.map +1 -1
  44. package/resources/customers/credits/credits.d.ts +4 -4
  45. package/resources/customers/credits/credits.d.ts.map +1 -1
  46. package/resources/customers/credits/credits.js.map +1 -1
  47. package/resources/customers/credits/credits.mjs.map +1 -1
  48. package/resources/customers/credits/index.d.ts +2 -2
  49. package/resources/customers/credits/index.d.ts.map +1 -1
  50. package/resources/customers/credits/index.js.map +1 -1
  51. package/resources/customers/credits/index.mjs.map +1 -1
  52. package/resources/customers/credits/ledger.d.ts +239 -984
  53. package/resources/customers/credits/ledger.d.ts.map +1 -1
  54. package/resources/customers/credits/ledger.js.map +1 -1
  55. package/resources/customers/credits/ledger.mjs.map +1 -1
  56. package/resources/customers/credits/top-ups.d.ts +29 -121
  57. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  58. package/resources/customers/credits/top-ups.js.map +1 -1
  59. package/resources/customers/credits/top-ups.mjs.map +1 -1
  60. package/resources/customers/customers.d.ts +84 -682
  61. package/resources/customers/customers.d.ts.map +1 -1
  62. package/resources/customers/customers.js.map +1 -1
  63. package/resources/customers/customers.mjs.map +1 -1
  64. package/resources/customers/index.d.ts +1 -1
  65. package/resources/customers/index.d.ts.map +1 -1
  66. package/resources/customers/index.js.map +1 -1
  67. package/resources/customers/index.mjs.map +1 -1
  68. package/resources/dimensional-price-groups/dimensional-price-groups.d.ts +6 -2
  69. package/resources/dimensional-price-groups/dimensional-price-groups.d.ts.map +1 -1
  70. package/resources/events/backfills.d.ts +2 -2
  71. package/resources/events/events.d.ts +9 -3
  72. package/resources/events/events.d.ts.map +1 -1
  73. package/resources/index.d.ts +7 -7
  74. package/resources/index.d.ts.map +1 -1
  75. package/resources/index.js +1 -4
  76. package/resources/index.js.map +1 -1
  77. package/resources/index.mjs +3 -3
  78. package/resources/index.mjs.map +1 -1
  79. package/resources/invoice-line-items.d.ts +9 -395
  80. package/resources/invoice-line-items.d.ts.map +1 -1
  81. package/resources/invoice-line-items.js.map +1 -1
  82. package/resources/invoice-line-items.mjs.map +1 -1
  83. package/resources/invoices.d.ts +43 -1704
  84. package/resources/invoices.d.ts.map +1 -1
  85. package/resources/invoices.js +4 -7
  86. package/resources/invoices.js.map +1 -1
  87. package/resources/invoices.mjs +3 -5
  88. package/resources/invoices.mjs.map +1 -1
  89. package/resources/items.d.ts +9 -3
  90. package/resources/items.d.ts.map +1 -1
  91. package/resources/metrics.d.ts +9 -3
  92. package/resources/metrics.d.ts.map +1 -1
  93. package/resources/plans/external-plan-id.d.ts +3 -1
  94. package/resources/plans/external-plan-id.d.ts.map +1 -1
  95. package/resources/plans/plans.d.ts +47 -3783
  96. package/resources/plans/plans.d.ts.map +1 -1
  97. package/resources/plans/plans.js.map +1 -1
  98. package/resources/plans/plans.mjs.map +1 -1
  99. package/resources/prices/external-price-id.d.ts +6 -4
  100. package/resources/prices/external-price-id.d.ts.map +1 -1
  101. package/resources/prices/index.d.ts +1 -1
  102. package/resources/prices/index.d.ts.map +1 -1
  103. package/resources/prices/index.js +1 -2
  104. package/resources/prices/index.js.map +1 -1
  105. package/resources/prices/index.mjs +1 -1
  106. package/resources/prices/index.mjs.map +1 -1
  107. package/resources/prices/prices.d.ts +505 -9417
  108. package/resources/prices/prices.d.ts.map +1 -1
  109. package/resources/prices/prices.js +39 -20
  110. package/resources/prices/prices.js.map +1 -1
  111. package/resources/prices/prices.mjs +38 -18
  112. package/resources/prices/prices.mjs.map +1 -1
  113. package/resources/shared.d.ts +7894 -9
  114. package/resources/shared.d.ts.map +1 -1
  115. package/resources/shared.js +11 -0
  116. package/resources/shared.js.map +1 -1
  117. package/resources/shared.mjs +7 -1
  118. package/resources/shared.mjs.map +1 -1
  119. package/resources/subscription-changes.d.ts +140 -2158
  120. package/resources/subscription-changes.d.ts.map +1 -1
  121. package/resources/subscription-changes.js.map +1 -1
  122. package/resources/subscription-changes.mjs.map +1 -1
  123. package/resources/subscriptions.d.ts +2646 -27141
  124. package/resources/subscriptions.d.ts.map +1 -1
  125. package/resources/subscriptions.js +2 -2
  126. package/resources/subscriptions.js.map +1 -1
  127. package/resources/subscriptions.mjs +2 -2
  128. package/resources/subscriptions.mjs.map +1 -1
  129. package/src/core.ts +17 -8
  130. package/src/index.ts +229 -42
  131. package/src/resource.ts +1 -1
  132. package/src/resources/alerts.ts +20 -94
  133. package/src/resources/beta/beta.ts +124 -8892
  134. package/src/resources/beta/external-plan-id.ts +118 -8593
  135. package/src/resources/credit-notes.ts +67 -216
  136. package/src/resources/customers/balance-transactions.ts +5 -36
  137. package/src/resources/customers/costs.ts +19 -117
  138. package/src/resources/customers/credits/credits.ts +18 -0
  139. package/src/resources/customers/credits/index.ts +9 -0
  140. package/src/resources/customers/credits/ledger.ts +259 -1468
  141. package/src/resources/customers/credits/top-ups.ts +33 -136
  142. package/src/resources/customers/customers.ts +165 -1457
  143. package/src/resources/customers/index.ts +8 -0
  144. package/src/resources/dimensional-price-groups/dimensional-price-groups.ts +2 -2
  145. package/src/resources/events/backfills.ts +2 -2
  146. package/src/resources/events/events.ts +3 -3
  147. package/src/resources/index.ts +42 -22
  148. package/src/resources/invoice-line-items.ts +13 -501
  149. package/src/resources/invoices.ts +65 -2396
  150. package/src/resources/items.ts +3 -3
  151. package/src/resources/metrics.ts +3 -3
  152. package/src/resources/plans/external-plan-id.ts +1 -1
  153. package/src/resources/plans/plans.ts +81 -4563
  154. package/src/resources/prices/external-price-id.ts +4 -4
  155. package/src/resources/prices/index.ts +2 -2
  156. package/src/resources/prices/prices.ts +561 -11851
  157. package/src/resources/shared.ts +9991 -22
  158. package/src/resources/subscription-changes.ts +171 -2670
  159. package/src/resources/subscriptions.ts +3246 -32984
  160. package/src/version.ts +1 -1
  161. package/version.d.ts +1 -1
  162. package/version.d.ts.map +1 -1
  163. package/version.js +1 -1
  164. package/version.js.map +1 -1
  165. package/version.mjs +1 -1
  166. package/version.mjs.map +1 -1
@@ -1,9 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../../resource.mjs";
3
3
  import { isRequestOptions } from "../../core.mjs";
4
+ import { PricesPage } from "../shared.mjs";
4
5
  import * as ExternalPriceIDAPI from "./external-price-id.mjs";
5
6
  import { ExternalPriceID } from "./external-price-id.mjs";
6
- import { Page } from "../../pagination.mjs";
7
7
  export class Prices extends APIResource {
8
8
  constructor() {
9
9
  super(...arguments);
@@ -70,23 +70,14 @@ export class Prices extends APIResource {
70
70
  }
71
71
  /**
72
72
  * This endpoint is used to evaluate the output of price(s) for a given customer
73
- * and time range over either ingested events or preview events. It enables
74
- * filtering and grouping the output using
73
+ * and time range over ingested events. It enables filtering and grouping the
74
+ * output using
75
75
  * [computed properties](/extensibility/advanced-metrics#computed-properties),
76
76
  * supporting the following workflows:
77
77
  *
78
78
  * 1. Showing detailed usage and costs to the end customer.
79
79
  * 2. Auditing subtotals on invoice line items.
80
80
  *
81
- * Prices may either reference existing prices in your Orb account or be defined
82
- * inline in the request body. Up to 100 prices can be evaluated in a single
83
- * request.
84
- *
85
- * Price evaluation by default uses ingested events, but you can also provide a
86
- * list of preview events to use instead. Up to 500 preview events can be provided
87
- * in a single request. When using ingested events, the start of the time range
88
- * must be no more than 100 days ago.
89
- *
90
81
  * For these workflows, the expressiveness of computed properties in both the
91
82
  * filters and grouping is critical. For example, if you'd like to show your
92
83
  * customer their usage grouped by hour and another property, you can do so with
@@ -96,13 +87,44 @@ export class Prices extends APIResource {
96
87
  * with the following `filter`:
97
88
  * `my_property = 'foo' AND my_other_property = 'bar'`.
98
89
  *
99
- * The length of the results must be no greater than 1000. Note that this is a POST
100
- * endpoint rather than a GET endpoint because it employs a JSON body rather than
101
- * query parameters.
90
+ * Prices may either reference existing prices in your Orb account or be defined
91
+ * inline in the request body. Up to 100 prices can be evaluated in a single
92
+ * request.
93
+ *
94
+ * Prices are evaluated on ingested events and the start of the time range must be
95
+ * no more than 100 days ago. To evaluate based off a set of provided events, the
96
+ * [evaluate preview events](/api-reference/price/evaluate-preview-events) endpoint
97
+ * can be used instead.
98
+ *
99
+ * Note that this is a POST endpoint rather than a GET endpoint because it employs
100
+ * a JSON body rather than query parameters.
102
101
  */
103
102
  evaluateMultiple(body, options) {
104
103
  return this._client.post('/prices/evaluate', { body, ...options });
105
104
  }
105
+ /**
106
+ * This endpoint evaluates prices on preview events instead of actual usage, making
107
+ * it ideal for building price calculators and cost estimation tools. You can
108
+ * filter and group results using
109
+ * [computed properties](/extensibility/advanced-metrics#computed-properties) to
110
+ * analyze pricing across different dimensions.
111
+ *
112
+ * Prices may either reference existing prices in your Orb account or be defined
113
+ * inline in the request body. The endpoint has the following limitations:
114
+ *
115
+ * 1. Up to 100 prices can be evaluated in a single request.
116
+ * 2. Up to 500 preview events can be provided in a single request.
117
+ *
118
+ * A top-level customer_id is required to evaluate the preview events.
119
+ * Additionally, all events without a customer_id will have the top-level
120
+ * customer_id added.
121
+ *
122
+ * Note that this is a POST endpoint rather than a GET endpoint because it employs
123
+ * a JSON body rather than query parameters.
124
+ */
125
+ evaluatePreviewEvents(body, options) {
126
+ return this._client.post('/prices/evaluate_preview_events', { body, ...options });
127
+ }
106
128
  /**
107
129
  * This endpoint returns a price given an identifier.
108
130
  */
@@ -110,8 +132,6 @@ export class Prices extends APIResource {
110
132
  return this._client.get(`/prices/${priceId}`, options);
111
133
  }
112
134
  }
113
- export class PricesPage extends Page {
114
- }
115
- Prices.PricesPage = PricesPage;
116
135
  Prices.ExternalPriceID = ExternalPriceID;
136
+ export { PricesPage };
117
137
  //# sourceMappingURL=prices.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"prices.mjs","sourceRoot":"","sources":["../../src/resources/prices/prices.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAIpB,KAAK,kBAAkB;OACvB,EAAE,eAAe,EAA+B;OAChD,EAAE,IAAI,EAAmB;AAEhC,MAAM,OAAO,MAAO,SAAQ,WAAW;IAAvC;;QACE,oBAAe,GAAuC,IAAI,kBAAkB,CAAC,eAAe,C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