orb-billing 4.4.0 → 4.6.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 (114) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +0 -0
  3. package/README.md +0 -0
  4. package/_shims/README.md +0 -0
  5. package/_shims/auto/types.d.ts +0 -0
  6. package/_shims/auto/types.js +0 -0
  7. package/_shims/auto/types.mjs +0 -0
  8. package/_shims/index.d.ts +0 -0
  9. package/_shims/index.js +0 -0
  10. package/_shims/index.mjs +0 -0
  11. package/_shims/manual-types.d.ts +0 -0
  12. package/_shims/manual-types.js +0 -0
  13. package/_shims/manual-types.mjs +0 -0
  14. package/_shims/node-types.d.ts +0 -0
  15. package/_shims/node-types.js +0 -0
  16. package/_shims/node-types.mjs +0 -0
  17. package/_shims/web-types.d.ts +0 -0
  18. package/_shims/web-types.js +0 -0
  19. package/_shims/web-types.mjs +0 -0
  20. package/index.d.mts +4 -4
  21. package/index.d.ts +4 -4
  22. package/index.d.ts.map +1 -1
  23. package/index.js +1 -1
  24. package/index.js.map +1 -1
  25. package/index.mjs +1 -1
  26. package/index.mjs.map +1 -1
  27. package/package.json +1 -1
  28. package/resources/alerts.d.ts +25 -0
  29. package/resources/alerts.d.ts.map +1 -1
  30. package/resources/alerts.js +6 -0
  31. package/resources/alerts.js.map +1 -1
  32. package/resources/alerts.mjs +6 -0
  33. package/resources/alerts.mjs.map +1 -1
  34. package/resources/index.d.ts +2 -2
  35. package/resources/index.d.ts.map +1 -1
  36. package/resources/index.js +4 -4
  37. package/resources/index.js.map +1 -1
  38. package/resources/index.mjs +1 -1
  39. package/resources/index.mjs.map +1 -1
  40. package/resources/metrics.d.ts +24 -58
  41. package/resources/metrics.d.ts.map +1 -1
  42. package/resources/metrics.js +11 -5
  43. package/resources/metrics.js.map +1 -1
  44. package/resources/metrics.mjs +9 -3
  45. package/resources/metrics.mjs.map +1 -1
  46. package/src/_shims/MultipartBody.ts +0 -0
  47. package/src/_shims/README.md +0 -0
  48. package/src/_shims/auto/runtime-bun.ts +0 -0
  49. package/src/_shims/auto/runtime-node.ts +0 -0
  50. package/src/_shims/auto/runtime.ts +0 -0
  51. package/src/_shims/auto/types-node.ts +0 -0
  52. package/src/_shims/auto/types.d.ts +0 -0
  53. package/src/_shims/auto/types.js +0 -0
  54. package/src/_shims/auto/types.mjs +0 -0
  55. package/src/_shims/bun-runtime.ts +0 -0
  56. package/src/_shims/index.d.ts +0 -0
  57. package/src/_shims/index.js +0 -0
  58. package/src/_shims/index.mjs +0 -0
  59. package/src/_shims/manual-types.d.ts +0 -0
  60. package/src/_shims/manual-types.js +0 -0
  61. package/src/_shims/manual-types.mjs +0 -0
  62. package/src/_shims/node-runtime.ts +0 -0
  63. package/src/_shims/node-types.d.ts +0 -0
  64. package/src/_shims/node-types.js +0 -0
  65. package/src/_shims/node-types.mjs +0 -0
  66. package/src/_shims/registry.ts +0 -0
  67. package/src/_shims/web-runtime.ts +0 -0
  68. package/src/_shims/web-types.d.ts +0 -0
  69. package/src/_shims/web-types.js +0 -0
  70. package/src/_shims/web-types.mjs +0 -0
  71. package/src/core.ts +0 -0
  72. package/src/error.ts +0 -0
  73. package/src/index.ts +4 -4
  74. package/src/lib/.keep +0 -0
  75. package/src/pagination.ts +0 -0
  76. package/src/resource.ts +0 -0
  77. package/src/resources/alerts.ts +34 -0
  78. package/src/resources/coupons/coupons.ts +0 -0
  79. package/src/resources/coupons/index.ts +0 -0
  80. package/src/resources/coupons/subscriptions.ts +0 -0
  81. package/src/resources/credit-notes.ts +0 -0
  82. package/src/resources/customers/balance-transactions.ts +0 -0
  83. package/src/resources/customers/costs.ts +0 -0
  84. package/src/resources/customers/credits/credits.ts +0 -0
  85. package/src/resources/customers/credits/index.ts +0 -0
  86. package/src/resources/customers/credits/ledger.ts +0 -0
  87. package/src/resources/customers/credits/top-ups.ts +0 -0
  88. package/src/resources/customers/customers.ts +0 -0
  89. package/src/resources/customers/index.ts +0 -0
  90. package/src/resources/events/backfills.ts +0 -0
  91. package/src/resources/events/events.ts +0 -0
  92. package/src/resources/events/index.ts +0 -0
  93. package/src/resources/index.ts +9 -9
  94. package/src/resources/invoice-line-items.ts +0 -0
  95. package/src/resources/invoices.ts +0 -0
  96. package/src/resources/items.ts +0 -0
  97. package/src/resources/metrics.ts +42 -72
  98. package/src/resources/plans/external-plan-id.ts +0 -0
  99. package/src/resources/plans/index.ts +0 -0
  100. package/src/resources/plans/plans.ts +0 -0
  101. package/src/resources/prices/external-price-id.ts +0 -0
  102. package/src/resources/prices/index.ts +0 -0
  103. package/src/resources/prices/prices.ts +0 -0
  104. package/src/resources/shared.ts +0 -0
  105. package/src/resources/subscriptions.ts +0 -0
  106. package/src/resources/top-level.ts +0 -0
  107. package/src/shims/node.ts +0 -0
  108. package/src/shims/web.ts +0 -0
  109. package/src/tsconfig.json +0 -0
  110. package/src/uploads.ts +0 -0
  111. package/src/version.ts +1 -1
  112. package/version.d.ts +1 -1
  113. package/version.js +1 -1
  114. package/version.mjs +1 -1
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  return result;
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.MetricListResponsesPage = exports.Metrics = void 0;
27
+ exports.BillableMetricsPage = exports.Metrics = void 0;
28
28
  const resource_1 = require("../resource.js");
29
29
  const core_1 = require("../core.js");
30
30
  const MetricsAPI = __importStar(require("./metrics.js"));
@@ -39,11 +39,17 @@ class Metrics extends resource_1.APIResource {
39
39
  create(body, options) {
40
40
  return this._client.post('/metrics', { body, ...options });
41
41
  }
42
+ update(metricId, body = {}, options) {
43
+ if ((0, core_1.isRequestOptions)(body)) {
44
+ return this.update(metricId, {}, body);
45
+ }
46
+ return this._client.put(`/metrics/${metricId}`, { body, ...options });
47
+ }
42
48
  list(query = {}, options) {
43
49
  if ((0, core_1.isRequestOptions)(query)) {
44
50
  return this.list({}, query);
45
51
  }
46
- return this._client.getAPIList('/metrics', MetricListResponsesPage, { query, ...options });
52
+ return this._client.getAPIList('/metrics', BillableMetricsPage, { query, ...options });
47
53
  }
48
54
  /**
49
55
  * This endpoint is used to list [metrics](../guides/concepts##metric). It returns
@@ -54,10 +60,10 @@ class Metrics extends resource_1.APIResource {
54
60
  }
55
61
  }
56
62
  exports.Metrics = Metrics;
57
- class MetricListResponsesPage extends pagination_1.Page {
63
+ class BillableMetricsPage extends pagination_1.Page {
58
64
  }
59
- exports.MetricListResponsesPage = MetricListResponsesPage;
65
+ exports.BillableMetricsPage = BillableMetricsPage;
60
66
  (function (Metrics) {
61
- Metrics.MetricListResponsesPage = MetricsAPI.MetricListResponsesPage;
67
+ Metrics.BillableMetricsPage = MetricsAPI.BillableMetricsPage;
62
68
  })(Metrics = exports.Metrics || (exports.Metrics = {}));
63
69
  //# sourceMappingURL=metrics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,6CAA0C;AAC1C,qCAA2C;AAE3C,yDAAwC;AAExC,iDAAsD;AAEtD,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;OAKG;IACH,MAAM,CAAC,IAAwB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAYD,IAAI,CACF,QAAgD,EAAE,EAClD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,uBAAuB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAgB,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAtCD,0BAsCC;AAED,MAAa,uBAAwB,SAAQ,iBAAwB;CAAG;AAAxE,0DAAwE;AAmIxE,WAAiB,OAAO;IAIR,+BAAuB,GAAG,UAAU,CAAC,uBAAuB,CAAC;AAG7E,CAAC,EAPgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAOvB"}
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,6CAA0C;AAC1C,qCAA2C;AAE3C,yDAAwC;AAExC,iDAAsD;AAEtD,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;OAKG;IACH,MAAM,CAAC,IAAwB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAaD,MAAM,CACJ,QAAgB,EAChB,OAAiD,EAAE,EACnD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,IAAI,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAYD,IAAI,CACF,QAAgD,EAAE,EAClD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,mBAAmB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAgB,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AA5DD,0BA4DC;AAED,MAAa,mBAAoB,SAAQ,iBAAoB;CAAG;AAAhE,kDAAgE;AAgFhE,WAAiB,OAAO;IAER,2BAAmB,GAAG,UAAU,CAAC,mBAAmB,CAAC;AAIrE,CAAC,EANgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAMvB"}
@@ -13,11 +13,17 @@ export class Metrics extends APIResource {
13
13
  create(body, options) {
14
14
  return this._client.post('/metrics', { body, ...options });
15
15
  }
16
+ update(metricId, body = {}, options) {
17
+ if (isRequestOptions(body)) {
18
+ return this.update(metricId, {}, body);
19
+ }
20
+ return this._client.put(`/metrics/${metricId}`, { body, ...options });
21
+ }
16
22
  list(query = {}, options) {
17
23
  if (isRequestOptions(query)) {
18
24
  return this.list({}, query);
19
25
  }
20
- return this._client.getAPIList('/metrics', MetricListResponsesPage, { query, ...options });
26
+ return this._client.getAPIList('/metrics', BillableMetricsPage, { query, ...options });
21
27
  }
22
28
  /**
23
29
  * This endpoint is used to list [metrics](../guides/concepts##metric). It returns
@@ -27,9 +33,9 @@ export class Metrics extends APIResource {
27
33
  return this._client.get(`/metrics/${metricId}`, options);
28
34
  }
29
35
  }
30
- export class MetricListResponsesPage extends Page {
36
+ export class BillableMetricsPage extends Page {
31
37
  }
32
38
  (function (Metrics) {
33
- Metrics.MetricListResponsesPage = MetricsAPI.MetricListResponsesPage;
39
+ Metrics.BillableMetricsPage = MetricsAPI.BillableMetricsPage;
34
40
  })(Metrics || (Metrics = {}));
35
41
  //# sourceMappingURL=metrics.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.mjs","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAEpB,KAAK,UAAU;OAEf,EAAE,IAAI,EAAmB;AAEhC,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;OAKG;IACH,MAAM,CAAC,IAAwB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAYD,IAAI,CACF,QAAgD,EAAE,EAClD,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,UAAU,EAAE,uBAAuB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAgB,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,IAAwB;CAAG;AAmIxE,WAAiB,OAAO;IAIR,+BAAuB,GAAG,UAAU,CAAC,uBAAuB,CAAC;AAG7E,CAAC,EAPgB,OAAO,KAAP,OAAO,QAOvB"}
1
+ {"version":3,"file":"metrics.mjs","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAEpB,KAAK,UAAU;OAEf,EAAE,IAAI,EAAmB;AAEhC,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;OAKG;IACH,MAAM,CAAC,IAAwB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAaD,MAAM,CACJ,QAAgB,EAChB,OAAiD,EAAE,EACnD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAYD,IAAI,CACF,QAAgD,EAAE,EAClD,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,UAAU,EAAE,mBAAmB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAgB,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,IAAoB;CAAG;AAgFhE,WAAiB,OAAO;IAER,2BAAmB,GAAG,UAAU,CAAC,mBAAmB,CAAC;AAIrE,CAAC,EANgB,OAAO,KAAP,OAAO,QAMvB"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/core.ts CHANGED
File without changes
package/src/error.ts CHANGED
File without changes
package/src/index.ts CHANGED
@@ -290,11 +290,10 @@ export namespace Orb {
290
290
  export import ItemListParams = API.ItemListParams;
291
291
 
292
292
  export import Metrics = API.Metrics;
293
- export import MetricCreateResponse = API.MetricCreateResponse;
294
- export import MetricListResponse = API.MetricListResponse;
295
- export import MetricFetchResponse = API.MetricFetchResponse;
296
- export import MetricListResponsesPage = API.MetricListResponsesPage;
293
+ export import BillableMetric = API.BillableMetric;
294
+ export import BillableMetricsPage = API.BillableMetricsPage;
297
295
  export import MetricCreateParams = API.MetricCreateParams;
296
+ export import MetricUpdateParams = API.MetricUpdateParams;
298
297
  export import MetricListParams = API.MetricListParams;
299
298
 
300
299
  export import Plans = API.Plans;
@@ -337,6 +336,7 @@ export namespace Orb {
337
336
  export import Alerts = API.Alerts;
338
337
  export import Alert = API.Alert;
339
338
  export import AlertsPage = API.AlertsPage;
339
+ export import AlertUpdateParams = API.AlertUpdateParams;
340
340
  export import AlertListParams = API.AlertListParams;
341
341
  export import AlertCreateForCustomerParams = API.AlertCreateForCustomerParams;
342
342
  export import AlertCreateForExternalCustomerParams = API.AlertCreateForExternalCustomerParams;
package/src/lib/.keep CHANGED
File without changes
package/src/pagination.ts CHANGED
File without changes
package/src/resource.ts CHANGED
File without changes
@@ -14,6 +14,17 @@ export class Alerts extends APIResource {
14
14
  return this._client.get(`/alerts/${alertId}`, options);
15
15
  }
16
16
 
17
+ /**
18
+ * This endpoint updates the thresholds of an alert.
19
+ */
20
+ update(
21
+ alertConfigurationId: string,
22
+ body: AlertUpdateParams,
23
+ options?: Core.RequestOptions,
24
+ ): Core.APIPromise<Alert> {
25
+ return this._client.put(`/alerts/${alertConfigurationId}`, { body, ...options });
26
+ }
27
+
17
28
  /**
18
29
  * This endpoint returns a list of alerts within Orb.
19
30
  *
@@ -201,6 +212,28 @@ export namespace Alert {
201
212
  }
202
213
  }
203
214
 
215
+ export interface AlertUpdateParams {
216
+ /**
217
+ * The thresholds that define the values at which the alert will be triggered.
218
+ */
219
+ thresholds: Array<AlertUpdateParams.Threshold>;
220
+ }
221
+
222
+ export namespace AlertUpdateParams {
223
+ /**
224
+ * Thresholds are used to define the conditions under which an alert will be
225
+ * triggered.
226
+ */
227
+ export interface Threshold {
228
+ /**
229
+ * The value at which an alert will fire. For credit balance alerts, the alert will
230
+ * fire at or below this value. For usage and cost alerts, the alert will fire at
231
+ * or above this value.
232
+ */
233
+ value: number;
234
+ }
235
+ }
236
+
204
237
  export interface AlertListParams extends PageParams {
205
238
  'created_at[gt]'?: string | null;
206
239
 
@@ -340,6 +373,7 @@ export namespace AlertCreateForSubscriptionParams {
340
373
  export namespace Alerts {
341
374
  export import Alert = AlertsAPI.Alert;
342
375
  export import AlertsPage = AlertsAPI.AlertsPage;
376
+ export import AlertUpdateParams = AlertsAPI.AlertUpdateParams;
343
377
  export import AlertListParams = AlertsAPI.AlertListParams;
344
378
  export import AlertCreateForCustomerParams = AlertsAPI.AlertCreateForCustomerParams;
345
379
  export import AlertCreateForExternalCustomerParams = AlertsAPI.AlertCreateForExternalCustomerParams;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,6 +3,7 @@
3
3
  export * from './shared';
4
4
  export {
5
5
  Alert,
6
+ AlertUpdateParams,
6
7
  AlertListParams,
7
8
  AlertCreateForCustomerParams,
8
9
  AlertCreateForExternalCustomerParams,
@@ -10,6 +11,14 @@ export {
10
11
  AlertsPage,
11
12
  Alerts,
12
13
  } from './alerts';
14
+ export {
15
+ BillableMetric,
16
+ MetricCreateParams,
17
+ MetricUpdateParams,
18
+ MetricListParams,
19
+ BillableMetricsPage,
20
+ Metrics,
21
+ } from './metrics';
13
22
  export { Coupon, CouponCreateParams, CouponListParams, CouponsPage, Coupons } from './coupons/coupons';
14
23
  export { CreditNote, CreditNoteListParams, CreditNotesPage, CreditNotes } from './credit-notes';
15
24
  export {
@@ -59,15 +68,6 @@ export {
59
68
  InvoiceLineItems,
60
69
  } from './invoice-line-items';
61
70
  export { Item, ItemCreateParams, ItemUpdateParams, ItemListParams, ItemsPage, Items } from './items';
62
- export {
63
- MetricCreateResponse,
64
- MetricListResponse,
65
- MetricFetchResponse,
66
- MetricCreateParams,
67
- MetricListParams,
68
- MetricListResponsesPage,
69
- Metrics,
70
- } from './metrics';
71
71
  export { Plan, PlanCreateParams, PlanUpdateParams, PlanListParams, PlansPage, Plans } from './plans/plans';
72
72
  export {
73
73
  Subscription,
File without changes
File without changes
File without changes
@@ -14,10 +14,32 @@ export class Metrics extends APIResource {
14
14
  * [SQL support](../guides/extensibility/advanced-metrics#sql-support) for a
15
15
  * description of constructing SQL queries with examples.
16
16
  */
17
- create(body: MetricCreateParams, options?: Core.RequestOptions): Core.APIPromise<MetricCreateResponse> {
17
+ create(body: MetricCreateParams, options?: Core.RequestOptions): Core.APIPromise<BillableMetric> {
18
18
  return this._client.post('/metrics', { body, ...options });
19
19
  }
20
20
 
21
+ /**
22
+ * This endpoint allows you to update the `metadata` property on a metric. If you
23
+ * pass `null` for the metadata value, it will clear any existing metadata for that
24
+ * invoice.
25
+ */
26
+ update(
27
+ metricId: string,
28
+ body?: MetricUpdateParams,
29
+ options?: Core.RequestOptions,
30
+ ): Core.APIPromise<BillableMetric>;
31
+ update(metricId: string, options?: Core.RequestOptions): Core.APIPromise<BillableMetric>;
32
+ update(
33
+ metricId: string,
34
+ body: MetricUpdateParams | Core.RequestOptions = {},
35
+ options?: Core.RequestOptions,
36
+ ): Core.APIPromise<BillableMetric> {
37
+ if (isRequestOptions(body)) {
38
+ return this.update(metricId, {}, body);
39
+ }
40
+ return this._client.put(`/metrics/${metricId}`, { body, ...options });
41
+ }
42
+
21
43
  /**
22
44
  * This endpoint is used to fetch [metric](../guides/concepts#metric) details given
23
45
  * a metric identifier. It returns information about the metrics including its
@@ -26,95 +48,35 @@ export class Metrics extends APIResource {
26
48
  list(
27
49
  query?: MetricListParams,
28
50
  options?: Core.RequestOptions,
29
- ): Core.PagePromise<MetricListResponsesPage, MetricListResponse>;
30
- list(options?: Core.RequestOptions): Core.PagePromise<MetricListResponsesPage, MetricListResponse>;
51
+ ): Core.PagePromise<BillableMetricsPage, BillableMetric>;
52
+ list(options?: Core.RequestOptions): Core.PagePromise<BillableMetricsPage, BillableMetric>;
31
53
  list(
32
54
  query: MetricListParams | Core.RequestOptions = {},
33
55
  options?: Core.RequestOptions,
34
- ): Core.PagePromise<MetricListResponsesPage, MetricListResponse> {
56
+ ): Core.PagePromise<BillableMetricsPage, BillableMetric> {
35
57
  if (isRequestOptions(query)) {
36
58
  return this.list({}, query);
37
59
  }
38
- return this._client.getAPIList('/metrics', MetricListResponsesPage, { query, ...options });
60
+ return this._client.getAPIList('/metrics', BillableMetricsPage, { query, ...options });
39
61
  }
40
62
 
41
63
  /**
42
64
  * This endpoint is used to list [metrics](../guides/concepts##metric). It returns
43
65
  * information about the metrics including its name, description, and item.
44
66
  */
45
- fetch(metricId: string, options?: Core.RequestOptions): Core.APIPromise<MetricFetchResponse> {
67
+ fetch(metricId: string, options?: Core.RequestOptions): Core.APIPromise<BillableMetric> {
46
68
  return this._client.get(`/metrics/${metricId}`, options);
47
69
  }
48
70
  }
49
71
 
50
- export class MetricListResponsesPage extends Page<MetricListResponse> {}
72
+ export class BillableMetricsPage extends Page<BillableMetric> {}
51
73
 
52
74
  /**
53
75
  * The Metric resource represents a calculation of a quantity based on events.
54
76
  * Metrics are defined by the query that transforms raw usage events into
55
77
  * meaningful values for your customers.
56
78
  */
57
- export interface MetricCreateResponse {
58
- id: string;
59
-
60
- description: string | null;
61
-
62
- /**
63
- * The Item resource represents a sellable product or good. Items are associated
64
- * with all line items, billable metrics, and prices and are used for defining
65
- * external sync behavior for invoices and tax calculation purposes.
66
- */
67
- item: ItemsAPI.Item;
68
-
69
- /**
70
- * User specified key-value pairs for the resource. If not present, this defaults
71
- * to an empty dictionary. Individual keys can be removed by setting the value to
72
- * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
73
- * `null`.
74
- */
75
- metadata: Record<string, string>;
76
-
77
- name: string;
78
-
79
- status: 'active' | 'draft' | 'archived';
80
- }
81
-
82
- /**
83
- * The Metric resource represents a calculation of a quantity based on events.
84
- * Metrics are defined by the query that transforms raw usage events into
85
- * meaningful values for your customers.
86
- */
87
- export interface MetricListResponse {
88
- id: string;
89
-
90
- description: string | null;
91
-
92
- /**
93
- * The Item resource represents a sellable product or good. Items are associated
94
- * with all line items, billable metrics, and prices and are used for defining
95
- * external sync behavior for invoices and tax calculation purposes.
96
- */
97
- item: ItemsAPI.Item;
98
-
99
- /**
100
- * User specified key-value pairs for the resource. If not present, this defaults
101
- * to an empty dictionary. Individual keys can be removed by setting the value to
102
- * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
103
- * `null`.
104
- */
105
- metadata: Record<string, string>;
106
-
107
- name: string;
108
-
109
- status: 'active' | 'draft' | 'archived';
110
- }
111
-
112
- /**
113
- * The Metric resource represents a calculation of a quantity based on events.
114
- * Metrics are defined by the query that transforms raw usage events into
115
- * meaningful values for your customers.
116
- */
117
- export interface MetricFetchResponse {
79
+ export interface BillableMetric {
118
80
  id: string;
119
81
 
120
82
  description: string | null;
@@ -168,6 +130,15 @@ export interface MetricCreateParams {
168
130
  metadata?: Record<string, string | null> | null;
169
131
  }
170
132
 
133
+ export interface MetricUpdateParams {
134
+ /**
135
+ * User-specified key/value pairs for the resource. Individual keys can be removed
136
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
137
+ * by setting `metadata` to `null`.
138
+ */
139
+ metadata?: Record<string, string | null> | null;
140
+ }
141
+
171
142
  export interface MetricListParams extends PageParams {
172
143
  'created_at[gt]'?: string | null;
173
144
 
@@ -179,10 +150,9 @@ export interface MetricListParams extends PageParams {
179
150
  }
180
151
 
181
152
  export namespace Metrics {
182
- export import MetricCreateResponse = MetricsAPI.MetricCreateResponse;
183
- export import MetricListResponse = MetricsAPI.MetricListResponse;
184
- export import MetricFetchResponse = MetricsAPI.MetricFetchResponse;
185
- export import MetricListResponsesPage = MetricsAPI.MetricListResponsesPage;
153
+ export import BillableMetric = MetricsAPI.BillableMetric;
154
+ export import BillableMetricsPage = MetricsAPI.BillableMetricsPage;
186
155
  export import MetricCreateParams = MetricsAPI.MetricCreateParams;
156
+ export import MetricUpdateParams = MetricsAPI.MetricUpdateParams;
187
157
  export import MetricListParams = MetricsAPI.MetricListParams;
188
158
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/shims/node.ts CHANGED
File without changes
package/src/shims/web.ts CHANGED
File without changes
package/src/tsconfig.json CHANGED
File without changes
package/src/uploads.ts CHANGED
File without changes
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '4.4.0'; // x-release-please-version
1
+ export const VERSION = '4.6.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.4.0";
1
+ export declare const VERSION = "4.6.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '4.4.0'; // x-release-please-version
4
+ exports.VERSION = '4.6.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '4.4.0'; // x-release-please-version
1
+ export const VERSION = '4.6.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map