github.com/circl-dev/go-swagger@v0.31.0/examples/auto-configure/restapi/operations/todos/update_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/auto-configure/models"
    14  )
    15  
    16  // UpdateOneOKCode is the HTTP code returned for type UpdateOneOK
    17  const UpdateOneOKCode int = 200
    18  
    19  /*UpdateOneOK OK
    20  
    21  swagger:response updateOneOK
    22  */
    23  type UpdateOneOK struct {
    24  
    25  	/*
    26  	  In: Body
    27  	*/
    28  	Payload *models.Item `json:"body,omitempty"`
    29  }
    30  
    31  // NewUpdateOneOK creates UpdateOneOK with default headers values
    32  func NewUpdateOneOK() *UpdateOneOK {
    33  
    34  	return &UpdateOneOK{}
    35  }
    36  
    37  // WithPayload adds the payload to the update one o k response
    38  func (o *UpdateOneOK) WithPayload(payload *models.Item) *UpdateOneOK {
    39  	o.Payload = payload
    40  	return o
    41  }
    42  
    43  // SetPayload sets the payload to the update one o k response
    44  func (o *UpdateOneOK) SetPayload(payload *models.Item) {
    45  	o.Payload = payload
    46  }
    47  
    48  // WriteResponse to the client
    49  func (o *UpdateOneOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    50  
    51  	rw.WriteHeader(200)
    52  	if o.Payload != nil {
    53  		payload := o.Payload
    54  		if err := producer.Produce(rw, payload); err != nil {
    55  			panic(err) // let the recovery middleware deal with this
    56  		}
    57  	}
    58  }
    59  
    60  /*UpdateOneDefault error
    61  
    62  swagger:response updateOneDefault
    63  */
    64  type UpdateOneDefault struct {
    65  	_statusCode int
    66  
    67  	/*
    68  	  In: Body
    69  	*/
    70  	Payload *models.Error `json:"body,omitempty"`
    71  }
    72  
    73  // NewUpdateOneDefault creates UpdateOneDefault with default headers values
    74  func NewUpdateOneDefault(code int) *UpdateOneDefault {
    75  	if code <= 0 {
    76  		code = 500
    77  	}
    78  
    79  	return &UpdateOneDefault{
    80  		_statusCode: code,
    81  	}
    82  }
    83  
    84  // WithStatusCode adds the status to the update one default response
    85  func (o *UpdateOneDefault) WithStatusCode(code int) *UpdateOneDefault {
    86  	o._statusCode = code
    87  	return o
    88  }
    89  
    90  // SetStatusCode sets the status to the update one default response
    91  func (o *UpdateOneDefault) SetStatusCode(code int) {
    92  	o._statusCode = code
    93  }
    94  
    95  // WithPayload adds the payload to the update one default response
    96  func (o *UpdateOneDefault) WithPayload(payload *models.Error) *UpdateOneDefault {
    97  	o.Payload = payload
    98  	return o
    99  }
   100  
   101  // SetPayload sets the payload to the update one default response
   102  func (o *UpdateOneDefault) SetPayload(payload *models.Error) {
   103  	o.Payload = payload
   104  }
   105  
   106  // WriteResponse to the client
   107  func (o *UpdateOneDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   108  
   109  	rw.WriteHeader(o._statusCode)
   110  	if o.Payload != nil {
   111  		payload := o.Payload
   112  		if err := producer.Produce(rw, payload); err != nil {
   113  			panic(err) // let the recovery middleware deal with this
   114  		}
   115  	}
   116  }