Skip to content

Commit 1cae097

Browse files
feat(api): api update
1 parent 59f4f8b commit 1cae097

File tree

5 files changed

+101
-17
lines changed

5 files changed

+101
-17
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 126
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-9f1a41612765cb08d100b2c9e85080e93306e8d0942d535f16052c3eb18d9b8b.yml
3-
openapi_spec_hash: 6dd28f36adc7e7d6a9245585eaf9b9c1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-931771ff4ab183044ee50ce43ea794ac0a15bfafbaf7df61ac0344af3ff08944.yml
3+
openapi_spec_hash: 71371804e373f662585284bf5d93cc62
44
config_hash: bcf82bddb691f6be773ac6cae8c03b9a

lib/orb/models/alert.rb

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ class Alert < Orb::Internal::Type::BaseModel
7474
-> { Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus] },
7575
nil?: true
7676

77-
# @!method initialize(id:, created_at:, currency:, customer:, enabled:, metric:, plan:, subscription:, thresholds:, type:, balance_alert_status: nil)
77+
# @!attribute license_type
78+
# Minified license type for alert serialization.
79+
#
80+
# @return [Orb::Models::Alert::LicenseType, nil]
81+
optional :license_type, -> { Orb::Alert::LicenseType }, nil?: true
82+
83+
# @!method initialize(id:, created_at:, currency:, customer:, enabled:, metric:, plan:, subscription:, thresholds:, type:, balance_alert_status: nil, license_type: nil)
7884
# Some parameter documentations has been truncated, see {Orb::Models::Alert} for
7985
# more details.
8086
#
@@ -105,6 +111,8 @@ class Alert < Orb::Internal::Type::BaseModel
105111
# @param type [Symbol, Orb::Models::Alert::Type] The type of alert. This must be a valid alert type.
106112
#
107113
# @param balance_alert_status [Array<Orb::Models::Alert::BalanceAlertStatus>, nil] The current status of the alert. This field is only present for credit balance a
114+
#
115+
# @param license_type [Orb::Models::Alert::LicenseType, nil] Minified license type for alert serialization.
108116

109117
# @see Orb::Models::Alert#metric
110118
class Metric < Orb::Internal::Type::BaseModel
@@ -170,6 +178,7 @@ module Type
170178
CREDIT_BALANCE_RECOVERED = :credit_balance_recovered
171179
USAGE_EXCEEDED = :usage_exceeded
172180
COST_EXCEEDED = :cost_exceeded
181+
LICENSE_BALANCE_THRESHOLD_REACHED = :license_balance_threshold_reached
173182

174183
# @!method self.values
175184
# @return [Array<Symbol>]
@@ -195,6 +204,19 @@ class BalanceAlertStatus < Orb::Internal::Type::BaseModel
195204
#
196205
# @param threshold_value [Float] The value of the threshold that defines the alert status.
197206
end
207+
208+
# @see Orb::Models::Alert#license_type
209+
class LicenseType < Orb::Internal::Type::BaseModel
210+
# @!attribute id
211+
#
212+
# @return [String]
213+
required :id, String
214+
215+
# @!method initialize(id:)
216+
# Minified license type for alert serialization.
217+
#
218+
# @param id [String]
219+
end
198220
end
199221
end
200222
end

rbi/orb/models/alert.rbi

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ module Orb
6565
sig { returns(T.nilable(T::Array[Orb::Alert::BalanceAlertStatus])) }
6666
attr_accessor :balance_alert_status
6767

68+
# Minified license type for alert serialization.
69+
sig { returns(T.nilable(Orb::Alert::LicenseType)) }
70+
attr_reader :license_type
71+
72+
sig do
73+
params(license_type: T.nilable(Orb::Alert::LicenseType::OrHash)).void
74+
end
75+
attr_writer :license_type
76+
6877
# [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending,
6978
# usage, or credit balance and trigger webhooks when a threshold is exceeded.
7079
#
@@ -83,7 +92,8 @@ module Orb
8392
thresholds: T.nilable(T::Array[Orb::Threshold::OrHash]),
8493
type: Orb::Alert::Type::OrSymbol,
8594
balance_alert_status:
86-
T.nilable(T::Array[Orb::Alert::BalanceAlertStatus::OrHash])
95+
T.nilable(T::Array[Orb::Alert::BalanceAlertStatus::OrHash]),
96+
license_type: T.nilable(Orb::Alert::LicenseType::OrHash)
8797
).returns(T.attached_class)
8898
end
8999
def self.new(
@@ -110,7 +120,9 @@ module Orb
110120
type:,
111121
# The current status of the alert. This field is only present for credit balance
112122
# alerts.
113-
balance_alert_status: nil
123+
balance_alert_status: nil,
124+
# Minified license type for alert serialization.
125+
license_type: nil
114126
)
115127
end
116128

@@ -128,7 +140,8 @@ module Orb
128140
thresholds: T.nilable(T::Array[Orb::Threshold]),
129141
type: Orb::Alert::Type::TaggedSymbol,
130142
balance_alert_status:
131-
T.nilable(T::Array[Orb::Alert::BalanceAlertStatus])
143+
T.nilable(T::Array[Orb::Alert::BalanceAlertStatus]),
144+
license_type: T.nilable(Orb::Alert::LicenseType)
132145
}
133146
)
134147
end
@@ -220,6 +233,11 @@ module Orb
220233
T.let(:credit_balance_recovered, Orb::Alert::Type::TaggedSymbol)
221234
USAGE_EXCEEDED = T.let(:usage_exceeded, Orb::Alert::Type::TaggedSymbol)
222235
COST_EXCEEDED = T.let(:cost_exceeded, Orb::Alert::Type::TaggedSymbol)
236+
LICENSE_BALANCE_THRESHOLD_REACHED =
237+
T.let(
238+
:license_balance_threshold_reached,
239+
Orb::Alert::Type::TaggedSymbol
240+
)
223241

224242
sig { override.returns(T::Array[Orb::Alert::Type::TaggedSymbol]) }
225243
def self.values
@@ -260,6 +278,25 @@ module Orb
260278
def to_hash
261279
end
262280
end
281+
282+
class LicenseType < Orb::Internal::Type::BaseModel
283+
OrHash =
284+
T.type_alias do
285+
T.any(Orb::Alert::LicenseType, Orb::Internal::AnyHash)
286+
end
287+
288+
sig { returns(String) }
289+
attr_accessor :id
290+
291+
# Minified license type for alert serialization.
292+
sig { params(id: String).returns(T.attached_class) }
293+
def self.new(id:)
294+
end
295+
296+
sig { override.returns({ id: String }) }
297+
def to_hash
298+
end
299+
end
263300
end
264301
end
265302
end

sig/orb/models/alert.rbs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ module Orb
1212
subscription: Orb::SubscriptionMinified?,
1313
thresholds: ::Array[Orb::Threshold]?,
1414
type: Orb::Models::Alert::type_,
15-
balance_alert_status: ::Array[Orb::Alert::BalanceAlertStatus]?
15+
balance_alert_status: ::Array[Orb::Alert::BalanceAlertStatus]?,
16+
license_type: Orb::Alert::LicenseType?
1617
}
1718

1819
class Alert < Orb::Internal::Type::BaseModel
@@ -38,6 +39,8 @@ module Orb
3839

3940
attr_accessor balance_alert_status: ::Array[Orb::Alert::BalanceAlertStatus]?
4041

42+
attr_accessor license_type: Orb::Alert::LicenseType?
43+
4144
def initialize: (
4245
id: String,
4346
created_at: Time,
@@ -49,7 +52,8 @@ module Orb
4952
subscription: Orb::SubscriptionMinified?,
5053
thresholds: ::Array[Orb::Threshold]?,
5154
type: Orb::Models::Alert::type_,
52-
?balance_alert_status: ::Array[Orb::Alert::BalanceAlertStatus]?
55+
?balance_alert_status: ::Array[Orb::Alert::BalanceAlertStatus]?,
56+
?license_type: Orb::Alert::LicenseType?
5357
) -> void
5458

5559
def to_hash: -> {
@@ -63,7 +67,8 @@ module Orb
6367
subscription: Orb::SubscriptionMinified?,
6468
thresholds: ::Array[Orb::Threshold]?,
6569
type: Orb::Models::Alert::type_,
66-
balance_alert_status: ::Array[Orb::Alert::BalanceAlertStatus]?
70+
balance_alert_status: ::Array[Orb::Alert::BalanceAlertStatus]?,
71+
license_type: Orb::Alert::LicenseType?
6772
}
6873

6974
type metric = { id: String }
@@ -114,6 +119,7 @@ module Orb
114119
| :credit_balance_recovered
115120
| :usage_exceeded
116121
| :cost_exceeded
122+
| :license_balance_threshold_reached
117123

118124
module Type
119125
extend Orb::Internal::Type::Enum
@@ -123,6 +129,7 @@ module Orb
123129
CREDIT_BALANCE_RECOVERED: :credit_balance_recovered
124130
USAGE_EXCEEDED: :usage_exceeded
125131
COST_EXCEEDED: :cost_exceeded
132+
LICENSE_BALANCE_THRESHOLD_REACHED: :license_balance_threshold_reached
126133

127134
def self?.values: -> ::Array[Orb::Models::Alert::type_]
128135
end
@@ -138,6 +145,16 @@ module Orb
138145

139146
def to_hash: -> { in_alert: bool, threshold_value: Float }
140147
end
148+
149+
type license_type = { id: String }
150+
151+
class LicenseType < Orb::Internal::Type::BaseModel
152+
attr_accessor id: String
153+
154+
def initialize: (id: String) -> void
155+
156+
def to_hash: -> { id: String }
157+
end
141158
end
142159
end
143160
end

test/orb/resources/alerts_test.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def test_retrieve
2222
subscription: Orb::SubscriptionMinified | nil,
2323
thresholds: ^(Orb::Internal::Type::ArrayOf[Orb::Threshold]) | nil,
2424
type: Orb::Alert::Type,
25-
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil
25+
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil,
26+
license_type: Orb::Alert::LicenseType | nil
2627
}
2728
end
2829
end
@@ -46,7 +47,8 @@ def test_update_required_params
4647
subscription: Orb::SubscriptionMinified | nil,
4748
thresholds: ^(Orb::Internal::Type::ArrayOf[Orb::Threshold]) | nil,
4849
type: Orb::Alert::Type,
49-
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil
50+
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil,
51+
license_type: Orb::Alert::LicenseType | nil
5052
}
5153
end
5254
end
@@ -79,7 +81,8 @@ def test_list
7981
subscription: Orb::SubscriptionMinified | nil,
8082
thresholds: ^(Orb::Internal::Type::ArrayOf[Orb::Threshold]) | nil,
8183
type: Orb::Alert::Type,
82-
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil
84+
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil,
85+
license_type: Orb::Alert::LicenseType | nil
8386
}
8487
end
8588
end
@@ -104,7 +107,8 @@ def test_create_for_customer_required_params
104107
subscription: Orb::SubscriptionMinified | nil,
105108
thresholds: ^(Orb::Internal::Type::ArrayOf[Orb::Threshold]) | nil,
106109
type: Orb::Alert::Type,
107-
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil
110+
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil,
111+
license_type: Orb::Alert::LicenseType | nil
108112
}
109113
end
110114
end
@@ -133,7 +137,8 @@ def test_create_for_external_customer_required_params
133137
subscription: Orb::SubscriptionMinified | nil,
134138
thresholds: ^(Orb::Internal::Type::ArrayOf[Orb::Threshold]) | nil,
135139
type: Orb::Alert::Type,
136-
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil
140+
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil,
141+
license_type: Orb::Alert::LicenseType | nil
137142
}
138143
end
139144
end
@@ -158,7 +163,8 @@ def test_create_for_subscription_required_params
158163
subscription: Orb::SubscriptionMinified | nil,
159164
thresholds: ^(Orb::Internal::Type::ArrayOf[Orb::Threshold]) | nil,
160165
type: Orb::Alert::Type,
161-
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil
166+
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil,
167+
license_type: Orb::Alert::LicenseType | nil
162168
}
163169
end
164170
end
@@ -182,7 +188,8 @@ def test_disable
182188
subscription: Orb::SubscriptionMinified | nil,
183189
thresholds: ^(Orb::Internal::Type::ArrayOf[Orb::Threshold]) | nil,
184190
type: Orb::Alert::Type,
185-
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil
191+
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil,
192+
license_type: Orb::Alert::LicenseType | nil
186193
}
187194
end
188195
end
@@ -206,7 +213,8 @@ def test_enable
206213
subscription: Orb::SubscriptionMinified | nil,
207214
thresholds: ^(Orb::Internal::Type::ArrayOf[Orb::Threshold]) | nil,
208215
type: Orb::Alert::Type,
209-
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil
216+
balance_alert_status: ^(Orb::Internal::Type::ArrayOf[Orb::Alert::BalanceAlertStatus]) | nil,
217+
license_type: Orb::Alert::LicenseType | nil
210218
}
211219
end
212220
end

0 commit comments

Comments
 (0)