github.com/circl-dev/go-swagger@v0.31.0/examples/todo-list-strict/restapi/operations/todos/add_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/circl-dev/runtime" 12 "github.com/circl-dev/runtime/middleware" 13 14 "github.com/circl-dev/go-swagger/examples/todo-list-strict/models" 15 ) 16 17 // AddOneCreatedCode is the HTTP code returned for type AddOneCreated 18 const AddOneCreatedCode int = 201 19 20 /*AddOneCreated Created 21 22 swagger:response addOneCreated 23 */ 24 type AddOneCreated struct { 25 26 /* 27 In: Body 28 */ 29 Payload *models.Item `json:"body,omitempty"` 30 } 31 32 // NewAddOneCreated creates AddOneCreated with default headers values 33 func NewAddOneCreated() *AddOneCreated { 34 35 return &AddOneCreated{} 36 } 37 38 // WithPayload adds the payload to the add one created response 39 func (o *AddOneCreated) WithPayload(payload *models.Item) *AddOneCreated { 40 o.Payload = payload 41 return o 42 } 43 44 // SetPayload sets the payload to the add one created response 45 func (o *AddOneCreated) SetPayload(payload *models.Item) { 46 o.Payload = payload 47 } 48 49 // WriteResponse to the client 50 func (o *AddOneCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 51 52 rw.WriteHeader(201) 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 func (o *AddOneCreated) AddOneResponder() {} 62 63 /*AddOneDefault error 64 65 swagger:response addOneDefault 66 */ 67 type AddOneDefault struct { 68 _statusCode int 69 70 /* 71 In: Body 72 */ 73 Payload *models.Error `json:"body,omitempty"` 74 } 75 76 // NewAddOneDefault creates AddOneDefault with default headers values 77 func NewAddOneDefault(code int) *AddOneDefault { 78 if code <= 0 { 79 code = 500 80 } 81 82 return &AddOneDefault{ 83 _statusCode: code, 84 } 85 } 86 87 // WithStatusCode adds the status to the add one default response 88 func (o *AddOneDefault) WithStatusCode(code int) *AddOneDefault { 89 o._statusCode = code 90 return o 91 } 92 93 // SetStatusCode sets the status to the add one default response 94 func (o *AddOneDefault) SetStatusCode(code int) { 95 o._statusCode = code 96 } 97 98 // WithPayload adds the payload to the add one default response 99 func (o *AddOneDefault) WithPayload(payload *models.Error) *AddOneDefault { 100 o.Payload = payload 101 return o 102 } 103 104 // SetPayload sets the payload to the add one default response 105 func (o *AddOneDefault) SetPayload(payload *models.Error) { 106 o.Payload = payload 107 } 108 109 // WriteResponse to the client 110 func (o *AddOneDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 111 112 rw.WriteHeader(o._statusCode) 113 if o.Payload != nil { 114 payload := o.Payload 115 if err := producer.Produce(rw, payload); err != nil { 116 panic(err) // let the recovery middleware deal with this 117 } 118 } 119 } 120 121 func (o *AddOneDefault) AddOneResponder() {} 122 123 type AddOneNotImplementedResponder struct { 124 middleware.Responder 125 } 126 127 func (*AddOneNotImplementedResponder) AddOneResponder() {} 128 129 func AddOneNotImplemented() AddOneResponder { 130 return &AddOneNotImplementedResponder{ 131 middleware.NotImplemented( 132 "operation authentication.AddOne has not yet been implemented", 133 ), 134 } 135 } 136 137 type AddOneResponder interface { 138 middleware.Responder 139 AddOneResponder() 140 }