diff --git a/datadog-accessors.go b/datadog-accessors.go index 9cd1fe7..96ad791 100644 --- a/datadog-accessors.go +++ b/datadog-accessors.go @@ -9097,18 +9097,18 @@ func (u *User) SetVerified(v bool) { } // GetAlertID returns the AlertID field if non-nil, zero value otherwise. -func (w *Widget) GetAlertID() int { +func (w *Widget) GetAlertID() StrIntD { if w == nil || w.AlertID == nil { - return 0 + return "" } return *w.AlertID } // GetAlertIDOk returns a tuple with the AlertID field if it's non-nil, zero value otherwise // and a boolean to check if the value has been set. -func (w *Widget) GetAlertIDOk() (int, bool) { +func (w *Widget) GetAlertIDOk() (StrIntD, bool) { if w == nil || w.AlertID == nil { - return 0, false + return "", false } return *w.AlertID, true } @@ -9123,7 +9123,7 @@ func (w *Widget) HasAlertID() bool { } // SetAlertID allocates a new w.AlertID and returns the pointer to it. -func (w *Widget) SetAlertID(v int) { +func (w *Widget) SetAlertID(v StrIntD) { w.AlertID = &v } diff --git a/integration/screen_widgets_test.go b/integration/screen_widgets_test.go index 29ecd84..dd0b0fd 100644 --- a/integration/screen_widgets_test.go +++ b/integration/screen_widgets_test.go @@ -222,7 +222,7 @@ func TestWidgets(t *testing.T) { TitleText: datadog.String("Test title"), TitleSize: datadog.Int(16), TitleAlign: datadog.String("right"), - AlertID: datadog.Int(123456), + AlertID: datadog.StrInt("123456"), VizType: datadog.String("toplist"), Time: &datadog.Time{ LiveSpan: datadog.String("15m"), @@ -238,7 +238,7 @@ func TestWidgets(t *testing.T) { TitleText: datadog.String("Test title"), TitleSize: datadog.Int(16), TitleAlign: datadog.String("right"), - AlertID: datadog.Int(123456), + AlertID: datadog.StrInt("123456"), TextSize: datadog.String("fill_height"), TextAlign: datadog.String("right"), Precision: datadog.StrInt("*"), diff --git a/screen_widgets.go b/screen_widgets.go index 57bb789..8d53e20 100644 --- a/screen_widgets.go +++ b/screen_widgets.go @@ -118,8 +118,8 @@ type Widget struct { FontSize *string `json:"font_size,omitempty"` // For AlertValue, AlertGraph widgets - AlertID *int `json:"alert_id,omitempty"` - AutoRefresh *bool `json:"auto_refresh,omitempty"` + AlertID *StrIntD `json:"alert_id,omitempty"` + AutoRefresh *bool `json:"auto_refresh,omitempty"` // For Timeseries, QueryValue, Toplist widgets Legend *bool `json:"legend,omitempty"` diff --git a/screenboards_test.go b/screenboards_test.go index 87658ff..0e334be 100644 --- a/screenboards_test.go +++ b/screenboards_test.go @@ -217,6 +217,17 @@ func TestGetScreenboard(t *testing.T) { }, }, }, + { + file: "screenboard_response_alert_id", + want: &Screenboard{ + Widgets: []Widget{ + { + Type: String("alert_value"), + AlertID: StrInt("2156443"), + }, + }, + }, + }, } for _, tt := range tests { t.Run(tt.file, func(t *testing.T) { diff --git a/testdata/fixtures/screenboard_response_alert_id.json b/testdata/fixtures/screenboard_response_alert_id.json new file mode 100644 index 0000000..4581584 --- /dev/null +++ b/testdata/fixtures/screenboard_response_alert_id.json @@ -0,0 +1,8 @@ +{ + "widgets": [ + { + "alert_id": "2156443", + "type": "alert_value" + } + ] +} \ No newline at end of file