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