github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/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/runtime" 13 "github.com/go-openapi/strfmt" 14 15 "github.com/thetreep/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 /* 50 DestroyOneNoContent handles this case with default header values. 51 52 Deleted 53 */ 54 type DestroyOneNoContent struct { 55 } 56 57 func (o *DestroyOneNoContent) Error() string { 58 return fmt.Sprintf("[DELETE /{id}][%d] destroyOneNoContent ", 204) 59 } 60 61 func (o *DestroyOneNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 62 63 return nil 64 } 65 66 // NewDestroyOneDefault creates a DestroyOneDefault with default headers values 67 func NewDestroyOneDefault(code int) *DestroyOneDefault { 68 return &DestroyOneDefault{ 69 _statusCode: code, 70 } 71 } 72 73 /* 74 DestroyOneDefault handles this case with default header values. 75 76 error 77 */ 78 type DestroyOneDefault struct { 79 _statusCode int 80 81 Payload *models.Error 82 } 83 84 // Code gets the status code for the destroy one default response 85 func (o *DestroyOneDefault) Code() int { 86 return o._statusCode 87 } 88 89 func (o *DestroyOneDefault) Error() string { 90 return fmt.Sprintf("[DELETE /{id}][%d] destroyOne default %+v", o._statusCode, o.Payload) 91 } 92 93 func (o *DestroyOneDefault) GetPayload() *models.Error { 94 return o.Payload 95 } 96 97 func (o *DestroyOneDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 98 99 o.Payload = new(models.Error) 100 101 // response payload 102 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 103 return err 104 } 105 106 return nil 107 }