github.com/circl-dev/go-swagger@v0.31.0/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_update_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/circl-dev/runtime" 12 13 "github.com/circl-dev/go-swagger/examples/contributed-templates/stratoscale/models" 14 ) 15 16 // PetUpdateCreatedCode is the HTTP code returned for type PetUpdateCreated 17 const PetUpdateCreatedCode int = 201 18 19 /*PetUpdateCreated Updated successfully 20 21 swagger:response petUpdateCreated 22 */ 23 type PetUpdateCreated struct { 24 25 /* 26 In: Body 27 */ 28 Payload *models.Pet `json:"body,omitempty"` 29 } 30 31 // NewPetUpdateCreated creates PetUpdateCreated with default headers values 32 func NewPetUpdateCreated() *PetUpdateCreated { 33 34 return &PetUpdateCreated{} 35 } 36 37 // WithPayload adds the payload to the pet update created response 38 func (o *PetUpdateCreated) WithPayload(payload *models.Pet) *PetUpdateCreated { 39 o.Payload = payload 40 return o 41 } 42 43 // SetPayload sets the payload to the pet update created response 44 func (o *PetUpdateCreated) SetPayload(payload *models.Pet) { 45 o.Payload = payload 46 } 47 48 // WriteResponse to the client 49 func (o *PetUpdateCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 50 51 rw.WriteHeader(201) 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 // PetUpdateBadRequestCode is the HTTP code returned for type PetUpdateBadRequest 61 const PetUpdateBadRequestCode int = 400 62 63 /*PetUpdateBadRequest Invalid ID supplied 64 65 swagger:response petUpdateBadRequest 66 */ 67 type PetUpdateBadRequest struct { 68 } 69 70 // NewPetUpdateBadRequest creates PetUpdateBadRequest with default headers values 71 func NewPetUpdateBadRequest() *PetUpdateBadRequest { 72 73 return &PetUpdateBadRequest{} 74 } 75 76 // WriteResponse to the client 77 func (o *PetUpdateBadRequest) 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 // PetUpdateNotFoundCode is the HTTP code returned for type PetUpdateNotFound 85 const PetUpdateNotFoundCode int = 404 86 87 /*PetUpdateNotFound Pet not found 88 89 swagger:response petUpdateNotFound 90 */ 91 type PetUpdateNotFound struct { 92 } 93 94 // NewPetUpdateNotFound creates PetUpdateNotFound with default headers values 95 func NewPetUpdateNotFound() *PetUpdateNotFound { 96 97 return &PetUpdateNotFound{} 98 } 99 100 // WriteResponse to the client 101 func (o *PetUpdateNotFound) 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 } 107 108 // PetUpdateMethodNotAllowedCode is the HTTP code returned for type PetUpdateMethodNotAllowed 109 const PetUpdateMethodNotAllowedCode int = 405 110 111 /*PetUpdateMethodNotAllowed Validation exception 112 113 swagger:response petUpdateMethodNotAllowed 114 */ 115 type PetUpdateMethodNotAllowed struct { 116 } 117 118 // NewPetUpdateMethodNotAllowed creates PetUpdateMethodNotAllowed with default headers values 119 func NewPetUpdateMethodNotAllowed() *PetUpdateMethodNotAllowed { 120 121 return &PetUpdateMethodNotAllowed{} 122 } 123 124 // WriteResponse to the client 125 func (o *PetUpdateMethodNotAllowed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 126 127 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 128 129 rw.WriteHeader(405) 130 }