forked from MyPureCloud/platform-client-sdk-go
/
effectiveconfiguration.go
118 lines (78 loc) · 3.37 KB
/
effectiveconfiguration.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
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"fmt"
"strconv"
"strings"
)
// Effectiveconfiguration - Effective Configuration for an ClientApp. This is comprised of the integration specific configuration along with overrides specified in the integration type.
type Effectiveconfiguration struct {
// Properties - Key-value configuration settings described by the schema in the propertiesSchemaUri field.
Properties *map[string]interface{} `json:"properties"`
// Advanced - Advanced configuration described by the schema in the advancedSchemaUri field.
Advanced *map[string]interface{} `json:"advanced"`
// Name - The name of the integration, used to distinguish this integration from others of the same type.
Name *string `json:"name,omitempty"`
// Notes - Notes about the integration.
Notes *string `json:"notes,omitempty"`
// Credentials - Credentials required by the integration. The required keys are indicated in the credentials property of the Integration Type
Credentials *map[string]Credentialinfo `json:"credentials"`
}
func (o *Effectiveconfiguration) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Effectiveconfiguration
return json.Marshal(&struct {
Properties *map[string]interface{} `json:"properties"`
Advanced *map[string]interface{} `json:"advanced"`
Name *string `json:"name,omitempty"`
Notes *string `json:"notes,omitempty"`
Credentials *map[string]Credentialinfo `json:"credentials"`
*Alias
}{
Properties: o.Properties,
Advanced: o.Advanced,
Name: o.Name,
Notes: o.Notes,
Credentials: o.Credentials,
Alias: (*Alias)(o),
})
}
func (o *Effectiveconfiguration) UnmarshalJSON(b []byte) error {
var EffectiveconfigurationMap map[string]interface{}
err := json.Unmarshal(b, &EffectiveconfigurationMap)
if err != nil {
return err
}
if Properties, ok := EffectiveconfigurationMap["properties"].(map[string]interface{}); ok {
PropertiesString, _ := json.Marshal(Properties)
json.Unmarshal(PropertiesString, &o.Properties)
}
if Advanced, ok := EffectiveconfigurationMap["advanced"].(map[string]interface{}); ok {
AdvancedString, _ := json.Marshal(Advanced)
json.Unmarshal(AdvancedString, &o.Advanced)
}
if Name, ok := EffectiveconfigurationMap["name"].(string); ok {
o.Name = &Name
}
if Notes, ok := EffectiveconfigurationMap["notes"].(string); ok {
o.Notes = &Notes
}
if Credentials, ok := EffectiveconfigurationMap["credentials"].(map[string]interface{}); ok {
CredentialsString, _ := json.Marshal(Credentials)
json.Unmarshal(CredentialsString, &o.Credentials)
}
return nil
}
// String returns a JSON representation of the model
func (o *Effectiveconfiguration) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
str = strings.Replace(str, strconv.Quote(*NullString()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullInt()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullFloat32()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullFloat64()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", NullTime().Format("2006-01-02T15:04:05Z07:00")), "null", -1)
return str
}