github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/todo-list-strict/restapi/operations/todos/find_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 // FindOKCode is the HTTP code returned for type FindOK 18 const FindOKCode int = 200 19 20 /* 21 FindOK OK 22 23 swagger:response findOK 24 */ 25 type FindOK struct { 26 27 /* 28 In: Body 29 */ 30 Payload []*models.Item `json:"body,omitempty"` 31 } 32 33 // NewFindOK creates FindOK with default headers values 34 func NewFindOK() *FindOK { 35 36 return &FindOK{} 37 } 38 39 // WithPayload adds the payload to the find o k response 40 func (o *FindOK) WithPayload(payload []*models.Item) *FindOK { 41 o.Payload = payload 42 return o 43 } 44 45 // SetPayload sets the payload to the find o k response 46 func (o *FindOK) SetPayload(payload []*models.Item) { 47 o.Payload = payload 48 } 49 50 // WriteResponse to the client 51 func (o *FindOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 52 53 rw.WriteHeader(200) 54 payload := o.Payload 55 if payload == nil { 56 // return empty array 57 payload = make([]*models.Item, 0, 50) 58 } 59 60 if err := producer.Produce(rw, payload); err != nil { 61 panic(err) // let the recovery middleware deal with this 62 } 63 } 64 65 func (o *FindOK) FindResponder() {} 66 67 /* 68 FindDefault error 69 70 swagger:response findDefault 71 */ 72 type FindDefault struct { 73 _statusCode int 74 75 /* 76 In: Body 77 */ 78 Payload *models.Error `json:"body,omitempty"` 79 } 80 81 // NewFindDefault creates FindDefault with default headers values 82 func NewFindDefault(code int) *FindDefault { 83 if code <= 0 { 84 code = 500 85 } 86 87 return &FindDefault{ 88 _statusCode: code, 89 } 90 } 91 92 // WithStatusCode adds the status to the find default response 93 func (o *FindDefault) WithStatusCode(code int) *FindDefault { 94 o._statusCode = code 95 return o 96 } 97 98 // SetStatusCode sets the status to the find default response 99 func (o *FindDefault) SetStatusCode(code int) { 100 o._statusCode = code 101 } 102 103 // WithPayload adds the payload to the find default response 104 func (o *FindDefault) WithPayload(payload *models.Error) *FindDefault { 105 o.Payload = payload 106 return o 107 } 108 109 // SetPayload sets the payload to the find default response 110 func (o *FindDefault) SetPayload(payload *models.Error) { 111 o.Payload = payload 112 } 113 114 // WriteResponse to the client 115 func (o *FindDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 116 117 rw.WriteHeader(o._statusCode) 118 if o.Payload != nil { 119 payload := o.Payload 120 if err := producer.Produce(rw, payload); err != nil { 121 panic(err) // let the recovery middleware deal with this 122 } 123 } 124 } 125 126 func (o *FindDefault) FindResponder() {} 127 128 type FindNotImplementedResponder struct { 129 middleware.Responder 130 } 131 132 func (*FindNotImplementedResponder) FindResponder() {} 133 134 func FindNotImplemented() FindResponder { 135 return &FindNotImplementedResponder{ 136 middleware.NotImplemented( 137 "operation authentication.Find has not yet been implemented", 138 ), 139 } 140 } 141 142 type FindResponder interface { 143 middleware.Responder 144 FindResponder() 145 }