github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/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 "encoding/json" 10 "fmt" 11 "io" 12 13 "github.com/go-openapi/runtime" 14 "github.com/go-openapi/strfmt" 15 16 "github.com/thetreep/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 default: 46 return nil, runtime.NewAPIError("[GET /store/order/{orderId}] OrderGet", response, response.Code()) 47 } 48 } 49 50 // NewOrderGetOK creates a OrderGetOK with default headers values 51 func NewOrderGetOK() *OrderGetOK { 52 return &OrderGetOK{} 53 } 54 55 /* 56 OrderGetOK describes a response with status code 200, with default header values. 57 58 successful operation 59 */ 60 type OrderGetOK struct { 61 Payload *models.Order 62 } 63 64 // IsSuccess returns true when this order get o k response has a 2xx status code 65 func (o *OrderGetOK) IsSuccess() bool { 66 return true 67 } 68 69 // IsRedirect returns true when this order get o k response has a 3xx status code 70 func (o *OrderGetOK) IsRedirect() bool { 71 return false 72 } 73 74 // IsClientError returns true when this order get o k response has a 4xx status code 75 func (o *OrderGetOK) IsClientError() bool { 76 return false 77 } 78 79 // IsServerError returns true when this order get o k response has a 5xx status code 80 func (o *OrderGetOK) IsServerError() bool { 81 return false 82 } 83 84 // IsCode returns true when this order get o k response a status code equal to that given 85 func (o *OrderGetOK) IsCode(code int) bool { 86 return code == 200 87 } 88 89 // Code gets the status code for the order get o k response 90 func (o *OrderGetOK) Code() int { 91 return 200 92 } 93 94 func (o *OrderGetOK) Error() string { 95 payload, _ := json.Marshal(o.Payload) 96 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetOK %s", 200, payload) 97 } 98 99 func (o *OrderGetOK) String() string { 100 payload, _ := json.Marshal(o.Payload) 101 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetOK %s", 200, payload) 102 } 103 104 func (o *OrderGetOK) GetPayload() *models.Order { 105 return o.Payload 106 } 107 108 func (o *OrderGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 109 110 o.Payload = new(models.Order) 111 112 // response payload 113 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 114 return err 115 } 116 117 return nil 118 } 119 120 // NewOrderGetBadRequest creates a OrderGetBadRequest with default headers values 121 func NewOrderGetBadRequest() *OrderGetBadRequest { 122 return &OrderGetBadRequest{} 123 } 124 125 /* 126 OrderGetBadRequest describes a response with status code 400, with default header values. 127 128 Invalid ID supplied 129 */ 130 type OrderGetBadRequest struct { 131 } 132 133 // IsSuccess returns true when this order get bad request response has a 2xx status code 134 func (o *OrderGetBadRequest) IsSuccess() bool { 135 return false 136 } 137 138 // IsRedirect returns true when this order get bad request response has a 3xx status code 139 func (o *OrderGetBadRequest) IsRedirect() bool { 140 return false 141 } 142 143 // IsClientError returns true when this order get bad request response has a 4xx status code 144 func (o *OrderGetBadRequest) IsClientError() bool { 145 return true 146 } 147 148 // IsServerError returns true when this order get bad request response has a 5xx status code 149 func (o *OrderGetBadRequest) IsServerError() bool { 150 return false 151 } 152 153 // IsCode returns true when this order get bad request response a status code equal to that given 154 func (o *OrderGetBadRequest) IsCode(code int) bool { 155 return code == 400 156 } 157 158 // Code gets the status code for the order get bad request response 159 func (o *OrderGetBadRequest) Code() int { 160 return 400 161 } 162 163 func (o *OrderGetBadRequest) Error() string { 164 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetBadRequest", 400) 165 } 166 167 func (o *OrderGetBadRequest) String() string { 168 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetBadRequest", 400) 169 } 170 171 func (o *OrderGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 172 173 return nil 174 } 175 176 // NewOrderGetNotFound creates a OrderGetNotFound with default headers values 177 func NewOrderGetNotFound() *OrderGetNotFound { 178 return &OrderGetNotFound{} 179 } 180 181 /* 182 OrderGetNotFound describes a response with status code 404, with default header values. 183 184 Order not found 185 */ 186 type OrderGetNotFound struct { 187 } 188 189 // IsSuccess returns true when this order get not found response has a 2xx status code 190 func (o *OrderGetNotFound) IsSuccess() bool { 191 return false 192 } 193 194 // IsRedirect returns true when this order get not found response has a 3xx status code 195 func (o *OrderGetNotFound) IsRedirect() bool { 196 return false 197 } 198 199 // IsClientError returns true when this order get not found response has a 4xx status code 200 func (o *OrderGetNotFound) IsClientError() bool { 201 return true 202 } 203 204 // IsServerError returns true when this order get not found response has a 5xx status code 205 func (o *OrderGetNotFound) IsServerError() bool { 206 return false 207 } 208 209 // IsCode returns true when this order get not found response a status code equal to that given 210 func (o *OrderGetNotFound) IsCode(code int) bool { 211 return code == 404 212 } 213 214 // Code gets the status code for the order get not found response 215 func (o *OrderGetNotFound) Code() int { 216 return 404 217 } 218 219 func (o *OrderGetNotFound) Error() string { 220 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetNotFound", 404) 221 } 222 223 func (o *OrderGetNotFound) String() string { 224 return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetNotFound", 404) 225 } 226 227 func (o *OrderGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 228 229 return nil 230 }