orb-billing 2.3.0 → 2.4.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 (73) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/client.d.ts +222 -0
  3. package/client.d.ts.map +1 -0
  4. package/client.js +156 -0
  5. package/client.js.map +1 -0
  6. package/client.mjs +129 -0
  7. package/client.mjs.map +1 -0
  8. package/index.d.mts +5 -221
  9. package/index.d.ts +5 -221
  10. package/index.d.ts.map +1 -1
  11. package/index.js +10 -130
  12. package/index.js.map +1 -1
  13. package/index.mjs +5 -127
  14. package/index.mjs.map +1 -1
  15. package/package.json +4 -4
  16. package/resources/customers/credits/credits.d.ts +6 -0
  17. package/resources/customers/credits/credits.d.ts.map +1 -1
  18. package/resources/customers/credits/credits.js.map +1 -1
  19. package/resources/customers/credits/credits.mjs.map +1 -1
  20. package/resources/events/backfills.d.ts +20 -0
  21. package/resources/events/backfills.d.ts.map +1 -1
  22. package/resources/events/backfills.js.map +1 -1
  23. package/resources/events/backfills.mjs.map +1 -1
  24. package/resources/invoices.d.ts +1 -1
  25. package/resources/invoices.js +1 -1
  26. package/resources/invoices.mjs +1 -1
  27. package/resources/plans/plans.d.ts +53 -1
  28. package/resources/plans/plans.d.ts.map +1 -1
  29. package/resources/plans/plans.js.map +1 -1
  30. package/resources/plans/plans.mjs.map +1 -1
  31. package/resources/prices/prices.d.ts +82 -2
  32. package/resources/prices/prices.d.ts.map +1 -1
  33. package/resources/prices/prices.js.map +1 -1
  34. package/resources/prices/prices.mjs.map +1 -1
  35. package/resources/subscriptions.d.ts +306 -3
  36. package/resources/subscriptions.d.ts.map +1 -1
  37. package/resources/subscriptions.js +5 -0
  38. package/resources/subscriptions.js.map +1 -1
  39. package/resources/subscriptions.mjs +5 -0
  40. package/resources/subscriptions.mjs.map +1 -1
  41. package/src/client.ts +301 -0
  42. package/src/index.ts +6 -299
  43. package/src/resources/customers/credits/credits.ts +6 -0
  44. package/src/resources/events/backfills.ts +25 -0
  45. package/src/resources/invoices.ts +1 -1
  46. package/src/resources/plans/plans.ts +66 -1
  47. package/src/resources/prices/prices.ts +114 -2
  48. package/src/resources/subscriptions.ts +374 -3
  49. package/src/version.ts +1 -1
  50. package/version.d.ts +1 -1
  51. package/version.js +1 -1
  52. package/version.mjs +1 -1
  53. package/resources/beta/beta.d.ts +0 -12
  54. package/resources/beta/beta.d.ts.map +0 -1
  55. package/resources/beta/beta.js +0 -40
  56. package/resources/beta/beta.js.map +0 -1
  57. package/resources/beta/beta.mjs +0 -13
  58. package/resources/beta/beta.mjs.map +0 -1
  59. package/resources/beta/index.d.ts +0 -3
  60. package/resources/beta/index.d.ts.map +0 -1
  61. package/resources/beta/index.js +0 -9
  62. package/resources/beta/index.js.map +0 -1
  63. package/resources/beta/index.mjs +0 -4
  64. package/resources/beta/index.mjs.map +0 -1
  65. package/resources/beta/price.d.ts +0 -82
  66. package/resources/beta/price.d.ts.map +0 -1
  67. package/resources/beta/price.js +0 -37
  68. package/resources/beta/price.js.map +0 -1
  69. package/resources/beta/price.mjs +0 -33
  70. package/resources/beta/price.mjs.map +0 -1
  71. package/src/resources/beta/beta.ts +0 -15
  72. package/src/resources/beta/index.ts +0 -4
  73. package/src/resources/beta/price.ts +0 -101
@@ -1 +0,0 @@
1
- {"version":3,"file":"beta.d.ts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,kCAAkC,CAAC;AAE7D,qBAAa,IAAK,SAAQ,WAAW;IACnC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAoC;CAC1D;AAED,yBAAiB,IAAI,CAAC;IACpB,MAAM,QAAQ,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;IACrC,MAAM,QAAQ,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAC;IAC/D,MAAM,QAAQ,qBAAqB,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IACrE,MAAM,QAAQ,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;CAClE"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.Beta = void 0;
28
- const resource_1 = require("orb-billing/resource");
29
- const PriceAPI = __importStar(require("orb-billing/resources/beta/price"));
30
- class Beta extends resource_1.APIResource {
31
- constructor() {
32
- super(...arguments);
33
- this.price = new PriceAPI.Price(this._client);
34
- }
35
- }
36
- exports.Beta = Beta;
37
- (function (Beta) {
38
- Beta.Price = PriceAPI.Price;
39
- })(Beta = exports.Beta || (exports.Beta = {}));
40
- //# sourceMappingURL=beta.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"beta.js","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,mDAAmD;AACnD,2EAA6D;AAE7D,MAAa,IAAK,SAAQ,sBAAW;IAArC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;CAAA;AAFD,oBAEC;AAED,WAAiB,IAAI;IACL,UAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;AAIvC,CAAC,EALgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAKpB"}
@@ -1,13 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from 'orb-billing/resource';
3
- import * as PriceAPI from 'orb-billing/resources/beta/price';
4
- export class Beta extends APIResource {
5
- constructor() {
6
- super(...arguments);
7
- this.price = new PriceAPI.Price(this._client);
8
- }
9
- }
10
- (function (Beta) {
11
- Beta.Price = PriceAPI.Price;
12
- })(Beta || (Beta = {}));
13
- //# sourceMappingURL=beta.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"beta.mjs","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE,MAAM,sBAAsB;OAC3C,KAAK,QAAQ,MAAM,kCAAkC;AAE5D,MAAM,OAAO,IAAK,SAAQ,WAAW;IAArC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;CAAA;AAED,WAAiB,IAAI;IACL,UAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;AAIvC,CAAC,EALgB,IAAI,KAAJ,IAAI,QAKpB"}
@@ -1,3 +0,0 @@
1
- export { Beta } from "./beta.js";
2
- export { EvaluatePriceGroup, PriceEvaluateResponse, PriceEvaluateParams, Price } from "./price.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -1,9 +0,0 @@
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.Price = exports.Beta = void 0;
5
- var beta_1 = require("./beta.js");
6
- Object.defineProperty(exports, "Beta", { enumerable: true, get: function () { return beta_1.Beta; } });
7
- var price_1 = require("./price.js");
8
- Object.defineProperty(exports, "Price", { enumerable: true, get: function () { return price_1.Price; } });
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kCAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,oCAAgG;AAAvB,8FAAA,KAAK,OAAA"}
@@ -1,4 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- export { Beta } from "./beta.mjs";
3
- export { Price } from "./price.mjs";
4
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,IAAI,EAAE;OACR,EAAkE,KAAK,EAAE"}
@@ -1,82 +0,0 @@
1
- import * as Core from 'orb-billing/core';
2
- import { APIResource } from 'orb-billing/resource';
3
- import * as PriceAPI from 'orb-billing/resources/beta/price';
4
- export declare class Price extends APIResource {
5
- /**
6
- * This endpoint is used to evaluate the output of a price for a given customer and
7
- * time range. It enables filtering and grouping the output using
8
- * [computed properties](../guides/extensibility/advanced-metrics#computed-properties),
9
- * supporting the following workflows:
10
- *
11
- * 1. Showing detailed usage and costs to the end customer.
12
- * 2. Auditing subtotals on invoice line items.
13
- *
14
- * For these workflows, the expressiveness of computed properties in both the
15
- * filters and grouping is critical. For example, if you'd like to show your
16
- * customer their usage grouped by hour and another property, you can do so with
17
- * the following `grouping_keys`:
18
- * `["hour_floor_timestamp_millis(timestamp_millis)", "my_property"]`. If you'd
19
- * like to examine a customer's usage for a specific property value, you can do so
20
- * with the following `filter`:
21
- * `my_property = 'foo' AND my_other_property = 'bar'`.
22
- *
23
- * By default, the start of the time range must be no more than 100 days ago and
24
- * the length of the results must be no greater than 1000. Note that this is a POST
25
- * endpoint rather than a GET endpoint because it employs a JSON body rather than
26
- * query parameters.
27
- */
28
- evaluate(priceId: string, body: PriceEvaluateParams, options?: Core.RequestOptions): Core.APIPromise<PriceEvaluateResponse>;
29
- }
30
- export interface EvaluatePriceGroup {
31
- /**
32
- * The price's output for the group
33
- */
34
- amount: string;
35
- /**
36
- * The values for the group in the order specified by `grouping_keys`
37
- */
38
- grouping_values: Array<string | number | boolean>;
39
- /**
40
- * The price's usage quantity for the group
41
- */
42
- quantity: number;
43
- }
44
- export interface PriceEvaluateResponse {
45
- data: Array<EvaluatePriceGroup>;
46
- }
47
- export interface PriceEvaluateParams {
48
- /**
49
- * The exclusive upper bound for event timestamps
50
- */
51
- timeframe_end: string;
52
- /**
53
- * The inclusive lower bound for event timestamps
54
- */
55
- timeframe_start: string;
56
- /**
57
- * The ID of the customer to which this evaluation is scoped.
58
- */
59
- customer_id?: string | null;
60
- /**
61
- * The external customer ID of the customer to which this evaluation is scoped.
62
- */
63
- external_customer_id?: string | null;
64
- /**
65
- * A boolean
66
- * [computed property](../guides/extensibility/advanced-metrics#computed-properties)
67
- * used to filter the underlying billable metric
68
- */
69
- filter?: string | null;
70
- /**
71
- * Properties (or
72
- * [computed properties](../guides/extensibility/advanced-metrics#computed-properties))
73
- * used to group the underlying billable metric
74
- */
75
- grouping_keys?: Array<string>;
76
- }
77
- export declare namespace Price {
78
- export import EvaluatePriceGroup = PriceAPI.EvaluatePriceGroup;
79
- export import PriceEvaluateResponse = PriceAPI.PriceEvaluateResponse;
80
- export import PriceEvaluateParams = PriceAPI.PriceEvaluateParams;
81
- }
82
- //# sourceMappingURL=price.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/resources/beta/price.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,kCAAkC,CAAC;AAE7D,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC;CAG1C;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IAElD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,yBAAiB,KAAK,CAAC;IACrB,MAAM,QAAQ,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAC;IAC/D,MAAM,QAAQ,qBAAqB,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IACrE,MAAM,QAAQ,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;CAClE"}
@@ -1,37 +0,0 @@
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.Price = void 0;
5
- const resource_1 = require("orb-billing/resource");
6
- class Price extends resource_1.APIResource {
7
- /**
8
- * This endpoint is used to evaluate the output of a price for a given customer and
9
- * time range. It enables filtering and grouping the output using
10
- * [computed properties](../guides/extensibility/advanced-metrics#computed-properties),
11
- * supporting the following workflows:
12
- *
13
- * 1. Showing detailed usage and costs to the end customer.
14
- * 2. Auditing subtotals on invoice line items.
15
- *
16
- * For these workflows, the expressiveness of computed properties in both the
17
- * filters and grouping is critical. For example, if you'd like to show your
18
- * customer their usage grouped by hour and another property, you can do so with
19
- * the following `grouping_keys`:
20
- * `["hour_floor_timestamp_millis(timestamp_millis)", "my_property"]`. If you'd
21
- * like to examine a customer's usage for a specific property value, you can do so
22
- * with the following `filter`:
23
- * `my_property = 'foo' AND my_other_property = 'bar'`.
24
- *
25
- * By default, the start of the time range must be no more than 100 days ago and
26
- * the length of the results must be no greater than 1000. Note that this is a POST
27
- * endpoint rather than a GET endpoint because it employs a JSON body rather than
28
- * query parameters.
29
- */
30
- evaluate(priceId, body, options) {
31
- return this._client.post(`/prices/${priceId}/evaluate`, { body, ...options });
32
- }
33
- }
34
- exports.Price = Price;
35
- (function (Price) {
36
- })(Price = exports.Price || (exports.Price = {}));
37
- //# sourceMappingURL=price.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"price.js","sourceRoot":"","sources":["../../src/resources/beta/price.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAGtF,mDAAmD;AAGnD,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CACN,OAAe,EACf,IAAyB,EACzB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,OAAO,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AA/BD,sBA+BC;AA2DD,WAAiB,KAAK;AAItB,CAAC,EAJgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAIrB"}
@@ -1,33 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from 'orb-billing/resource';
3
- export class Price extends APIResource {
4
- /**
5
- * This endpoint is used to evaluate the output of a price for a given customer and
6
- * time range. It enables filtering and grouping the output using
7
- * [computed properties](../guides/extensibility/advanced-metrics#computed-properties),
8
- * supporting the following workflows:
9
- *
10
- * 1. Showing detailed usage and costs to the end customer.
11
- * 2. Auditing subtotals on invoice line items.
12
- *
13
- * For these workflows, the expressiveness of computed properties in both the
14
- * filters and grouping is critical. For example, if you'd like to show your
15
- * customer their usage grouped by hour and another property, you can do so with
16
- * the following `grouping_keys`:
17
- * `["hour_floor_timestamp_millis(timestamp_millis)", "my_property"]`. If you'd
18
- * like to examine a customer's usage for a specific property value, you can do so
19
- * with the following `filter`:
20
- * `my_property = 'foo' AND my_other_property = 'bar'`.
21
- *
22
- * By default, the start of the time range must be no more than 100 days ago and
23
- * the length of the results must be no greater than 1000. Note that this is a POST
24
- * endpoint rather than a GET endpoint because it employs a JSON body rather than
25
- * query parameters.
26
- */
27
- evaluate(priceId, body, options) {
28
- return this._client.post(`/prices/${priceId}/evaluate`, { body, ...options });
29
- }
30
- }
31
- (function (Price) {
32
- })(Price || (Price = {}));
33
- //# sourceMappingURL=price.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"price.mjs","sourceRoot":"","sources":["../../src/resources/beta/price.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,WAAW,EAAE,MAAM,sBAAsB;AAGlD,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CACN,OAAe,EACf,IAAyB,EACzB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,OAAO,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AA2DD,WAAiB,KAAK;AAItB,CAAC,EAJgB,KAAK,KAAL,KAAK,QAIrB"}
@@ -1,15 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from "../../resource";
4
- import * as PriceAPI from "./price";
5
-
6
- export class Beta extends APIResource {
7
- price: PriceAPI.Price = new PriceAPI.Price(this._client);
8
- }
9
-
10
- export namespace Beta {
11
- export import Price = PriceAPI.Price;
12
- export import EvaluatePriceGroup = PriceAPI.EvaluatePriceGroup;
13
- export import PriceEvaluateResponse = PriceAPI.PriceEvaluateResponse;
14
- export import PriceEvaluateParams = PriceAPI.PriceEvaluateParams;
15
- }
@@ -1,4 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export { Beta } from './beta';
4
- export { EvaluatePriceGroup, PriceEvaluateResponse, PriceEvaluateParams, Price } from './price';
@@ -1,101 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import * as Core from "../../core";
4
- import { APIResource } from "../../resource";
5
- import * as PriceAPI from "./price";
6
-
7
- export class Price extends APIResource {
8
- /**
9
- * This endpoint is used to evaluate the output of a price for a given customer and
10
- * time range. It enables filtering and grouping the output using
11
- * [computed properties](../guides/extensibility/advanced-metrics#computed-properties),
12
- * supporting the following workflows:
13
- *
14
- * 1. Showing detailed usage and costs to the end customer.
15
- * 2. Auditing subtotals on invoice line items.
16
- *
17
- * For these workflows, the expressiveness of computed properties in both the
18
- * filters and grouping is critical. For example, if you'd like to show your
19
- * customer their usage grouped by hour and another property, you can do so with
20
- * the following `grouping_keys`:
21
- * `["hour_floor_timestamp_millis(timestamp_millis)", "my_property"]`. If you'd
22
- * like to examine a customer's usage for a specific property value, you can do so
23
- * with the following `filter`:
24
- * `my_property = 'foo' AND my_other_property = 'bar'`.
25
- *
26
- * By default, the start of the time range must be no more than 100 days ago and
27
- * the length of the results must be no greater than 1000. Note that this is a POST
28
- * endpoint rather than a GET endpoint because it employs a JSON body rather than
29
- * query parameters.
30
- */
31
- evaluate(
32
- priceId: string,
33
- body: PriceEvaluateParams,
34
- options?: Core.RequestOptions,
35
- ): Core.APIPromise<PriceEvaluateResponse> {
36
- return this._client.post(`/prices/${priceId}/evaluate`, { body, ...options });
37
- }
38
- }
39
-
40
- export interface EvaluatePriceGroup {
41
- /**
42
- * The price's output for the group
43
- */
44
- amount: string;
45
-
46
- /**
47
- * The values for the group in the order specified by `grouping_keys`
48
- */
49
- grouping_values: Array<string | number | boolean>;
50
-
51
- /**
52
- * The price's usage quantity for the group
53
- */
54
- quantity: number;
55
- }
56
-
57
- export interface PriceEvaluateResponse {
58
- data: Array<EvaluatePriceGroup>;
59
- }
60
-
61
- export interface PriceEvaluateParams {
62
- /**
63
- * The exclusive upper bound for event timestamps
64
- */
65
- timeframe_end: string;
66
-
67
- /**
68
- * The inclusive lower bound for event timestamps
69
- */
70
- timeframe_start: string;
71
-
72
- /**
73
- * The ID of the customer to which this evaluation is scoped.
74
- */
75
- customer_id?: string | null;
76
-
77
- /**
78
- * The external customer ID of the customer to which this evaluation is scoped.
79
- */
80
- external_customer_id?: string | null;
81
-
82
- /**
83
- * A boolean
84
- * [computed property](../guides/extensibility/advanced-metrics#computed-properties)
85
- * used to filter the underlying billable metric
86
- */
87
- filter?: string | null;
88
-
89
- /**
90
- * Properties (or
91
- * [computed properties](../guides/extensibility/advanced-metrics#computed-properties))
92
- * used to group the underlying billable metric
93
- */
94
- grouping_keys?: Array<string>;
95
- }
96
-
97
- export namespace Price {
98
- export import EvaluatePriceGroup = PriceAPI.EvaluatePriceGroup;
99
- export import PriceEvaluateResponse = PriceAPI.PriceEvaluateResponse;
100
- export import PriceEvaluateParams = PriceAPI.PriceEvaluateParams;
101
- }