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