1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package timestamp
19
20
21
22
23 import (
24 "fmt"
25 "io"
26
27 "github.com/go-openapi/runtime"
28 "github.com/go-openapi/strfmt"
29
30 "github.com/sigstore/timestamp-authority/pkg/generated/models"
31 )
32
33
34 type GetTimestampResponseReader struct {
35 formats strfmt.Registry
36 writer io.Writer
37 }
38
39
40 func (o *GetTimestampResponseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
41 switch response.Code() {
42 case 201:
43 result := NewGetTimestampResponseCreated(o.writer)
44 if err := result.readResponse(response, consumer, o.formats); err != nil {
45 return nil, err
46 }
47 return result, nil
48 case 400:
49 result := NewGetTimestampResponseBadRequest()
50 if err := result.readResponse(response, consumer, o.formats); err != nil {
51 return nil, err
52 }
53 return nil, result
54 case 501:
55 result := NewGetTimestampResponseNotImplemented()
56 if err := result.readResponse(response, consumer, o.formats); err != nil {
57 return nil, err
58 }
59 return nil, result
60 default:
61 result := NewGetTimestampResponseDefault(response.Code())
62 if err := result.readResponse(response, consumer, o.formats); err != nil {
63 return nil, err
64 }
65 if response.Code()/100 == 2 {
66 return result, nil
67 }
68 return nil, result
69 }
70 }
71
72
73 func NewGetTimestampResponseCreated(writer io.Writer) *GetTimestampResponseCreated {
74 return &GetTimestampResponseCreated{
75
76 Payload: writer,
77 }
78 }
79
80
85 type GetTimestampResponseCreated struct {
86 Payload io.Writer
87 }
88
89
90 func (o *GetTimestampResponseCreated) IsSuccess() bool {
91 return true
92 }
93
94
95 func (o *GetTimestampResponseCreated) IsRedirect() bool {
96 return false
97 }
98
99
100 func (o *GetTimestampResponseCreated) IsClientError() bool {
101 return false
102 }
103
104
105 func (o *GetTimestampResponseCreated) IsServerError() bool {
106 return false
107 }
108
109
110 func (o *GetTimestampResponseCreated) IsCode(code int) bool {
111 return code == 201
112 }
113
114
115 func (o *GetTimestampResponseCreated) Code() int {
116 return 201
117 }
118
119 func (o *GetTimestampResponseCreated) Error() string {
120 return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseCreated %+v", 201, o.Payload)
121 }
122
123 func (o *GetTimestampResponseCreated) String() string {
124 return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseCreated %+v", 201, o.Payload)
125 }
126
127 func (o *GetTimestampResponseCreated) GetPayload() io.Writer {
128 return o.Payload
129 }
130
131 func (o *GetTimestampResponseCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
132
133
134 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
135 return err
136 }
137
138 return nil
139 }
140
141
142 func NewGetTimestampResponseBadRequest() *GetTimestampResponseBadRequest {
143 return &GetTimestampResponseBadRequest{}
144 }
145
146
151 type GetTimestampResponseBadRequest struct {
152 Payload *models.Error
153 }
154
155
156 func (o *GetTimestampResponseBadRequest) IsSuccess() bool {
157 return false
158 }
159
160
161 func (o *GetTimestampResponseBadRequest) IsRedirect() bool {
162 return false
163 }
164
165
166 func (o *GetTimestampResponseBadRequest) IsClientError() bool {
167 return true
168 }
169
170
171 func (o *GetTimestampResponseBadRequest) IsServerError() bool {
172 return false
173 }
174
175
176 func (o *GetTimestampResponseBadRequest) IsCode(code int) bool {
177 return code == 400
178 }
179
180
181 func (o *GetTimestampResponseBadRequest) Code() int {
182 return 400
183 }
184
185 func (o *GetTimestampResponseBadRequest) Error() string {
186 return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseBadRequest %+v", 400, o.Payload)
187 }
188
189 func (o *GetTimestampResponseBadRequest) String() string {
190 return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseBadRequest %+v", 400, o.Payload)
191 }
192
193 func (o *GetTimestampResponseBadRequest) GetPayload() *models.Error {
194 return o.Payload
195 }
196
197 func (o *GetTimestampResponseBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
198
199 o.Payload = new(models.Error)
200
201
202 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
203 return err
204 }
205
206 return nil
207 }
208
209
210 func NewGetTimestampResponseNotImplemented() *GetTimestampResponseNotImplemented {
211 return &GetTimestampResponseNotImplemented{}
212 }
213
214
219 type GetTimestampResponseNotImplemented struct {
220 }
221
222
223 func (o *GetTimestampResponseNotImplemented) IsSuccess() bool {
224 return false
225 }
226
227
228 func (o *GetTimestampResponseNotImplemented) IsRedirect() bool {
229 return false
230 }
231
232
233 func (o *GetTimestampResponseNotImplemented) IsClientError() bool {
234 return false
235 }
236
237
238 func (o *GetTimestampResponseNotImplemented) IsServerError() bool {
239 return true
240 }
241
242
243 func (o *GetTimestampResponseNotImplemented) IsCode(code int) bool {
244 return code == 501
245 }
246
247
248 func (o *GetTimestampResponseNotImplemented) Code() int {
249 return 501
250 }
251
252 func (o *GetTimestampResponseNotImplemented) Error() string {
253 return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseNotImplemented ", 501)
254 }
255
256 func (o *GetTimestampResponseNotImplemented) String() string {
257 return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponseNotImplemented ", 501)
258 }
259
260 func (o *GetTimestampResponseNotImplemented) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
261
262 return nil
263 }
264
265
266 func NewGetTimestampResponseDefault(code int) *GetTimestampResponseDefault {
267 return &GetTimestampResponseDefault{
268 _statusCode: code,
269 }
270 }
271
272
277 type GetTimestampResponseDefault struct {
278 _statusCode int
279
280 Payload *models.Error
281 }
282
283
284 func (o *GetTimestampResponseDefault) IsSuccess() bool {
285 return o._statusCode/100 == 2
286 }
287
288
289 func (o *GetTimestampResponseDefault) IsRedirect() bool {
290 return o._statusCode/100 == 3
291 }
292
293
294 func (o *GetTimestampResponseDefault) IsClientError() bool {
295 return o._statusCode/100 == 4
296 }
297
298
299 func (o *GetTimestampResponseDefault) IsServerError() bool {
300 return o._statusCode/100 == 5
301 }
302
303
304 func (o *GetTimestampResponseDefault) IsCode(code int) bool {
305 return o._statusCode == code
306 }
307
308
309 func (o *GetTimestampResponseDefault) Code() int {
310 return o._statusCode
311 }
312
313 func (o *GetTimestampResponseDefault) Error() string {
314 return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponse default %+v", o._statusCode, o.Payload)
315 }
316
317 func (o *GetTimestampResponseDefault) String() string {
318 return fmt.Sprintf("[POST /api/v1/timestamp][%d] getTimestampResponse default %+v", o._statusCode, o.Payload)
319 }
320
321 func (o *GetTimestampResponseDefault) GetPayload() *models.Error {
322 return o.Payload
323 }
324
325 func (o *GetTimestampResponseDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
326
327 o.Payload = new(models.Error)
328
329
330 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
331 return err
332 }
333
334 return nil
335 }
336
View as plain text