github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/examples/contributed-templates/stratoscale/client/pet/pet_upload_image_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 "github.com/go-openapi/strfmt" 14 15 "github.com/go-swagger/go-swagger/examples/contributed-templates/stratoscale/models" 16 ) 17 18 // PetUploadImageReader is a Reader for the PetUploadImage structure. 19 type PetUploadImageReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *PetUploadImageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 200: 27 result := NewPetUploadImageOK() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 default: 33 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 34 } 35 } 36 37 // NewPetUploadImageOK creates a PetUploadImageOK with default headers values 38 func NewPetUploadImageOK() *PetUploadImageOK { 39 return &PetUploadImageOK{} 40 } 41 42 /* 43 PetUploadImageOK describes a response with status code 200, with default header values. 44 45 successful operation 46 */ 47 type PetUploadImageOK struct { 48 Payload *models.APIResponse 49 } 50 51 // IsSuccess returns true when this pet upload image o k response returns a 2xx status code 52 func (o *PetUploadImageOK) IsSuccess() bool { 53 return true 54 } 55 56 // IsRedirect returns true when this pet upload image o k response returns a 3xx status code 57 func (o *PetUploadImageOK) IsRedirect() bool { 58 return false 59 } 60 61 // IsClientError returns true when this pet upload image o k response returns a 4xx status code 62 func (o *PetUploadImageOK) IsClientError() bool { 63 return false 64 } 65 66 // IsServerError returns true when this pet upload image o k response returns a 5xx status code 67 func (o *PetUploadImageOK) IsServerError() bool { 68 return false 69 } 70 71 // IsCode returns true when this pet upload image o k response returns a 4xx status code 72 func (o *PetUploadImageOK) IsCode(code int) bool { 73 return code == 200 74 } 75 76 func (o *PetUploadImageOK) Error() string { 77 return fmt.Sprintf("[POST /pet/{petId}/image][%d] petUploadImageOK %+v", 200, o.Payload) 78 } 79 80 func (o *PetUploadImageOK) String() string { 81 return fmt.Sprintf("[POST /pet/{petId}/image][%d] petUploadImageOK %+v", 200, o.Payload) 82 } 83 84 func (o *PetUploadImageOK) GetPayload() *models.APIResponse { 85 return o.Payload 86 } 87 88 func (o *PetUploadImageOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 89 90 o.Payload = new(models.APIResponse) 91 92 // response payload 93 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 94 return err 95 } 96 97 return nil 98 }