github.com/djarvur/go-swagger@v0.18.0/examples/task-tracker/client/tasks/delete_task_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package tasks 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/task-tracker/models" 17 ) 18 19 // DeleteTaskReader is a Reader for the DeleteTask structure. 20 type DeleteTaskReader struct { 21 formats strfmt.Registry 22 } 23 24 // ReadResponse reads a server response into the received o. 25 func (o *DeleteTaskReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 switch response.Code() { 27 28 case 204: 29 result := NewDeleteTaskNoContent() 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 := NewDeleteTaskDefault(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 // NewDeleteTaskNoContent creates a DeleteTaskNoContent with default headers values 48 func NewDeleteTaskNoContent() *DeleteTaskNoContent { 49 return &DeleteTaskNoContent{} 50 } 51 52 /*DeleteTaskNoContent handles this case with default header values. 53 54 Task deleted 55 */ 56 type DeleteTaskNoContent struct { 57 } 58 59 func (o *DeleteTaskNoContent) Error() string { 60 return fmt.Sprintf("[DELETE /tasks/{id}][%d] deleteTaskNoContent ", 204) 61 } 62 63 func (o *DeleteTaskNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 64 65 return nil 66 } 67 68 // NewDeleteTaskDefault creates a DeleteTaskDefault with default headers values 69 func NewDeleteTaskDefault(code int) *DeleteTaskDefault { 70 return &DeleteTaskDefault{ 71 _statusCode: code, 72 } 73 } 74 75 /*DeleteTaskDefault handles this case with default header values. 76 77 Error response 78 */ 79 type DeleteTaskDefault struct { 80 _statusCode int 81 82 XErrorCode string 83 84 Payload *models.Error 85 } 86 87 // Code gets the status code for the delete task default response 88 func (o *DeleteTaskDefault) Code() int { 89 return o._statusCode 90 } 91 92 func (o *DeleteTaskDefault) Error() string { 93 return fmt.Sprintf("[DELETE /tasks/{id}][%d] deleteTask default %+v", o._statusCode, o.Payload) 94 } 95 96 func (o *DeleteTaskDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 97 98 // response header X-Error-Code 99 o.XErrorCode = response.GetHeader("X-Error-Code") 100 101 o.Payload = new(models.Error) 102 103 // response payload 104 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 105 return err 106 } 107 108 return nil 109 }