-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel_add_key_request.go
124 lines (102 loc) · 3.14 KB
/
model_add_key_request.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
/*
* Mist API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 2.0.0
* Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package mist_sdk
import (
"encoding/json"
"fmt"
)
// AddKeyRequest struct for AddKeyRequest
type AddKeyRequest struct {
AddKeyRequestAnyOf *AddKeyRequestAnyOf
AddKeyRequestAnyOf1 *AddKeyRequestAnyOf1
AddKeyRequestAnyOf2 *AddKeyRequestAnyOf2
}
// Unmarshal JSON data into any of the pointers in the struct
func (dst *AddKeyRequest) UnmarshalJSON(data []byte) error {
var err error
// try to unmarshal JSON data into AddKeyRequestAnyOf
err = json.Unmarshal(data, &dst.AddKeyRequestAnyOf);
if err == nil {
jsonAddKeyRequestAnyOf, _ := json.Marshal(dst.AddKeyRequestAnyOf)
if string(jsonAddKeyRequestAnyOf) == "{}" { // empty struct
dst.AddKeyRequestAnyOf = nil
} else {
return nil // data stored in dst.AddKeyRequestAnyOf, return on the first match
}
} else {
dst.AddKeyRequestAnyOf = nil
}
// try to unmarshal JSON data into AddKeyRequestAnyOf1
err = json.Unmarshal(data, &dst.AddKeyRequestAnyOf1);
if err == nil {
jsonAddKeyRequestAnyOf1, _ := json.Marshal(dst.AddKeyRequestAnyOf1)
if string(jsonAddKeyRequestAnyOf1) == "{}" { // empty struct
dst.AddKeyRequestAnyOf1 = nil
} else {
return nil // data stored in dst.AddKeyRequestAnyOf1, return on the first match
}
} else {
dst.AddKeyRequestAnyOf1 = nil
}
// try to unmarshal JSON data into AddKeyRequestAnyOf2
err = json.Unmarshal(data, &dst.AddKeyRequestAnyOf2);
if err == nil {
jsonAddKeyRequestAnyOf2, _ := json.Marshal(dst.AddKeyRequestAnyOf2)
if string(jsonAddKeyRequestAnyOf2) == "{}" { // empty struct
dst.AddKeyRequestAnyOf2 = nil
} else {
return nil // data stored in dst.AddKeyRequestAnyOf2, return on the first match
}
} else {
dst.AddKeyRequestAnyOf2 = nil
}
return fmt.Errorf("Data failed to match schemas in anyOf(AddKeyRequest)")
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src *AddKeyRequest) MarshalJSON() ([]byte, error) {
if src.AddKeyRequestAnyOf != nil {
return json.Marshal(&src.AddKeyRequestAnyOf)
}
if src.AddKeyRequestAnyOf1 != nil {
return json.Marshal(&src.AddKeyRequestAnyOf1)
}
if src.AddKeyRequestAnyOf2 != nil {
return json.Marshal(&src.AddKeyRequestAnyOf2)
}
return nil, nil // no data in anyOf schemas
}
type NullableAddKeyRequest struct {
value *AddKeyRequest
isSet bool
}
func (v NullableAddKeyRequest) Get() *AddKeyRequest {
return v.value
}
func (v *NullableAddKeyRequest) Set(val *AddKeyRequest) {
v.value = val
v.isSet = true
}
func (v NullableAddKeyRequest) IsSet() bool {
return v.isSet
}
func (v *NullableAddKeyRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAddKeyRequest(val *AddKeyRequest) *NullableAddKeyRequest {
return &NullableAddKeyRequest{value: val, isSet: true}
}
func (v NullableAddKeyRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAddKeyRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}