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