github.com/djarvur/go-swagger@v0.18.0/examples/generated/restapi/operations/pet/get_pet_by_id_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package pet 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 models "github.com/go-swagger/go-swagger/examples/generated/models" 14 ) 15 16 // GetPetByIDOKCode is the HTTP code returned for type GetPetByIDOK 17 const GetPetByIDOKCode int = 200 18 19 /*GetPetByIDOK successful operation 20 21 swagger:response getPetByIdOK 22 */ 23 type GetPetByIDOK struct { 24 25 /* 26 In: Body 27 */ 28 Payload *models.Pet `json:"body,omitempty"` 29 } 30 31 // NewGetPetByIDOK creates GetPetByIDOK with default headers values 32 func NewGetPetByIDOK() *GetPetByIDOK { 33 34 return &GetPetByIDOK{} 35 } 36 37 // WithPayload adds the payload to the get pet by Id o k response 38 func (o *GetPetByIDOK) WithPayload(payload *models.Pet) *GetPetByIDOK { 39 o.Payload = payload 40 return o 41 } 42 43 // SetPayload sets the payload to the get pet by Id o k response 44 func (o *GetPetByIDOK) SetPayload(payload *models.Pet) { 45 o.Payload = payload 46 } 47 48 // WriteResponse to the client 49 func (o *GetPetByIDOK) 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 // GetPetByIDBadRequestCode is the HTTP code returned for type GetPetByIDBadRequest 61 const GetPetByIDBadRequestCode int = 400 62 63 /*GetPetByIDBadRequest Invalid ID supplied 64 65 swagger:response getPetByIdBadRequest 66 */ 67 type GetPetByIDBadRequest struct { 68 } 69 70 // NewGetPetByIDBadRequest creates GetPetByIDBadRequest with default headers values 71 func NewGetPetByIDBadRequest() *GetPetByIDBadRequest { 72 73 return &GetPetByIDBadRequest{} 74 } 75 76 // WriteResponse to the client 77 func (o *GetPetByIDBadRequest) 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 // GetPetByIDNotFoundCode is the HTTP code returned for type GetPetByIDNotFound 85 const GetPetByIDNotFoundCode int = 404 86 87 /*GetPetByIDNotFound Pet not found 88 89 swagger:response getPetByIdNotFound 90 */ 91 type GetPetByIDNotFound struct { 92 } 93 94 // NewGetPetByIDNotFound creates GetPetByIDNotFound with default headers values 95 func NewGetPetByIDNotFound() *GetPetByIDNotFound { 96 97 return &GetPetByIDNotFound{} 98 } 99 100 // WriteResponse to the client 101 func (o *GetPetByIDNotFound) 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 }