github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/generated/restapi/operations/user/login_user_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package user 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 14 // LoginUserOKCode is the HTTP code returned for type LoginUserOK 15 const LoginUserOKCode int = 200 16 17 /* 18 LoginUserOK successful operation 19 20 swagger:response loginUserOK 21 */ 22 type LoginUserOK struct { 23 24 /* 25 In: Body 26 */ 27 Payload string `json:"body,omitempty"` 28 } 29 30 // NewLoginUserOK creates LoginUserOK with default headers values 31 func NewLoginUserOK() *LoginUserOK { 32 33 return &LoginUserOK{} 34 } 35 36 // WithPayload adds the payload to the login user o k response 37 func (o *LoginUserOK) WithPayload(payload string) *LoginUserOK { 38 o.Payload = payload 39 return o 40 } 41 42 // SetPayload sets the payload to the login user o k response 43 func (o *LoginUserOK) SetPayload(payload string) { 44 o.Payload = payload 45 } 46 47 // WriteResponse to the client 48 func (o *LoginUserOK) 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 // LoginUserBadRequestCode is the HTTP code returned for type LoginUserBadRequest 58 const LoginUserBadRequestCode int = 400 59 60 /* 61 LoginUserBadRequest Invalid username/password supplied 62 63 swagger:response loginUserBadRequest 64 */ 65 type LoginUserBadRequest struct { 66 } 67 68 // NewLoginUserBadRequest creates LoginUserBadRequest with default headers values 69 func NewLoginUserBadRequest() *LoginUserBadRequest { 70 71 return &LoginUserBadRequest{} 72 } 73 74 // WriteResponse to the client 75 func (o *LoginUserBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 76 77 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 78 79 rw.WriteHeader(400) 80 }