github.com/rzurga/go-swagger@v0.28.1-0.20211109195225-5d1f453ffa3a/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  /* DestroyOneNoContent describes a response with status code 204, 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 describes a response with status code -1, 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  func (o *DestroyOneDefault) GetPayload() *models.Error {
    91  	return 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  }