-
Notifications
You must be signed in to change notification settings - Fork 12
/
messengersettings.go
90 lines (65 loc) · 2.34 KB
/
messengersettings.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
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Messengersettings - Settings concerning messenger
type Messengersettings struct {
// Enabled - Whether or not messenger is enabled
Enabled *bool `json:"enabled,omitempty"`
// Styles - The style settings for messenger
Styles *Messengerstyles `json:"styles,omitempty"`
// LauncherButton - The launcher button settings for messenger
LauncherButton *Launcherbuttonsettings `json:"launcherButton,omitempty"`
// FileUpload - The file upload settings for messenger
FileUpload *Fileuploadsettings `json:"fileUpload,omitempty"`
}
func (o *Messengersettings) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Messengersettings
return json.Marshal(&struct {
Enabled *bool `json:"enabled,omitempty"`
Styles *Messengerstyles `json:"styles,omitempty"`
LauncherButton *Launcherbuttonsettings `json:"launcherButton,omitempty"`
FileUpload *Fileuploadsettings `json:"fileUpload,omitempty"`
*Alias
}{
Enabled: o.Enabled,
Styles: o.Styles,
LauncherButton: o.LauncherButton,
FileUpload: o.FileUpload,
Alias: (*Alias)(o),
})
}
func (o *Messengersettings) UnmarshalJSON(b []byte) error {
var MessengersettingsMap map[string]interface{}
err := json.Unmarshal(b, &MessengersettingsMap)
if err != nil {
return err
}
if Enabled, ok := MessengersettingsMap["enabled"].(bool); ok {
o.Enabled = &Enabled
}
if Styles, ok := MessengersettingsMap["styles"].(map[string]interface{}); ok {
StylesString, _ := json.Marshal(Styles)
json.Unmarshal(StylesString, &o.Styles)
}
if LauncherButton, ok := MessengersettingsMap["launcherButton"].(map[string]interface{}); ok {
LauncherButtonString, _ := json.Marshal(LauncherButton)
json.Unmarshal(LauncherButtonString, &o.LauncherButton)
}
if FileUpload, ok := MessengersettingsMap["fileUpload"].(map[string]interface{}); ok {
FileUploadString, _ := json.Marshal(FileUpload)
json.Unmarshal(FileUploadString, &o.FileUpload)
}
return nil
}
// String returns a JSON representation of the model
func (o *Messengersettings) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}