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