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