-
Notifications
You must be signed in to change notification settings - Fork 12
/
widgetclientconfig.go
91 lines (66 loc) · 2.1 KB
/
widgetclientconfig.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
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Widgetclientconfig
type Widgetclientconfig struct {
// V1
V1 *Widgetclientconfigv1 `json:"v1,omitempty"`
// V2
V2 *Widgetclientconfigv2 `json:"v2,omitempty"`
// V1Http
V1Http *Widgetclientconfigv1http `json:"v1-http,omitempty"`
// ThirdParty
ThirdParty *Widgetclientconfigthirdparty `json:"third-party,omitempty"`
}
func (o *Widgetclientconfig) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Widgetclientconfig
return json.Marshal(&struct {
V1 *Widgetclientconfigv1 `json:"v1,omitempty"`
V2 *Widgetclientconfigv2 `json:"v2,omitempty"`
V1Http *Widgetclientconfigv1http `json:"v1-http,omitempty"`
ThirdParty *Widgetclientconfigthirdparty `json:"third-party,omitempty"`
*Alias
}{
V1: o.V1,
V2: o.V2,
V1Http: o.V1Http,
ThirdParty: o.ThirdParty,
Alias: (*Alias)(o),
})
}
func (o *Widgetclientconfig) UnmarshalJSON(b []byte) error {
var WidgetclientconfigMap map[string]interface{}
err := json.Unmarshal(b, &WidgetclientconfigMap)
if err != nil {
return err
}
if V1, ok := WidgetclientconfigMap["v1"].(map[string]interface{}); ok {
V1String, _ := json.Marshal(V1)
json.Unmarshal(V1String, &o.V1)
}
if V2, ok := WidgetclientconfigMap["v2"].(map[string]interface{}); ok {
V2String, _ := json.Marshal(V2)
json.Unmarshal(V2String, &o.V2)
}
if V1Http, ok := WidgetclientconfigMap["v1-http"].(map[string]interface{}); ok {
V1HttpString, _ := json.Marshal(V1Http)
json.Unmarshal(V1HttpString, &o.V1Http)
}
if ThirdParty, ok := WidgetclientconfigMap["third-party"].(map[string]interface{}); ok {
ThirdPartyString, _ := json.Marshal(ThirdParty)
json.Unmarshal(ThirdPartyString, &o.ThirdParty)
}
return nil
}
// String returns a JSON representation of the model
func (o *Widgetclientconfig) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}