Skip to content

Commit bbb9dce

Browse files
feat(api): api update
1 parent 8605410 commit bbb9dce

2 files changed

Lines changed: 35 additions & 9 deletions

File tree

.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

alert.go

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ type Alert struct {
224224
// The current status of the alert. This field is only present for credit balance
225225
// alerts.
226226
BalanceAlertStatus []AlertBalanceAlertStatus `json:"balance_alert_status,nullable"`
227-
JSON alertJSON `json:"-"`
227+
// Minified license type for alert serialization.
228+
LicenseType AlertLicenseType `json:"license_type,nullable"`
229+
JSON alertJSON `json:"-"`
228230
}
229231

230232
// alertJSON contains the JSON metadata for the struct [Alert]
@@ -240,6 +242,7 @@ type alertJSON struct {
240242
Thresholds apijson.Field
241243
Type apijson.Field
242244
BalanceAlertStatus apijson.Field
245+
LicenseType apijson.Field
243246
raw string
244247
ExtraFields map[string]apijson.Field
245248
}
@@ -307,16 +310,17 @@ func (r alertPlanJSON) RawJSON() string {
307310
type AlertType string
308311

309312
const (
310-
AlertTypeCreditBalanceDepleted AlertType = "credit_balance_depleted"
311-
AlertTypeCreditBalanceDropped AlertType = "credit_balance_dropped"
312-
AlertTypeCreditBalanceRecovered AlertType = "credit_balance_recovered"
313-
AlertTypeUsageExceeded AlertType = "usage_exceeded"
314-
AlertTypeCostExceeded AlertType = "cost_exceeded"
313+
AlertTypeCreditBalanceDepleted AlertType = "credit_balance_depleted"
314+
AlertTypeCreditBalanceDropped AlertType = "credit_balance_dropped"
315+
AlertTypeCreditBalanceRecovered AlertType = "credit_balance_recovered"
316+
AlertTypeUsageExceeded AlertType = "usage_exceeded"
317+
AlertTypeCostExceeded AlertType = "cost_exceeded"
318+
AlertTypeLicenseBalanceThresholdReached AlertType = "license_balance_threshold_reached"
315319
)
316320

317321
func (r AlertType) IsKnown() bool {
318322
switch r {
319-
case AlertTypeCreditBalanceDepleted, AlertTypeCreditBalanceDropped, AlertTypeCreditBalanceRecovered, AlertTypeUsageExceeded, AlertTypeCostExceeded:
323+
case AlertTypeCreditBalanceDepleted, AlertTypeCreditBalanceDropped, AlertTypeCreditBalanceRecovered, AlertTypeUsageExceeded, AlertTypeCostExceeded, AlertTypeLicenseBalanceThresholdReached:
320324
return true
321325
}
322326
return false
@@ -348,6 +352,28 @@ func (r alertBalanceAlertStatusJSON) RawJSON() string {
348352
return r.raw
349353
}
350354

355+
// Minified license type for alert serialization.
356+
type AlertLicenseType struct {
357+
ID string `json:"id,required"`
358+
JSON alertLicenseTypeJSON `json:"-"`
359+
}
360+
361+
// alertLicenseTypeJSON contains the JSON metadata for the struct
362+
// [AlertLicenseType]
363+
type alertLicenseTypeJSON struct {
364+
ID apijson.Field
365+
raw string
366+
ExtraFields map[string]apijson.Field
367+
}
368+
369+
func (r *AlertLicenseType) UnmarshalJSON(data []byte) (err error) {
370+
return apijson.UnmarshalRoot(data, r)
371+
}
372+
373+
func (r alertLicenseTypeJSON) RawJSON() string {
374+
return r.raw
375+
}
376+
351377
// Thresholds are used to define the conditions under which an alert will be
352378
// triggered.
353379
type Threshold struct {

0 commit comments

Comments
 (0)