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