github.com/circl-dev/go-swagger@v0.31.0/examples/todo-list-strict/client/todos/destroy_one_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package todos 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/todo-list/models" 16 ) 17 18 // DestroyOneReader is a Reader for the DestroyOne structure. 19 type DestroyOneReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *DestroyOneReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 204: 27 result := NewDestroyOneNoContent() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 default: 33 result := NewDestroyOneDefault(response.Code()) 34 if err := result.readResponse(response, consumer, o.formats); err != nil { 35 return nil, err 36 } 37 if response.Code()/100 == 2 { 38 return result, nil 39 } 40 return nil, result 41 } 42 } 43 44 // NewDestroyOneNoContent creates a DestroyOneNoContent with default headers values 45 func NewDestroyOneNoContent() *DestroyOneNoContent { 46 return &DestroyOneNoContent{} 47 } 48 49 /*DestroyOneNoContent handles this case with default header values. 50 51 Deleted 52 */ 53 type DestroyOneNoContent struct { 54 } 55 56 func (o *DestroyOneNoContent) Error() string { 57 return fmt.Sprintf("[DELETE /{id}][%d] destroyOneNoContent ", 204) 58 } 59 60 func (o *DestroyOneNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 61 62 return nil 63 } 64 65 // NewDestroyOneDefault creates a DestroyOneDefault with default headers values 66 func NewDestroyOneDefault(code int) *DestroyOneDefault { 67 return &DestroyOneDefault{ 68 _statusCode: code, 69 } 70 } 71 72 /*DestroyOneDefault handles this case with default header values. 73 74 error 75 */ 76 type DestroyOneDefault struct { 77 _statusCode int 78 79 Payload *models.Error 80 } 81 82 // Code gets the status code for the destroy one default response 83 func (o *DestroyOneDefault) Code() int { 84 return o._statusCode 85 } 86 87 func (o *DestroyOneDefault) Error() string { 88 return fmt.Sprintf("[DELETE /{id}][%d] destroyOne default %+v", o._statusCode, o.Payload) 89 } 90 91 func (o *DestroyOneDefault) GetPayload() *models.Error { 92 return o.Payload 93 } 94 95 func (o *DestroyOneDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 96 97 o.Payload = new(models.Error) 98 99 // response payload 100 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 101 return err 102 } 103 104 return nil 105 }