github.com/circl-dev/go-swagger@v0.31.0/examples/generated/restapi/operations/user/get_user_by_name_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/circl-dev/runtime" 12 13 "github.com/circl-dev/go-swagger/examples/generated/models" 14 ) 15 16 // GetUserByNameOKCode is the HTTP code returned for type GetUserByNameOK 17 const GetUserByNameOKCode int = 200 18 19 /*GetUserByNameOK successful operation 20 21 swagger:response getUserByNameOK 22 */ 23 type GetUserByNameOK struct { 24 25 /* 26 In: Body 27 */ 28 Payload *models.User `json:"body,omitempty"` 29 } 30 31 // NewGetUserByNameOK creates GetUserByNameOK with default headers values 32 func NewGetUserByNameOK() *GetUserByNameOK { 33 34 return &GetUserByNameOK{} 35 } 36 37 // WithPayload adds the payload to the get user by name o k response 38 func (o *GetUserByNameOK) WithPayload(payload *models.User) *GetUserByNameOK { 39 o.Payload = payload 40 return o 41 } 42 43 // SetPayload sets the payload to the get user by name o k response 44 func (o *GetUserByNameOK) SetPayload(payload *models.User) { 45 o.Payload = payload 46 } 47 48 // WriteResponse to the client 49 func (o *GetUserByNameOK) 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 // GetUserByNameBadRequestCode is the HTTP code returned for type GetUserByNameBadRequest 61 const GetUserByNameBadRequestCode int = 400 62 63 /*GetUserByNameBadRequest Invalid username supplied 64 65 swagger:response getUserByNameBadRequest 66 */ 67 type GetUserByNameBadRequest struct { 68 } 69 70 // NewGetUserByNameBadRequest creates GetUserByNameBadRequest with default headers values 71 func NewGetUserByNameBadRequest() *GetUserByNameBadRequest { 72 73 return &GetUserByNameBadRequest{} 74 } 75 76 // WriteResponse to the client 77 func (o *GetUserByNameBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 78 79 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 80 81 rw.WriteHeader(400) 82 } 83 84 // GetUserByNameNotFoundCode is the HTTP code returned for type GetUserByNameNotFound 85 const GetUserByNameNotFoundCode int = 404 86 87 /*GetUserByNameNotFound User not found 88 89 swagger:response getUserByNameNotFound 90 */ 91 type GetUserByNameNotFound struct { 92 } 93 94 // NewGetUserByNameNotFound creates GetUserByNameNotFound with default headers values 95 func NewGetUserByNameNotFound() *GetUserByNameNotFound { 96 97 return &GetUserByNameNotFound{} 98 } 99 100 // WriteResponse to the client 101 func (o *GetUserByNameNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 102 103 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 104 105 rw.WriteHeader(404) 106 }