github.com/Percona-Lab/go-swagger@v0.19.0/examples/contributed-templates/stratoscale/client/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 "fmt" 10 "io" 11 12 "github.com/go-openapi/runtime" 13 14 strfmt "github.com/go-openapi/strfmt" 15 16 models "github.com/go-swagger/go-swagger/examples/contributed-templates/stratoscale/models" 17 ) 18 19 // PetUpdateReader is a Reader for the PetUpdate structure. 20 type PetUpdateReader struct { 21 formats strfmt.Registry 22 } 23 24 // ReadResponse reads a server response into the received o. 25 func (o *PetUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 switch response.Code() { 27 28 case 201: 29 result := NewPetUpdateCreated() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 35 case 400: 36 result := NewPetUpdateBadRequest() 37 if err := result.readResponse(response, consumer, o.formats); err != nil { 38 return nil, err 39 } 40 return nil, result 41 42 case 404: 43 result := NewPetUpdateNotFound() 44 if err := result.readResponse(response, consumer, o.formats); err != nil { 45 return nil, err 46 } 47 return nil, result 48 49 case 405: 50 result := NewPetUpdateMethodNotAllowed() 51 if err := result.readResponse(response, consumer, o.formats); err != nil { 52 return nil, err 53 } 54 return nil, result 55 56 default: 57 return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 } 59 } 60 61 // NewPetUpdateCreated creates a PetUpdateCreated with default headers values 62 func NewPetUpdateCreated() *PetUpdateCreated { 63 return &PetUpdateCreated{} 64 } 65 66 /*PetUpdateCreated handles this case with default header values. 67 68 Updated successfully 69 */ 70 type PetUpdateCreated struct { 71 Payload *models.Pet 72 } 73 74 func (o *PetUpdateCreated) Error() string { 75 return fmt.Sprintf("[PUT /pet][%d] petUpdateCreated %+v", 201, o.Payload) 76 } 77 78 func (o *PetUpdateCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 79 80 o.Payload = new(models.Pet) 81 82 // response payload 83 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 84 return err 85 } 86 87 return nil 88 } 89 90 // NewPetUpdateBadRequest creates a PetUpdateBadRequest with default headers values 91 func NewPetUpdateBadRequest() *PetUpdateBadRequest { 92 return &PetUpdateBadRequest{} 93 } 94 95 /*PetUpdateBadRequest handles this case with default header values. 96 97 Invalid ID supplied 98 */ 99 type PetUpdateBadRequest struct { 100 } 101 102 func (o *PetUpdateBadRequest) Error() string { 103 return fmt.Sprintf("[PUT /pet][%d] petUpdateBadRequest ", 400) 104 } 105 106 func (o *PetUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 107 108 return nil 109 } 110 111 // NewPetUpdateNotFound creates a PetUpdateNotFound with default headers values 112 func NewPetUpdateNotFound() *PetUpdateNotFound { 113 return &PetUpdateNotFound{} 114 } 115 116 /*PetUpdateNotFound handles this case with default header values. 117 118 Pet not found 119 */ 120 type PetUpdateNotFound struct { 121 } 122 123 func (o *PetUpdateNotFound) Error() string { 124 return fmt.Sprintf("[PUT /pet][%d] petUpdateNotFound ", 404) 125 } 126 127 func (o *PetUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 128 129 return nil 130 } 131 132 // NewPetUpdateMethodNotAllowed creates a PetUpdateMethodNotAllowed with default headers values 133 func NewPetUpdateMethodNotAllowed() *PetUpdateMethodNotAllowed { 134 return &PetUpdateMethodNotAllowed{} 135 } 136 137 /*PetUpdateMethodNotAllowed handles this case with default header values. 138 139 Validation exception 140 */ 141 type PetUpdateMethodNotAllowed struct { 142 } 143 144 func (o *PetUpdateMethodNotAllowed) Error() string { 145 return fmt.Sprintf("[PUT /pet][%d] petUpdateMethodNotAllowed ", 405) 146 } 147 148 func (o *PetUpdateMethodNotAllowed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 149 150 return nil 151 }