github.com/circl-dev/go-swagger@v0.31.0/examples/todo-list/restapi/operations/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  	"net/http"
    10  
    11  	"github.com/circl-dev/runtime"
    12  
    13  	"github.com/circl-dev/go-swagger/examples/todo-list/models"
    14  )
    15  
    16  // DestroyOneNoContentCode is the HTTP code returned for type DestroyOneNoContent
    17  const DestroyOneNoContentCode int = 204
    18  
    19  /*DestroyOneNoContent Deleted
    20  
    21  swagger:response destroyOneNoContent
    22  */
    23  type DestroyOneNoContent struct {
    24  }
    25  
    26  // NewDestroyOneNoContent creates DestroyOneNoContent with default headers values
    27  func NewDestroyOneNoContent() *DestroyOneNoContent {
    28  
    29  	return &DestroyOneNoContent{}
    30  }
    31  
    32  // WriteResponse to the client
    33  func (o *DestroyOneNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    34  
    35  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    36  
    37  	rw.WriteHeader(204)
    38  }
    39  
    40  /*DestroyOneDefault error
    41  
    42  swagger:response destroyOneDefault
    43  */
    44  type DestroyOneDefault struct {
    45  	_statusCode int
    46  
    47  	/*
    48  	  In: Body
    49  	*/
    50  	Payload *models.Error `json:"body,omitempty"`
    51  }
    52  
    53  // NewDestroyOneDefault creates DestroyOneDefault with default headers values
    54  func NewDestroyOneDefault(code int) *DestroyOneDefault {
    55  	if code <= 0 {
    56  		code = 500
    57  	}
    58  
    59  	return &DestroyOneDefault{
    60  		_statusCode: code,
    61  	}
    62  }
    63  
    64  // WithStatusCode adds the status to the destroy one default response
    65  func (o *DestroyOneDefault) WithStatusCode(code int) *DestroyOneDefault {
    66  	o._statusCode = code
    67  	return o
    68  }
    69  
    70  // SetStatusCode sets the status to the destroy one default response
    71  func (o *DestroyOneDefault) SetStatusCode(code int) {
    72  	o._statusCode = code
    73  }
    74  
    75  // WithPayload adds the payload to the destroy one default response
    76  func (o *DestroyOneDefault) WithPayload(payload *models.Error) *DestroyOneDefault {
    77  	o.Payload = payload
    78  	return o
    79  }
    80  
    81  // SetPayload sets the payload to the destroy one default response
    82  func (o *DestroyOneDefault) SetPayload(payload *models.Error) {
    83  	o.Payload = payload
    84  }
    85  
    86  // WriteResponse to the client
    87  func (o *DestroyOneDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    88  
    89  	rw.WriteHeader(o._statusCode)
    90  	if o.Payload != nil {
    91  		payload := o.Payload
    92  		if err := producer.Produce(rw, payload); err != nil {
    93  			panic(err) // let the recovery middleware deal with this
    94  		}
    95  	}
    96  }