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