From 8a217fdad1b09120a92f9ff45550ee932db03a16 Mon Sep 17 00:00:00 2001 From: Justin Sanford Date: Tue, 12 Dec 2023 15:06:35 +0000 Subject: [PATCH] last files --- model_broadcast_status.go.patch | 13 ++++ ...t_metric_timeseries_data_response.go.patch | 59 +++++++++++++++++++ model_space_status.go.patch | 13 ++++ 3 files changed, 85 insertions(+) create mode 100644 model_broadcast_status.go.patch create mode 100644 model_get_metric_timeseries_data_response.go.patch create mode 100644 model_space_status.go.patch diff --git a/model_broadcast_status.go.patch b/model_broadcast_status.go.patch new file mode 100644 index 0000000..8cf119c --- /dev/null +++ b/model_broadcast_status.go.patch @@ -0,0 +1,13 @@ +diff --git a/model_broadcast_status.go b/model_broadcast_status.go +index 2411549..f8db8a4 100644 +--- a/model_broadcast_status.go ++++ b/model_broadcast_status.go +@@ -8,6 +8,6 @@ type BroadcastStatus string + + // List of BroadcastStatus + const ( +- IDLE BroadcastStatus = "idle" +- ACTIVE BroadcastStatus = "active" ++ BROADCAST_IDLE BroadcastStatus = "idle" ++ BROADCAST_ACTIVE BroadcastStatus = "active" + ) diff --git a/model_get_metric_timeseries_data_response.go.patch b/model_get_metric_timeseries_data_response.go.patch new file mode 100644 index 0000000..53a1117 --- /dev/null +++ b/model_get_metric_timeseries_data_response.go.patch @@ -0,0 +1,59 @@ +diff --git a/model_get_metric_timeseries_data_response.go b/model_get_metric_timeseries_data_response.go +index 288dfe6..f174a6c 100644 +--- a/model_get_metric_timeseries_data_response.go ++++ b/model_get_metric_timeseries_data_response.go +@@ -3,9 +3,54 @@ + + package muxgo + ++import ( ++ "encoding/json" ++ "fmt" ++) ++ + type GetMetricTimeseriesDataResponse struct { + Data [][]string `json:"data,omitempty"` + TotalRowCount int64 `json:"total_row_count,omitempty"` + Timeframe []int64 `json:"timeframe,omitempty"` + Meta ListBreakdownValuesResponseMeta `json:"meta,omitempty"` + } ++ ++// !!! 🐉 Here be dragons 🐉 !!! ++// We use a custom Unmarshal to work around one awkward API call where we can't model the response ++// from the API elegantly since go doesn't have heterogeneous arrays. This isn't perfect, or memory ++// friendly, but it works. ++func (this *GetMetricTimeseriesDataResponse) UnmarshalJSON(data []byte) error { ++ ++ // Unmarshal JSON into a string => interface{} map ++ var result map[string]interface{} ++ json.Unmarshal(data, &result) ++ ++ // Build up a new list of each of the datapoints from data as [][]string, nil checking as we go ++ datapoints := [][]string{} ++ for _, node := range result["data"].([]interface{}) { ++ nodeAsArray := node.([]interface{}) ++ d := make([]string, 3) ++ d[0] = nodeAsArray[0].(string) ++ if nodeAsArray[1] != nil { ++ d[1] = fmt.Sprintf("%f", nodeAsArray[1].(float64)) ++ } ++ if nodeAsArray[2] != nil { ++ d[2] = fmt.Sprintf("%f", nodeAsArray[2].(float64)) ++ } ++ datapoints = append(datapoints, d) ++ } ++ ++ // Build the array of timeframe ++ timeframes := []int64{} ++ for _, time := range result["timeframe"].([]interface{}) { ++ timefloat := time.(float64) ++ timeframes = append(timeframes, int64(timefloat)) ++ } ++ ++ // Set the fields on the response object to what we've pieced together ++ this.Data = datapoints ++ this.Timeframe = timeframes ++ this.TotalRowCount = int64(result["total_row_count"].(float64)) ++ ++ return nil ++} diff --git a/model_space_status.go.patch b/model_space_status.go.patch new file mode 100644 index 0000000..cecb39c --- /dev/null +++ b/model_space_status.go.patch @@ -0,0 +1,13 @@ +diff --git a/model_space_status.go b/model_space_status.go +index 31572b7..9adb99c 100644 +--- a/model_space_status.go ++++ b/model_space_status.go +@@ -8,6 +8,6 @@ type SpaceStatus string + + // List of SpaceStatus + const ( +- IDLE SpaceStatus = "idle" +- ACTIVE SpaceStatus = "active" ++ SPACE_IDLE SpaceStatus = "idle" ++ SPACE_ACTIVE SpaceStatus = "active" + )