github.com/circl-dev/go-swagger@v0.31.0/examples/composed-auth/restapi/operations/add_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/circl-dev/runtime" 12 13 "github.com/circl-dev/go-swagger/examples/composed-auth/models" 14 ) 15 16 // AddOrderOKCode is the HTTP code returned for type AddOrderOK 17 const AddOrderOKCode int = 200 18 19 /*AddOrderOK empty response 20 21 swagger:response addOrderOK 22 */ 23 type AddOrderOK struct { 24 } 25 26 // NewAddOrderOK creates AddOrderOK with default headers values 27 func NewAddOrderOK() *AddOrderOK { 28 29 return &AddOrderOK{} 30 } 31 32 // WriteResponse to the client 33 func (o *AddOrderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 34 35 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 36 37 rw.WriteHeader(200) 38 } 39 40 // AddOrderUnauthorizedCode is the HTTP code returned for type AddOrderUnauthorized 41 const AddOrderUnauthorizedCode int = 401 42 43 /*AddOrderUnauthorized unauthorized access for a lack of authentication 44 45 swagger:response addOrderUnauthorized 46 */ 47 type AddOrderUnauthorized struct { 48 } 49 50 // NewAddOrderUnauthorized creates AddOrderUnauthorized with default headers values 51 func NewAddOrderUnauthorized() *AddOrderUnauthorized { 52 53 return &AddOrderUnauthorized{} 54 } 55 56 // WriteResponse to the client 57 func (o *AddOrderUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 58 59 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 60 61 rw.WriteHeader(401) 62 } 63 64 // AddOrderForbiddenCode is the HTTP code returned for type AddOrderForbidden 65 const AddOrderForbiddenCode int = 403 66 67 /*AddOrderForbidden forbidden access for a lack of sufficient privileges 68 69 swagger:response addOrderForbidden 70 */ 71 type AddOrderForbidden struct { 72 } 73 74 // NewAddOrderForbidden creates AddOrderForbidden with default headers values 75 func NewAddOrderForbidden() *AddOrderForbidden { 76 77 return &AddOrderForbidden{} 78 } 79 80 // WriteResponse to the client 81 func (o *AddOrderForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 82 83 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 84 85 rw.WriteHeader(403) 86 } 87 88 /*AddOrderDefault other error response 89 90 swagger:response addOrderDefault 91 */ 92 type AddOrderDefault struct { 93 _statusCode int 94 95 /* 96 In: Body 97 */ 98 Payload *models.Error `json:"body,omitempty"` 99 } 100 101 // NewAddOrderDefault creates AddOrderDefault with default headers values 102 func NewAddOrderDefault(code int) *AddOrderDefault { 103 if code <= 0 { 104 code = 500 105 } 106 107 return &AddOrderDefault{ 108 _statusCode: code, 109 } 110 } 111 112 // WithStatusCode adds the status to the add order default response 113 func (o *AddOrderDefault) WithStatusCode(code int) *AddOrderDefault { 114 o._statusCode = code 115 return o 116 } 117 118 // SetStatusCode sets the status to the add order default response 119 func (o *AddOrderDefault) SetStatusCode(code int) { 120 o._statusCode = code 121 } 122 123 // WithPayload adds the payload to the add order default response 124 func (o *AddOrderDefault) WithPayload(payload *models.Error) *AddOrderDefault { 125 o.Payload = payload 126 return o 127 } 128 129 // SetPayload sets the payload to the add order default response 130 func (o *AddOrderDefault) SetPayload(payload *models.Error) { 131 o.Payload = payload 132 } 133 134 // WriteResponse to the client 135 func (o *AddOrderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 136 137 rw.WriteHeader(o._statusCode) 138 if o.Payload != nil { 139 payload := o.Payload 140 if err := producer.Produce(rw, payload); err != nil { 141 panic(err) // let the recovery middleware deal with this 142 } 143 } 144 }