github.com/ffalor/go-swagger@v0.0.0-20231011000038-9f25265ac351/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 "github.com/go-openapi/strfmt" 14 15 "github.com/go-swagger/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 describes a response with status code 204, with default header values. 51 52 Deleted 53 */ 54 type DestroyOneNoContent struct { 55 } 56 57 // IsSuccess returns true when this destroy one no content response has a 2xx status code 58 func (o *DestroyOneNoContent) IsSuccess() bool { 59 return true 60 } 61 62 // IsRedirect returns true when this destroy one no content response has a 3xx status code 63 func (o *DestroyOneNoContent) IsRedirect() bool { 64 return false 65 } 66 67 // IsClientError returns true when this destroy one no content response has a 4xx status code 68 func (o *DestroyOneNoContent) IsClientError() bool { 69 return false 70 } 71 72 // IsServerError returns true when this destroy one no content response has a 5xx status code 73 func (o *DestroyOneNoContent) IsServerError() bool { 74 return false 75 } 76 77 // IsCode returns true when this destroy one no content response a status code equal to that given 78 func (o *DestroyOneNoContent) IsCode(code int) bool { 79 return code == 204 80 } 81 82 // Code gets the status code for the destroy one no content response 83 func (o *DestroyOneNoContent) Code() int { 84 return 204 85 } 86 87 func (o *DestroyOneNoContent) Error() string { 88 return fmt.Sprintf("[DELETE /{id}][%d] destroyOneNoContent ", 204) 89 } 90 91 func (o *DestroyOneNoContent) String() string { 92 return fmt.Sprintf("[DELETE /{id}][%d] destroyOneNoContent ", 204) 93 } 94 95 func (o *DestroyOneNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 96 97 return nil 98 } 99 100 // NewDestroyOneDefault creates a DestroyOneDefault with default headers values 101 func NewDestroyOneDefault(code int) *DestroyOneDefault { 102 return &DestroyOneDefault{ 103 _statusCode: code, 104 } 105 } 106 107 /* 108 DestroyOneDefault describes a response with status code -1, with default header values. 109 110 error 111 */ 112 type DestroyOneDefault struct { 113 _statusCode int 114 115 Payload *models.Error 116 } 117 118 // IsSuccess returns true when this destroy one default response has a 2xx status code 119 func (o *DestroyOneDefault) IsSuccess() bool { 120 return o._statusCode/100 == 2 121 } 122 123 // IsRedirect returns true when this destroy one default response has a 3xx status code 124 func (o *DestroyOneDefault) IsRedirect() bool { 125 return o._statusCode/100 == 3 126 } 127 128 // IsClientError returns true when this destroy one default response has a 4xx status code 129 func (o *DestroyOneDefault) IsClientError() bool { 130 return o._statusCode/100 == 4 131 } 132 133 // IsServerError returns true when this destroy one default response has a 5xx status code 134 func (o *DestroyOneDefault) IsServerError() bool { 135 return o._statusCode/100 == 5 136 } 137 138 // IsCode returns true when this destroy one default response a status code equal to that given 139 func (o *DestroyOneDefault) IsCode(code int) bool { 140 return o._statusCode == code 141 } 142 143 // Code gets the status code for the destroy one default response 144 func (o *DestroyOneDefault) Code() int { 145 return o._statusCode 146 } 147 148 func (o *DestroyOneDefault) Error() string { 149 return fmt.Sprintf("[DELETE /{id}][%d] destroyOne default %+v", o._statusCode, o.Payload) 150 } 151 152 func (o *DestroyOneDefault) String() string { 153 return fmt.Sprintf("[DELETE /{id}][%d] destroyOne default %+v", o._statusCode, o.Payload) 154 } 155 156 func (o *DestroyOneDefault) GetPayload() *models.Error { 157 return o.Payload 158 } 159 160 func (o *DestroyOneDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 161 162 o.Payload = new(models.Error) 163 164 // response payload 165 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 166 return err 167 } 168 169 return nil 170 }