-
Notifications
You must be signed in to change notification settings - Fork 1
/
model_get_v2_channels_channel_id_clips_200_response.go
148 lines (119 loc) · 4.62 KB
/
model_get_v2_channels_channel_id_clips_200_response.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
/*
Holodex/HoloAPI V2
Holodex Public API. Successor to the HoloAPI v1
API version: 2.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package holodex
import (
"encoding/json"
"fmt"
)
// GetV2ChannelsChannelIdClips200Response - struct for GetV2ChannelsChannelIdClips200Response
type GetV2ChannelsChannelIdClips200Response struct {
GetV2ChannelsChannelIdClips200ResponseOneOf *GetV2ChannelsChannelIdClips200ResponseOneOf
ArrayOfVideoFull *[]VideoFull
}
// GetV2ChannelsChannelIdClips200ResponseOneOfAsGetV2ChannelsChannelIdClips200Response is a convenience function that returns GetV2ChannelsChannelIdClips200ResponseOneOf wrapped in GetV2ChannelsChannelIdClips200Response
func GetV2ChannelsChannelIdClips200ResponseOneOfAsGetV2ChannelsChannelIdClips200Response(v *GetV2ChannelsChannelIdClips200ResponseOneOf) GetV2ChannelsChannelIdClips200Response {
return GetV2ChannelsChannelIdClips200Response{
GetV2ChannelsChannelIdClips200ResponseOneOf: v,
}
}
// []VideoFullAsGetV2ChannelsChannelIdClips200Response is a convenience function that returns []VideoFull wrapped in GetV2ChannelsChannelIdClips200Response
func ArrayOfVideoFullAsGetV2ChannelsChannelIdClips200Response(v *[]VideoFull) GetV2ChannelsChannelIdClips200Response {
return GetV2ChannelsChannelIdClips200Response{
ArrayOfVideoFull: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *GetV2ChannelsChannelIdClips200Response) UnmarshalJSON(data []byte) error {
var err error
match := 0
// try to unmarshal data into GetV2ChannelsChannelIdClips200ResponseOneOf
err = newStrictDecoder(data).Decode(&dst.GetV2ChannelsChannelIdClips200ResponseOneOf)
if err == nil {
jsonGetV2ChannelsChannelIdClips200ResponseOneOf, _ := json.Marshal(dst.GetV2ChannelsChannelIdClips200ResponseOneOf)
if string(jsonGetV2ChannelsChannelIdClips200ResponseOneOf) == "{}" { // empty struct
dst.GetV2ChannelsChannelIdClips200ResponseOneOf = nil
} else {
match++
}
} else {
dst.GetV2ChannelsChannelIdClips200ResponseOneOf = nil
}
// try to unmarshal data into ArrayOfVideoFull
err = newStrictDecoder(data).Decode(&dst.ArrayOfVideoFull)
if err == nil {
jsonArrayOfVideoFull, _ := json.Marshal(dst.ArrayOfVideoFull)
if string(jsonArrayOfVideoFull) == "{}" { // empty struct
dst.ArrayOfVideoFull = nil
} else {
match++
}
} else {
dst.ArrayOfVideoFull = nil
}
if match > 1 { // more than 1 match
// reset to nil
dst.GetV2ChannelsChannelIdClips200ResponseOneOf = nil
dst.ArrayOfVideoFull = nil
return fmt.Errorf("Data matches more than one schema in oneOf(GetV2ChannelsChannelIdClips200Response)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
return fmt.Errorf("Data failed to match schemas in oneOf(GetV2ChannelsChannelIdClips200Response)")
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src GetV2ChannelsChannelIdClips200Response) MarshalJSON() ([]byte, error) {
if src.GetV2ChannelsChannelIdClips200ResponseOneOf != nil {
return json.Marshal(&src.GetV2ChannelsChannelIdClips200ResponseOneOf)
}
if src.ArrayOfVideoFull != nil {
return json.Marshal(&src.ArrayOfVideoFull)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *GetV2ChannelsChannelIdClips200Response) GetActualInstance() (interface{}) {
if obj == nil {
return nil
}
if obj.GetV2ChannelsChannelIdClips200ResponseOneOf != nil {
return obj.GetV2ChannelsChannelIdClips200ResponseOneOf
}
if obj.ArrayOfVideoFull != nil {
return obj.ArrayOfVideoFull
}
// all schemas are nil
return nil
}
type NullableGetV2ChannelsChannelIdClips200Response struct {
value *GetV2ChannelsChannelIdClips200Response
isSet bool
}
func (v NullableGetV2ChannelsChannelIdClips200Response) Get() *GetV2ChannelsChannelIdClips200Response {
return v.value
}
func (v *NullableGetV2ChannelsChannelIdClips200Response) Set(val *GetV2ChannelsChannelIdClips200Response) {
v.value = val
v.isSet = true
}
func (v NullableGetV2ChannelsChannelIdClips200Response) IsSet() bool {
return v.isSet
}
func (v *NullableGetV2ChannelsChannelIdClips200Response) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGetV2ChannelsChannelIdClips200Response(val *GetV2ChannelsChannelIdClips200Response) *NullableGetV2ChannelsChannelIdClips200Response {
return &NullableGetV2ChannelsChannelIdClips200Response{value: val, isSet: true}
}
func (v NullableGetV2ChannelsChannelIdClips200Response) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGetV2ChannelsChannelIdClips200Response) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}