github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/artifact/list_artifacts_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package artifact 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "fmt" 10 "io" 11 12 "github.com/go-openapi/errors" 13 "github.com/go-openapi/runtime" 14 "github.com/go-openapi/strfmt" 15 "github.com/go-openapi/swag" 16 17 "github.com/goharbor/go-client/pkg/sdk/v2.0/models" 18 ) 19 20 // ListArtifactsReader is a Reader for the ListArtifacts structure. 21 type ListArtifactsReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *ListArtifactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewListArtifactsOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 case 400: 35 result := NewListArtifactsBadRequest() 36 if err := result.readResponse(response, consumer, o.formats); err != nil { 37 return nil, err 38 } 39 return nil, result 40 case 401: 41 result := NewListArtifactsUnauthorized() 42 if err := result.readResponse(response, consumer, o.formats); err != nil { 43 return nil, err 44 } 45 return nil, result 46 case 403: 47 result := NewListArtifactsForbidden() 48 if err := result.readResponse(response, consumer, o.formats); err != nil { 49 return nil, err 50 } 51 return nil, result 52 case 404: 53 result := NewListArtifactsNotFound() 54 if err := result.readResponse(response, consumer, o.formats); err != nil { 55 return nil, err 56 } 57 return nil, result 58 case 500: 59 result := NewListArtifactsInternalServerError() 60 if err := result.readResponse(response, consumer, o.formats); err != nil { 61 return nil, err 62 } 63 return nil, result 64 default: 65 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 66 } 67 } 68 69 // NewListArtifactsOK creates a ListArtifactsOK with default headers values 70 func NewListArtifactsOK() *ListArtifactsOK { 71 return &ListArtifactsOK{} 72 } 73 74 /* 75 ListArtifactsOK describes a response with status code 200, with default header values. 76 77 Success 78 */ 79 type ListArtifactsOK struct { 80 81 /* Link refers to the previous page and next page 82 */ 83 Link string 84 85 /* The total count of artifacts 86 */ 87 XTotalCount int64 88 89 Payload []*models.Artifact 90 } 91 92 // IsSuccess returns true when this list artifacts o k response has a 2xx status code 93 func (o *ListArtifactsOK) IsSuccess() bool { 94 return true 95 } 96 97 // IsRedirect returns true when this list artifacts o k response has a 3xx status code 98 func (o *ListArtifactsOK) IsRedirect() bool { 99 return false 100 } 101 102 // IsClientError returns true when this list artifacts o k response has a 4xx status code 103 func (o *ListArtifactsOK) IsClientError() bool { 104 return false 105 } 106 107 // IsServerError returns true when this list artifacts o k response has a 5xx status code 108 func (o *ListArtifactsOK) IsServerError() bool { 109 return false 110 } 111 112 // IsCode returns true when this list artifacts o k response a status code equal to that given 113 func (o *ListArtifactsOK) IsCode(code int) bool { 114 return code == 200 115 } 116 117 func (o *ListArtifactsOK) Error() string { 118 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsOK %+v", 200, o.Payload) 119 } 120 121 func (o *ListArtifactsOK) String() string { 122 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsOK %+v", 200, o.Payload) 123 } 124 125 func (o *ListArtifactsOK) GetPayload() []*models.Artifact { 126 return o.Payload 127 } 128 129 func (o *ListArtifactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 130 131 // hydrates response header Link 132 hdrLink := response.GetHeader("Link") 133 134 if hdrLink != "" { 135 o.Link = hdrLink 136 } 137 138 // hydrates response header X-Total-Count 139 hdrXTotalCount := response.GetHeader("X-Total-Count") 140 141 if hdrXTotalCount != "" { 142 valxTotalCount, err := swag.ConvertInt64(hdrXTotalCount) 143 if err != nil { 144 return errors.InvalidType("X-Total-Count", "header", "int64", hdrXTotalCount) 145 } 146 o.XTotalCount = valxTotalCount 147 } 148 149 // response payload 150 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 151 return err 152 } 153 154 return nil 155 } 156 157 // NewListArtifactsBadRequest creates a ListArtifactsBadRequest with default headers values 158 func NewListArtifactsBadRequest() *ListArtifactsBadRequest { 159 return &ListArtifactsBadRequest{} 160 } 161 162 /* 163 ListArtifactsBadRequest describes a response with status code 400, with default header values. 164 165 Bad request 166 */ 167 type ListArtifactsBadRequest struct { 168 169 /* The ID of the corresponding request for the response 170 */ 171 XRequestID string 172 173 Payload *models.Errors 174 } 175 176 // IsSuccess returns true when this list artifacts bad request response has a 2xx status code 177 func (o *ListArtifactsBadRequest) IsSuccess() bool { 178 return false 179 } 180 181 // IsRedirect returns true when this list artifacts bad request response has a 3xx status code 182 func (o *ListArtifactsBadRequest) IsRedirect() bool { 183 return false 184 } 185 186 // IsClientError returns true when this list artifacts bad request response has a 4xx status code 187 func (o *ListArtifactsBadRequest) IsClientError() bool { 188 return true 189 } 190 191 // IsServerError returns true when this list artifacts bad request response has a 5xx status code 192 func (o *ListArtifactsBadRequest) IsServerError() bool { 193 return false 194 } 195 196 // IsCode returns true when this list artifacts bad request response a status code equal to that given 197 func (o *ListArtifactsBadRequest) IsCode(code int) bool { 198 return code == 400 199 } 200 201 func (o *ListArtifactsBadRequest) Error() string { 202 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsBadRequest %+v", 400, o.Payload) 203 } 204 205 func (o *ListArtifactsBadRequest) String() string { 206 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsBadRequest %+v", 400, o.Payload) 207 } 208 209 func (o *ListArtifactsBadRequest) GetPayload() *models.Errors { 210 return o.Payload 211 } 212 213 func (o *ListArtifactsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 214 215 // hydrates response header X-Request-Id 216 hdrXRequestID := response.GetHeader("X-Request-Id") 217 218 if hdrXRequestID != "" { 219 o.XRequestID = hdrXRequestID 220 } 221 222 o.Payload = new(models.Errors) 223 224 // response payload 225 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 226 return err 227 } 228 229 return nil 230 } 231 232 // NewListArtifactsUnauthorized creates a ListArtifactsUnauthorized with default headers values 233 func NewListArtifactsUnauthorized() *ListArtifactsUnauthorized { 234 return &ListArtifactsUnauthorized{} 235 } 236 237 /* 238 ListArtifactsUnauthorized describes a response with status code 401, with default header values. 239 240 Unauthorized 241 */ 242 type ListArtifactsUnauthorized struct { 243 244 /* The ID of the corresponding request for the response 245 */ 246 XRequestID string 247 248 Payload *models.Errors 249 } 250 251 // IsSuccess returns true when this list artifacts unauthorized response has a 2xx status code 252 func (o *ListArtifactsUnauthorized) IsSuccess() bool { 253 return false 254 } 255 256 // IsRedirect returns true when this list artifacts unauthorized response has a 3xx status code 257 func (o *ListArtifactsUnauthorized) IsRedirect() bool { 258 return false 259 } 260 261 // IsClientError returns true when this list artifacts unauthorized response has a 4xx status code 262 func (o *ListArtifactsUnauthorized) IsClientError() bool { 263 return true 264 } 265 266 // IsServerError returns true when this list artifacts unauthorized response has a 5xx status code 267 func (o *ListArtifactsUnauthorized) IsServerError() bool { 268 return false 269 } 270 271 // IsCode returns true when this list artifacts unauthorized response a status code equal to that given 272 func (o *ListArtifactsUnauthorized) IsCode(code int) bool { 273 return code == 401 274 } 275 276 func (o *ListArtifactsUnauthorized) Error() string { 277 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsUnauthorized %+v", 401, o.Payload) 278 } 279 280 func (o *ListArtifactsUnauthorized) String() string { 281 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsUnauthorized %+v", 401, o.Payload) 282 } 283 284 func (o *ListArtifactsUnauthorized) GetPayload() *models.Errors { 285 return o.Payload 286 } 287 288 func (o *ListArtifactsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 289 290 // hydrates response header X-Request-Id 291 hdrXRequestID := response.GetHeader("X-Request-Id") 292 293 if hdrXRequestID != "" { 294 o.XRequestID = hdrXRequestID 295 } 296 297 o.Payload = new(models.Errors) 298 299 // response payload 300 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 301 return err 302 } 303 304 return nil 305 } 306 307 // NewListArtifactsForbidden creates a ListArtifactsForbidden with default headers values 308 func NewListArtifactsForbidden() *ListArtifactsForbidden { 309 return &ListArtifactsForbidden{} 310 } 311 312 /* 313 ListArtifactsForbidden describes a response with status code 403, with default header values. 314 315 Forbidden 316 */ 317 type ListArtifactsForbidden struct { 318 319 /* The ID of the corresponding request for the response 320 */ 321 XRequestID string 322 323 Payload *models.Errors 324 } 325 326 // IsSuccess returns true when this list artifacts forbidden response has a 2xx status code 327 func (o *ListArtifactsForbidden) IsSuccess() bool { 328 return false 329 } 330 331 // IsRedirect returns true when this list artifacts forbidden response has a 3xx status code 332 func (o *ListArtifactsForbidden) IsRedirect() bool { 333 return false 334 } 335 336 // IsClientError returns true when this list artifacts forbidden response has a 4xx status code 337 func (o *ListArtifactsForbidden) IsClientError() bool { 338 return true 339 } 340 341 // IsServerError returns true when this list artifacts forbidden response has a 5xx status code 342 func (o *ListArtifactsForbidden) IsServerError() bool { 343 return false 344 } 345 346 // IsCode returns true when this list artifacts forbidden response a status code equal to that given 347 func (o *ListArtifactsForbidden) IsCode(code int) bool { 348 return code == 403 349 } 350 351 func (o *ListArtifactsForbidden) Error() string { 352 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsForbidden %+v", 403, o.Payload) 353 } 354 355 func (o *ListArtifactsForbidden) String() string { 356 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsForbidden %+v", 403, o.Payload) 357 } 358 359 func (o *ListArtifactsForbidden) GetPayload() *models.Errors { 360 return o.Payload 361 } 362 363 func (o *ListArtifactsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 364 365 // hydrates response header X-Request-Id 366 hdrXRequestID := response.GetHeader("X-Request-Id") 367 368 if hdrXRequestID != "" { 369 o.XRequestID = hdrXRequestID 370 } 371 372 o.Payload = new(models.Errors) 373 374 // response payload 375 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 376 return err 377 } 378 379 return nil 380 } 381 382 // NewListArtifactsNotFound creates a ListArtifactsNotFound with default headers values 383 func NewListArtifactsNotFound() *ListArtifactsNotFound { 384 return &ListArtifactsNotFound{} 385 } 386 387 /* 388 ListArtifactsNotFound describes a response with status code 404, with default header values. 389 390 Not found 391 */ 392 type ListArtifactsNotFound struct { 393 394 /* The ID of the corresponding request for the response 395 */ 396 XRequestID string 397 398 Payload *models.Errors 399 } 400 401 // IsSuccess returns true when this list artifacts not found response has a 2xx status code 402 func (o *ListArtifactsNotFound) IsSuccess() bool { 403 return false 404 } 405 406 // IsRedirect returns true when this list artifacts not found response has a 3xx status code 407 func (o *ListArtifactsNotFound) IsRedirect() bool { 408 return false 409 } 410 411 // IsClientError returns true when this list artifacts not found response has a 4xx status code 412 func (o *ListArtifactsNotFound) IsClientError() bool { 413 return true 414 } 415 416 // IsServerError returns true when this list artifacts not found response has a 5xx status code 417 func (o *ListArtifactsNotFound) IsServerError() bool { 418 return false 419 } 420 421 // IsCode returns true when this list artifacts not found response a status code equal to that given 422 func (o *ListArtifactsNotFound) IsCode(code int) bool { 423 return code == 404 424 } 425 426 func (o *ListArtifactsNotFound) Error() string { 427 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsNotFound %+v", 404, o.Payload) 428 } 429 430 func (o *ListArtifactsNotFound) String() string { 431 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsNotFound %+v", 404, o.Payload) 432 } 433 434 func (o *ListArtifactsNotFound) GetPayload() *models.Errors { 435 return o.Payload 436 } 437 438 func (o *ListArtifactsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 439 440 // hydrates response header X-Request-Id 441 hdrXRequestID := response.GetHeader("X-Request-Id") 442 443 if hdrXRequestID != "" { 444 o.XRequestID = hdrXRequestID 445 } 446 447 o.Payload = new(models.Errors) 448 449 // response payload 450 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 451 return err 452 } 453 454 return nil 455 } 456 457 // NewListArtifactsInternalServerError creates a ListArtifactsInternalServerError with default headers values 458 func NewListArtifactsInternalServerError() *ListArtifactsInternalServerError { 459 return &ListArtifactsInternalServerError{} 460 } 461 462 /* 463 ListArtifactsInternalServerError describes a response with status code 500, with default header values. 464 465 Internal server error 466 */ 467 type ListArtifactsInternalServerError struct { 468 469 /* The ID of the corresponding request for the response 470 */ 471 XRequestID string 472 473 Payload *models.Errors 474 } 475 476 // IsSuccess returns true when this list artifacts internal server error response has a 2xx status code 477 func (o *ListArtifactsInternalServerError) IsSuccess() bool { 478 return false 479 } 480 481 // IsRedirect returns true when this list artifacts internal server error response has a 3xx status code 482 func (o *ListArtifactsInternalServerError) IsRedirect() bool { 483 return false 484 } 485 486 // IsClientError returns true when this list artifacts internal server error response has a 4xx status code 487 func (o *ListArtifactsInternalServerError) IsClientError() bool { 488 return false 489 } 490 491 // IsServerError returns true when this list artifacts internal server error response has a 5xx status code 492 func (o *ListArtifactsInternalServerError) IsServerError() bool { 493 return true 494 } 495 496 // IsCode returns true when this list artifacts internal server error response a status code equal to that given 497 func (o *ListArtifactsInternalServerError) IsCode(code int) bool { 498 return code == 500 499 } 500 501 func (o *ListArtifactsInternalServerError) Error() string { 502 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsInternalServerError %+v", 500, o.Payload) 503 } 504 505 func (o *ListArtifactsInternalServerError) String() string { 506 return fmt.Sprintf("[GET /projects/{project_name}/repositories/{repository_name}/artifacts][%d] listArtifactsInternalServerError %+v", 500, o.Payload) 507 } 508 509 func (o *ListArtifactsInternalServerError) GetPayload() *models.Errors { 510 return o.Payload 511 } 512 513 func (o *ListArtifactsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 514 515 // hydrates response header X-Request-Id 516 hdrXRequestID := response.GetHeader("X-Request-Id") 517 518 if hdrXRequestID != "" { 519 o.XRequestID = hdrXRequestID 520 } 521 522 o.Payload = new(models.Errors) 523 524 // response payload 525 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 526 return err 527 } 528 529 return nil 530 }