github.com/circl-dev/go-swagger@v0.31.0/examples/contributed-templates/stratoscale/client/store/order_get_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package store 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/strfmt" 13 "github.com/circl-dev/runtime" 14 15 "github.com/circl-dev/go-swagger/examples/contributed-templates/stratoscale/models" 16 ) 17 18 // OrderGetReader is a Reader for the OrderGet structure. 19 type OrderGetReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *OrderGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 200: 27 result := NewOrderGetOK() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 case 400: 33 result := NewOrderGetBadRequest() 34 if err := result.readResponse(response, consumer, o.formats); err != nil { 35 return nil, err 36 } 37 return nil, result 38 case 404: 39 result := NewOrderGetNotFound() 40 if err := result.readResponse(response, consumer, o.formats); err != nil { 41 return nil, err 42 } 43 return nil, result 44 default: 45 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 46 } 47 } 48 49 // NewOrderGetOK creates a OrderGetOK with default headers values 50 func NewOrderGetOK() *OrderGetOK { 51 return &OrderGetOK{} 52 } 53 54 /* OrderGetOK describes a response with status code 200, with default header values. 55 56 successful operation 57 */ 58 type OrderGetOK struct { 59 Payload *models.Order 60 } 61 62 func (o *OrderGetOK) Error() string { 63 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetOK %+v", 200, o.Payload) 64 } 65 func (o *OrderGetOK) GetPayload() *models.Order { 66 return o.Payload 67 } 68 69 func (o *OrderGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 70 71 o.Payload = new(models.Order) 72 73 // response payload 74 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 75 return err 76 } 77 78 return nil 79 } 80 81 // NewOrderGetBadRequest creates a OrderGetBadRequest with default headers values 82 func NewOrderGetBadRequest() *OrderGetBadRequest { 83 return &OrderGetBadRequest{} 84 } 85 86 /* OrderGetBadRequest describes a response with status code 400, with default header values. 87 88 Invalid ID supplied 89 */ 90 type OrderGetBadRequest struct { 91 } 92 93 func (o *OrderGetBadRequest) Error() string { 94 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetBadRequest ", 400) 95 } 96 97 func (o *OrderGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 98 99 return nil 100 } 101 102 // NewOrderGetNotFound creates a OrderGetNotFound with default headers values 103 func NewOrderGetNotFound() *OrderGetNotFound { 104 return &OrderGetNotFound{} 105 } 106 107 /* OrderGetNotFound describes a response with status code 404, with default header values. 108 109 Order not found 110 */ 111 type OrderGetNotFound struct { 112 } 113 114 func (o *OrderGetNotFound) Error() string { 115 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetNotFound ", 404) 116 } 117 118 func (o *OrderGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 119 120 return nil 121 }