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
@@ -0,0 +1,248 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class MigrationCreateParams < Orb::Internal::Type::BaseModel
6
+ extend Orb::Internal::Type::RequestParameters::Converter
7
+ include Orb::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Orb::MigrationCreateParams, Orb::Internal::AnyHash)
12
+ end
13
+
14
+ # When the migration takes effect: 'immediately', 'requested_date' on
15
+ # `effective_date`, 'start_of_term' or 'end_of_term' for the start or end of each
16
+ # subscription's current billing period, or 'start_of_invoice' or 'end_of_invoice'
17
+ # for the start of its current or next invoice.
18
+ sig { returns(Orb::MigrationCreateParams::EffectiveTime::OrSymbol) }
19
+ attr_accessor :effective_time
20
+
21
+ # The plan version to migrate subscriptions to. It can't be a draft version.
22
+ sig { returns(Integer) }
23
+ attr_accessor :target_plan_version_number
24
+
25
+ # When false, a subscription whose migration would void an issued invoice or
26
+ # create a credit note fails instead.
27
+ sig { returns(T.nilable(T::Boolean)) }
28
+ attr_reader :allow_invoice_credit_or_void
29
+
30
+ sig { params(allow_invoice_credit_or_void: T::Boolean).void }
31
+ attr_writer :allow_invoice_credit_or_void
32
+
33
+ # When true, an in-arrears price the migration ends mid-cycle bills its final line
34
+ # item on the next scheduled invoice instead of on its end date.
35
+ sig { returns(T.nilable(T::Boolean)) }
36
+ attr_reader :can_defer_billing
37
+
38
+ sig { params(can_defer_billing: T::Boolean).void }
39
+ attr_writer :can_defer_billing
40
+
41
+ # The date the migration takes effect, at midnight in each customer's timezone.
42
+ # Required when `effective_time` is `requested_date`, and not allowed otherwise.
43
+ sig { returns(T.nilable(Date)) }
44
+ attr_accessor :effective_date
45
+
46
+ # Leave these subscriptions out. Can't be combined with
47
+ # `included_subscription_ids`.
48
+ sig { returns(T.nilable(T::Array[String])) }
49
+ attr_accessor :excluded_subscription_ids
50
+
51
+ # The external ID of the plan whose subscriptions to migrate.
52
+ sig { returns(T.nilable(String)) }
53
+ attr_accessor :external_plan_id
54
+
55
+ # `true` migrates only subscriptions in a trial, `false` only subscriptions not in
56
+ # a trial.
57
+ sig { returns(T.nilable(T::Boolean)) }
58
+ attr_accessor :in_trial
59
+
60
+ # Migrate only these subscriptions. When set, the filters below are ignored.
61
+ sig { returns(T.nilable(T::Array[String])) }
62
+ attr_accessor :included_subscription_ids
63
+
64
+ # The plan whose subscriptions to migrate. Exactly one of `plan_id` and
65
+ # `external_plan_id` is required.
66
+ sig { returns(T.nilable(String)) }
67
+ attr_accessor :plan_id
68
+
69
+ # Migrate only subscriptions currently on these plan versions.
70
+ sig { returns(T.nilable(T::Array[Integer])) }
71
+ attr_accessor :plan_version_numbers
72
+
73
+ # Why the migration was created.
74
+ sig { returns(T.nilable(String)) }
75
+ attr_accessor :reason
76
+
77
+ # Migrate subscriptions with these statuses. Defaults to active subscriptions.
78
+ sig do
79
+ returns(
80
+ T.nilable(T::Array[Orb::MigrationCreateParams::Status::OrSymbol])
81
+ )
82
+ end
83
+ attr_reader :statuses
84
+
85
+ sig do
86
+ params(
87
+ statuses: T::Array[Orb::MigrationCreateParams::Status::OrSymbol]
88
+ ).void
89
+ end
90
+ attr_writer :statuses
91
+
92
+ sig do
93
+ params(
94
+ effective_time: Orb::MigrationCreateParams::EffectiveTime::OrSymbol,
95
+ target_plan_version_number: Integer,
96
+ allow_invoice_credit_or_void: T::Boolean,
97
+ can_defer_billing: T::Boolean,
98
+ effective_date: T.nilable(Date),
99
+ excluded_subscription_ids: T.nilable(T::Array[String]),
100
+ external_plan_id: T.nilable(String),
101
+ in_trial: T.nilable(T::Boolean),
102
+ included_subscription_ids: T.nilable(T::Array[String]),
103
+ plan_id: T.nilable(String),
104
+ plan_version_numbers: T.nilable(T::Array[Integer]),
105
+ reason: T.nilable(String),
106
+ statuses: T::Array[Orb::MigrationCreateParams::Status::OrSymbol],
107
+ request_options: Orb::RequestOptions::OrHash
108
+ ).returns(T.attached_class)
109
+ end
110
+ def self.new(
111
+ # When the migration takes effect: 'immediately', 'requested_date' on
112
+ # `effective_date`, 'start_of_term' or 'end_of_term' for the start or end of each
113
+ # subscription's current billing period, or 'start_of_invoice' or 'end_of_invoice'
114
+ # for the start of its current or next invoice.
115
+ effective_time:,
116
+ # The plan version to migrate subscriptions to. It can't be a draft version.
117
+ target_plan_version_number:,
118
+ # When false, a subscription whose migration would void an issued invoice or
119
+ # create a credit note fails instead.
120
+ allow_invoice_credit_or_void: nil,
121
+ # When true, an in-arrears price the migration ends mid-cycle bills its final line
122
+ # item on the next scheduled invoice instead of on its end date.
123
+ can_defer_billing: nil,
124
+ # The date the migration takes effect, at midnight in each customer's timezone.
125
+ # Required when `effective_time` is `requested_date`, and not allowed otherwise.
126
+ effective_date: nil,
127
+ # Leave these subscriptions out. Can't be combined with
128
+ # `included_subscription_ids`.
129
+ excluded_subscription_ids: nil,
130
+ # The external ID of the plan whose subscriptions to migrate.
131
+ external_plan_id: nil,
132
+ # `true` migrates only subscriptions in a trial, `false` only subscriptions not in
133
+ # a trial.
134
+ in_trial: nil,
135
+ # Migrate only these subscriptions. When set, the filters below are ignored.
136
+ included_subscription_ids: nil,
137
+ # The plan whose subscriptions to migrate. Exactly one of `plan_id` and
138
+ # `external_plan_id` is required.
139
+ plan_id: nil,
140
+ # Migrate only subscriptions currently on these plan versions.
141
+ plan_version_numbers: nil,
142
+ # Why the migration was created.
143
+ reason: nil,
144
+ # Migrate subscriptions with these statuses. Defaults to active subscriptions.
145
+ statuses: nil,
146
+ request_options: {}
147
+ )
148
+ end
149
+
150
+ sig do
151
+ override.returns(
152
+ {
153
+ effective_time: Orb::MigrationCreateParams::EffectiveTime::OrSymbol,
154
+ target_plan_version_number: Integer,
155
+ allow_invoice_credit_or_void: T::Boolean,
156
+ can_defer_billing: T::Boolean,
157
+ effective_date: T.nilable(Date),
158
+ excluded_subscription_ids: T.nilable(T::Array[String]),
159
+ external_plan_id: T.nilable(String),
160
+ in_trial: T.nilable(T::Boolean),
161
+ included_subscription_ids: T.nilable(T::Array[String]),
162
+ plan_id: T.nilable(String),
163
+ plan_version_numbers: T.nilable(T::Array[Integer]),
164
+ reason: T.nilable(String),
165
+ statuses: T::Array[Orb::MigrationCreateParams::Status::OrSymbol],
166
+ request_options: Orb::RequestOptions
167
+ }
168
+ )
169
+ end
170
+ def to_hash
171
+ end
172
+
173
+ # When the migration takes effect: 'immediately', 'requested_date' on
174
+ # `effective_date`, 'start_of_term' or 'end_of_term' for the start or end of each
175
+ # subscription's current billing period, or 'start_of_invoice' or 'end_of_invoice'
176
+ # for the start of its current or next invoice.
177
+ module EffectiveTime
178
+ extend Orb::Internal::Type::Enum
179
+
180
+ TaggedSymbol =
181
+ T.type_alias do
182
+ T.all(Symbol, Orb::MigrationCreateParams::EffectiveTime)
183
+ end
184
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
185
+
186
+ IMMEDIATELY =
187
+ T.let(
188
+ :immediately,
189
+ Orb::MigrationCreateParams::EffectiveTime::TaggedSymbol
190
+ )
191
+ REQUESTED_DATE =
192
+ T.let(
193
+ :requested_date,
194
+ Orb::MigrationCreateParams::EffectiveTime::TaggedSymbol
195
+ )
196
+ START_OF_TERM =
197
+ T.let(
198
+ :start_of_term,
199
+ Orb::MigrationCreateParams::EffectiveTime::TaggedSymbol
200
+ )
201
+ END_OF_TERM =
202
+ T.let(
203
+ :end_of_term,
204
+ Orb::MigrationCreateParams::EffectiveTime::TaggedSymbol
205
+ )
206
+ START_OF_INVOICE =
207
+ T.let(
208
+ :start_of_invoice,
209
+ Orb::MigrationCreateParams::EffectiveTime::TaggedSymbol
210
+ )
211
+ END_OF_INVOICE =
212
+ T.let(
213
+ :end_of_invoice,
214
+ Orb::MigrationCreateParams::EffectiveTime::TaggedSymbol
215
+ )
216
+
217
+ sig do
218
+ override.returns(
219
+ T::Array[Orb::MigrationCreateParams::EffectiveTime::TaggedSymbol]
220
+ )
221
+ end
222
+ def self.values
223
+ end
224
+ end
225
+
226
+ module Status
227
+ extend Orb::Internal::Type::Enum
228
+
229
+ TaggedSymbol =
230
+ T.type_alias { T.all(Symbol, Orb::MigrationCreateParams::Status) }
231
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
232
+
233
+ ACTIVE =
234
+ T.let(:active, Orb::MigrationCreateParams::Status::TaggedSymbol)
235
+ UPCOMING =
236
+ T.let(:upcoming, Orb::MigrationCreateParams::Status::TaggedSymbol)
237
+
238
+ sig do
239
+ override.returns(
240
+ T::Array[Orb::MigrationCreateParams::Status::TaggedSymbol]
241
+ )
242
+ end
243
+ def self.values
244
+ end
245
+ end
246
+ end
247
+ end
248
+ end
@@ -0,0 +1,218 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class MigrationCreateResponse < Orb::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Orb::Models::MigrationCreateResponse, Orb::Internal::AnyHash)
9
+ end
10
+
11
+ # Unique identifier for this plan version change.
12
+ sig { returns(String) }
13
+ attr_accessor :id
14
+
15
+ # When the migration takes effect. Can be a specific date/time, 'start_of_term' or
16
+ # 'end_of_term' when scheduled to be at the start or end of the current billing
17
+ # period, or 'start_of_invoice' or 'end_of_invoice' when scheduled to be at the
18
+ # start of the current or next invoice.
19
+ sig do
20
+ returns(
21
+ T.nilable(
22
+ Orb::Models::MigrationCreateResponse::EffectiveTime::Variants
23
+ )
24
+ )
25
+ end
26
+ attr_accessor :effective_time
27
+
28
+ # When the migration completed or was canceled, or null if it is still in
29
+ # progress.
30
+ sig { returns(T.nilable(Time)) }
31
+ attr_accessor :ended_at
32
+
33
+ # The ID of the plan being migrated.
34
+ sig { returns(String) }
35
+ attr_accessor :plan_id
36
+
37
+ # When Orb began migrating the plan's subscriptions. Null if the migration has not
38
+ # begun, or was canceled before it began.
39
+ sig { returns(T.nilable(Time)) }
40
+ attr_accessor :started_at
41
+
42
+ # Current status of the migration: 'not_started', 'in_progress', 'completed',
43
+ # 'action_needed', or 'canceled'.
44
+ sig do
45
+ returns(Orb::Models::MigrationCreateResponse::Status::TaggedSymbol)
46
+ end
47
+ attr_accessor :status
48
+
49
+ # The plan version subscriptions are migrated to.
50
+ sig { returns(Integer) }
51
+ attr_accessor :target_plan_version_number
52
+
53
+ # A migration moves a plan's subscriptions onto one of the plan's versions. Each
54
+ # subscription is migrated asynchronously, either immediately or at a scheduled
55
+ # time, and the migration reports its overall status as it progresses.
56
+ sig do
57
+ params(
58
+ id: String,
59
+ effective_time:
60
+ T.nilable(
61
+ T.any(
62
+ Date,
63
+ Time,
64
+ Orb::Models::MigrationCreateResponse::EffectiveTime::OrSymbol
65
+ )
66
+ ),
67
+ ended_at: T.nilable(Time),
68
+ plan_id: String,
69
+ started_at: T.nilable(Time),
70
+ status: Orb::Models::MigrationCreateResponse::Status::OrSymbol,
71
+ target_plan_version_number: Integer
72
+ ).returns(T.attached_class)
73
+ end
74
+ def self.new(
75
+ # Unique identifier for this plan version change.
76
+ id:,
77
+ # When the migration takes effect. Can be a specific date/time, 'start_of_term' or
78
+ # 'end_of_term' when scheduled to be at the start or end of the current billing
79
+ # period, or 'start_of_invoice' or 'end_of_invoice' when scheduled to be at the
80
+ # start of the current or next invoice.
81
+ effective_time:,
82
+ # When the migration completed or was canceled, or null if it is still in
83
+ # progress.
84
+ ended_at:,
85
+ # The ID of the plan being migrated.
86
+ plan_id:,
87
+ # When Orb began migrating the plan's subscriptions. Null if the migration has not
88
+ # begun, or was canceled before it began.
89
+ started_at:,
90
+ # Current status of the migration: 'not_started', 'in_progress', 'completed',
91
+ # 'action_needed', or 'canceled'.
92
+ status:,
93
+ # The plan version subscriptions are migrated to.
94
+ target_plan_version_number:
95
+ )
96
+ end
97
+
98
+ sig do
99
+ override.returns(
100
+ {
101
+ id: String,
102
+ effective_time:
103
+ T.nilable(
104
+ Orb::Models::MigrationCreateResponse::EffectiveTime::Variants
105
+ ),
106
+ ended_at: T.nilable(Time),
107
+ plan_id: String,
108
+ started_at: T.nilable(Time),
109
+ status: Orb::Models::MigrationCreateResponse::Status::TaggedSymbol,
110
+ target_plan_version_number: Integer
111
+ }
112
+ )
113
+ end
114
+ def to_hash
115
+ end
116
+
117
+ # When the migration takes effect. Can be a specific date/time, 'start_of_term' or
118
+ # 'end_of_term' when scheduled to be at the start or end of the current billing
119
+ # period, or 'start_of_invoice' or 'end_of_invoice' when scheduled to be at the
120
+ # start of the current or next invoice.
121
+ module EffectiveTime
122
+ extend Orb::Internal::Type::Union
123
+
124
+ Variants =
125
+ T.type_alias do
126
+ T.any(
127
+ Date,
128
+ Time,
129
+ Orb::Models::MigrationCreateResponse::EffectiveTime::TaggedSymbol
130
+ )
131
+ end
132
+
133
+ sig do
134
+ override.returns(
135
+ T::Array[
136
+ Orb::Models::MigrationCreateResponse::EffectiveTime::Variants
137
+ ]
138
+ )
139
+ end
140
+ def self.variants
141
+ end
142
+
143
+ TaggedSymbol =
144
+ T.type_alias do
145
+ T.all(Symbol, Orb::Models::MigrationCreateResponse::EffectiveTime)
146
+ end
147
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
148
+
149
+ START_OF_TERM =
150
+ T.let(
151
+ :start_of_term,
152
+ Orb::Models::MigrationCreateResponse::EffectiveTime::TaggedSymbol
153
+ )
154
+ END_OF_TERM =
155
+ T.let(
156
+ :end_of_term,
157
+ Orb::Models::MigrationCreateResponse::EffectiveTime::TaggedSymbol
158
+ )
159
+ START_OF_INVOICE =
160
+ T.let(
161
+ :start_of_invoice,
162
+ Orb::Models::MigrationCreateResponse::EffectiveTime::TaggedSymbol
163
+ )
164
+ END_OF_INVOICE =
165
+ T.let(
166
+ :end_of_invoice,
167
+ Orb::Models::MigrationCreateResponse::EffectiveTime::TaggedSymbol
168
+ )
169
+ end
170
+
171
+ # Current status of the migration: 'not_started', 'in_progress', 'completed',
172
+ # 'action_needed', or 'canceled'.
173
+ module Status
174
+ extend Orb::Internal::Type::Enum
175
+
176
+ TaggedSymbol =
177
+ T.type_alias do
178
+ T.all(Symbol, Orb::Models::MigrationCreateResponse::Status)
179
+ end
180
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
181
+
182
+ NOT_STARTED =
183
+ T.let(
184
+ :not_started,
185
+ Orb::Models::MigrationCreateResponse::Status::TaggedSymbol
186
+ )
187
+ IN_PROGRESS =
188
+ T.let(
189
+ :in_progress,
190
+ Orb::Models::MigrationCreateResponse::Status::TaggedSymbol
191
+ )
192
+ COMPLETED =
193
+ T.let(
194
+ :completed,
195
+ Orb::Models::MigrationCreateResponse::Status::TaggedSymbol
196
+ )
197
+ ACTION_NEEDED =
198
+ T.let(
199
+ :action_needed,
200
+ Orb::Models::MigrationCreateResponse::Status::TaggedSymbol
201
+ )
202
+ CANCELED =
203
+ T.let(
204
+ :canceled,
205
+ Orb::Models::MigrationCreateResponse::Status::TaggedSymbol
206
+ )
207
+
208
+ sig do
209
+ override.returns(
210
+ T::Array[Orb::Models::MigrationCreateResponse::Status::TaggedSymbol]
211
+ )
212
+ end
213
+ def self.values
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,66 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class MigrationListParams < Orb::Internal::Type::BaseModel
6
+ extend Orb::Internal::Type::RequestParameters::Converter
7
+ include Orb::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias { T.any(Orb::MigrationListParams, Orb::Internal::AnyHash) }
11
+
12
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
13
+ # from the initial request.
14
+ sig { returns(T.nilable(String)) }
15
+ attr_accessor :cursor
16
+
17
+ sig { returns(T.nilable(String)) }
18
+ attr_accessor :external_plan_id
19
+
20
+ # The number of items to fetch. Defaults to 20.
21
+ sig { returns(T.nilable(Integer)) }
22
+ attr_reader :limit
23
+
24
+ sig { params(limit: Integer).void }
25
+ attr_writer :limit
26
+
27
+ sig { returns(T.nilable(String)) }
28
+ attr_accessor :plan_id
29
+
30
+ sig do
31
+ params(
32
+ cursor: T.nilable(String),
33
+ external_plan_id: T.nilable(String),
34
+ limit: Integer,
35
+ plan_id: T.nilable(String),
36
+ request_options: Orb::RequestOptions::OrHash
37
+ ).returns(T.attached_class)
38
+ end
39
+ def self.new(
40
+ # Cursor for pagination. This can be populated by the `next_cursor` value returned
41
+ # from the initial request.
42
+ cursor: nil,
43
+ external_plan_id: nil,
44
+ # The number of items to fetch. Defaults to 20.
45
+ limit: nil,
46
+ plan_id: nil,
47
+ request_options: {}
48
+ )
49
+ end
50
+
51
+ sig do
52
+ override.returns(
53
+ {
54
+ cursor: T.nilable(String),
55
+ external_plan_id: T.nilable(String),
56
+ limit: Integer,
57
+ plan_id: T.nilable(String),
58
+ request_options: Orb::RequestOptions
59
+ }
60
+ )
61
+ end
62
+ def to_hash
63
+ end
64
+ end
65
+ end
66
+ end