-
Notifications
You must be signed in to change notification settings - Fork 4
/
model_address_tokens_transaction_unconfirmed_token.go
179 lines (146 loc) · 6.89 KB
/
model_address_tokens_transaction_unconfirmed_token.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
176
177
/*
CryptoAPIs
Crypto APIs is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of their blockchain applications. Crypto APIs provides unified endpoints and data, raw data, automatic tokens and coins forwardings, callback functionalities, and much more.
API version: 2021-03-20
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package cryptoapis
import (
"encoding/json"
"fmt"
)
// AddressTokensTransactionUnconfirmedToken - struct for AddressTokensTransactionUnconfirmedToken
type AddressTokensTransactionUnconfirmedToken struct {
AddressTokensTransactionUnconfirmedErc20 *AddressTokensTransactionUnconfirmedErc20
AddressTokensTransactionUnconfirmedErc721 *AddressTokensTransactionUnconfirmedErc721
AddressTokensTransactionUnconfirmedOmni *AddressTokensTransactionUnconfirmedOmni
}
// AddressTokensTransactionUnconfirmedErc20AsAddressTokensTransactionUnconfirmedToken is a convenience function that returns AddressTokensTransactionUnconfirmedErc20 wrapped in AddressTokensTransactionUnconfirmedToken
func AddressTokensTransactionUnconfirmedErc20AsAddressTokensTransactionUnconfirmedToken(v *AddressTokensTransactionUnconfirmedErc20) AddressTokensTransactionUnconfirmedToken {
return AddressTokensTransactionUnconfirmedToken{
AddressTokensTransactionUnconfirmedErc20: v,
}
}
// AddressTokensTransactionUnconfirmedErc721AsAddressTokensTransactionUnconfirmedToken is a convenience function that returns AddressTokensTransactionUnconfirmedErc721 wrapped in AddressTokensTransactionUnconfirmedToken
func AddressTokensTransactionUnconfirmedErc721AsAddressTokensTransactionUnconfirmedToken(v *AddressTokensTransactionUnconfirmedErc721) AddressTokensTransactionUnconfirmedToken {
return AddressTokensTransactionUnconfirmedToken{
AddressTokensTransactionUnconfirmedErc721: v,
}
}
// AddressTokensTransactionUnconfirmedOmniAsAddressTokensTransactionUnconfirmedToken is a convenience function that returns AddressTokensTransactionUnconfirmedOmni wrapped in AddressTokensTransactionUnconfirmedToken
func AddressTokensTransactionUnconfirmedOmniAsAddressTokensTransactionUnconfirmedToken(v *AddressTokensTransactionUnconfirmedOmni) AddressTokensTransactionUnconfirmedToken {
return AddressTokensTransactionUnconfirmedToken{
AddressTokensTransactionUnconfirmedOmni: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *AddressTokensTransactionUnconfirmedToken) UnmarshalJSON(data []byte) error {
var err error
match := 0
// try to unmarshal data into AddressTokensTransactionUnconfirmedErc20
err = newStrictDecoder(data).Decode(&dst.AddressTokensTransactionUnconfirmedErc20)
if err == nil {
jsonAddressTokensTransactionUnconfirmedErc20, _ := json.Marshal(dst.AddressTokensTransactionUnconfirmedErc20)
if string(jsonAddressTokensTransactionUnconfirmedErc20) == "{}" { // empty struct
dst.AddressTokensTransactionUnconfirmedErc20 = nil
} else {
match++
}
} else {
dst.AddressTokensTransactionUnconfirmedErc20 = nil
}
// try to unmarshal data into AddressTokensTransactionUnconfirmedErc721
err = newStrictDecoder(data).Decode(&dst.AddressTokensTransactionUnconfirmedErc721)
if err == nil {
jsonAddressTokensTransactionUnconfirmedErc721, _ := json.Marshal(dst.AddressTokensTransactionUnconfirmedErc721)
if string(jsonAddressTokensTransactionUnconfirmedErc721) == "{}" { // empty struct
dst.AddressTokensTransactionUnconfirmedErc721 = nil
} else {
match++
}
} else {
dst.AddressTokensTransactionUnconfirmedErc721 = nil
}
// try to unmarshal data into AddressTokensTransactionUnconfirmedOmni
err = newStrictDecoder(data).Decode(&dst.AddressTokensTransactionUnconfirmedOmni)
if err == nil {
jsonAddressTokensTransactionUnconfirmedOmni, _ := json.Marshal(dst.AddressTokensTransactionUnconfirmedOmni)
if string(jsonAddressTokensTransactionUnconfirmedOmni) == "{}" { // empty struct
dst.AddressTokensTransactionUnconfirmedOmni = nil
} else {
match++
}
} else {
dst.AddressTokensTransactionUnconfirmedOmni = nil
}
if match > 1 { // more than 1 match
// reset to nil
dst.AddressTokensTransactionUnconfirmedErc20 = nil
dst.AddressTokensTransactionUnconfirmedErc721 = nil
dst.AddressTokensTransactionUnconfirmedOmni = nil
return fmt.Errorf("Data matches more than one schema in oneOf(AddressTokensTransactionUnconfirmedToken)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
return fmt.Errorf("Data failed to match schemas in oneOf(AddressTokensTransactionUnconfirmedToken)")
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src AddressTokensTransactionUnconfirmedToken) MarshalJSON() ([]byte, error) {
if src.AddressTokensTransactionUnconfirmedErc20 != nil {
return json.Marshal(&src.AddressTokensTransactionUnconfirmedErc20)
}
if src.AddressTokensTransactionUnconfirmedErc721 != nil {
return json.Marshal(&src.AddressTokensTransactionUnconfirmedErc721)
}
if src.AddressTokensTransactionUnconfirmedOmni != nil {
return json.Marshal(&src.AddressTokensTransactionUnconfirmedOmni)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *AddressTokensTransactionUnconfirmedToken) GetActualInstance() (interface{}) {
if obj == nil {
return nil
}
if obj.AddressTokensTransactionUnconfirmedErc20 != nil {
return obj.AddressTokensTransactionUnconfirmedErc20
}
if obj.AddressTokensTransactionUnconfirmedErc721 != nil {
return obj.AddressTokensTransactionUnconfirmedErc721
}
if obj.AddressTokensTransactionUnconfirmedOmni != nil {
return obj.AddressTokensTransactionUnconfirmedOmni
}
// all schemas are nil
return nil
}
type NullableAddressTokensTransactionUnconfirmedToken struct {
value *AddressTokensTransactionUnconfirmedToken
isSet bool
}
func (v NullableAddressTokensTransactionUnconfirmedToken) Get() *AddressTokensTransactionUnconfirmedToken {
return v.value
}
func (v *NullableAddressTokensTransactionUnconfirmedToken) Set(val *AddressTokensTransactionUnconfirmedToken) {
v.value = val
v.isSet = true
}
func (v NullableAddressTokensTransactionUnconfirmedToken) IsSet() bool {
return v.isSet
}
func (v *NullableAddressTokensTransactionUnconfirmedToken) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAddressTokensTransactionUnconfirmedToken(val *AddressTokensTransactionUnconfirmedToken) *NullableAddressTokensTransactionUnconfirmedToken {
return &NullableAddressTokensTransactionUnconfirmedToken{value: val, isSet: true}
}
func (v NullableAddressTokensTransactionUnconfirmedToken) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAddressTokensTransactionUnconfirmedToken) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}