github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/examples/auto-configure/restapi/operations/todos/update_one_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package todos 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 "net/http" 10 11 "github.com/go-openapi/runtime" 12 13 "github.com/go-swagger/go-swagger/examples/auto-configure/models" 14 ) 15 16 // UpdateOneOKCode is the HTTP code returned for type UpdateOneOK 17 const UpdateOneOKCode int = 200 18 19 /* 20 UpdateOneOK OK 21 22 swagger:response updateOneOK 23 */ 24 type UpdateOneOK struct { 25 26 /* 27 In: Body 28 */ 29 Payload *models.Item `json:"body,omitempty"` 30 } 31 32 // NewUpdateOneOK creates UpdateOneOK with default headers values 33 func NewUpdateOneOK() *UpdateOneOK { 34 35 return &UpdateOneOK{} 36 } 37 38 // WithPayload adds the payload to the update one o k response 39 func (o *UpdateOneOK) WithPayload(payload *models.Item) *UpdateOneOK { 40 o.Payload = payload 41 return o 42 } 43 44 // SetPayload sets the payload to the update one o k response 45 func (o *UpdateOneOK) SetPayload(payload *models.Item) { 46 o.Payload = payload 47 } 48 49 // WriteResponse to the client 50 func (o *UpdateOneOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 51 52 rw.WriteHeader(200) 53 if o.Payload != nil { 54 payload := o.Payload 55 if err := producer.Produce(rw, payload); err != nil { 56 panic(err) // let the recovery middleware deal with this 57 } 58 } 59 } 60 61 /* 62 UpdateOneDefault error 63 64 swagger:response updateOneDefault 65 */ 66 type UpdateOneDefault struct { 67 _statusCode int 68 69 /* 70 In: Body 71 */ 72 Payload *models.Error `json:"body,omitempty"` 73 } 74 75 // NewUpdateOneDefault creates UpdateOneDefault with default headers values 76 func NewUpdateOneDefault(code int) *UpdateOneDefault { 77 if code <= 0 { 78 code = 500 79 } 80 81 return &UpdateOneDefault{ 82 _statusCode: code, 83 } 84 } 85 86 // WithStatusCode adds the status to the update one default response 87 func (o *UpdateOneDefault) WithStatusCode(code int) *UpdateOneDefault { 88 o._statusCode = code 89 return o 90 } 91 92 // SetStatusCode sets the status to the update one default response 93 func (o *UpdateOneDefault) SetStatusCode(code int) { 94 o._statusCode = code 95 } 96 97 // WithPayload adds the payload to the update one default response 98 func (o *UpdateOneDefault) WithPayload(payload *models.Error) *UpdateOneDefault { 99 o.Payload = payload 100 return o 101 } 102 103 // SetPayload sets the payload to the update one default response 104 func (o *UpdateOneDefault) SetPayload(payload *models.Error) { 105 o.Payload = payload 106 } 107 108 // WriteResponse to the client 109 func (o *UpdateOneDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 110 111 rw.WriteHeader(o._statusCode) 112 if o.Payload != nil { 113 payload := o.Payload 114 if err := producer.Produce(rw, payload); err != nil { 115 panic(err) // let the recovery middleware deal with this 116 } 117 } 118 }