go-datadog-api
go-datadog-api copied to clipboard
Use json.Number for Screenboard.Width and ConditionalFormat.Value
I got the following error.
FATA[0001] json: cannot unmarshal string into Go struct field Screenboard.width of type int
I investigated this error and found that width
is occasionally returned as string.
$ curl -G "https://app.datadoghq.com/api/v1/screen/XXXXXX" -d "api_key=$DATADOG_API_KEY" -d "application_key=$DATADOG_APP_KEY" | jq . | grep width
"width": "100%",
Another dashboard:
$ curl -G "https://app.datadoghq.com/api/v1/screen/XXXXXX" -d "api_key=$DATADOG_API_KEY" -d "application_key=$DATADOG_APP_KEY" | jq . | grep width
"width": 424,
ConditionalFormat.Value
is also the same.
"conditional_formats": [
{
"palette": "white_on_red",
"comparator": ">",
"invert": false,
"value": 10,
"custom_bg_color": null,
"custom_fg_color": null
},
...
"conditional_formats": [
{
"palette": "white_on_red",
"comparator": "<",
"value": "3"
},
This PR includes breaking changes because it was written in the same way as the codes in other places. But please tell me if there is a better way.