github.com/djarvur/go-swagger@v0.18.0/examples/tutorials/custom-server/gen/restapi/operations/get_greeting_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package operations 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 14 // GetGreetingOKCode is the HTTP code returned for type GetGreetingOK 15 const GetGreetingOKCode int = 200 16 17 /*GetGreetingOK returns a greeting 18 19 swagger:response getGreetingOK 20 */ 21 type GetGreetingOK struct { 22 23 /*contains the actual greeting as plain text 24 In: Body 25 */ 26 Payload string `json:"body,omitempty"` 27 } 28 29 // NewGetGreetingOK creates GetGreetingOK with default headers values 30 func NewGetGreetingOK() *GetGreetingOK { 31 32 return &GetGreetingOK{} 33 } 34 35 // WithPayload adds the payload to the get greeting o k response 36 func (o *GetGreetingOK) WithPayload(payload string) *GetGreetingOK { 37 o.Payload = payload 38 return o 39 } 40 41 // SetPayload sets the payload to the get greeting o k response 42 func (o *GetGreetingOK) SetPayload(payload string) { 43 o.Payload = payload 44 } 45 46 // WriteResponse to the client 47 func (o *GetGreetingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 48 49 rw.WriteHeader(200) 50 payload := o.Payload 51 if err := producer.Produce(rw, payload); err != nil { 52 panic(err) // let the recovery middleware deal with this 53 } 54 55 }