/
oas_schemas_gen.go
282 lines (232 loc) · 5.77 KB
/
oas_schemas_gen.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
// Code generated by ogen, DO NOT EDIT.
package api
import (
"github.com/go-faster/errors"
)
// ComplicatedParameterNameGetOK is response for ComplicatedParameterNameGet operation.
type ComplicatedParameterNameGetOK struct{}
type ContentParameters struct {
Query User `json:"query"`
Path User `json:"path"`
Header User `json:"header"`
Cookie User `json:"cookie"`
}
// GetQuery returns the value of Query.
func (s *ContentParameters) GetQuery() User {
return s.Query
}
// GetPath returns the value of Path.
func (s *ContentParameters) GetPath() User {
return s.Path
}
// GetHeader returns the value of Header.
func (s *ContentParameters) GetHeader() User {
return s.Header
}
// GetCookie returns the value of Cookie.
func (s *ContentParameters) GetCookie() User {
return s.Cookie
}
// SetQuery sets the value of Query.
func (s *ContentParameters) SetQuery(val User) {
s.Query = val
}
// SetPath sets the value of Path.
func (s *ContentParameters) SetPath(val User) {
s.Path = val
}
// SetHeader sets the value of Header.
func (s *ContentParameters) SetHeader(val User) {
s.Header = val
}
// SetCookie sets the value of Cookie.
func (s *ContentParameters) SetCookie(val User) {
s.Cookie = val
}
type ObjectQueryParameterOK struct {
Style string `json:"style"`
Value OneLevelObject `json:"value"`
}
// GetStyle returns the value of Style.
func (s *ObjectQueryParameterOK) GetStyle() string {
return s.Style
}
// GetValue returns the value of Value.
func (s *ObjectQueryParameterOK) GetValue() OneLevelObject {
return s.Value
}
// SetStyle sets the value of Style.
func (s *ObjectQueryParameterOK) SetStyle(val string) {
s.Style = val
}
// SetValue sets the value of Value.
func (s *ObjectQueryParameterOK) SetValue(val OneLevelObject) {
s.Value = val
}
// Ref: #/components/schemas/OneLevelObject
type OneLevelObject struct {
Min int `json:"min"`
Max int `json:"max"`
Filter string `json:"filter"`
}
// GetMin returns the value of Min.
func (s *OneLevelObject) GetMin() int {
return s.Min
}
// GetMax returns the value of Max.
func (s *OneLevelObject) GetMax() int {
return s.Max
}
// GetFilter returns the value of Filter.
func (s *OneLevelObject) GetFilter() string {
return s.Filter
}
// SetMin sets the value of Min.
func (s *OneLevelObject) SetMin(val int) {
s.Min = val
}
// SetMax sets the value of Max.
func (s *OneLevelObject) SetMax(val int) {
s.Max = val
}
// SetFilter sets the value of Filter.
func (s *OneLevelObject) SetFilter(val string) {
s.Filter = val
}
// NewOptOneLevelObject returns new OptOneLevelObject with value set to v.
func NewOptOneLevelObject(v OneLevelObject) OptOneLevelObject {
return OptOneLevelObject{
Value: v,
Set: true,
}
}
// OptOneLevelObject is optional OneLevelObject.
type OptOneLevelObject struct {
Value OneLevelObject
Set bool
}
// IsSet returns true if OptOneLevelObject was set.
func (o OptOneLevelObject) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptOneLevelObject) Reset() {
var v OneLevelObject
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptOneLevelObject) SetTo(v OneLevelObject) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptOneLevelObject) Get() (v OneLevelObject, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptOneLevelObject) Or(d OneLevelObject) OneLevelObject {
if v, ok := o.Get(); ok {
return v
}
return d
}
// SameNameOK is response for SameName operation.
type SameNameOK struct{}
// SimilarNamesOK is response for SimilarNames operation.
type SimilarNamesOK struct{}
// Ref: #/components/schemas/User
type User struct {
ID int `json:"id"`
Username string `json:"username"`
Role UserRole `json:"role"`
Friends []User `json:"friends"`
}
// GetID returns the value of ID.
func (s *User) GetID() int {
return s.ID
}
// GetUsername returns the value of Username.
func (s *User) GetUsername() string {
return s.Username
}
// GetRole returns the value of Role.
func (s *User) GetRole() UserRole {
return s.Role
}
// GetFriends returns the value of Friends.
func (s *User) GetFriends() []User {
return s.Friends
}
// SetID sets the value of ID.
func (s *User) SetID(val int) {
s.ID = val
}
// SetUsername sets the value of Username.
func (s *User) SetUsername(val string) {
s.Username = val
}
// SetRole sets the value of Role.
func (s *User) SetRole(val UserRole) {
s.Role = val
}
// SetFriends sets the value of Friends.
func (s *User) SetFriends(val []User) {
s.Friends = val
}
type UserRole string
const (
UserRoleAdmin UserRole = "admin"
UserRoleUser UserRole = "user"
UserRoleBot UserRole = "bot"
)
// AllValues returns all UserRole values.
func (UserRole) AllValues() []UserRole {
return []UserRole{
UserRoleAdmin,
UserRoleUser,
UserRoleBot,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s UserRole) MarshalText() ([]byte, error) {
switch s {
case UserRoleAdmin:
return []byte(s), nil
case UserRoleUser:
return []byte(s), nil
case UserRoleBot:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *UserRole) UnmarshalText(data []byte) error {
switch UserRole(data) {
case UserRoleAdmin:
*s = UserRoleAdmin
return nil
case UserRoleUser:
*s = UserRoleUser
return nil
case UserRoleBot:
*s = UserRoleBot
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Ref: #/components/schemas/Value
type Value struct {
Value string `json:"value"`
}
// GetValue returns the value of Value.
func (s *Value) GetValue() string {
return s.Value
}
// SetValue sets the value of Value.
func (s *Value) SetValue(val string) {
s.Value = val
}