Skip to content

Commit b3f57be

Browse files
committed
Fix Width types for when screenboard width is string
1 parent b815c45 commit b3f57be

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

datadog-accessors.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6555,18 +6555,18 @@ func (s *Screenboard) SetTitle(v string) {
65556555
}
65566556

65576557
// GetWidth returns the Width field if non-nil, zero value otherwise.
6558-
func (s *Screenboard) GetWidth() int {
6558+
func (s *Screenboard) GetWidth() json.Number {
65596559
if s == nil || s.Width == nil {
6560-
return 0
6560+
return ""
65616561
}
65626562
return *s.Width
65636563
}
65646564

65656565
// GetWidthOk returns a tuple with the Width field if it's non-nil, zero value otherwise
65666566
// and a boolean to check if the value has been set.
6567-
func (s *Screenboard) GetWidthOk() (int, bool) {
6567+
func (s *Screenboard) GetWidthOk() (json.Number, bool) {
65686568
if s == nil || s.Width == nil {
6569-
return 0, false
6569+
return "", false
65706570
}
65716571
return *s.Width, true
65726572
}
@@ -6581,7 +6581,7 @@ func (s *Screenboard) HasWidth() bool {
65816581
}
65826582

65836583
// SetWidth allocates a new s.Width and returns the pointer to it.
6584-
func (s *Screenboard) SetWidth(v int) {
6584+
func (s *Screenboard) SetWidth(v json.Number) {
65856585
s.Width = &v
65866586
}
65876587

integration/screenboards_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package integration
22

33
import (
4+
"encoding/json"
45
"testing"
56

67
"github.com/zorkian/go-datadog-api"
@@ -94,7 +95,7 @@ func getTestScreenboard() *datadog.Screenboard {
9495
return &datadog.Screenboard{
9596
Title: datadog.String("___Test-Board___"),
9697
Height: datadog.Int(600),
97-
Width: datadog.Int(800),
98+
Width: datadog.JsonNumber(json.Number("800")),
9899
Widgets: []datadog.Widget{},
99100
}
100101
}
@@ -129,7 +130,7 @@ func assertScreenboardEquals(t *testing.T, actual, expected *datadog.Screenboard
129130
t.Errorf("Screenboard title does not match: %s != %s", *actual.Title, *expected.Title)
130131
}
131132
if *actual.Width != *expected.Width {
132-
t.Errorf("Screenboard width does not match: %d != %d", *actual.Width, *expected.Width)
133+
t.Errorf("Screenboard width does not match: %s != %s", *actual.Width, *expected.Width)
133134
}
134135
if *actual.Height != *expected.Height {
135136
t.Errorf("Screenboard width does not match: %d != %d", *actual.Height, *expected.Height)

screenboards.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package datadog
1010

1111
import (
12+
"encoding/json"
1213
"fmt"
1314
)
1415

@@ -18,7 +19,7 @@ type Screenboard struct {
1819
Id *int `json:"id,omitempty"`
1920
Title *string `json:"board_title,omitempty"`
2021
Height *int `json:"height,omitempty"`
21-
Width *int `json:"width,omitempty"`
22+
Width *json.Number `json:"width,omitempty"`
2223
Shared *bool `json:"shared,omitempty"`
2324
TemplateVariables []TemplateVariable `json:"template_variables,omitempty"`
2425
Widgets []Widget `json:"widgets"`

0 commit comments

Comments
 (0)