/
model_patched_view_field_options.go
159 lines (131 loc) · 4.71 KB
/
model_patched_view_field_options.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
/*
Baserow API spec
For more information about our REST API, please visit [this page](https://baserow.io/docs/apis%2Frest-api). For more information about our deprecation policy, please visit [this page](https://baserow.io/docs/apis%2Fdeprecations).
API version: 1.18.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package client
import (
"encoding/json"
"fmt"
)
// PatchedViewFieldOptions struct for PatchedViewFieldOptions
type PatchedViewFieldOptions struct {
CalendarViewFieldOptions *CalendarViewFieldOptions
FormViewFieldOptions *FormViewFieldOptions
GalleryViewFieldOptions *GalleryViewFieldOptions
GridViewFieldOptions *GridViewFieldOptions
KanbanViewFieldOptions *KanbanViewFieldOptions
}
// Unmarshal JSON data into any of the pointers in the struct
func (dst *PatchedViewFieldOptions) UnmarshalJSON(data []byte) error {
var err error
// try to unmarshal JSON data into CalendarViewFieldOptions
err = json.Unmarshal(data, &dst.CalendarViewFieldOptions);
if err == nil {
jsonCalendarViewFieldOptions, _ := json.Marshal(dst.CalendarViewFieldOptions)
if string(jsonCalendarViewFieldOptions) == "{}" { // empty struct
dst.CalendarViewFieldOptions = nil
} else {
return nil // data stored in dst.CalendarViewFieldOptions, return on the first match
}
} else {
dst.CalendarViewFieldOptions = nil
}
// try to unmarshal JSON data into FormViewFieldOptions
err = json.Unmarshal(data, &dst.FormViewFieldOptions);
if err == nil {
jsonFormViewFieldOptions, _ := json.Marshal(dst.FormViewFieldOptions)
if string(jsonFormViewFieldOptions) == "{}" { // empty struct
dst.FormViewFieldOptions = nil
} else {
return nil // data stored in dst.FormViewFieldOptions, return on the first match
}
} else {
dst.FormViewFieldOptions = nil
}
// try to unmarshal JSON data into GalleryViewFieldOptions
err = json.Unmarshal(data, &dst.GalleryViewFieldOptions);
if err == nil {
jsonGalleryViewFieldOptions, _ := json.Marshal(dst.GalleryViewFieldOptions)
if string(jsonGalleryViewFieldOptions) == "{}" { // empty struct
dst.GalleryViewFieldOptions = nil
} else {
return nil // data stored in dst.GalleryViewFieldOptions, return on the first match
}
} else {
dst.GalleryViewFieldOptions = nil
}
// try to unmarshal JSON data into GridViewFieldOptions
err = json.Unmarshal(data, &dst.GridViewFieldOptions);
if err == nil {
jsonGridViewFieldOptions, _ := json.Marshal(dst.GridViewFieldOptions)
if string(jsonGridViewFieldOptions) == "{}" { // empty struct
dst.GridViewFieldOptions = nil
} else {
return nil // data stored in dst.GridViewFieldOptions, return on the first match
}
} else {
dst.GridViewFieldOptions = nil
}
// try to unmarshal JSON data into KanbanViewFieldOptions
err = json.Unmarshal(data, &dst.KanbanViewFieldOptions);
if err == nil {
jsonKanbanViewFieldOptions, _ := json.Marshal(dst.KanbanViewFieldOptions)
if string(jsonKanbanViewFieldOptions) == "{}" { // empty struct
dst.KanbanViewFieldOptions = nil
} else {
return nil // data stored in dst.KanbanViewFieldOptions, return on the first match
}
} else {
dst.KanbanViewFieldOptions = nil
}
return fmt.Errorf("data failed to match schemas in anyOf(PatchedViewFieldOptions)")
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src *PatchedViewFieldOptions) MarshalJSON() ([]byte, error) {
if src.CalendarViewFieldOptions != nil {
return json.Marshal(&src.CalendarViewFieldOptions)
}
if src.FormViewFieldOptions != nil {
return json.Marshal(&src.FormViewFieldOptions)
}
if src.GalleryViewFieldOptions != nil {
return json.Marshal(&src.GalleryViewFieldOptions)
}
if src.GridViewFieldOptions != nil {
return json.Marshal(&src.GridViewFieldOptions)
}
if src.KanbanViewFieldOptions != nil {
return json.Marshal(&src.KanbanViewFieldOptions)
}
return nil, nil // no data in anyOf schemas
}
type NullablePatchedViewFieldOptions struct {
value *PatchedViewFieldOptions
isSet bool
}
func (v NullablePatchedViewFieldOptions) Get() *PatchedViewFieldOptions {
return v.value
}
func (v *NullablePatchedViewFieldOptions) Set(val *PatchedViewFieldOptions) {
v.value = val
v.isSet = true
}
func (v NullablePatchedViewFieldOptions) IsSet() bool {
return v.isSet
}
func (v *NullablePatchedViewFieldOptions) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePatchedViewFieldOptions(val *PatchedViewFieldOptions) *NullablePatchedViewFieldOptions {
return &NullablePatchedViewFieldOptions{value: val, isSet: true}
}
func (v NullablePatchedViewFieldOptions) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePatchedViewFieldOptions) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}