orb-billing 1.34.2 → 1.35.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 (58) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/core.js +1 -1
  4. package/core.js.map +1 -1
  5. package/core.mjs +1 -1
  6. package/core.mjs.map +1 -1
  7. package/index.d.mts +2 -0
  8. package/index.d.ts +2 -0
  9. package/index.d.ts.map +1 -1
  10. package/index.js +2 -0
  11. package/index.js.map +1 -1
  12. package/index.mjs +2 -0
  13. package/index.mjs.map +1 -1
  14. package/package.json +1 -1
  15. package/resources/beta/beta.d.ts +12 -0
  16. package/resources/beta/beta.d.ts.map +1 -0
  17. package/resources/beta/beta.js +40 -0
  18. package/resources/beta/beta.js.map +1 -0
  19. package/resources/beta/beta.mjs +13 -0
  20. package/resources/beta/beta.mjs.map +1 -0
  21. package/resources/beta/index.d.ts +3 -0
  22. package/resources/beta/index.d.ts.map +1 -0
  23. package/resources/beta/index.js +9 -0
  24. package/resources/beta/index.js.map +1 -0
  25. package/resources/beta/index.mjs +4 -0
  26. package/resources/beta/index.mjs.map +1 -0
  27. package/resources/beta/price.d.ts +82 -0
  28. package/resources/beta/price.d.ts.map +1 -0
  29. package/resources/beta/price.js +37 -0
  30. package/resources/beta/price.js.map +1 -0
  31. package/resources/beta/price.mjs +33 -0
  32. package/resources/beta/price.mjs.map +1 -0
  33. package/resources/index.d.ts +1 -0
  34. package/resources/index.d.ts.map +1 -1
  35. package/resources/index.js +3 -1
  36. package/resources/index.js.map +1 -1
  37. package/resources/index.mjs +1 -0
  38. package/resources/index.mjs.map +1 -1
  39. package/resources/prices/prices.d.ts +1 -103
  40. package/resources/prices/prices.d.ts.map +1 -1
  41. package/resources/prices/prices.js.map +1 -1
  42. package/resources/prices/prices.mjs.map +1 -1
  43. package/resources/subscriptions.d.ts +2 -210
  44. package/resources/subscriptions.d.ts.map +1 -1
  45. package/resources/subscriptions.js.map +1 -1
  46. package/resources/subscriptions.mjs.map +1 -1
  47. package/src/core.ts +2 -2
  48. package/src/index.ts +3 -0
  49. package/src/resources/beta/beta.ts +15 -0
  50. package/src/resources/beta/index.ts +4 -0
  51. package/src/resources/beta/price.ts +101 -0
  52. package/src/resources/index.ts +1 -0
  53. package/src/resources/prices/prices.ts +0 -154
  54. package/src/resources/subscriptions.ts +0 -264
  55. package/src/version.ts +1 -1
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
  58. package/version.mjs +1 -1
@@ -0,0 +1,101 @@
1
+ // File generated from our OpenAPI spec by Stainless.
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
+ }
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
3
  export * from './shared';
4
+ export { Beta } from './beta/beta';
4
5
  export { Coupon, CouponCreateParams, CouponListParams, CouponsPage, Coupons } from './coupons/coupons';
5
6
  export { CreditNote, CreditNoteListParams, CreditNotesPage, CreditNotes } from './credit-notes';
6
7
  export {
@@ -295,8 +295,6 @@ export type Price =
295
295
  | Price.BpsPrice
296
296
  | Price.BulkBpsPrice
297
297
  | Price.BulkPrice
298
- | Price.TestRatingFunctionPrice
299
- | Price.FivetranExamplePrice
300
298
  | Price.ThresholdTotalAmountPrice
301
299
  | Price.TieredPackagePrice
302
300
  | Price.TieredWithMinimumPrice
@@ -1098,158 +1096,6 @@ export namespace Price {
1098
1096
  }
1099
1097
  }
1100
1098
 
1101
- export interface TestRatingFunctionPrice {
1102
- id: string;
1103
-
1104
- billable_metric: TestRatingFunctionPrice.BillableMetric | null;
1105
-
1106
- cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual';
1107
-
1108
- created_at: string;
1109
-
1110
- currency: string;
1111
-
1112
- discount: Shared.Discount | null;
1113
-
1114
- external_price_id: string | null;
1115
-
1116
- fixed_price_quantity: number | null;
1117
-
1118
- item: TestRatingFunctionPrice.Item;
1119
-
1120
- maximum: TestRatingFunctionPrice.Maximum | null;
1121
-
1122
- maximum_amount: string | null;
1123
-
1124
- minimum: TestRatingFunctionPrice.Minimum | null;
1125
-
1126
- minimum_amount: string | null;
1127
-
1128
- model_type: 'test_rating_function';
1129
-
1130
- name: string;
1131
-
1132
- plan_phase_order: number | null;
1133
-
1134
- price_type: 'usage_price' | 'fixed_price';
1135
-
1136
- test_rating_function_config: Record<string, unknown>;
1137
- }
1138
-
1139
- export namespace TestRatingFunctionPrice {
1140
- export interface BillableMetric {
1141
- id: string;
1142
- }
1143
-
1144
- export interface Item {
1145
- id: string;
1146
-
1147
- name: string;
1148
- }
1149
-
1150
- export interface Maximum {
1151
- /**
1152
- * List of price_ids that this maximum amount applies to. For plan/plan phase
1153
- * maximums, this can be a subset of prices.
1154
- */
1155
- applies_to_price_ids: Array<string>;
1156
-
1157
- /**
1158
- * Maximum amount applied
1159
- */
1160
- maximum_amount: string;
1161
- }
1162
-
1163
- export interface Minimum {
1164
- /**
1165
- * List of price_ids that this minimum amount applies to. For plan/plan phase
1166
- * minimums, this can be a subset of prices.
1167
- */
1168
- applies_to_price_ids: Array<string>;
1169
-
1170
- /**
1171
- * Minimum amount applied
1172
- */
1173
- minimum_amount: string;
1174
- }
1175
- }
1176
-
1177
- export interface FivetranExamplePrice {
1178
- id: string;
1179
-
1180
- billable_metric: FivetranExamplePrice.BillableMetric | null;
1181
-
1182
- cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual';
1183
-
1184
- created_at: string;
1185
-
1186
- currency: string;
1187
-
1188
- discount: Shared.Discount | null;
1189
-
1190
- external_price_id: string | null;
1191
-
1192
- fivetran_example_config: Record<string, unknown>;
1193
-
1194
- fixed_price_quantity: number | null;
1195
-
1196
- item: FivetranExamplePrice.Item;
1197
-
1198
- maximum: FivetranExamplePrice.Maximum | null;
1199
-
1200
- maximum_amount: string | null;
1201
-
1202
- minimum: FivetranExamplePrice.Minimum | null;
1203
-
1204
- minimum_amount: string | null;
1205
-
1206
- model_type: 'fivetran_example';
1207
-
1208
- name: string;
1209
-
1210
- plan_phase_order: number | null;
1211
-
1212
- price_type: 'usage_price' | 'fixed_price';
1213
- }
1214
-
1215
- export namespace FivetranExamplePrice {
1216
- export interface BillableMetric {
1217
- id: string;
1218
- }
1219
-
1220
- export interface Item {
1221
- id: string;
1222
-
1223
- name: string;
1224
- }
1225
-
1226
- export interface Maximum {
1227
- /**
1228
- * List of price_ids that this maximum amount applies to. For plan/plan phase
1229
- * maximums, this can be a subset of prices.
1230
- */
1231
- applies_to_price_ids: Array<string>;
1232
-
1233
- /**
1234
- * Maximum amount applied
1235
- */
1236
- maximum_amount: string;
1237
- }
1238
-
1239
- export interface Minimum {
1240
- /**
1241
- * List of price_ids that this minimum amount applies to. For plan/plan phase
1242
- * minimums, this can be a subset of prices.
1243
- */
1244
- applies_to_price_ids: Array<string>;
1245
-
1246
- /**
1247
- * Minimum amount applied
1248
- */
1249
- minimum_amount: string;
1250
- }
1251
- }
1252
-
1253
1099
  export interface ThresholdTotalAmountPrice {
1254
1100
  id: string;
1255
1101
 
@@ -2121,8 +2121,6 @@ export interface SubscriptionCreateParams {
2121
2121
  | SubscriptionCreateParams.OverrideBpsPrice
2122
2122
  | SubscriptionCreateParams.OverrideBulkBpsPrice
2123
2123
  | SubscriptionCreateParams.OverrideBulkPrice
2124
- | SubscriptionCreateParams.OverrideTestRatingFunctionPrice
2125
- | SubscriptionCreateParams.OverrideFivetranExamplePrice
2126
2124
  | SubscriptionCreateParams.OverrideThresholdTotalAmountPrice
2127
2125
  | SubscriptionCreateParams.OverrideTieredPackagePrice
2128
2126
  | SubscriptionCreateParams.OverrideTieredWithMinimumPrice
@@ -2840,136 +2838,6 @@ export namespace SubscriptionCreateParams {
2840
2838
  }
2841
2839
  }
2842
2840
 
2843
- export interface OverrideTestRatingFunctionPrice {
2844
- id: string;
2845
-
2846
- model_type: 'test_rating_function';
2847
-
2848
- test_rating_function_config: Record<string, unknown>;
2849
-
2850
- /**
2851
- * The subscription's override discount for the plan.
2852
- */
2853
- discount?: OverrideTestRatingFunctionPrice.Discount | null;
2854
-
2855
- /**
2856
- * The starting quantity of the price, if the price is a fixed price.
2857
- */
2858
- fixed_price_quantity?: number | null;
2859
-
2860
- /**
2861
- * The subscription's override maximum amount for the plan.
2862
- */
2863
- maximum_amount?: string | null;
2864
-
2865
- /**
2866
- * The subscription's override minimum amount for the plan.
2867
- */
2868
- minimum_amount?: string | null;
2869
- }
2870
-
2871
- export namespace OverrideTestRatingFunctionPrice {
2872
- /**
2873
- * The subscription's override discount for the plan.
2874
- */
2875
- export interface Discount {
2876
- discount_type: 'percentage' | 'trial' | 'usage' | 'amount';
2877
-
2878
- /**
2879
- * Only available if discount_type is `amount`.
2880
- */
2881
- amount_discount?: string | null;
2882
-
2883
- /**
2884
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
2885
- * this can be a subset of prices.
2886
- */
2887
- applies_to_price_ids?: Array<string> | null;
2888
-
2889
- /**
2890
- * Only available if discount_type is `percentage`. This is a number between 0
2891
- * and 1.
2892
- */
2893
- percentage_discount?: number | null;
2894
-
2895
- /**
2896
- * Only available if discount_type is `trial`
2897
- */
2898
- trial_amount_discount?: string | null;
2899
-
2900
- /**
2901
- * Only available if discount_type is `usage`. Number of usage units that this
2902
- * discount is for
2903
- */
2904
- usage_discount?: number | null;
2905
- }
2906
- }
2907
-
2908
- export interface OverrideFivetranExamplePrice {
2909
- id: string;
2910
-
2911
- fivetran_example_config: Record<string, unknown>;
2912
-
2913
- model_type: 'fivetran_example';
2914
-
2915
- /**
2916
- * The subscription's override discount for the plan.
2917
- */
2918
- discount?: OverrideFivetranExamplePrice.Discount | null;
2919
-
2920
- /**
2921
- * The starting quantity of the price, if the price is a fixed price.
2922
- */
2923
- fixed_price_quantity?: number | null;
2924
-
2925
- /**
2926
- * The subscription's override maximum amount for the plan.
2927
- */
2928
- maximum_amount?: string | null;
2929
-
2930
- /**
2931
- * The subscription's override minimum amount for the plan.
2932
- */
2933
- minimum_amount?: string | null;
2934
- }
2935
-
2936
- export namespace OverrideFivetranExamplePrice {
2937
- /**
2938
- * The subscription's override discount for the plan.
2939
- */
2940
- export interface Discount {
2941
- discount_type: 'percentage' | 'trial' | 'usage' | 'amount';
2942
-
2943
- /**
2944
- * Only available if discount_type is `amount`.
2945
- */
2946
- amount_discount?: string | null;
2947
-
2948
- /**
2949
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
2950
- * this can be a subset of prices.
2951
- */
2952
- applies_to_price_ids?: Array<string> | null;
2953
-
2954
- /**
2955
- * Only available if discount_type is `percentage`. This is a number between 0
2956
- * and 1.
2957
- */
2958
- percentage_discount?: number | null;
2959
-
2960
- /**
2961
- * Only available if discount_type is `trial`
2962
- */
2963
- trial_amount_discount?: string | null;
2964
-
2965
- /**
2966
- * Only available if discount_type is `usage`. Number of usage units that this
2967
- * discount is for
2968
- */
2969
- usage_discount?: number | null;
2970
- }
2971
- }
2972
-
2973
2841
  export interface OverrideThresholdTotalAmountPrice {
2974
2842
  id: string;
2975
2843
 
@@ -4444,8 +4312,6 @@ export interface SubscriptionSchedulePlanChangeParams {
4444
4312
  | SubscriptionSchedulePlanChangeParams.OverrideBpsPrice
4445
4313
  | SubscriptionSchedulePlanChangeParams.OverrideBulkBpsPrice
4446
4314
  | SubscriptionSchedulePlanChangeParams.OverrideBulkPrice
4447
- | SubscriptionSchedulePlanChangeParams.OverrideTestRatingFunctionPrice
4448
- | SubscriptionSchedulePlanChangeParams.OverrideFivetranExamplePrice
4449
4315
  | SubscriptionSchedulePlanChangeParams.OverrideThresholdTotalAmountPrice
4450
4316
  | SubscriptionSchedulePlanChangeParams.OverrideTieredPackagePrice
4451
4317
  | SubscriptionSchedulePlanChangeParams.OverrideTieredWithMinimumPrice
@@ -5161,136 +5027,6 @@ export namespace SubscriptionSchedulePlanChangeParams {
5161
5027
  }
5162
5028
  }
5163
5029
 
5164
- export interface OverrideTestRatingFunctionPrice {
5165
- id: string;
5166
-
5167
- model_type: 'test_rating_function';
5168
-
5169
- test_rating_function_config: Record<string, unknown>;
5170
-
5171
- /**
5172
- * The subscription's override discount for the plan.
5173
- */
5174
- discount?: OverrideTestRatingFunctionPrice.Discount | null;
5175
-
5176
- /**
5177
- * The starting quantity of the price, if the price is a fixed price.
5178
- */
5179
- fixed_price_quantity?: number | null;
5180
-
5181
- /**
5182
- * The subscription's override maximum amount for the plan.
5183
- */
5184
- maximum_amount?: string | null;
5185
-
5186
- /**
5187
- * The subscription's override minimum amount for the plan.
5188
- */
5189
- minimum_amount?: string | null;
5190
- }
5191
-
5192
- export namespace OverrideTestRatingFunctionPrice {
5193
- /**
5194
- * The subscription's override discount for the plan.
5195
- */
5196
- export interface Discount {
5197
- discount_type: 'percentage' | 'trial' | 'usage' | 'amount';
5198
-
5199
- /**
5200
- * Only available if discount_type is `amount`.
5201
- */
5202
- amount_discount?: string | null;
5203
-
5204
- /**
5205
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
5206
- * this can be a subset of prices.
5207
- */
5208
- applies_to_price_ids?: Array<string> | null;
5209
-
5210
- /**
5211
- * Only available if discount_type is `percentage`. This is a number between 0
5212
- * and 1.
5213
- */
5214
- percentage_discount?: number | null;
5215
-
5216
- /**
5217
- * Only available if discount_type is `trial`
5218
- */
5219
- trial_amount_discount?: string | null;
5220
-
5221
- /**
5222
- * Only available if discount_type is `usage`. Number of usage units that this
5223
- * discount is for
5224
- */
5225
- usage_discount?: number | null;
5226
- }
5227
- }
5228
-
5229
- export interface OverrideFivetranExamplePrice {
5230
- id: string;
5231
-
5232
- fivetran_example_config: Record<string, unknown>;
5233
-
5234
- model_type: 'fivetran_example';
5235
-
5236
- /**
5237
- * The subscription's override discount for the plan.
5238
- */
5239
- discount?: OverrideFivetranExamplePrice.Discount | null;
5240
-
5241
- /**
5242
- * The starting quantity of the price, if the price is a fixed price.
5243
- */
5244
- fixed_price_quantity?: number | null;
5245
-
5246
- /**
5247
- * The subscription's override maximum amount for the plan.
5248
- */
5249
- maximum_amount?: string | null;
5250
-
5251
- /**
5252
- * The subscription's override minimum amount for the plan.
5253
- */
5254
- minimum_amount?: string | null;
5255
- }
5256
-
5257
- export namespace OverrideFivetranExamplePrice {
5258
- /**
5259
- * The subscription's override discount for the plan.
5260
- */
5261
- export interface Discount {
5262
- discount_type: 'percentage' | 'trial' | 'usage' | 'amount';
5263
-
5264
- /**
5265
- * Only available if discount_type is `amount`.
5266
- */
5267
- amount_discount?: string | null;
5268
-
5269
- /**
5270
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
5271
- * this can be a subset of prices.
5272
- */
5273
- applies_to_price_ids?: Array<string> | null;
5274
-
5275
- /**
5276
- * Only available if discount_type is `percentage`. This is a number between 0
5277
- * and 1.
5278
- */
5279
- percentage_discount?: number | null;
5280
-
5281
- /**
5282
- * Only available if discount_type is `trial`
5283
- */
5284
- trial_amount_discount?: string | null;
5285
-
5286
- /**
5287
- * Only available if discount_type is `usage`. Number of usage units that this
5288
- * discount is for
5289
- */
5290
- usage_discount?: number | null;
5291
- }
5292
- }
5293
-
5294
5030
  export interface OverrideThresholdTotalAmountPrice {
5295
5031
  id: string;
5296
5032
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.34.2'; // x-release-please-version
1
+ export const VERSION = '1.35.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.34.2";
1
+ export declare const VERSION = "1.35.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 = '1.34.2'; // x-release-please-version
4
+ exports.VERSION = '1.35.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.34.2'; // x-release-please-version
1
+ export const VERSION = '1.35.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map