orb-billing 1.54.0 → 1.56.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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/orb/client.rb +7 -0
  5. data/lib/orb/models/beta/external_plan_id_create_plan_version_params.rb +496 -6
  6. data/lib/orb/models/beta_create_plan_version_params.rb +496 -6
  7. data/lib/orb/models/changed_subscription_resources.rb +2 -2
  8. data/lib/orb/models/credit_block_accounting_sync_failed_webhook_event.rb +4 -4
  9. data/lib/orb/models/credit_block_accounting_sync_succeeded_webhook_event.rb +4 -4
  10. data/lib/orb/models/credit_block_list_invoices_response.rb +4 -4
  11. data/lib/orb/models/credit_block_retrieve_response.rb +4 -4
  12. data/lib/orb/models/credit_block_update_response.rb +4 -4
  13. data/lib/orb/models/customer_credit_ledger_incremented_webhook_event.rb +4 -4
  14. data/lib/orb/models/dimensional_price_groups/price_create_response.rb +2 -2
  15. data/lib/orb/models/invoice.rb +2 -2
  16. data/lib/orb/models/invoice_edited_webhook_event.rb +2 -2
  17. data/lib/orb/models/invoice_fetch_upcoming_response.rb +2 -2
  18. data/lib/orb/models/invoice_line_item_create_response.rb +2 -2
  19. data/lib/orb/models/metric_update_params.rb +4 -3
  20. data/lib/orb/models/migration_cancel_params.rb +20 -0
  21. data/lib/orb/models/migration_cancel_response.rb +133 -0
  22. data/lib/orb/models/migration_create_params.rb +159 -0
  23. data/lib/orb/models/migration_create_response.rb +133 -0
  24. data/lib/orb/models/migration_list_params.rb +48 -0
  25. data/lib/orb/models/migration_list_response.rb +133 -0
  26. data/lib/orb/models/migration_retrieve_params.rb +20 -0
  27. data/lib/orb/models/migration_retrieve_response.rb +133 -0
  28. data/lib/orb/models/migration_subscription.rb +75 -0
  29. data/lib/orb/models/migrations/subscription_list_params.rb +74 -0
  30. data/lib/orb/models/per_price_cost.rb +2 -2
  31. data/lib/orb/models/plan.rb +2 -2
  32. data/lib/orb/models/plan_create_params.rb +246 -3
  33. data/lib/orb/models/plan_version.rb +2 -2
  34. data/lib/orb/models/plans/migration_cancel_response.rb +28 -8
  35. data/lib/orb/models/plans/migration_list_response.rb +28 -8
  36. data/lib/orb/models/plans/migration_retrieve_response.rb +28 -8
  37. data/lib/orb/models/price.rb +416 -1
  38. data/lib/orb/models/price_create_params.rb +231 -3
  39. data/lib/orb/models/price_edited_webhook_event.rb +2 -2
  40. data/lib/orb/models/price_evaluate_multiple_params.rb +238 -3
  41. data/lib/orb/models/price_evaluate_preview_events_params.rb +238 -3
  42. data/lib/orb/models/price_interval.rb +2 -2
  43. data/lib/orb/models/subscription_create_params.rb +495 -6
  44. data/lib/orb/models/subscription_price_intervals_params.rb +238 -3
  45. data/lib/orb/models/subscription_schedule_plan_change_params.rb +496 -6
  46. data/lib/orb/models/webhooks/credit_block_accounting_sync_failed_standard_webhook_event.rb +4 -4
  47. data/lib/orb/models/webhooks/credit_block_accounting_sync_succeeded_standard_webhook_event.rb +4 -4
  48. data/lib/orb/models/webhooks/customer_credit_ledger_incremented_standard_webhook_event.rb +4 -4
  49. data/lib/orb/models/webhooks/invoice_edited_standard_webhook_event.rb +2 -2
  50. data/lib/orb/models/webhooks/price_edited_standard_webhook_event.rb +2 -2
  51. data/lib/orb/models.rb +12 -0
  52. data/lib/orb/resources/credit_blocks.rb +1 -1
  53. data/lib/orb/resources/dimensional_price_groups/prices.rb +1 -1
  54. data/lib/orb/resources/metrics.rb +11 -10
  55. data/lib/orb/resources/migrations/subscriptions.rb +60 -0
  56. data/lib/orb/resources/migrations.rb +153 -0
  57. data/lib/orb/resources/prices/external_price_id.rb +2 -2
  58. data/lib/orb/resources/prices.rb +5 -5
  59. data/lib/orb/version.rb +1 -1
  60. data/lib/orb.rb +12 -0
  61. data/rbi/orb/client.rbi +6 -0
  62. data/rbi/orb/models/beta/external_plan_id_create_plan_version_params.rbi +2939 -2129
  63. data/rbi/orb/models/beta_create_plan_version_params.rbi +2937 -2127
  64. data/rbi/orb/models/changed_subscription_resources.rbi +2 -1
  65. data/rbi/orb/models/credit_block_accounting_sync_failed_webhook_event.rbi +5 -5
  66. data/rbi/orb/models/credit_block_accounting_sync_succeeded_webhook_event.rbi +5 -5
  67. data/rbi/orb/models/credit_block_list_invoices_response.rbi +5 -5
  68. data/rbi/orb/models/credit_block_retrieve_response.rbi +5 -5
  69. data/rbi/orb/models/credit_block_update_response.rbi +5 -5
  70. data/rbi/orb/models/customer_credit_ledger_incremented_webhook_event.rbi +5 -5
  71. data/rbi/orb/models/dimensional_price_groups/price_create_response.rbi +2 -1
  72. data/rbi/orb/models/invoice.rbi +2 -1
  73. data/rbi/orb/models/invoice_edited_webhook_event.rbi +2 -1
  74. data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +2 -1
  75. data/rbi/orb/models/invoice_line_item_create_response.rbi +2 -1
  76. data/rbi/orb/models/metric_update_params.rbi +6 -4
  77. data/rbi/orb/models/migration_cancel_params.rbi +35 -0
  78. data/rbi/orb/models/migration_cancel_response.rbi +218 -0
  79. data/rbi/orb/models/migration_create_params.rbi +248 -0
  80. data/rbi/orb/models/migration_create_response.rbi +218 -0
  81. data/rbi/orb/models/migration_list_params.rbi +66 -0
  82. data/rbi/orb/models/migration_list_response.rbi +214 -0
  83. data/rbi/orb/models/migration_retrieve_params.rbi +35 -0
  84. data/rbi/orb/models/migration_retrieve_response.rbi +221 -0
  85. data/rbi/orb/models/migration_subscription.rbi +112 -0
  86. data/rbi/orb/models/migrations/subscription_list_params.rbi +147 -0
  87. data/rbi/orb/models/per_price_cost.rbi +2 -1
  88. data/rbi/orb/models/plan.rbi +2 -1
  89. data/rbi/orb/models/plan_create_params.rbi +409 -4
  90. data/rbi/orb/models/plan_version.rbi +2 -1
  91. data/rbi/orb/models/plans/migration_cancel_response.rbi +36 -12
  92. data/rbi/orb/models/plans/migration_list_response.rbi +36 -12
  93. data/rbi/orb/models/plans/migration_retrieve_response.rbi +36 -12
  94. data/rbi/orb/models/price.rbi +716 -1
  95. data/rbi/orb/models/price_create_params.rbi +397 -4
  96. data/rbi/orb/models/price_edited_webhook_event.rbi +2 -1
  97. data/rbi/orb/models/price_evaluate_multiple_params.rbi +397 -4
  98. data/rbi/orb/models/price_evaluate_preview_events_params.rbi +397 -4
  99. data/rbi/orb/models/price_interval.rbi +2 -1
  100. data/rbi/orb/models/subscription_create_params.rbi +2676 -1866
  101. data/rbi/orb/models/subscription_price_intervals_params.rbi +397 -4
  102. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +2686 -1876
  103. data/rbi/orb/models/webhooks/credit_block_accounting_sync_failed_standard_webhook_event.rbi +5 -5
  104. data/rbi/orb/models/webhooks/credit_block_accounting_sync_succeeded_standard_webhook_event.rbi +5 -5
  105. data/rbi/orb/models/webhooks/customer_credit_ledger_incremented_standard_webhook_event.rbi +5 -5
  106. data/rbi/orb/models/webhooks/invoice_edited_standard_webhook_event.rbi +2 -1
  107. data/rbi/orb/models/webhooks/price_edited_standard_webhook_event.rbi +2 -1
  108. data/rbi/orb/models.rbi +12 -0
  109. data/rbi/orb/resources/credit_blocks.rbi +1 -1
  110. data/rbi/orb/resources/metrics.rbi +13 -11
  111. data/rbi/orb/resources/migrations/subscriptions.rbi +54 -0
  112. data/rbi/orb/resources/migrations.rbi +130 -0
  113. data/rbi/orb/resources/prices.rbi +2 -1
  114. data/sig/orb/client.rbs +2 -0
  115. data/sig/orb/models/beta/external_plan_id_create_plan_version_params.rbs +322 -0
  116. data/sig/orb/models/beta_create_plan_version_params.rbs +322 -0
  117. data/sig/orb/models/credit_block_accounting_sync_failed_webhook_event.rbs +2 -2
  118. data/sig/orb/models/credit_block_accounting_sync_succeeded_webhook_event.rbs +2 -2
  119. data/sig/orb/models/credit_block_list_invoices_response.rbs +2 -2
  120. data/sig/orb/models/credit_block_retrieve_response.rbs +2 -2
  121. data/sig/orb/models/credit_block_update_response.rbs +2 -2
  122. data/sig/orb/models/customer_credit_ledger_incremented_webhook_event.rbs +2 -2
  123. data/sig/orb/models/migration_cancel_params.rbs +23 -0
  124. data/sig/orb/models/migration_cancel_response.rbs +84 -0
  125. data/sig/orb/models/migration_create_params.rbs +126 -0
  126. data/sig/orb/models/migration_create_response.rbs +84 -0
  127. data/sig/orb/models/migration_list_params.rbs +43 -0
  128. data/sig/orb/models/migration_list_response.rbs +84 -0
  129. data/sig/orb/models/migration_retrieve_params.rbs +23 -0
  130. data/sig/orb/models/migration_retrieve_response.rbs +84 -0
  131. data/sig/orb/models/migration_subscription.rbs +54 -0
  132. data/sig/orb/models/migrations/subscription_list_params.rbs +64 -0
  133. data/sig/orb/models/plan_create_params.rbs +161 -0
  134. data/sig/orb/models/plans/migration_cancel_response.rbs +17 -4
  135. data/sig/orb/models/plans/migration_list_response.rbs +17 -4
  136. data/sig/orb/models/plans/migration_retrieve_response.rbs +17 -4
  137. data/sig/orb/models/price.rbs +305 -0
  138. data/sig/orb/models/price_create_params.rbs +151 -0
  139. data/sig/orb/models/price_evaluate_multiple_params.rbs +156 -0
  140. data/sig/orb/models/price_evaluate_preview_events_params.rbs +156 -0
  141. data/sig/orb/models/subscription_create_params.rbs +322 -0
  142. data/sig/orb/models/subscription_price_intervals_params.rbs +156 -0
  143. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +322 -0
  144. data/sig/orb/models/webhooks/credit_block_accounting_sync_failed_standard_webhook_event.rbs +2 -2
  145. data/sig/orb/models/webhooks/credit_block_accounting_sync_succeeded_standard_webhook_event.rbs +2 -2
  146. data/sig/orb/models/webhooks/customer_credit_ledger_incremented_standard_webhook_event.rbs +2 -2
  147. data/sig/orb/models.rbs +12 -0
  148. data/sig/orb/resources/migrations/subscriptions.rbs +18 -0
  149. data/sig/orb/resources/migrations.rbs +44 -0
  150. metadata +37 -1
@@ -344,7 +344,7 @@ module Orb
344
344
  sig { returns(T.nilable(String)) }
345
345
  attr_accessor :per_unit_cost_basis
346
346
 
347
- # `void` means the credit block was deleted. A voided block's `balance` is
347
+ # A deleted credit block keeps its historical fields, and its `balance` is
348
348
  # always 0.
349
349
  sig do
350
350
  returns(
@@ -442,7 +442,7 @@ module Orb
442
442
  # `null`.
443
443
  metadata:,
444
444
  per_unit_cost_basis:,
445
- # `void` means the credit block was deleted. A voided block's `balance` is
445
+ # A deleted credit block keeps its historical fields, and its `balance` is
446
446
  # always 0.
447
447
  status:,
448
448
  # The credit allocation that funded a block. Extends the allocation resource
@@ -683,7 +683,7 @@ module Orb
683
683
  end
684
684
  end
685
685
 
686
- # `void` means the credit block was deleted. A voided block's `balance` is
686
+ # A deleted credit block keeps its historical fields, and its `balance` is
687
687
  # always 0.
688
688
  module Status
689
689
  extend Orb::Internal::Type::Enum
@@ -707,9 +707,9 @@ module Orb
707
707
  :pending_payment,
708
708
  Orb::Webhooks::CreditBlockAccountingSyncFailedStandardWebhookEvent::Block::Status::TaggedSymbol
709
709
  )
710
- VOID =
710
+ DELETED =
711
711
  T.let(
712
- :void,
712
+ :deleted,
713
713
  Orb::Webhooks::CreditBlockAccountingSyncFailedStandardWebhookEvent::Block::Status::TaggedSymbol
714
714
  )
715
715
 
@@ -344,7 +344,7 @@ module Orb
344
344
  sig { returns(T.nilable(String)) }
345
345
  attr_accessor :per_unit_cost_basis
346
346
 
347
- # `void` means the credit block was deleted. A voided block's `balance` is
347
+ # A deleted credit block keeps its historical fields, and its `balance` is
348
348
  # always 0.
349
349
  sig do
350
350
  returns(
@@ -442,7 +442,7 @@ module Orb
442
442
  # `null`.
443
443
  metadata:,
444
444
  per_unit_cost_basis:,
445
- # `void` means the credit block was deleted. A voided block's `balance` is
445
+ # A deleted credit block keeps its historical fields, and its `balance` is
446
446
  # always 0.
447
447
  status:,
448
448
  # The credit allocation that funded a block. Extends the allocation resource
@@ -683,7 +683,7 @@ module Orb
683
683
  end
684
684
  end
685
685
 
686
- # `void` means the credit block was deleted. A voided block's `balance` is
686
+ # A deleted credit block keeps its historical fields, and its `balance` is
687
687
  # always 0.
688
688
  module Status
689
689
  extend Orb::Internal::Type::Enum
@@ -707,9 +707,9 @@ module Orb
707
707
  :pending_payment,
708
708
  Orb::Webhooks::CreditBlockAccountingSyncSucceededStandardWebhookEvent::Block::Status::TaggedSymbol
709
709
  )
710
- VOID =
710
+ DELETED =
711
711
  T.let(
712
- :void,
712
+ :deleted,
713
713
  Orb::Webhooks::CreditBlockAccountingSyncSucceededStandardWebhookEvent::Block::Status::TaggedSymbol
714
714
  )
715
715
 
@@ -302,7 +302,7 @@ module Orb
302
302
  sig { returns(T.nilable(String)) }
303
303
  attr_accessor :per_unit_cost_basis
304
304
 
305
- # `void` means the credit block was deleted. A voided block's `balance` is
305
+ # A deleted credit block keeps its historical fields, and its `balance` is
306
306
  # always 0.
307
307
  sig do
308
308
  returns(
@@ -400,7 +400,7 @@ module Orb
400
400
  # `null`.
401
401
  metadata:,
402
402
  per_unit_cost_basis:,
403
- # `void` means the credit block was deleted. A voided block's `balance` is
403
+ # A deleted credit block keeps its historical fields, and its `balance` is
404
404
  # always 0.
405
405
  status:,
406
406
  # The credit allocation that funded a block. Extends the allocation resource
@@ -641,7 +641,7 @@ module Orb
641
641
  end
642
642
  end
643
643
 
644
- # `void` means the credit block was deleted. A voided block's `balance` is
644
+ # A deleted credit block keeps its historical fields, and its `balance` is
645
645
  # always 0.
646
646
  module Status
647
647
  extend Orb::Internal::Type::Enum
@@ -665,9 +665,9 @@ module Orb
665
665
  :pending_payment,
666
666
  Orb::Webhooks::CustomerCreditLedgerIncrementedStandardWebhookEvent::Properties::Block::Status::TaggedSymbol
667
667
  )
668
- VOID =
668
+ DELETED =
669
669
  T.let(
670
- :void,
670
+ :deleted,
671
671
  Orb::Webhooks::CustomerCreditLedgerIncrementedStandardWebhookEvent::Properties::Block::Status::TaggedSymbol
672
672
  )
673
673
 
@@ -1839,7 +1839,8 @@ module Orb
1839
1839
  Orb::Price::MeteredAllowance::OrHash,
1840
1840
  Orb::Price::MinimumComposite::OrHash,
1841
1841
  Orb::Price::Percent::OrHash,
1842
- Orb::Price::EventOutput::OrHash
1842
+ Orb::Price::EventOutput::OrHash,
1843
+ Orb::Price::UnitWithMultiplier::OrHash
1843
1844
  ),
1844
1845
  quantity: Float,
1845
1846
  start_date: Time,
@@ -107,7 +107,8 @@ module Orb
107
107
  Orb::Price::MeteredAllowance::OrHash,
108
108
  Orb::Price::MinimumComposite::OrHash,
109
109
  Orb::Price::Percent::OrHash,
110
- Orb::Price::EventOutput::OrHash
110
+ Orb::Price::EventOutput::OrHash,
111
+ Orb::Price::UnitWithMultiplier::OrHash
111
112
  ),
112
113
  properties:
113
114
  Orb::Webhooks::PriceEditedStandardWebhookEvent::Properties::OrHash,
data/rbi/orb/models.rbi CHANGED
@@ -411,6 +411,18 @@ module Orb
411
411
 
412
412
  MetricUpdateParams = Orb::Models::MetricUpdateParams
413
413
 
414
+ MigrationCancelParams = Orb::Models::MigrationCancelParams
415
+
416
+ MigrationCreateParams = Orb::Models::MigrationCreateParams
417
+
418
+ MigrationListParams = Orb::Models::MigrationListParams
419
+
420
+ MigrationRetrieveParams = Orb::Models::MigrationRetrieveParams
421
+
422
+ Migrations = Orb::Models::Migrations
423
+
424
+ MigrationSubscription = Orb::Models::MigrationSubscription
425
+
414
426
  Minimum = Orb::Models::Minimum
415
427
 
416
428
  MinimumInterval = Orb::Models::MinimumInterval
@@ -6,7 +6,7 @@ module Orb
6
6
  # credits within Orb.
7
7
  class CreditBlocks
8
8
  # This endpoint returns a credit block identified by its block_id. A deleted
9
- # credit block is returned with a `status` of `void` and a `balance` of 0.
9
+ # credit block is returned with a `status` of `deleted` and a `balance` of 0.
10
10
  sig do
11
11
  params(
12
12
  block_id: String,
@@ -41,14 +41,16 @@ module Orb
41
41
  )
42
42
  end
43
43
 
44
- # This endpoint allows you to update the `name`, `description`, and `metadata`
45
- # properties on a metric. Fields left out of the request are not changed, and
46
- # `name` cannot be empty. If you pass `null` for the metadata value, it will clear
47
- # any existing metadata for that metric.
44
+ # This endpoint allows you to update the `name`, `description`, `item_id`, and
45
+ # `metadata` properties on a metric. Fields left out of the request are not
46
+ # changed, and `name` cannot be empty. If you pass `null` for the metadata value,
47
+ # it will clear any existing metadata for that metric. Changing `item_id` applies
48
+ # to prices created on the metric afterwards; existing prices keep the item they
49
+ # were created with.
48
50
  #
49
- # While a metric is in `draft` status, its `sql` and `item_id` can also be
50
- # changed. Use [publish metric](/api-reference/metric/publish-metric) to make a
51
- # draft metric active.
51
+ # While a metric is in `draft` status, its `sql` can also be changed. Use
52
+ # [publish metric](/api-reference/metric/publish-metric) to make a draft metric
53
+ # active.
52
54
  sig do
53
55
  params(
54
56
  metric_id: String,
@@ -64,8 +66,9 @@ module Orb
64
66
  metric_id,
65
67
  # A description of the metric.
66
68
  description: nil,
67
- # The id of the item to associate the metric with. Can only be changed while the
68
- # metric is in `draft` status.
69
+ # The id of the item to associate the metric with. Prices created on the metric
70
+ # afterwards use the new item; existing prices keep the item they were created
71
+ # with.
69
72
  item_id: nil,
70
73
  # User-specified key/value pairs for the resource. Individual keys can be removed
71
74
  # by setting the value to `null`, and the entire metadata mapping can be cleared
@@ -144,8 +147,7 @@ module Orb
144
147
 
145
148
  # This endpoint publishes a [metric](/core-concepts#metric) in `draft` status,
146
149
  # making it `active`. Only draft metrics can be published, and an active metric
147
- # can't be moved back into `draft`, so its `sql` and `item_id` can no longer be
148
- # changed.
150
+ # can't be moved back into `draft`, so its `sql` can no longer be changed.
149
151
  sig do
150
152
  params(
151
153
  metric_id: String,
@@ -0,0 +1,54 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Resources
5
+ class Migrations
6
+ # A migration moves a plan's subscriptions onto one of the plan's versions. Each
7
+ # subscription is migrated asynchronously, either immediately or at a scheduled
8
+ # time, and the migration reports its overall status as it progresses.
9
+ class Subscriptions
10
+ # This endpoint returns the subscriptions a migration applies to, with the status
11
+ # of each one. A subscription that could not be migrated has the status `failed`
12
+ # and a `failure_reason`.
13
+ #
14
+ # The list is empty until the migration has finished selecting its subscriptions.
15
+ # Once a migration is canceled, only the subscriptions it processed before the
16
+ # cancellation are returned.
17
+ sig do
18
+ params(
19
+ migration_id: String,
20
+ cursor: T.nilable(String),
21
+ limit: Integer,
22
+ status:
23
+ T.nilable(
24
+ T::Array[
25
+ Orb::Migrations::SubscriptionListParams::Status::OrSymbol
26
+ ]
27
+ ),
28
+ subscription_id: T.nilable(T::Array[String]),
29
+ request_options: Orb::RequestOptions::OrHash
30
+ ).returns(Orb::Internal::Page[Orb::MigrationSubscription])
31
+ end
32
+ def list(
33
+ migration_id,
34
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
35
+ # from the initial request.
36
+ cursor: nil,
37
+ # The number of items to fetch. Defaults to 20.
38
+ limit: nil,
39
+ # Only return subscriptions with one of these statuses.
40
+ status: nil,
41
+ # Only return these subscriptions. Up to 100 IDs.
42
+ subscription_id: nil,
43
+ request_options: {}
44
+ )
45
+ end
46
+
47
+ # @api private
48
+ sig { params(client: Orb::Client).returns(T.attached_class) }
49
+ def self.new(client:)
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,130 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Resources
5
+ # A migration moves a plan's subscriptions onto one of the plan's versions. Each
6
+ # subscription is migrated asynchronously, either immediately or at a scheduled
7
+ # time, and the migration reports its overall status as it progresses.
8
+ class Migrations
9
+ # A migration moves a plan's subscriptions onto one of the plan's versions. Each
10
+ # subscription is migrated asynchronously, either immediately or at a scheduled
11
+ # time, and the migration reports its overall status as it progresses.
12
+ sig { returns(Orb::Resources::Migrations::Subscriptions) }
13
+ attr_reader :subscriptions
14
+
15
+ # This endpoint creates a migration of a plan's subscriptions to one of its
16
+ # versions. With `included_subscription_ids` it migrates exactly those
17
+ # subscriptions; otherwise it migrates the plan's subscriptions that match the
18
+ # filters. Each subscription is migrated asynchronously; fetch the migration to
19
+ # follow its status.
20
+ sig do
21
+ params(
22
+ effective_time: Orb::MigrationCreateParams::EffectiveTime::OrSymbol,
23
+ target_plan_version_number: Integer,
24
+ allow_invoice_credit_or_void: T::Boolean,
25
+ can_defer_billing: T::Boolean,
26
+ effective_date: T.nilable(Date),
27
+ excluded_subscription_ids: T.nilable(T::Array[String]),
28
+ external_plan_id: T.nilable(String),
29
+ in_trial: T.nilable(T::Boolean),
30
+ included_subscription_ids: T.nilable(T::Array[String]),
31
+ plan_id: T.nilable(String),
32
+ plan_version_numbers: T.nilable(T::Array[Integer]),
33
+ reason: T.nilable(String),
34
+ statuses: T::Array[Orb::MigrationCreateParams::Status::OrSymbol],
35
+ request_options: Orb::RequestOptions::OrHash
36
+ ).returns(Orb::Models::MigrationCreateResponse)
37
+ end
38
+ def create(
39
+ # When the migration takes effect: 'immediately', 'requested_date' on
40
+ # `effective_date`, 'start_of_term' or 'end_of_term' for the start or end of each
41
+ # subscription's current billing period, or 'start_of_invoice' or 'end_of_invoice'
42
+ # for the start of its current or next invoice.
43
+ effective_time:,
44
+ # The plan version to migrate subscriptions to. It can't be a draft version.
45
+ target_plan_version_number:,
46
+ # When false, a subscription whose migration would void an issued invoice or
47
+ # create a credit note fails instead.
48
+ allow_invoice_credit_or_void: nil,
49
+ # When true, an in-arrears price the migration ends mid-cycle bills its final line
50
+ # item on the next scheduled invoice instead of on its end date.
51
+ can_defer_billing: nil,
52
+ # The date the migration takes effect, at midnight in each customer's timezone.
53
+ # Required when `effective_time` is `requested_date`, and not allowed otherwise.
54
+ effective_date: nil,
55
+ # Leave these subscriptions out. Can't be combined with
56
+ # `included_subscription_ids`.
57
+ excluded_subscription_ids: nil,
58
+ # The external ID of the plan whose subscriptions to migrate.
59
+ external_plan_id: nil,
60
+ # `true` migrates only subscriptions in a trial, `false` only subscriptions not in
61
+ # a trial.
62
+ in_trial: nil,
63
+ # Migrate only these subscriptions. When set, the filters below are ignored.
64
+ included_subscription_ids: nil,
65
+ # The plan whose subscriptions to migrate. Exactly one of `plan_id` and
66
+ # `external_plan_id` is required.
67
+ plan_id: nil,
68
+ # Migrate only subscriptions currently on these plan versions.
69
+ plan_version_numbers: nil,
70
+ # Why the migration was created.
71
+ reason: nil,
72
+ # Migrate subscriptions with these statuses. Defaults to active subscriptions.
73
+ statuses: nil,
74
+ request_options: {}
75
+ )
76
+ end
77
+
78
+ # This endpoint returns a migration identified by its ID.
79
+ sig do
80
+ params(
81
+ migration_id: String,
82
+ request_options: Orb::RequestOptions::OrHash
83
+ ).returns(Orb::Models::MigrationRetrieveResponse)
84
+ end
85
+ def retrieve(migration_id, request_options: {})
86
+ end
87
+
88
+ # This endpoint returns a list of migrations across all plans in the account,
89
+ # optionally filtered by plan (`plan_id` or `external_plan_id`). The list of
90
+ # migrations is ordered starting from the most recently created migration. The
91
+ # response also includes pagination_metadata, which lets the caller retrieve the
92
+ # next page of results if they exist.
93
+ sig do
94
+ params(
95
+ cursor: T.nilable(String),
96
+ external_plan_id: T.nilable(String),
97
+ limit: Integer,
98
+ plan_id: T.nilable(String),
99
+ request_options: Orb::RequestOptions::OrHash
100
+ ).returns(Orb::Internal::Page[Orb::Models::MigrationListResponse])
101
+ end
102
+ def list(
103
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
104
+ # from the initial request.
105
+ cursor: nil,
106
+ external_plan_id: nil,
107
+ # The number of items to fetch. Defaults to 20.
108
+ limit: nil,
109
+ plan_id: nil,
110
+ request_options: {}
111
+ )
112
+ end
113
+
114
+ # This endpoint cancels a migration identified by its ID.
115
+ sig do
116
+ params(
117
+ migration_id: String,
118
+ request_options: Orb::RequestOptions::OrHash
119
+ ).returns(Orb::Models::MigrationCancelResponse)
120
+ end
121
+ def cancel(migration_id, request_options: {})
122
+ end
123
+
124
+ # @api private
125
+ sig { params(client: Orb::Client).returns(T.attached_class) }
126
+ def self.new(client:)
127
+ end
128
+ end
129
+ end
130
+ end
@@ -75,7 +75,8 @@ module Orb
75
75
  Orb::PriceCreateParams::Body::MeteredAllowance::OrHash,
76
76
  Orb::NewFloatingMinimumCompositePrice::OrHash,
77
77
  Orb::PriceCreateParams::Body::Percent::OrHash,
78
- Orb::PriceCreateParams::Body::EventOutput::OrHash
78
+ Orb::PriceCreateParams::Body::EventOutput::OrHash,
79
+ Orb::PriceCreateParams::Body::UnitWithMultiplier::OrHash
79
80
  ),
80
81
  request_options: Orb::RequestOptions::OrHash
81
82
  ).returns(Orb::Price::Variants)
data/sig/orb/client.rbs CHANGED
@@ -38,6 +38,8 @@ module Orb
38
38
 
39
39
  attr_reader plans: Orb::Resources::Plans
40
40
 
41
+ attr_reader migrations: Orb::Resources::Migrations
42
+
41
43
  attr_reader prices: Orb::Resources::Prices
42
44
 
43
45
  attr_reader subscriptions: Orb::Resources::Subscriptions