-
Notifications
You must be signed in to change notification settings - Fork 13
/
buforecastmodification.go
175 lines (115 loc) · 5.36 KB
/
buforecastmodification.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Buforecastmodification
type Buforecastmodification struct {
// VarType - The type of the modification
VarType *string `json:"type,omitempty"`
// StartIntervalIndex - The number of 15 minute intervals past referenceStartDate representing the first interval to which to apply this modification. Must be null if values is populated
StartIntervalIndex *int `json:"startIntervalIndex,omitempty"`
// EndIntervalIndex - The number of 15 minute intervals past referenceStartDate representing the last interval to which to apply this modification. Must be null if values is populated
EndIntervalIndex *int `json:"endIntervalIndex,omitempty"`
// Metric - The metric to which this modification applies
Metric *string `json:"metric,omitempty"`
// LegacyMetric - The legacy metric to which this modification applies if applicable
LegacyMetric *string `json:"legacyMetric,omitempty"`
// Value - The value of the modification. Must be null if \"values\" is populated
Value *float64 `json:"value,omitempty"`
// Values - The list of values to update. Only applicable for grid-type modifications. Must be null if \"value\" is populated
Values *[]Wfmforecastmodificationintervaloffsetvalue `json:"values,omitempty"`
// DisplayGranularity - The client side display granularity of the modification, expressed in the ISO-8601 duration format. Periods are represented as an ISO-8601 string. For example: P1D or P1DT12H
DisplayGranularity *string `json:"displayGranularity,omitempty"`
// Granularity - The actual granularity of the modification as stored behind the scenes, expressed in the ISO-8601 duration format. Periods are represented as an ISO-8601 string. For example: P1D or P1DT12H
Granularity *string `json:"granularity,omitempty"`
// Enabled - Whether the modification is enabled for the forecast
Enabled *bool `json:"enabled,omitempty"`
// PlanningGroupIds - The IDs of the planning groups to which this forecast modification applies. Leave empty to apply to all
PlanningGroupIds *[]string `json:"planningGroupIds,omitempty"`
}
func (o *Buforecastmodification) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Buforecastmodification
return json.Marshal(&struct {
VarType *string `json:"type,omitempty"`
StartIntervalIndex *int `json:"startIntervalIndex,omitempty"`
EndIntervalIndex *int `json:"endIntervalIndex,omitempty"`
Metric *string `json:"metric,omitempty"`
LegacyMetric *string `json:"legacyMetric,omitempty"`
Value *float64 `json:"value,omitempty"`
Values *[]Wfmforecastmodificationintervaloffsetvalue `json:"values,omitempty"`
DisplayGranularity *string `json:"displayGranularity,omitempty"`
Granularity *string `json:"granularity,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
PlanningGroupIds *[]string `json:"planningGroupIds,omitempty"`
*Alias
}{
VarType: o.VarType,
StartIntervalIndex: o.StartIntervalIndex,
EndIntervalIndex: o.EndIntervalIndex,
Metric: o.Metric,
LegacyMetric: o.LegacyMetric,
Value: o.Value,
Values: o.Values,
DisplayGranularity: o.DisplayGranularity,
Granularity: o.Granularity,
Enabled: o.Enabled,
PlanningGroupIds: o.PlanningGroupIds,
Alias: (*Alias)(o),
})
}
func (o *Buforecastmodification) UnmarshalJSON(b []byte) error {
var BuforecastmodificationMap map[string]interface{}
err := json.Unmarshal(b, &BuforecastmodificationMap)
if err != nil {
return err
}
if VarType, ok := BuforecastmodificationMap["type"].(string); ok {
o.VarType = &VarType
}
if StartIntervalIndex, ok := BuforecastmodificationMap["startIntervalIndex"].(float64); ok {
StartIntervalIndexInt := int(StartIntervalIndex)
o.StartIntervalIndex = &StartIntervalIndexInt
}
if EndIntervalIndex, ok := BuforecastmodificationMap["endIntervalIndex"].(float64); ok {
EndIntervalIndexInt := int(EndIntervalIndex)
o.EndIntervalIndex = &EndIntervalIndexInt
}
if Metric, ok := BuforecastmodificationMap["metric"].(string); ok {
o.Metric = &Metric
}
if LegacyMetric, ok := BuforecastmodificationMap["legacyMetric"].(string); ok {
o.LegacyMetric = &LegacyMetric
}
if Value, ok := BuforecastmodificationMap["value"].(float64); ok {
o.Value = &Value
}
if Values, ok := BuforecastmodificationMap["values"].([]interface{}); ok {
ValuesString, _ := json.Marshal(Values)
json.Unmarshal(ValuesString, &o.Values)
}
if DisplayGranularity, ok := BuforecastmodificationMap["displayGranularity"].(string); ok {
o.DisplayGranularity = &DisplayGranularity
}
if Granularity, ok := BuforecastmodificationMap["granularity"].(string); ok {
o.Granularity = &Granularity
}
if Enabled, ok := BuforecastmodificationMap["enabled"].(bool); ok {
o.Enabled = &Enabled
}
if PlanningGroupIds, ok := BuforecastmodificationMap["planningGroupIds"].([]interface{}); ok {
PlanningGroupIdsString, _ := json.Marshal(PlanningGroupIds)
json.Unmarshal(PlanningGroupIdsString, &o.PlanningGroupIds)
}
return nil
}
// String returns a JSON representation of the model
func (o *Buforecastmodification) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}