orb-billing 1.52.0 → 1.53.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/orb/models/billable_metric_edited_webhook_event.rb +33 -1
  5. data/lib/orb/models/metric_create_params.rb +24 -1
  6. data/lib/orb/models/metric_list_params.rb +1 -1
  7. data/lib/orb/models/metric_publish_params.rb +20 -0
  8. data/lib/orb/models/metric_update_params.rb +20 -1
  9. data/lib/orb/models/plan.rb +9 -1
  10. data/lib/orb/models/plan_version_phase.rb +9 -1
  11. data/lib/orb/models/webhooks/billable_metric_edited_standard_webhook_event.rb +35 -1
  12. data/lib/orb/models.rb +2 -0
  13. data/lib/orb/resources/metrics.rb +34 -2
  14. data/lib/orb/version.rb +1 -1
  15. data/lib/orb.rb +1 -0
  16. data/rbi/orb/models/billable_metric_edited_webhook_event.rbi +76 -3
  17. data/rbi/orb/models/metric_create_params.rbi +37 -0
  18. data/rbi/orb/models/metric_list_params.rbi +1 -1
  19. data/rbi/orb/models/metric_publish_params.rbi +33 -0
  20. data/rbi/orb/models/metric_update_params.rbi +22 -0
  21. data/rbi/orb/models/plan.rbi +11 -3
  22. data/rbi/orb/models/plan_version_phase.rbi +11 -3
  23. data/rbi/orb/models/webhooks/billable_metric_edited_standard_webhook_event.rbi +76 -3
  24. data/rbi/orb/models.rbi +2 -0
  25. data/rbi/orb/resources/metrics.rbi +31 -0
  26. data/sig/orb/models/billable_metric_edited_webhook_event.rbs +30 -3
  27. data/sig/orb/models/metric_create_params.rbs +21 -1
  28. data/sig/orb/models/metric_list_params.rbs +2 -2
  29. data/sig/orb/models/metric_publish_params.rbs +23 -0
  30. data/sig/orb/models/metric_update_params.rbs +11 -1
  31. data/sig/orb/models/plan.rbs +8 -3
  32. data/sig/orb/models/plan_version_phase.rbs +8 -3
  33. data/sig/orb/models/webhooks/billable_metric_edited_standard_webhook_event.rbs +30 -3
  34. data/sig/orb/models.rbs +2 -0
  35. data/sig/orb/resources/metrics.rbs +8 -0
  36. metadata +4 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cce17c745ddc15b16ebe1d23688847f71b279cabe10f8d5543a437863e887e90
4
- data.tar.gz: 97a8b25b6b8a0c60cb0689a327f8c113c21b279618ee70b909188378d6051da5
3
+ metadata.gz: 950351e40d31694b639bee789b3022557b0fa8727303e1ca35abfea9cad93466
4
+ data.tar.gz: 8a6fd092876c79778cbf3d87a7304670dbee7cf1d36cb980eda50c5bb5abc3f9
5
5
  SHA512:
6
- metadata.gz: 6be489bfae61be4efac80c81621dcbf01beb80f4ea08ff1846177dc0f7b387545cde6591d48610a52fc70e24b092887fd2d2aff6e208d49bc3b6ae73c4dd0e97
7
- data.tar.gz: eb34946ce0dbf3f13f0db9ef286637e9241972eea7296e5ccfe8b29d618760d1785d9955ca6ef7d3f91347780c1a82642cbb84c8fcecba64d08b272e8fad0bad
6
+ metadata.gz: c798e20fbe78d5f96793f78b9bf7a2d09dd739a709f27a7e0c0e0d630bae3fe782c2be620744dc679e3ddae10ef4430de3a7a9b4a9fd13fece43867138c09a66
7
+ data.tar.gz: b10175d96eeb55c4748c24dce2b2e8c3f4e80a1391099bbe23df496aca4b49cf980c6947f618acc0329f1e2816afca300c7c1f294105e5bcf5c25815a9ddaba6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.53.0](https://github.com/orbcorp/orb-ruby/compare/v1.52.0...v1.53.0) (2026-11-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** add price_ids to plan phases in plan responses ([31c53a7](https://github.com/orbcorp/orb-ruby/commit/31c53a746d3a58bf1c5e2af1a17e0ec609d2632b))
9
+ * **api:** support draft billable metrics with SQL/item edits and publish ([d101f75](https://github.com/orbcorp/orb-ruby/commit/d101f751084628d14727d0be016bec21f21b4853))
10
+
3
11
  ## [1.52.0](https://github.com/orbcorp/orb-ruby/compare/v1.51.0...v1.52.0) (2026-10-31)
4
12
 
5
13
 
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "orb-billing", "~> 1.52.0"
18
+ gem "orb-billing", "~> 1.53.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -92,6 +92,11 @@ module Orb
92
92
  # @return [String, nil]
93
93
  optional :description, String, nil?: true
94
94
 
95
+ # @!attribute item_id
96
+ #
97
+ # @return [String, nil]
98
+ optional :item_id, String, nil?: true
99
+
95
100
  # @!attribute metadata
96
101
  #
97
102
  # @return [Hash{Symbol=>String}, nil]
@@ -102,12 +107,39 @@ module Orb
102
107
  # @return [String, nil]
103
108
  optional :name, String, nil?: true
104
109
 
105
- # @!method initialize(description: nil, metadata: nil, name: nil)
110
+ # @!attribute sql
111
+ #
112
+ # @return [String, nil]
113
+ optional :sql, String, nil?: true
114
+
115
+ # @!attribute status
116
+ #
117
+ # @return [Symbol, Orb::Models::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status, nil]
118
+ optional :status,
119
+ enum: -> { Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status },
120
+ nil?: true
121
+
122
+ # @!method initialize(description: nil, item_id: nil, metadata: nil, name: nil, sql: nil, status: nil)
106
123
  # metadata values are non-null on the wire, as on the price event.
107
124
  #
108
125
  # @param description [String, nil]
126
+ # @param item_id [String, nil]
109
127
  # @param metadata [Hash{Symbol=>String}, nil]
110
128
  # @param name [String, nil]
129
+ # @param sql [String, nil]
130
+ # @param status [Symbol, Orb::Models::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status, nil]
131
+
132
+ # @see Orb::Models::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes#status
133
+ module Status
134
+ extend Orb::Internal::Type::Enum
135
+
136
+ ACTIVE = :active
137
+ ARCHIVED = :archived
138
+ DRAFT = :draft
139
+
140
+ # @!method self.values
141
+ # @return [Array<Symbol>]
142
+ end
111
143
  end
112
144
  end
113
145
 
@@ -39,7 +39,15 @@ module Orb
39
39
  # @return [Hash{Symbol=>String, nil}, nil]
40
40
  optional :metadata, Orb::Internal::Type::HashOf[String, nil?: true], nil?: true
41
41
 
42
- # @!method initialize(description:, item_id:, name:, sql:, metadata: nil, request_options: {})
42
+ # @!attribute status
43
+ # The status of the metric to create (either active or draft). If not specified,
44
+ # this defaults to active. A draft metric's `sql` and `item_id` can be changed
45
+ # until it's published.
46
+ #
47
+ # @return [Symbol, Orb::Models::MetricCreateParams::Status, nil]
48
+ optional :status, enum: -> { Orb::MetricCreateParams::Status }
49
+
50
+ # @!method initialize(description:, item_id:, name:, sql:, metadata: nil, status: nil, request_options: {})
43
51
  # Some parameter documentations has been truncated, see
44
52
  # {Orb::Models::MetricCreateParams} for more details.
45
53
  #
@@ -53,7 +61,22 @@ module Orb
53
61
  #
54
62
  # @param metadata [Hash{Symbol=>String, nil}, nil] User-specified key/value pairs for the resource. Individual keys can be removed
55
63
  #
64
+ # @param status [Symbol, Orb::Models::MetricCreateParams::Status] The status of the metric to create (either active or draft). If not specified, t
65
+ #
56
66
  # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
67
+
68
+ # The status of the metric to create (either active or draft). If not specified,
69
+ # this defaults to active. A draft metric's `sql` and `item_id` can be changed
70
+ # until it's published.
71
+ module Status
72
+ extend Orb::Internal::Type::Enum
73
+
74
+ ACTIVE = :active
75
+ DRAFT = :draft
76
+
77
+ # @!method self.values
78
+ # @return [Array<Symbol>]
79
+ end
57
80
  end
58
81
  end
59
82
  end
@@ -71,8 +71,8 @@ module Orb
71
71
  extend Orb::Internal::Type::Enum
72
72
 
73
73
  ACTIVE = :active
74
- ARCHIVED = :archived
75
74
  DRAFT = :draft
75
+ ARCHIVED = :archived
76
76
 
77
77
  # @!method self.values
78
78
  # @return [Array<Symbol>]
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orb
4
+ module Models
5
+ # @see Orb::Resources::Metrics#publish
6
+ class MetricPublishParams < Orb::Internal::Type::BaseModel
7
+ extend Orb::Internal::Type::RequestParameters::Converter
8
+ include Orb::Internal::Type::RequestParameters
9
+
10
+ # @!attribute metric_id
11
+ #
12
+ # @return [String]
13
+ required :metric_id, String
14
+
15
+ # @!method initialize(metric_id:, request_options: {})
16
+ # @param metric_id [String]
17
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -18,6 +18,13 @@ module Orb
18
18
  # @return [String, nil]
19
19
  optional :description, String, nil?: true
20
20
 
21
+ # @!attribute item_id
22
+ # The id of the item to associate the metric with. Can only be changed while the
23
+ # metric is in `draft` status.
24
+ #
25
+ # @return [String, nil]
26
+ optional :item_id, String, nil?: true
27
+
21
28
  # @!attribute metadata
22
29
  # User-specified key/value pairs for the resource. Individual keys can be removed
23
30
  # by setting the value to `null`, and the entire metadata mapping can be cleared
@@ -32,7 +39,15 @@ module Orb
32
39
  # @return [String, nil]
33
40
  optional :name, String, nil?: true
34
41
 
35
- # @!method initialize(metric_id:, description: nil, metadata: nil, name: nil, request_options: {})
42
+ # @!attribute sql
43
+ # A new sql string defining the metric. Can only be changed while the metric is in
44
+ # `draft` status and no price uses it. If the metric has parameters, the new sql
45
+ # must use the same ones.
46
+ #
47
+ # @return [String, nil]
48
+ optional :sql, String, nil?: true
49
+
50
+ # @!method initialize(metric_id:, description: nil, item_id: nil, metadata: nil, name: nil, sql: nil, request_options: {})
36
51
  # Some parameter documentations has been truncated, see
37
52
  # {Orb::Models::MetricUpdateParams} for more details.
38
53
  #
@@ -40,10 +55,14 @@ module Orb
40
55
  #
41
56
  # @param description [String, nil] A description of the metric.
42
57
  #
58
+ # @param item_id [String, nil] The id of the item to associate the metric with. Can only be changed while the m
59
+ #
43
60
  # @param metadata [Hash{Symbol=>String, nil}, nil] User-specified key/value pairs for the resource. Individual keys can be removed
44
61
  #
45
62
  # @param name [String, nil] The name of the metric.
46
63
  #
64
+ # @param sql [String, nil] A new sql string defining the metric. Can only be changed while the metric is in
65
+ #
47
66
  # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
48
67
  end
49
68
  end
@@ -512,7 +512,13 @@ module Orb
512
512
  # @return [Integer]
513
513
  required :order, Integer
514
514
 
515
- # @!method initialize(id:, description:, discount:, duration:, duration_unit:, maximum:, maximum_amount:, minimum:, minimum_amount:, name:, order:)
515
+ # @!attribute price_ids
516
+ # The IDs of the prices active in this phase.
517
+ #
518
+ # @return [Array<String>]
519
+ required :price_ids, Orb::Internal::Type::ArrayOf[String]
520
+
521
+ # @!method initialize(id:, description:, discount:, duration:, duration_unit:, maximum:, maximum_amount:, minimum:, minimum_amount:, name:, order:, price_ids:)
516
522
  # Some parameter documentations has been truncated, see
517
523
  # {Orb::Models::Plan::PlanPhase} for more details.
518
524
  #
@@ -537,6 +543,8 @@ module Orb
537
543
  # @param name [String]
538
544
  #
539
545
  # @param order [Integer] Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
546
+ #
547
+ # @param price_ids [Array<String>] The IDs of the prices active in this phase.
540
548
 
541
549
  # @see Orb::Models::Plan::PlanPhase#duration_unit
542
550
  module DurationUnit
@@ -36,7 +36,13 @@ module Orb
36
36
  # @return [Integer]
37
37
  required :order, Integer
38
38
 
39
- # @!method initialize(id:, description:, duration:, duration_unit:, name:, order:)
39
+ # @!attribute price_ids
40
+ # The IDs of the prices active in this phase.
41
+ #
42
+ # @return [Array<String>]
43
+ required :price_ids, Orb::Internal::Type::ArrayOf[String]
44
+
45
+ # @!method initialize(id:, description:, duration:, duration_unit:, name:, order:, price_ids:)
40
46
  # Some parameter documentations has been truncated, see
41
47
  # {Orb::Models::PlanVersionPhase} for more details.
42
48
  #
@@ -51,6 +57,8 @@ module Orb
51
57
  # @param name [String]
52
58
  #
53
59
  # @param order [Integer] Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
60
+ #
61
+ # @param price_ids [Array<String>] The IDs of the prices active in this phase.
54
62
 
55
63
  # @see Orb::Models::PlanVersionPhase#duration_unit
56
64
  module DurationUnit
@@ -95,6 +95,11 @@ module Orb
95
95
  # @return [String, nil]
96
96
  optional :description, String, nil?: true
97
97
 
98
+ # @!attribute item_id
99
+ #
100
+ # @return [String, nil]
101
+ optional :item_id, String, nil?: true
102
+
98
103
  # @!attribute metadata
99
104
  #
100
105
  # @return [Hash{Symbol=>String}, nil]
@@ -105,12 +110,41 @@ module Orb
105
110
  # @return [String, nil]
106
111
  optional :name, String, nil?: true
107
112
 
108
- # @!method initialize(description: nil, metadata: nil, name: nil)
113
+ # @!attribute sql
114
+ #
115
+ # @return [String, nil]
116
+ optional :sql, String, nil?: true
117
+
118
+ # @!attribute status
119
+ #
120
+ # @return [Symbol, Orb::Models::Webhooks::BillableMetricEditedStandardWebhookEvent::Properties::PreviousAttributes::Status, nil]
121
+ optional :status,
122
+ enum: -> {
123
+ Orb::Webhooks::BillableMetricEditedStandardWebhookEvent::Properties::PreviousAttributes::Status
124
+ },
125
+ nil?: true
126
+
127
+ # @!method initialize(description: nil, item_id: nil, metadata: nil, name: nil, sql: nil, status: nil)
109
128
  # metadata values are non-null on the wire, as on the price event.
110
129
  #
111
130
  # @param description [String, nil]
131
+ # @param item_id [String, nil]
112
132
  # @param metadata [Hash{Symbol=>String}, nil]
113
133
  # @param name [String, nil]
134
+ # @param sql [String, nil]
135
+ # @param status [Symbol, Orb::Models::Webhooks::BillableMetricEditedStandardWebhookEvent::Properties::PreviousAttributes::Status, nil]
136
+
137
+ # @see Orb::Models::Webhooks::BillableMetricEditedStandardWebhookEvent::Properties::PreviousAttributes#status
138
+ module Status
139
+ extend Orb::Internal::Type::Enum
140
+
141
+ ACTIVE = :active
142
+ ARCHIVED = :archived
143
+ DRAFT = :draft
144
+
145
+ # @!method self.values
146
+ # @return [Array<Symbol>]
147
+ end
114
148
  end
115
149
  end
116
150
 
data/lib/orb/models.rb CHANGED
@@ -403,6 +403,8 @@ module Orb
403
403
 
404
404
  MetricListParams = Orb::Models::MetricListParams
405
405
 
406
+ MetricPublishParams = Orb::Models::MetricPublishParams
407
+
406
408
  MetricUnarchiveParams = Orb::Models::MetricUnarchiveParams
407
409
 
408
410
  MetricUpdateParams = Orb::Models::MetricUpdateParams
@@ -13,7 +13,7 @@ module Orb
13
13
  # string. See [SQL support](/extensibility/advanced-metrics#sql-support) for a
14
14
  # description of constructing SQL queries with examples.
15
15
  #
16
- # @overload create(description:, item_id:, name:, sql:, metadata: nil, request_options: {})
16
+ # @overload create(description:, item_id:, name:, sql:, metadata: nil, status: nil, request_options: {})
17
17
  #
18
18
  # @param description [String, nil] A description of the metric.
19
19
  #
@@ -25,6 +25,8 @@ module Orb
25
25
  #
26
26
  # @param metadata [Hash{Symbol=>String, nil}, nil] User-specified key/value pairs for the resource. Individual keys can be removed
27
27
  #
28
+ # @param status [Symbol, Orb::Models::MetricCreateParams::Status] The status of the metric to create (either active or draft). If not specified, t
29
+ #
28
30
  # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
29
31
  #
30
32
  # @return [Orb::Models::BillableMetric]
@@ -49,16 +51,24 @@ module Orb
49
51
  # `name` cannot be empty. If you pass `null` for the metadata value, it will clear
50
52
  # any existing metadata for that metric.
51
53
  #
52
- # @overload update(metric_id, description: nil, metadata: nil, name: nil, request_options: {})
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.
57
+ #
58
+ # @overload update(metric_id, description: nil, item_id: nil, metadata: nil, name: nil, sql: nil, request_options: {})
53
59
  #
54
60
  # @param metric_id [String]
55
61
  #
56
62
  # @param description [String, nil] A description of the metric.
57
63
  #
64
+ # @param item_id [String, nil] The id of the item to associate the metric with. Can only be changed while the m
65
+ #
58
66
  # @param metadata [Hash{Symbol=>String, nil}, nil] User-specified key/value pairs for the resource. Individual keys can be removed
59
67
  #
60
68
  # @param name [String, nil] The name of the metric.
61
69
  #
70
+ # @param sql [String, nil] A new sql string defining the metric. Can only be changed while the metric is in
71
+ #
62
72
  # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
63
73
  #
64
74
  # @return [Orb::Models::BillableMetric]
@@ -169,6 +179,28 @@ module Orb
169
179
  )
170
180
  end
171
181
 
182
+ # This endpoint publishes a [metric](/core-concepts#metric) in `draft` status,
183
+ # 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
+ #
187
+ # @overload publish(metric_id, request_options: {})
188
+ #
189
+ # @param metric_id [String]
190
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
191
+ #
192
+ # @return [Orb::Models::BillableMetric]
193
+ #
194
+ # @see Orb::Models::MetricPublishParams
195
+ def publish(metric_id, params = {})
196
+ @client.request(
197
+ method: :post,
198
+ path: ["metrics/%1$s/publish", metric_id],
199
+ model: Orb::BillableMetric,
200
+ options: params[:request_options]
201
+ )
202
+ end
203
+
172
204
  # This endpoint restores an archived [metric](/core-concepts#metric) to `active`,
173
205
  # so it can be chosen for new plans again. Only archived metrics can be
174
206
  # unarchived.
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.52.0"
4
+ VERSION = "1.53.0"
5
5
  end
data/lib/orb.rb CHANGED
@@ -315,6 +315,7 @@ require_relative "orb/models/metric_create_params"
315
315
  require_relative "orb/models/metric_events_dropped_by_watermark_webhook_event"
316
316
  require_relative "orb/models/metric_fetch_params"
317
317
  require_relative "orb/models/metric_list_params"
318
+ require_relative "orb/models/metric_publish_params"
318
319
  require_relative "orb/models/metric_unarchive_params"
319
320
  require_relative "orb/models/metric_update_params"
320
321
  require_relative "orb/models/minimum"
@@ -187,34 +187,107 @@ module Orb
187
187
  sig { returns(T.nilable(String)) }
188
188
  attr_accessor :description
189
189
 
190
+ sig { returns(T.nilable(String)) }
191
+ attr_accessor :item_id
192
+
190
193
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
191
194
  attr_accessor :metadata
192
195
 
193
196
  sig { returns(T.nilable(String)) }
194
197
  attr_accessor :name
195
198
 
199
+ sig { returns(T.nilable(String)) }
200
+ attr_accessor :sql
201
+
202
+ sig do
203
+ returns(
204
+ T.nilable(
205
+ Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status::TaggedSymbol
206
+ )
207
+ )
208
+ end
209
+ attr_accessor :status
210
+
196
211
  # metadata values are non-null on the wire, as on the price event.
197
212
  sig do
198
213
  params(
199
214
  description: T.nilable(String),
215
+ item_id: T.nilable(String),
200
216
  metadata: T.nilable(T::Hash[Symbol, String]),
201
- name: T.nilable(String)
217
+ name: T.nilable(String),
218
+ sql: T.nilable(String),
219
+ status:
220
+ T.nilable(
221
+ Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status::OrSymbol
222
+ )
202
223
  ).returns(T.attached_class)
203
224
  end
204
- def self.new(description: nil, metadata: nil, name: nil)
225
+ def self.new(
226
+ description: nil,
227
+ item_id: nil,
228
+ metadata: nil,
229
+ name: nil,
230
+ sql: nil,
231
+ status: nil
232
+ )
205
233
  end
206
234
 
207
235
  sig do
208
236
  override.returns(
209
237
  {
210
238
  description: T.nilable(String),
239
+ item_id: T.nilable(String),
211
240
  metadata: T.nilable(T::Hash[Symbol, String]),
212
- name: T.nilable(String)
241
+ name: T.nilable(String),
242
+ sql: T.nilable(String),
243
+ status:
244
+ T.nilable(
245
+ Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status::TaggedSymbol
246
+ )
213
247
  }
214
248
  )
215
249
  end
216
250
  def to_hash
217
251
  end
252
+
253
+ module Status
254
+ extend Orb::Internal::Type::Enum
255
+
256
+ TaggedSymbol =
257
+ T.type_alias do
258
+ T.all(
259
+ Symbol,
260
+ Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status
261
+ )
262
+ end
263
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
264
+
265
+ ACTIVE =
266
+ T.let(
267
+ :active,
268
+ Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status::TaggedSymbol
269
+ )
270
+ ARCHIVED =
271
+ T.let(
272
+ :archived,
273
+ Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status::TaggedSymbol
274
+ )
275
+ DRAFT =
276
+ T.let(
277
+ :draft,
278
+ Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status::TaggedSymbol
279
+ )
280
+
281
+ sig do
282
+ override.returns(
283
+ T::Array[
284
+ Orb::BillableMetricEditedWebhookEvent::Properties::PreviousAttributes::Status::TaggedSymbol
285
+ ]
286
+ )
287
+ end
288
+ def self.values
289
+ end
290
+ end
218
291
  end
219
292
  end
220
293
 
@@ -31,6 +31,15 @@ module Orb
31
31
  sig { returns(T.nilable(T::Hash[Symbol, T.nilable(String)])) }
32
32
  attr_accessor :metadata
33
33
 
34
+ # The status of the metric to create (either active or draft). If not specified,
35
+ # this defaults to active. A draft metric's `sql` and `item_id` can be changed
36
+ # until it's published.
37
+ sig { returns(T.nilable(Orb::MetricCreateParams::Status::OrSymbol)) }
38
+ attr_reader :status
39
+
40
+ sig { params(status: Orb::MetricCreateParams::Status::OrSymbol).void }
41
+ attr_writer :status
42
+
34
43
  sig do
35
44
  params(
36
45
  description: T.nilable(String),
@@ -38,6 +47,7 @@ module Orb
38
47
  name: String,
39
48
  sql: String,
40
49
  metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
50
+ status: Orb::MetricCreateParams::Status::OrSymbol,
41
51
  request_options: Orb::RequestOptions::OrHash
42
52
  ).returns(T.attached_class)
43
53
  end
@@ -54,6 +64,10 @@ module Orb
54
64
  # by setting the value to `null`, and the entire metadata mapping can be cleared
55
65
  # by setting `metadata` to `null`.
56
66
  metadata: nil,
67
+ # The status of the metric to create (either active or draft). If not specified,
68
+ # this defaults to active. A draft metric's `sql` and `item_id` can be changed
69
+ # until it's published.
70
+ status: nil,
57
71
  request_options: {}
58
72
  )
59
73
  end
@@ -66,12 +80,35 @@ module Orb
66
80
  name: String,
67
81
  sql: String,
68
82
  metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
83
+ status: Orb::MetricCreateParams::Status::OrSymbol,
69
84
  request_options: Orb::RequestOptions
70
85
  }
71
86
  )
72
87
  end
73
88
  def to_hash
74
89
  end
90
+
91
+ # The status of the metric to create (either active or draft). If not specified,
92
+ # this defaults to active. A draft metric's `sql` and `item_id` can be changed
93
+ # until it's published.
94
+ module Status
95
+ extend Orb::Internal::Type::Enum
96
+
97
+ TaggedSymbol =
98
+ T.type_alias { T.all(Symbol, Orb::MetricCreateParams::Status) }
99
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
100
+
101
+ ACTIVE = T.let(:active, Orb::MetricCreateParams::Status::TaggedSymbol)
102
+ DRAFT = T.let(:draft, Orb::MetricCreateParams::Status::TaggedSymbol)
103
+
104
+ sig do
105
+ override.returns(
106
+ T::Array[Orb::MetricCreateParams::Status::TaggedSymbol]
107
+ )
108
+ end
109
+ def self.values
110
+ end
111
+ end
75
112
  end
76
113
  end
77
114
  end
@@ -91,8 +91,8 @@ module Orb
91
91
  OrSymbol = T.type_alias { T.any(Symbol, String) }
92
92
 
93
93
  ACTIVE = T.let(:active, Orb::MetricListParams::Status::TaggedSymbol)
94
- ARCHIVED = T.let(:archived, Orb::MetricListParams::Status::TaggedSymbol)
95
94
  DRAFT = T.let(:draft, Orb::MetricListParams::Status::TaggedSymbol)
95
+ ARCHIVED = T.let(:archived, Orb::MetricListParams::Status::TaggedSymbol)
96
96
 
97
97
  sig do
98
98
  override.returns(
@@ -0,0 +1,33 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class MetricPublishParams < 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::MetricPublishParams, Orb::Internal::AnyHash) }
11
+
12
+ sig { returns(String) }
13
+ attr_accessor :metric_id
14
+
15
+ sig do
16
+ params(
17
+ metric_id: String,
18
+ request_options: Orb::RequestOptions::OrHash
19
+ ).returns(T.attached_class)
20
+ end
21
+ def self.new(metric_id:, request_options: {})
22
+ end
23
+
24
+ sig do
25
+ override.returns(
26
+ { metric_id: String, request_options: Orb::RequestOptions }
27
+ )
28
+ end
29
+ def to_hash
30
+ end
31
+ end
32
+ end
33
+ end