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