-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_agent_device.go
104 lines (84 loc) · 2.45 KB
/
model_agent_device.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
/*
Eliona REST API
The Eliona REST API enables unified access to the resources and data of an Eliona environment.
API version: 2.7.3
Contact: hello@eliona.io
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"encoding/json"
"fmt"
)
// AgentDevice struct for AgentDevice
type AgentDevice struct {
IosysAgentDevice *IosysAgentDevice
MbusAgentDevice *MbusAgentDevice
}
// Unmarshal JSON data into any of the pointers in the struct
func (dst *AgentDevice) UnmarshalJSON(data []byte) error {
var err error
// try to unmarshal JSON data into IosysAgentDevice
err = json.Unmarshal(data, &dst.IosysAgentDevice)
if err == nil {
jsonIosysAgentDevice, _ := json.Marshal(dst.IosysAgentDevice)
if string(jsonIosysAgentDevice) == "{}" { // empty struct
dst.IosysAgentDevice = nil
} else {
return nil // data stored in dst.IosysAgentDevice, return on the first match
}
} else {
dst.IosysAgentDevice = nil
}
// try to unmarshal JSON data into MbusAgentDevice
err = json.Unmarshal(data, &dst.MbusAgentDevice)
if err == nil {
jsonMbusAgentDevice, _ := json.Marshal(dst.MbusAgentDevice)
if string(jsonMbusAgentDevice) == "{}" { // empty struct
dst.MbusAgentDevice = nil
} else {
return nil // data stored in dst.MbusAgentDevice, return on the first match
}
} else {
dst.MbusAgentDevice = nil
}
return fmt.Errorf("data failed to match schemas in anyOf(AgentDevice)")
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src *AgentDevice) MarshalJSON() ([]byte, error) {
if src.IosysAgentDevice != nil {
return json.Marshal(&src.IosysAgentDevice)
}
if src.MbusAgentDevice != nil {
return json.Marshal(&src.MbusAgentDevice)
}
return nil, nil // no data in anyOf schemas
}
type NullableAgentDevice struct {
value *AgentDevice
isSet bool
}
func (v NullableAgentDevice) Get() *AgentDevice {
return v.value
}
func (v *NullableAgentDevice) Set(val *AgentDevice) {
v.value = val
v.isSet = true
}
func (v NullableAgentDevice) IsSet() bool {
return v.isSet
}
func (v *NullableAgentDevice) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAgentDevice(val *AgentDevice) *NullableAgentDevice {
return &NullableAgentDevice{value: val, isSet: true}
}
func (v NullableAgentDevice) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAgentDevice) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}