orb-billing 5.38.0 → 5.40.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 (80) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +1 -1
  3. package/README.md +4 -1
  4. package/index.d.mts +7 -4
  5. package/index.d.ts +7 -4
  6. package/index.d.ts.map +1 -1
  7. package/index.js +5 -0
  8. package/index.js.map +1 -1
  9. package/index.mjs +7 -2
  10. package/index.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/credit-blocks.d.ts +59 -0
  13. package/resources/credit-blocks.d.ts.map +1 -0
  14. package/resources/credit-blocks.js +38 -0
  15. package/resources/credit-blocks.js.map +1 -0
  16. package/resources/credit-blocks.mjs +34 -0
  17. package/resources/credit-blocks.mjs.map +1 -0
  18. package/resources/index.d.ts +3 -2
  19. package/resources/index.d.ts.map +1 -1
  20. package/resources/index.js +5 -1
  21. package/resources/index.js.map +1 -1
  22. package/resources/index.mjs +3 -2
  23. package/resources/index.mjs.map +1 -1
  24. package/resources/invoices.d.ts +439 -2
  25. package/resources/invoices.d.ts.map +1 -1
  26. package/resources/invoices.js +28 -1
  27. package/resources/invoices.js.map +1 -1
  28. package/resources/invoices.mjs +26 -0
  29. package/resources/invoices.mjs.map +1 -1
  30. package/resources/plans/index.d.ts +1 -0
  31. package/resources/plans/index.d.ts.map +1 -1
  32. package/resources/plans/index.js +4 -1
  33. package/resources/plans/index.js.map +1 -1
  34. package/resources/plans/index.mjs +1 -0
  35. package/resources/plans/index.mjs.map +1 -1
  36. package/resources/plans/migrations.d.ts +47 -0
  37. package/resources/plans/migrations.d.ts.map +1 -0
  38. package/resources/plans/migrations.js +36 -0
  39. package/resources/plans/migrations.js.map +1 -0
  40. package/resources/plans/migrations.mjs +31 -0
  41. package/resources/plans/migrations.mjs.map +1 -0
  42. package/resources/plans/plans.d.ts +4 -0
  43. package/resources/plans/plans.d.ts.map +1 -1
  44. package/resources/plans/plans.js +5 -0
  45. package/resources/plans/plans.js.map +1 -1
  46. package/resources/plans/plans.mjs +5 -0
  47. package/resources/plans/plans.mjs.map +1 -1
  48. package/resources/prices/prices.d.ts +1 -91
  49. package/resources/prices/prices.d.ts.map +1 -1
  50. package/resources/prices/prices.js.map +1 -1
  51. package/resources/prices/prices.mjs.map +1 -1
  52. package/resources/shared.d.ts +3 -273
  53. package/resources/shared.d.ts.map +1 -1
  54. package/resources/shared.js.map +1 -1
  55. package/resources/shared.mjs.map +1 -1
  56. package/resources/subscription-changes.d.ts +33 -1
  57. package/resources/subscription-changes.d.ts.map +1 -1
  58. package/resources/subscription-changes.js +15 -1
  59. package/resources/subscription-changes.js.map +1 -1
  60. package/resources/subscription-changes.mjs +13 -0
  61. package/resources/subscription-changes.mjs.map +1 -1
  62. package/resources/subscriptions.d.ts +1 -91
  63. package/resources/subscriptions.d.ts.map +1 -1
  64. package/resources/subscriptions.js.map +1 -1
  65. package/resources/subscriptions.mjs.map +1 -1
  66. package/src/index.ts +19 -0
  67. package/src/resources/credit-blocks.ts +81 -0
  68. package/src/resources/index.ts +7 -0
  69. package/src/resources/invoices.ts +557 -1
  70. package/src/resources/plans/index.ts +8 -0
  71. package/src/resources/plans/migrations.ts +105 -0
  72. package/src/resources/plans/plans.ts +21 -0
  73. package/src/resources/prices/prices.ts +1 -91
  74. package/src/resources/shared.ts +3 -273
  75. package/src/resources/subscription-changes.ts +64 -0
  76. package/src/resources/subscriptions.ts +1 -91
  77. package/src/version.ts +1 -1
  78. package/version.d.ts +1 -1
  79. package/version.js +1 -1
  80. package/version.mjs +1 -1
@@ -0,0 +1,105 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import { isRequestOptions } from '../../core';
5
+ import * as Core from '../../core';
6
+ import { Page, type PageParams } from '../../pagination';
7
+
8
+ export class Migrations extends APIResource {
9
+ /**
10
+ * Fetch migration
11
+ */
12
+ retrieve(
13
+ planId: string,
14
+ migrationId: string,
15
+ options?: Core.RequestOptions,
16
+ ): Core.APIPromise<MigrationRetrieveResponse> {
17
+ return this._client.get(`/plans/${planId}/migrations/${migrationId}`, options);
18
+ }
19
+
20
+ /**
21
+ * This endpoint returns a list of all migrations for a plan. The list of
22
+ * migrations is ordered starting from the most recently created migration. The
23
+ * response also includes pagination_metadata, which lets the caller retrieve the
24
+ * next page of results if they exist.
25
+ */
26
+ list(
27
+ planId: string,
28
+ query?: MigrationListParams,
29
+ options?: Core.RequestOptions,
30
+ ): Core.PagePromise<MigrationListResponsesPage, MigrationListResponse>;
31
+ list(
32
+ planId: string,
33
+ options?: Core.RequestOptions,
34
+ ): Core.PagePromise<MigrationListResponsesPage, MigrationListResponse>;
35
+ list(
36
+ planId: string,
37
+ query: MigrationListParams | Core.RequestOptions = {},
38
+ options?: Core.RequestOptions,
39
+ ): Core.PagePromise<MigrationListResponsesPage, MigrationListResponse> {
40
+ if (isRequestOptions(query)) {
41
+ return this.list(planId, {}, query);
42
+ }
43
+ return this._client.getAPIList(`/plans/${planId}/migrations`, MigrationListResponsesPage, {
44
+ query,
45
+ ...options,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * This endpoint cancels a migration.
51
+ */
52
+ cancel(
53
+ planId: string,
54
+ migrationId: string,
55
+ options?: Core.RequestOptions,
56
+ ): Core.APIPromise<MigrationCancelResponse> {
57
+ return this._client.post(`/plans/${planId}/migrations/${migrationId}/cancel`, options);
58
+ }
59
+ }
60
+
61
+ export class MigrationListResponsesPage extends Page<MigrationListResponse> {}
62
+
63
+ export interface MigrationRetrieveResponse {
64
+ id: string;
65
+
66
+ effective_time: (string & {}) | (string & {}) | 'end_of_term' | null;
67
+
68
+ plan_id: string;
69
+
70
+ status: 'not_started' | 'in_progress' | 'completed' | 'action_needed' | 'canceled';
71
+ }
72
+
73
+ export interface MigrationListResponse {
74
+ id: string;
75
+
76
+ effective_time: (string & {}) | (string & {}) | 'end_of_term' | null;
77
+
78
+ plan_id: string;
79
+
80
+ status: 'not_started' | 'in_progress' | 'completed' | 'action_needed' | 'canceled';
81
+ }
82
+
83
+ export interface MigrationCancelResponse {
84
+ id: string;
85
+
86
+ effective_time: (string & {}) | (string & {}) | 'end_of_term' | null;
87
+
88
+ plan_id: string;
89
+
90
+ status: 'not_started' | 'in_progress' | 'completed' | 'action_needed' | 'canceled';
91
+ }
92
+
93
+ export interface MigrationListParams extends PageParams {}
94
+
95
+ Migrations.MigrationListResponsesPage = MigrationListResponsesPage;
96
+
97
+ export declare namespace Migrations {
98
+ export {
99
+ type MigrationRetrieveResponse as MigrationRetrieveResponse,
100
+ type MigrationListResponse as MigrationListResponse,
101
+ type MigrationCancelResponse as MigrationCancelResponse,
102
+ MigrationListResponsesPage as MigrationListResponsesPage,
103
+ type MigrationListParams as MigrationListParams,
104
+ };
105
+ }
@@ -6,10 +6,20 @@ import * as Core from '../../core';
6
6
  import * as Shared from '../shared';
7
7
  import * as ExternalPlanIDAPI from './external-plan-id';
8
8
  import { ExternalPlanID, ExternalPlanIDUpdateParams } from './external-plan-id';
9
+ import * as MigrationsAPI from './migrations';
10
+ import {
11
+ MigrationCancelResponse,
12
+ MigrationListParams,
13
+ MigrationListResponse,
14
+ MigrationListResponsesPage,
15
+ MigrationRetrieveResponse,
16
+ Migrations,
17
+ } from './migrations';
9
18
  import { Page, type PageParams } from '../../pagination';
10
19
 
11
20
  export class Plans extends APIResource {
12
21
  externalPlanId: ExternalPlanIDAPI.ExternalPlanID = new ExternalPlanIDAPI.ExternalPlanID(this._client);
22
+ migrations: MigrationsAPI.Migrations = new MigrationsAPI.Migrations(this._client);
13
23
 
14
24
  /**
15
25
  * This endpoint allows creation of plans including their prices.
@@ -1214,6 +1224,8 @@ export interface PlanListParams extends PageParams {
1214
1224
 
1215
1225
  Plans.PlansPage = PlansPage;
1216
1226
  Plans.ExternalPlanID = ExternalPlanID;
1227
+ Plans.Migrations = Migrations;
1228
+ Plans.MigrationListResponsesPage = MigrationListResponsesPage;
1217
1229
 
1218
1230
  export declare namespace Plans {
1219
1231
  export {
@@ -1225,4 +1237,13 @@ export declare namespace Plans {
1225
1237
  };
1226
1238
 
1227
1239
  export { ExternalPlanID as ExternalPlanID, type ExternalPlanIDUpdateParams as ExternalPlanIDUpdateParams };
1240
+
1241
+ export {
1242
+ Migrations as Migrations,
1243
+ type MigrationRetrieveResponse as MigrationRetrieveResponse,
1244
+ type MigrationListResponse as MigrationListResponse,
1245
+ type MigrationCancelResponse as MigrationCancelResponse,
1246
+ MigrationListResponsesPage as MigrationListResponsesPage,
1247
+ type MigrationListParams as MigrationListParams,
1248
+ };
1228
1249
  }
@@ -1016,9 +1016,6 @@ export declare namespace PriceCreateParams {
1016
1016
  * Configuration for a single threshold
1017
1017
  */
1018
1018
  export interface ConsumptionTable {
1019
- /**
1020
- * Quantity threshold
1021
- */
1022
1019
  threshold: string;
1023
1020
 
1024
1021
  /**
@@ -1128,9 +1125,6 @@ export declare namespace PriceCreateParams {
1128
1125
  * Configuration for tiered_package pricing
1129
1126
  */
1130
1127
  export interface TieredPackageConfig {
1131
- /**
1132
- * Package size
1133
- */
1134
1128
  package_size: string;
1135
1129
 
1136
1130
  /**
@@ -1152,9 +1146,6 @@ export declare namespace PriceCreateParams {
1152
1146
  */
1153
1147
  per_unit: string;
1154
1148
 
1155
- /**
1156
- * Tier lower bound
1157
- */
1158
1149
  tier_lower_bound: string;
1159
1150
  }
1160
1151
  }
@@ -1281,14 +1272,8 @@ export declare namespace PriceCreateParams {
1281
1272
  * Configuration for a single tier
1282
1273
  */
1283
1274
  export interface Tier {
1284
- /**
1285
- * Minimum amount
1286
- */
1287
1275
  minimum_amount: string;
1288
1276
 
1289
- /**
1290
- * Tier lower bound
1291
- */
1292
1277
  tier_lower_bound: string;
1293
1278
 
1294
1279
  /**
@@ -1415,9 +1400,6 @@ export declare namespace PriceCreateParams {
1415
1400
  * Configuration for a single tier
1416
1401
  */
1417
1402
  export interface Tier {
1418
- /**
1419
- * Tier lower bound
1420
- */
1421
1403
  tier_lower_bound: string;
1422
1404
 
1423
1405
  /**
@@ -1527,9 +1509,6 @@ export declare namespace PriceCreateParams {
1527
1509
  * Configuration for tiered_package_with_minimum pricing
1528
1510
  */
1529
1511
  export interface TieredPackageWithMinimumConfig {
1530
- /**
1531
- * Package size
1532
- */
1533
1512
  package_size: number;
1534
1513
 
1535
1514
  /**
@@ -1544,19 +1523,10 @@ export declare namespace PriceCreateParams {
1544
1523
  * Configuration for a single tier
1545
1524
  */
1546
1525
  export interface Tier {
1547
- /**
1548
- * Minimum amount
1549
- */
1550
1526
  minimum_amount: string;
1551
1527
 
1552
- /**
1553
- * Price per package
1554
- */
1555
1528
  per_unit: string;
1556
1529
 
1557
- /**
1558
- * Tier lower bound
1559
- */
1560
1530
  tier_lower_bound: string;
1561
1531
  }
1562
1532
  }
@@ -1661,19 +1631,10 @@ export declare namespace PriceCreateParams {
1661
1631
  * Configuration for package_with_allocation pricing
1662
1632
  */
1663
1633
  export interface PackageWithAllocationConfig {
1664
- /**
1665
- * Usage allocation
1666
- */
1667
1634
  allocation: string;
1668
1635
 
1669
- /**
1670
- * Price per package
1671
- */
1672
1636
  package_amount: string;
1673
1637
 
1674
- /**
1675
- * Package size
1676
- */
1677
1638
  package_size: string;
1678
1639
  }
1679
1640
  }
@@ -2605,14 +2566,8 @@ export declare namespace PriceCreateParams {
2605
2566
  * Configuration for a scaling factor
2606
2567
  */
2607
2568
  export interface ScalingFactor {
2608
- /**
2609
- * Scaling factor
2610
- */
2611
2569
  scaling_factor: string;
2612
2570
 
2613
- /**
2614
- * Scaling value
2615
- */
2616
2571
  scaling_value: string;
2617
2572
  }
2618
2573
 
@@ -2620,9 +2575,6 @@ export declare namespace PriceCreateParams {
2620
2575
  * Configuration for a unit amount
2621
2576
  */
2622
2577
  export interface UnitAmount {
2623
- /**
2624
- * Pricing value
2625
- */
2626
2578
  pricing_value: string;
2627
2579
 
2628
2580
  /**
@@ -2991,9 +2943,6 @@ export declare namespace PriceCreateParams {
2991
2943
  */
2992
2944
  grouping_key: string;
2993
2945
 
2994
- /**
2995
- * Package size
2996
- */
2997
2946
  package_size: string;
2998
2947
 
2999
2948
  /**
@@ -3009,13 +2958,10 @@ export declare namespace PriceCreateParams {
3009
2958
  */
3010
2959
  export interface Tier {
3011
2960
  /**
3012
- * Price per package
2961
+ * Per package
3013
2962
  */
3014
2963
  per_unit: string;
3015
2964
 
3016
- /**
3017
- * Tier lower bound
3018
- */
3019
2965
  tier_lower_bound: string;
3020
2966
  }
3021
2967
  }
@@ -3125,9 +3071,6 @@ export declare namespace PriceCreateParams {
3125
3071
  */
3126
3072
  grouping_key: string;
3127
3073
 
3128
- /**
3129
- * Package size
3130
- */
3131
3074
  package_size: string;
3132
3075
 
3133
3076
  /**
@@ -3141,9 +3084,6 @@ export declare namespace PriceCreateParams {
3141
3084
  * Configuration for a single tier
3142
3085
  */
3143
3086
  export interface Tier {
3144
- /**
3145
- * Tier lower bound
3146
- */
3147
3087
  tier_lower_bound: string;
3148
3088
 
3149
3089
  /**
@@ -3284,19 +3224,10 @@ export declare namespace PriceCreateParams {
3284
3224
  * Configuration for a single matrix scaling factor
3285
3225
  */
3286
3226
  export interface MatrixScalingFactor {
3287
- /**
3288
- * First dimension value
3289
- */
3290
3227
  first_dimension_value: string;
3291
3228
 
3292
- /**
3293
- * Scaling factor
3294
- */
3295
3229
  scaling_factor: string;
3296
3230
 
3297
- /**
3298
- * Second dimension value (optional)
3299
- */
3300
3231
  second_dimension_value?: string | null;
3301
3232
  }
3302
3233
  }
@@ -3411,9 +3342,6 @@ export declare namespace PriceCreateParams {
3411
3342
  */
3412
3343
  matrix_scaling_factors: Array<ScalableMatrixWithTieredPricingConfig.MatrixScalingFactor>;
3413
3344
 
3414
- /**
3415
- * Tier pricing structure
3416
- */
3417
3345
  tiers: Array<ScalableMatrixWithTieredPricingConfig.Tier>;
3418
3346
 
3419
3347
  /**
@@ -3427,19 +3355,10 @@ export declare namespace PriceCreateParams {
3427
3355
  * Configuration for a single matrix scaling factor
3428
3356
  */
3429
3357
  export interface MatrixScalingFactor {
3430
- /**
3431
- * First dimension value
3432
- */
3433
3358
  first_dimension_value: string;
3434
3359
 
3435
- /**
3436
- * Scaling factor
3437
- */
3438
3360
  scaling_factor: string;
3439
3361
 
3440
- /**
3441
- * Second dimension value (optional)
3442
- */
3443
3362
  second_dimension_value?: string | null;
3444
3363
  }
3445
3364
 
@@ -3447,14 +3366,8 @@ export declare namespace PriceCreateParams {
3447
3366
  * Configuration for a single tier entry with business logic
3448
3367
  */
3449
3368
  export interface Tier {
3450
- /**
3451
- * Tier lower bound
3452
- */
3453
3369
  tier_lower_bound: string;
3454
3370
 
3455
- /**
3456
- * Per unit amount
3457
- */
3458
3371
  unit_amount: string;
3459
3372
  }
3460
3373
  }
@@ -3564,9 +3477,6 @@ export declare namespace PriceCreateParams {
3564
3477
  */
3565
3478
  dimension_values: Array<CumulativeGroupedBulkConfig.DimensionValue>;
3566
3479
 
3567
- /**
3568
- * Grouping key name
3569
- */
3570
3480
  group: string;
3571
3481
  }
3572
3482