orb-billing 4.74.0 → 5.0.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 (137) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/index.d.mts +148 -14
  3. package/index.d.ts +148 -14
  4. package/index.d.ts.map +1 -1
  5. package/index.js +0 -3
  6. package/index.js.map +1 -1
  7. package/index.mjs +3 -6
  8. package/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/alerts.d.ts +20 -88
  11. package/resources/alerts.d.ts.map +1 -1
  12. package/resources/alerts.js.map +1 -1
  13. package/resources/alerts.mjs.map +1 -1
  14. package/resources/beta/beta.d.ts +9 -7313
  15. package/resources/beta/beta.d.ts.map +1 -1
  16. package/resources/beta/beta.js.map +1 -1
  17. package/resources/beta/beta.mjs.map +1 -1
  18. package/resources/beta/external-plan-id.d.ts +7 -7074
  19. package/resources/beta/external-plan-id.d.ts.map +1 -1
  20. package/resources/beta/external-plan-id.js.map +1 -1
  21. package/resources/beta/external-plan-id.mjs.map +1 -1
  22. package/resources/credit-notes.d.ts +9 -163
  23. package/resources/credit-notes.d.ts.map +1 -1
  24. package/resources/credit-notes.js +3 -6
  25. package/resources/credit-notes.js.map +1 -1
  26. package/resources/credit-notes.mjs +2 -4
  27. package/resources/credit-notes.mjs.map +1 -1
  28. package/resources/customers/balance-transactions.d.ts +5 -32
  29. package/resources/customers/balance-transactions.d.ts.map +1 -1
  30. package/resources/customers/balance-transactions.js.map +1 -1
  31. package/resources/customers/balance-transactions.mjs.map +1 -1
  32. package/resources/customers/costs.d.ts +3 -81
  33. package/resources/customers/costs.d.ts.map +1 -1
  34. package/resources/customers/credits/credits.d.ts +4 -4
  35. package/resources/customers/credits/credits.d.ts.map +1 -1
  36. package/resources/customers/credits/credits.js.map +1 -1
  37. package/resources/customers/credits/credits.mjs.map +1 -1
  38. package/resources/customers/credits/index.d.ts +2 -2
  39. package/resources/customers/credits/index.d.ts.map +1 -1
  40. package/resources/customers/credits/index.js.map +1 -1
  41. package/resources/customers/credits/index.mjs.map +1 -1
  42. package/resources/customers/credits/ledger.d.ts +171 -962
  43. package/resources/customers/credits/ledger.d.ts.map +1 -1
  44. package/resources/customers/credits/ledger.js.map +1 -1
  45. package/resources/customers/credits/ledger.mjs.map +1 -1
  46. package/resources/customers/credits/top-ups.d.ts +29 -121
  47. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  48. package/resources/customers/credits/top-ups.js.map +1 -1
  49. package/resources/customers/credits/top-ups.mjs.map +1 -1
  50. package/resources/customers/customers.d.ts +72 -678
  51. package/resources/customers/customers.d.ts.map +1 -1
  52. package/resources/customers/customers.js.map +1 -1
  53. package/resources/customers/customers.mjs.map +1 -1
  54. package/resources/customers/index.d.ts +1 -1
  55. package/resources/customers/index.d.ts.map +1 -1
  56. package/resources/customers/index.js.map +1 -1
  57. package/resources/customers/index.mjs.map +1 -1
  58. package/resources/index.d.ts +7 -7
  59. package/resources/index.d.ts.map +1 -1
  60. package/resources/index.js +1 -4
  61. package/resources/index.js.map +1 -1
  62. package/resources/index.mjs +3 -3
  63. package/resources/index.mjs.map +1 -1
  64. package/resources/invoice-line-items.d.ts +6 -395
  65. package/resources/invoice-line-items.d.ts.map +1 -1
  66. package/resources/invoice-line-items.js.map +1 -1
  67. package/resources/invoice-line-items.mjs.map +1 -1
  68. package/resources/invoices.d.ts +30 -1700
  69. package/resources/invoices.d.ts.map +1 -1
  70. package/resources/invoices.js +3 -6
  71. package/resources/invoices.js.map +1 -1
  72. package/resources/invoices.mjs +2 -4
  73. package/resources/invoices.mjs.map +1 -1
  74. package/resources/plans/plans.d.ts +7 -3801
  75. package/resources/plans/plans.d.ts.map +1 -1
  76. package/resources/plans/plans.js.map +1 -1
  77. package/resources/plans/plans.mjs.map +1 -1
  78. package/resources/prices/external-price-id.d.ts +3 -3
  79. package/resources/prices/external-price-id.d.ts.map +1 -1
  80. package/resources/prices/index.d.ts +1 -1
  81. package/resources/prices/index.d.ts.map +1 -1
  82. package/resources/prices/index.js +1 -2
  83. package/resources/prices/index.js.map +1 -1
  84. package/resources/prices/index.mjs +1 -1
  85. package/resources/prices/index.mjs.map +1 -1
  86. package/resources/prices/prices.d.ts +346 -9372
  87. package/resources/prices/prices.d.ts.map +1 -1
  88. package/resources/prices/prices.js +39 -20
  89. package/resources/prices/prices.js.map +1 -1
  90. package/resources/prices/prices.mjs +38 -18
  91. package/resources/prices/prices.mjs.map +1 -1
  92. package/resources/shared.d.ts +7269 -9
  93. package/resources/shared.d.ts.map +1 -1
  94. package/resources/shared.js +11 -0
  95. package/resources/shared.js.map +1 -1
  96. package/resources/shared.mjs +7 -1
  97. package/resources/shared.mjs.map +1 -1
  98. package/resources/subscription-changes.d.ts +138 -2158
  99. package/resources/subscription-changes.d.ts.map +1 -1
  100. package/resources/subscription-changes.js.map +1 -1
  101. package/resources/subscription-changes.mjs.map +1 -1
  102. package/resources/subscriptions.d.ts +2639 -27234
  103. package/resources/subscriptions.d.ts.map +1 -1
  104. package/resources/subscriptions.js +1 -1
  105. package/resources/subscriptions.js.map +1 -1
  106. package/resources/subscriptions.mjs +1 -1
  107. package/resources/subscriptions.mjs.map +1 -1
  108. package/src/index.ts +219 -42
  109. package/src/resources/alerts.ts +20 -94
  110. package/src/resources/beta/beta.ts +124 -8892
  111. package/src/resources/beta/external-plan-id.ts +118 -8593
  112. package/src/resources/credit-notes.ts +10 -217
  113. package/src/resources/customers/balance-transactions.ts +5 -36
  114. package/src/resources/customers/costs.ts +3 -101
  115. package/src/resources/customers/credits/credits.ts +18 -0
  116. package/src/resources/customers/credits/index.ts +9 -0
  117. package/src/resources/customers/credits/ledger.ts +212 -1435
  118. package/src/resources/customers/credits/top-ups.ts +33 -136
  119. package/src/resources/customers/customers.ts +162 -1454
  120. package/src/resources/customers/index.ts +8 -0
  121. package/src/resources/index.ts +42 -22
  122. package/src/resources/invoice-line-items.ts +10 -501
  123. package/src/resources/invoices.ts +60 -2394
  124. package/src/resources/plans/plans.ts +38 -4588
  125. package/src/resources/prices/external-price-id.ts +3 -3
  126. package/src/resources/prices/index.ts +2 -2
  127. package/src/resources/prices/prices.ts +500 -11810
  128. package/src/resources/shared.ts +9582 -22
  129. package/src/resources/subscription-changes.ts +171 -2670
  130. package/src/resources/subscriptions.ts +3162 -32900
  131. package/src/version.ts +1 -1
  132. package/version.d.ts +1 -1
  133. package/version.d.ts.map +1 -1
  134. package/version.js +1 -1
  135. package/version.js.map +1 -1
  136. package/version.mjs +1 -1
  137. 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,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA2H7G,CAAC;IAzHC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAuB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAe,EAAE,IAAuB,EAAE,OAA6B;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAQD,IAAI,CACF,QAA+C,EAAE,EACjD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,QAAQ,CACN,OAA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