/
oas_schemas_gen.go
301 lines (248 loc) · 6.02 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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Code generated by ogen, DO NOT EDIT.
package oas
import (
"fmt"
"io"
"net/url"
)
func (s *ErrorStatusCode) Error() string {
return fmt.Sprintf("code %d: %+v", s.StatusCode, s.Response)
}
// Error description.
// Ref: #/components/schemas/Error
type Error struct {
Message string `json:"message"`
}
// GetMessage returns the value of Message.
func (s *Error) GetMessage() string {
return s.Message
}
// SetMessage sets the value of Message.
func (s *Error) SetMessage(val string) {
s.Message = val
}
// ErrorStatusCode wraps Error with StatusCode.
type ErrorStatusCode struct {
StatusCode int
Response Error
}
// GetStatusCode returns the value of StatusCode.
func (s *ErrorStatusCode) GetStatusCode() int {
return s.StatusCode
}
// GetResponse returns the value of Response.
func (s *ErrorStatusCode) GetResponse() Error {
return s.Response
}
// SetStatusCode sets the value of StatusCode.
func (s *ErrorStatusCode) SetStatusCode(val int) {
s.StatusCode = val
}
// SetResponse sets the value of Response.
func (s *ErrorStatusCode) SetResponse(val Error) {
s.Response = val
}
// NewOptString returns new OptString with value set to v.
func NewOptString(v string) OptString {
return OptString{
Value: v,
Set: true,
}
}
// OptString is optional string.
type OptString struct {
Value string
Set bool
}
// IsSet returns true if OptString was set.
func (o OptString) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptString) Reset() {
var v string
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptString) SetTo(v string) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptString) Get() (v string, 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 OptString) Or(d string) string {
if v, ok := o.Get(); ok {
return v
}
return d
}
type SVG struct {
Data io.Reader
}
// Read reads data from the Data reader.
//
// Kept to satisfy the io.Reader interface.
func (s SVG) Read(p []byte) (n int, err error) {
if s.Data == nil {
return 0, io.EOF
}
return s.Data.Read(p)
}
// SVGHeaders wraps SVG with response headers.
type SVGHeaders struct {
CacheControl OptString
ETag OptString
Response SVG
}
// GetCacheControl returns the value of CacheControl.
func (s *SVGHeaders) GetCacheControl() OptString {
return s.CacheControl
}
// GetETag returns the value of ETag.
func (s *SVGHeaders) GetETag() OptString {
return s.ETag
}
// GetResponse returns the value of Response.
func (s *SVGHeaders) GetResponse() SVG {
return s.Response
}
// SetCacheControl sets the value of CacheControl.
func (s *SVGHeaders) SetCacheControl(val OptString) {
s.CacheControl = val
}
// SetETag sets the value of ETag.
func (s *SVGHeaders) SetETag(val OptString) {
s.ETag = val
}
// SetResponse sets the value of Response.
func (s *SVGHeaders) SetResponse(val SVG) {
s.Response = val
}
// Statistics.
// Ref: #/components/schemas/Statistics
type Statistics struct {
// Total commits.
TotalCommits int `json:"total_commits"`
// Top users.
TopUsers []UserStat `json:"top_users"`
}
// GetTotalCommits returns the value of TotalCommits.
func (s *Statistics) GetTotalCommits() int {
return s.TotalCommits
}
// GetTopUsers returns the value of TopUsers.
func (s *Statistics) GetTopUsers() []UserStat {
return s.TopUsers
}
// SetTotalCommits sets the value of TotalCommits.
func (s *Statistics) SetTotalCommits(val int) {
s.TotalCommits = val
}
// SetTopUsers sets the value of TopUsers.
func (s *Statistics) SetTopUsers(val []UserStat) {
s.TopUsers = val
}
// Status.
// Ref: #/components/schemas/Status
type Status struct {
// Message.
Message string `json:"message"`
Stat Statistics `json:"stat"`
}
// GetMessage returns the value of Message.
func (s *Status) GetMessage() string {
return s.Message
}
// GetStat returns the value of Stat.
func (s *Status) GetStat() Statistics {
return s.Stat
}
// SetMessage sets the value of Message.
func (s *Status) SetMessage(val string) {
s.Message = val
}
// SetStat sets the value of Stat.
func (s *Status) SetStat(val Statistics) {
s.Stat = val
}
// Ref: #/components/schemas/User
type User struct {
// User ID.
ID int64 `json:"id"`
// User name.
Nickname string `json:"nickname"`
// User full name.
FullName string `json:"full_name"`
// User avatar URL.
AvatarURL url.URL `json:"avatar_url"`
// User profile URL.
HTMLURL url.URL `json:"html_url"`
}
// GetID returns the value of ID.
func (s *User) GetID() int64 {
return s.ID
}
// GetNickname returns the value of Nickname.
func (s *User) GetNickname() string {
return s.Nickname
}
// GetFullName returns the value of FullName.
func (s *User) GetFullName() string {
return s.FullName
}
// GetAvatarURL returns the value of AvatarURL.
func (s *User) GetAvatarURL() url.URL {
return s.AvatarURL
}
// GetHTMLURL returns the value of HTMLURL.
func (s *User) GetHTMLURL() url.URL {
return s.HTMLURL
}
// SetID sets the value of ID.
func (s *User) SetID(val int64) {
s.ID = val
}
// SetNickname sets the value of Nickname.
func (s *User) SetNickname(val string) {
s.Nickname = val
}
// SetFullName sets the value of FullName.
func (s *User) SetFullName(val string) {
s.FullName = val
}
// SetAvatarURL sets the value of AvatarURL.
func (s *User) SetAvatarURL(val url.URL) {
s.AvatarURL = val
}
// SetHTMLURL sets the value of HTMLURL.
func (s *User) SetHTMLURL(val url.URL) {
s.HTMLURL = val
}
// User statistics.
// Ref: #/components/schemas/UserStat
type UserStat struct {
User User `json:"user"`
// Total commits.
TotalCommits int `json:"total_commits"`
}
// GetUser returns the value of User.
func (s *UserStat) GetUser() User {
return s.User
}
// GetTotalCommits returns the value of TotalCommits.
func (s *UserStat) GetTotalCommits() int {
return s.TotalCommits
}
// SetUser sets the value of User.
func (s *UserStat) SetUser(val User) {
s.User = val
}
// SetTotalCommits sets the value of TotalCommits.
func (s *UserStat) SetTotalCommits(val int) {
s.TotalCommits = val
}