orb-billing 1.55.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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +1 -1
  4. data/lib/orb/client.rb +7 -0
  5. data/lib/orb/models/metric_update_params.rb +4 -3
  6. data/lib/orb/models/migration_cancel_params.rb +20 -0
  7. data/lib/orb/models/migration_cancel_response.rb +133 -0
  8. data/lib/orb/models/migration_create_params.rb +159 -0
  9. data/lib/orb/models/migration_create_response.rb +133 -0
  10. data/lib/orb/models/migration_list_params.rb +48 -0
  11. data/lib/orb/models/migration_list_response.rb +133 -0
  12. data/lib/orb/models/migration_retrieve_params.rb +20 -0
  13. data/lib/orb/models/migration_retrieve_response.rb +133 -0
  14. data/lib/orb/models/migration_subscription.rb +75 -0
  15. data/lib/orb/models/migrations/subscription_list_params.rb +74 -0
  16. data/lib/orb/models/plans/migration_cancel_response.rb +28 -8
  17. data/lib/orb/models/plans/migration_list_response.rb +28 -8
  18. data/lib/orb/models/plans/migration_retrieve_response.rb +28 -8
  19. data/lib/orb/models.rb +12 -0
  20. data/lib/orb/resources/metrics.rb +11 -10
  21. data/lib/orb/resources/migrations/subscriptions.rb +60 -0
  22. data/lib/orb/resources/migrations.rb +153 -0
  23. data/lib/orb/version.rb +1 -1
  24. data/lib/orb.rb +12 -0
  25. data/rbi/orb/client.rbi +6 -0
  26. data/rbi/orb/models/metric_update_params.rbi +6 -4
  27. data/rbi/orb/models/migration_cancel_params.rbi +35 -0
  28. data/rbi/orb/models/migration_cancel_response.rbi +218 -0
  29. data/rbi/orb/models/migration_create_params.rbi +248 -0
  30. data/rbi/orb/models/migration_create_response.rbi +218 -0
  31. data/rbi/orb/models/migration_list_params.rbi +66 -0
  32. data/rbi/orb/models/migration_list_response.rbi +214 -0
  33. data/rbi/orb/models/migration_retrieve_params.rbi +35 -0
  34. data/rbi/orb/models/migration_retrieve_response.rbi +221 -0
  35. data/rbi/orb/models/migration_subscription.rbi +112 -0
  36. data/rbi/orb/models/migrations/subscription_list_params.rbi +147 -0
  37. data/rbi/orb/models/plans/migration_cancel_response.rbi +36 -12
  38. data/rbi/orb/models/plans/migration_list_response.rbi +36 -12
  39. data/rbi/orb/models/plans/migration_retrieve_response.rbi +36 -12
  40. data/rbi/orb/models.rbi +12 -0
  41. data/rbi/orb/resources/metrics.rbi +13 -11
  42. data/rbi/orb/resources/migrations/subscriptions.rbi +54 -0
  43. data/rbi/orb/resources/migrations.rbi +130 -0
  44. data/sig/orb/client.rbs +2 -0
  45. data/sig/orb/models/migration_cancel_params.rbs +23 -0
  46. data/sig/orb/models/migration_cancel_response.rbs +84 -0
  47. data/sig/orb/models/migration_create_params.rbs +126 -0
  48. data/sig/orb/models/migration_create_response.rbs +84 -0
  49. data/sig/orb/models/migration_list_params.rbs +43 -0
  50. data/sig/orb/models/migration_list_response.rbs +84 -0
  51. data/sig/orb/models/migration_retrieve_params.rbs +23 -0
  52. data/sig/orb/models/migration_retrieve_response.rbs +84 -0
  53. data/sig/orb/models/migration_subscription.rbs +54 -0
  54. data/sig/orb/models/migrations/subscription_list_params.rbs +64 -0
  55. data/sig/orb/models/plans/migration_cancel_response.rbs +17 -4
  56. data/sig/orb/models/plans/migration_list_response.rbs +17 -4
  57. data/sig/orb/models/plans/migration_retrieve_response.rbs +17 -4
  58. data/sig/orb/models.rbs +12 -0
  59. data/sig/orb/resources/migrations/subscriptions.rbs +18 -0
  60. data/sig/orb/resources/migrations.rbs +44 -0
  61. metadata +37 -1
data/lib/orb/models.rb CHANGED
@@ -409,6 +409,18 @@ module Orb
409
409
 
410
410
  MetricUpdateParams = Orb::Models::MetricUpdateParams
411
411
 
412
+ MigrationCancelParams = Orb::Models::MigrationCancelParams
413
+
414
+ MigrationCreateParams = Orb::Models::MigrationCreateParams
415
+
416
+ MigrationListParams = Orb::Models::MigrationListParams
417
+
418
+ MigrationRetrieveParams = Orb::Models::MigrationRetrieveParams
419
+
420
+ Migrations = Orb::Models::Migrations
421
+
422
+ MigrationSubscription = Orb::Models::MigrationSubscription
423
+
412
424
  Minimum = Orb::Models::Minimum
413
425
 
414
426
  MinimumInterval = Orb::Models::MinimumInterval
@@ -46,14 +46,16 @@ module Orb
46
46
  # Some parameter documentations has been truncated, see
47
47
  # {Orb::Models::MetricUpdateParams} for more details.
48
48
  #
49
- # This endpoint allows you to update the `name`, `description`, and `metadata`
50
- # properties on a metric. Fields left out of the request are not changed, and
51
- # `name` cannot be empty. If you pass `null` for the metadata value, it will clear
52
- # any existing metadata for that metric.
49
+ # This endpoint allows you to update the `name`, `description`, `item_id`, and
50
+ # `metadata` properties on a metric. Fields left out of the request are not
51
+ # changed, and `name` cannot be empty. If you pass `null` for the metadata value,
52
+ # it will clear any existing metadata for that metric. Changing `item_id` applies
53
+ # to prices created on the metric afterwards; existing prices keep the item they
54
+ # were created with.
53
55
  #
54
- # While a metric is in `draft` status, its `sql` and `item_id` can also be
55
- # changed. Use [publish metric](/api-reference/metric/publish-metric) to make a
56
- # draft metric active.
56
+ # While a metric is in `draft` status, its `sql` can also be changed. Use
57
+ # [publish metric](/api-reference/metric/publish-metric) to make a draft metric
58
+ # active.
57
59
  #
58
60
  # @overload update(metric_id, description: nil, item_id: nil, metadata: nil, name: nil, sql: nil, request_options: {})
59
61
  #
@@ -61,7 +63,7 @@ module Orb
61
63
  #
62
64
  # @param description [String, nil] A description of the metric.
63
65
  #
64
- # @param item_id [String, nil] The id of the item to associate the metric with. Can only be changed while the m
66
+ # @param item_id [String, nil] The id of the item to associate the metric with. Prices created on the metric af
65
67
  #
66
68
  # @param metadata [Hash{Symbol=>String, nil}, nil] User-specified key/value pairs for the resource. Individual keys can be removed
67
69
  #
@@ -181,8 +183,7 @@ module Orb
181
183
 
182
184
  # This endpoint publishes a [metric](/core-concepts#metric) in `draft` status,
183
185
  # making it `active`. Only draft metrics can be published, and an active metric
184
- # can't be moved back into `draft`, so its `sql` and `item_id` can no longer be
185
- # changed.
186
+ # can't be moved back into `draft`, so its `sql` can no longer be changed.
186
187
  #
187
188
  # @overload publish(metric_id, request_options: {})
188
189
  #
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
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
+ # Some parameter documentations has been truncated, see
11
+ # {Orb::Models::Migrations::SubscriptionListParams} for more details.
12
+ #
13
+ # This endpoint returns the subscriptions a migration applies to, with the status
14
+ # of each one. A subscription that could not be migrated has the status `failed`
15
+ # and a `failure_reason`.
16
+ #
17
+ # The list is empty until the migration has finished selecting its subscriptions.
18
+ # Once a migration is canceled, only the subscriptions it processed before the
19
+ # cancellation are returned.
20
+ #
21
+ # @overload list(migration_id, cursor: nil, limit: nil, status: nil, subscription_id: nil, request_options: {})
22
+ #
23
+ # @param migration_id [String]
24
+ #
25
+ # @param cursor [String, nil] Cursor for pagination. This can be populated by the `next_cursor` value returned
26
+ #
27
+ # @param limit [Integer] The number of items to fetch. Defaults to 20.
28
+ #
29
+ # @param status [Array<Symbol, Orb::Models::Migrations::SubscriptionListParams::Status>, nil] Only return subscriptions with one of these statuses.
30
+ #
31
+ # @param subscription_id [Array<String>, nil] Only return these subscriptions. Up to 100 IDs.
32
+ #
33
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
34
+ #
35
+ # @return [Orb::Internal::Page<Orb::Models::MigrationSubscription>]
36
+ #
37
+ # @see Orb::Models::Migrations::SubscriptionListParams
38
+ def list(migration_id, params = {})
39
+ parsed, options = Orb::Migrations::SubscriptionListParams.dump_request(params)
40
+ query = Orb::Internal::Util.encode_query_params(parsed)
41
+ @client.request(
42
+ method: :get,
43
+ path: ["migrations/%1$s/subscriptions", migration_id],
44
+ query: query,
45
+ page: Orb::Internal::Page,
46
+ model: Orb::MigrationSubscription,
47
+ options: options
48
+ )
49
+ end
50
+
51
+ # @api private
52
+ #
53
+ # @param client [Orb::Client]
54
+ def initialize(client:)
55
+ @client = client
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,153 @@
1
+ # frozen_string_literal: true
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
+ # @return [Orb::Resources::Migrations::Subscriptions]
13
+ attr_reader :subscriptions
14
+
15
+ # Some parameter documentations has been truncated, see
16
+ # {Orb::Models::MigrationCreateParams} for more details.
17
+ #
18
+ # This endpoint creates a migration of a plan's subscriptions to one of its
19
+ # versions. With `included_subscription_ids` it migrates exactly those
20
+ # subscriptions; otherwise it migrates the plan's subscriptions that match the
21
+ # filters. Each subscription is migrated asynchronously; fetch the migration to
22
+ # follow its status.
23
+ #
24
+ # @overload create(effective_time:, target_plan_version_number:, allow_invoice_credit_or_void: nil, can_defer_billing: nil, effective_date: nil, excluded_subscription_ids: nil, external_plan_id: nil, in_trial: nil, included_subscription_ids: nil, plan_id: nil, plan_version_numbers: nil, reason: nil, statuses: nil, request_options: {})
25
+ #
26
+ # @param effective_time [Symbol, Orb::Models::MigrationCreateParams::EffectiveTime] When the migration takes effect: 'immediately', 'requested_date' on `effective_d
27
+ #
28
+ # @param target_plan_version_number [Integer] The plan version to migrate subscriptions to. It can't be a draft version.
29
+ #
30
+ # @param allow_invoice_credit_or_void [Boolean] When false, a subscription whose migration would void an issued invoice or creat
31
+ #
32
+ # @param can_defer_billing [Boolean] When true, an in-arrears price the migration ends mid-cycle bills its final line
33
+ #
34
+ # @param effective_date [Date, nil] The date the migration takes effect, at midnight in each customer's timezone. Re
35
+ #
36
+ # @param excluded_subscription_ids [Array<String>, nil] Leave these subscriptions out. Can't be combined with `included_subscription_ids
37
+ #
38
+ # @param external_plan_id [String, nil] The external ID of the plan whose subscriptions to migrate.
39
+ #
40
+ # @param in_trial [Boolean, nil] `true` migrates only subscriptions in a trial, `false` only subscriptions not in
41
+ #
42
+ # @param included_subscription_ids [Array<String>, nil] Migrate only these subscriptions. When set, the filters below are ignored.
43
+ #
44
+ # @param plan_id [String, nil] The plan whose subscriptions to migrate. Exactly one of `plan_id` and
45
+ # `external\_
46
+ #
47
+ # @param plan_version_numbers [Array<Integer>, nil] Migrate only subscriptions currently on these plan versions.
48
+ #
49
+ # @param reason [String, nil] Why the migration was created.
50
+ #
51
+ # @param statuses [Array<Symbol, Orb::Models::MigrationCreateParams::Status>] Migrate subscriptions with these statuses. Defaults to active subscriptions.
52
+ #
53
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
54
+ #
55
+ # @return [Orb::Models::MigrationCreateResponse]
56
+ #
57
+ # @see Orb::Models::MigrationCreateParams
58
+ def create(params)
59
+ parsed, options = Orb::MigrationCreateParams.dump_request(params)
60
+ @client.request(
61
+ method: :post,
62
+ path: "migrations",
63
+ body: parsed,
64
+ model: Orb::Models::MigrationCreateResponse,
65
+ options: options
66
+ )
67
+ end
68
+
69
+ # This endpoint returns a migration identified by its ID.
70
+ #
71
+ # @overload retrieve(migration_id, request_options: {})
72
+ #
73
+ # @param migration_id [String]
74
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
75
+ #
76
+ # @return [Orb::Models::MigrationRetrieveResponse]
77
+ #
78
+ # @see Orb::Models::MigrationRetrieveParams
79
+ def retrieve(migration_id, params = {})
80
+ @client.request(
81
+ method: :get,
82
+ path: ["migrations/%1$s", migration_id],
83
+ model: Orb::Models::MigrationRetrieveResponse,
84
+ options: params[:request_options]
85
+ )
86
+ end
87
+
88
+ # Some parameter documentations has been truncated, see
89
+ # {Orb::Models::MigrationListParams} for more details.
90
+ #
91
+ # This endpoint returns a list of migrations across all plans in the account,
92
+ # optionally filtered by plan (`plan_id` or `external_plan_id`). The list of
93
+ # migrations is ordered starting from the most recently created migration. The
94
+ # response also includes pagination_metadata, which lets the caller retrieve the
95
+ # next page of results if they exist.
96
+ #
97
+ # @overload list(cursor: nil, external_plan_id: nil, limit: nil, plan_id: nil, request_options: {})
98
+ #
99
+ # @param cursor [String, nil] Cursor for pagination. This can be populated by the `next_cursor` value returned
100
+ #
101
+ # @param external_plan_id [String, nil]
102
+ #
103
+ # @param limit [Integer] The number of items to fetch. Defaults to 20.
104
+ #
105
+ # @param plan_id [String, nil]
106
+ #
107
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
108
+ #
109
+ # @return [Orb::Internal::Page<Orb::Models::MigrationListResponse>]
110
+ #
111
+ # @see Orb::Models::MigrationListParams
112
+ def list(params = {})
113
+ parsed, options = Orb::MigrationListParams.dump_request(params)
114
+ query = Orb::Internal::Util.encode_query_params(parsed)
115
+ @client.request(
116
+ method: :get,
117
+ path: "migrations",
118
+ query: query,
119
+ page: Orb::Internal::Page,
120
+ model: Orb::Models::MigrationListResponse,
121
+ options: options
122
+ )
123
+ end
124
+
125
+ # This endpoint cancels a migration identified by its ID.
126
+ #
127
+ # @overload cancel(migration_id, request_options: {})
128
+ #
129
+ # @param migration_id [String]
130
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
131
+ #
132
+ # @return [Orb::Models::MigrationCancelResponse]
133
+ #
134
+ # @see Orb::Models::MigrationCancelParams
135
+ def cancel(migration_id, params = {})
136
+ @client.request(
137
+ method: :post,
138
+ path: ["migrations/%1$s/cancel", migration_id],
139
+ model: Orb::Models::MigrationCancelResponse,
140
+ options: params[:request_options]
141
+ )
142
+ end
143
+
144
+ # @api private
145
+ #
146
+ # @param client [Orb::Client]
147
+ def initialize(client:)
148
+ @client = client
149
+ @subscriptions = Orb::Resources::Migrations::Subscriptions.new(client: client)
150
+ end
151
+ end
152
+ end
153
+ end
data/lib/orb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orb
4
- VERSION = "1.55.0"
4
+ VERSION = "1.56.0"
5
5
  end
data/lib/orb.rb CHANGED
@@ -318,6 +318,16 @@ require_relative "orb/models/metric_list_params"
318
318
  require_relative "orb/models/metric_publish_params"
319
319
  require_relative "orb/models/metric_unarchive_params"
320
320
  require_relative "orb/models/metric_update_params"
321
+ require_relative "orb/models/migration_cancel_params"
322
+ require_relative "orb/models/migration_cancel_response"
323
+ require_relative "orb/models/migration_create_params"
324
+ require_relative "orb/models/migration_create_response"
325
+ require_relative "orb/models/migration_list_params"
326
+ require_relative "orb/models/migration_list_response"
327
+ require_relative "orb/models/migration_retrieve_params"
328
+ require_relative "orb/models/migration_retrieve_response"
329
+ require_relative "orb/models/migrations/subscription_list_params"
330
+ require_relative "orb/models/migration_subscription"
321
331
  require_relative "orb/models/minimum"
322
332
  require_relative "orb/models/minimum_interval"
323
333
  require_relative "orb/models/monetary_amount_discount_adjustment"
@@ -661,6 +671,8 @@ require_relative "orb/resources/licenses/external_licenses"
661
671
  require_relative "orb/resources/licenses/usage"
662
672
  require_relative "orb/resources/license_types"
663
673
  require_relative "orb/resources/metrics"
674
+ require_relative "orb/resources/migrations"
675
+ require_relative "orb/resources/migrations/subscriptions"
664
676
  require_relative "orb/resources/plans"
665
677
  require_relative "orb/resources/plans/external_plan_id"
666
678
  require_relative "orb/resources/plans/migrations"
data/rbi/orb/client.rbi CHANGED
@@ -109,6 +109,12 @@ module Orb
109
109
  sig { returns(Orb::Resources::Plans) }
110
110
  attr_reader :plans
111
111
 
112
+ # A migration moves a plan's subscriptions onto one of the plan's versions. Each
113
+ # subscription is migrated asynchronously, either immediately or at a scheduled
114
+ # time, and the migration reports its overall status as it progresses.
115
+ sig { returns(Orb::Resources::Migrations) }
116
+ attr_reader :migrations
117
+
112
118
  # The Price resource represents a price that can be billed on a subscription,
113
119
  # resulting in a charge on an invoice in the form of an invoice line item. Prices
114
120
  # take a quantity and determine an amount to bill.
@@ -16,8 +16,9 @@ module Orb
16
16
  sig { returns(T.nilable(String)) }
17
17
  attr_accessor :description
18
18
 
19
- # The id of the item to associate the metric with. Can only be changed while the
20
- # metric is in `draft` status.
19
+ # The id of the item to associate the metric with. Prices created on the metric
20
+ # afterwards use the new item; existing prices keep the item they were created
21
+ # with.
21
22
  sig { returns(T.nilable(String)) }
22
23
  attr_accessor :item_id
23
24
 
@@ -52,8 +53,9 @@ module Orb
52
53
  metric_id:,
53
54
  # A description of the metric.
54
55
  description: nil,
55
- # The id of the item to associate the metric with. Can only be changed while the
56
- # metric is in `draft` status.
56
+ # The id of the item to associate the metric with. Prices created on the metric
57
+ # afterwards use the new item; existing prices keep the item they were created
58
+ # with.
57
59
  item_id: nil,
58
60
  # User-specified key/value pairs for the resource. Individual keys can be removed
59
61
  # by setting the value to `null`, and the entire metadata mapping can be cleared
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class MigrationCancelParams < 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::MigrationCancelParams, Orb::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :migration_id
16
+
17
+ sig do
18
+ params(
19
+ migration_id: String,
20
+ request_options: Orb::RequestOptions::OrHash
21
+ ).returns(T.attached_class)
22
+ end
23
+ def self.new(migration_id:, request_options: {})
24
+ end
25
+
26
+ sig do
27
+ override.returns(
28
+ { migration_id: String, request_options: Orb::RequestOptions }
29
+ )
30
+ end
31
+ def to_hash
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,218 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class MigrationCancelResponse < Orb::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Orb::Models::MigrationCancelResponse, 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::MigrationCancelResponse::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::MigrationCancelResponse::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::MigrationCancelResponse::EffectiveTime::OrSymbol
65
+ )
66
+ ),
67
+ ended_at: T.nilable(Time),
68
+ plan_id: String,
69
+ started_at: T.nilable(Time),
70
+ status: Orb::Models::MigrationCancelResponse::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::MigrationCancelResponse::EffectiveTime::Variants
105
+ ),
106
+ ended_at: T.nilable(Time),
107
+ plan_id: String,
108
+ started_at: T.nilable(Time),
109
+ status: Orb::Models::MigrationCancelResponse::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::MigrationCancelResponse::EffectiveTime::TaggedSymbol
130
+ )
131
+ end
132
+
133
+ sig do
134
+ override.returns(
135
+ T::Array[
136
+ Orb::Models::MigrationCancelResponse::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::MigrationCancelResponse::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::MigrationCancelResponse::EffectiveTime::TaggedSymbol
153
+ )
154
+ END_OF_TERM =
155
+ T.let(
156
+ :end_of_term,
157
+ Orb::Models::MigrationCancelResponse::EffectiveTime::TaggedSymbol
158
+ )
159
+ START_OF_INVOICE =
160
+ T.let(
161
+ :start_of_invoice,
162
+ Orb::Models::MigrationCancelResponse::EffectiveTime::TaggedSymbol
163
+ )
164
+ END_OF_INVOICE =
165
+ T.let(
166
+ :end_of_invoice,
167
+ Orb::Models::MigrationCancelResponse::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::MigrationCancelResponse::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::MigrationCancelResponse::Status::TaggedSymbol
186
+ )
187
+ IN_PROGRESS =
188
+ T.let(
189
+ :in_progress,
190
+ Orb::Models::MigrationCancelResponse::Status::TaggedSymbol
191
+ )
192
+ COMPLETED =
193
+ T.let(
194
+ :completed,
195
+ Orb::Models::MigrationCancelResponse::Status::TaggedSymbol
196
+ )
197
+ ACTION_NEEDED =
198
+ T.let(
199
+ :action_needed,
200
+ Orb::Models::MigrationCancelResponse::Status::TaggedSymbol
201
+ )
202
+ CANCELED =
203
+ T.let(
204
+ :canceled,
205
+ Orb::Models::MigrationCancelResponse::Status::TaggedSymbol
206
+ )
207
+
208
+ sig do
209
+ override.returns(
210
+ T::Array[Orb::Models::MigrationCancelResponse::Status::TaggedSymbol]
211
+ )
212
+ end
213
+ def self.values
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end