github.com/djarvur/go-swagger@v0.18.0/examples/composed-auth/restapi/operations/get_order_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 models "github.com/go-swagger/go-swagger/examples/composed-auth/models" 14 ) 15 16 // GetOrderOKCode is the HTTP code returned for type GetOrderOK 17 const GetOrderOKCode int = 200 18 19 /*GetOrderOK content of an order 20 21 swagger:response getOrderOK 22 */ 23 type GetOrderOK struct { 24 25 /* 26 In: Body 27 */ 28 Payload *models.Order `json:"body,omitempty"` 29 } 30 31 // NewGetOrderOK creates GetOrderOK with default headers values 32 func NewGetOrderOK() *GetOrderOK { 33 34 return &GetOrderOK{} 35 } 36 37 // WithPayload adds the payload to the get order o k response 38 func (o *GetOrderOK) WithPayload(payload *models.Order) *GetOrderOK { 39 o.Payload = payload 40 return o 41 } 42 43 // SetPayload sets the payload to the get order o k response 44 func (o *GetOrderOK) SetPayload(payload *models.Order) { 45 o.Payload = payload 46 } 47 48 // WriteResponse to the client 49 func (o *GetOrderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 50 51 rw.WriteHeader(200) 52 if o.Payload != nil { 53 payload := o.Payload 54 if err := producer.Produce(rw, payload); err != nil { 55 panic(err) // let the recovery middleware deal with this 56 } 57 } 58 } 59 60 // GetOrderUnauthorizedCode is the HTTP code returned for type GetOrderUnauthorized 61 const GetOrderUnauthorizedCode int = 401 62 63 /*GetOrderUnauthorized unauthorized access for a lack of authentication 64 65 swagger:response getOrderUnauthorized 66 */ 67 type GetOrderUnauthorized struct { 68 } 69 70 // NewGetOrderUnauthorized creates GetOrderUnauthorized with default headers values 71 func NewGetOrderUnauthorized() *GetOrderUnauthorized { 72 73 return &GetOrderUnauthorized{} 74 } 75 76 // WriteResponse to the client 77 func (o *GetOrderUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 78 79 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 80 81 rw.WriteHeader(401) 82 } 83 84 // GetOrderForbiddenCode is the HTTP code returned for type GetOrderForbidden 85 const GetOrderForbiddenCode int = 403 86 87 /*GetOrderForbidden forbidden access for a lack of sufficient privileges 88 89 swagger:response getOrderForbidden 90 */ 91 type GetOrderForbidden struct { 92 } 93 94 // NewGetOrderForbidden creates GetOrderForbidden with default headers values 95 func NewGetOrderForbidden() *GetOrderForbidden { 96 97 return &GetOrderForbidden{} 98 } 99 100 // WriteResponse to the client 101 func (o *GetOrderForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 102 103 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 104 105 rw.WriteHeader(403) 106 } 107 108 /*GetOrderDefault other error response 109 110 swagger:response getOrderDefault 111 */ 112 type GetOrderDefault struct { 113 _statusCode int 114 115 /* 116 In: Body 117 */ 118 Payload *models.Error `json:"body,omitempty"` 119 } 120 121 // NewGetOrderDefault creates GetOrderDefault with default headers values 122 func NewGetOrderDefault(code int) *GetOrderDefault { 123 if code <= 0 { 124 code = 500 125 } 126 127 return &GetOrderDefault{ 128 _statusCode: code, 129 } 130 } 131 132 // WithStatusCode adds the status to the get order default response 133 func (o *GetOrderDefault) WithStatusCode(code int) *GetOrderDefault { 134 o._statusCode = code 135 return o 136 } 137 138 // SetStatusCode sets the status to the get order default response 139 func (o *GetOrderDefault) SetStatusCode(code int) { 140 o._statusCode = code 141 } 142 143 // WithPayload adds the payload to the get order default response 144 func (o *GetOrderDefault) WithPayload(payload *models.Error) *GetOrderDefault { 145 o.Payload = payload 146 return o 147 } 148 149 // SetPayload sets the payload to the get order default response 150 func (o *GetOrderDefault) SetPayload(payload *models.Error) { 151 o.Payload = payload 152 } 153 154 // WriteResponse to the client 155 func (o *GetOrderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 156 157 rw.WriteHeader(o._statusCode) 158 if o.Payload != nil { 159 payload := o.Payload 160 if err := producer.Produce(rw, payload); err != nil { 161 panic(err) // let the recovery middleware deal with this 162 } 163 } 164 }