github.com/djarvur/go-swagger@v0.18.0/examples/stream-server/restapi/operations/elapse_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 "io" 10 "net/http" 11 12 "github.com/go-openapi/runtime" 13 ) 14 15 // ElapseOKCode is the HTTP code returned for type ElapseOK 16 const ElapseOKCode int = 200 17 18 /*ElapseOK Secondly update on remaining time 19 20 swagger:response elapseOK 21 */ 22 type ElapseOK struct { 23 24 /* 25 In: Body 26 */ 27 Payload io.ReadCloser `json:"body,omitempty"` 28 } 29 30 // NewElapseOK creates ElapseOK with default headers values 31 func NewElapseOK() *ElapseOK { 32 33 return &ElapseOK{} 34 } 35 36 // WithPayload adds the payload to the elapse o k response 37 func (o *ElapseOK) WithPayload(payload io.ReadCloser) *ElapseOK { 38 o.Payload = payload 39 return o 40 } 41 42 // SetPayload sets the payload to the elapse o k response 43 func (o *ElapseOK) SetPayload(payload io.ReadCloser) { 44 o.Payload = payload 45 } 46 47 // WriteResponse to the client 48 func (o *ElapseOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 49 50 rw.WriteHeader(200) 51 payload := o.Payload 52 if err := producer.Produce(rw, payload); err != nil { 53 panic(err) // let the recovery middleware deal with this 54 } 55 56 } 57 58 // ElapseForbiddenCode is the HTTP code returned for type ElapseForbidden 59 const ElapseForbiddenCode int = 403 60 61 /*ElapseForbidden Contrived - thrown when length of 11 is chosen 62 63 swagger:response elapseForbidden 64 */ 65 type ElapseForbidden struct { 66 } 67 68 // NewElapseForbidden creates ElapseForbidden with default headers values 69 func NewElapseForbidden() *ElapseForbidden { 70 71 return &ElapseForbidden{} 72 } 73 74 // WriteResponse to the client 75 func (o *ElapseForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 76 77 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 78 79 rw.WriteHeader(403) 80 }