Skip to content

Commit 6f9b29a

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

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

datadog-accessors.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package datadog
1111

1212
import (
1313
"encoding/json"
14+
"fmt"
1415
)
1516

1617
// GetCreator returns the Creator field if non-nil, zero value otherwise.
@@ -6556,19 +6557,21 @@ func (s *Screenboard) SetTitle(v string) {
65566557

65576558
// GetWidth returns the Width field if non-nil, zero value otherwise.
65586559
func (s *Screenboard) GetWidth() int {
6559-
if s == nil || s.Width == nil {
6560+
num, err := s.Width.Int64()
6561+
if err != nil || s == nil || s.Width == nil {
65606562
return 0
65616563
}
6562-
return *s.Width
6564+
return int(num)
65636565
}
65646566

65656567
// GetWidthOk returns a tuple with the Width field if it's non-nil, zero value otherwise
65666568
// and a boolean to check if the value has been set.
65676569
func (s *Screenboard) GetWidthOk() (int, bool) {
6568-
if s == nil || s.Width == nil {
6570+
num, err := s.Width.Int64()
6571+
if err != nil || s == nil || s.Width == nil {
65696572
return 0, false
65706573
}
6571-
return *s.Width, true
6574+
return int(num), true
65726575
}
65736576

65746577
// HasWidth returns a boolean if a field has been set.
@@ -6582,7 +6585,8 @@ func (s *Screenboard) HasWidth() bool {
65826585

65836586
// SetWidth allocates a new s.Width and returns the pointer to it.
65846587
func (s *Screenboard) SetWidth(v int) {
6585-
s.Width = &v
6588+
width := json.Number(fmt.Sprint(v))
6589+
s.Width = &width
65866590
}
65876591

65886592
// GetId returns the Id field if non-nil, zero value otherwise.

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)