github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/todo-list-strict/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/go-openapi/runtime"
    12  	"github.com/go-openapi/runtime/middleware"
    13  
    14  	"github.com/thetreep/go-swagger/examples/todo-list-strict/models"
    15  )
    16  
    17  // UpdateOneOKCode is the HTTP code returned for type UpdateOneOK
    18  const UpdateOneOKCode int = 200
    19  
    20  /*
    21  UpdateOneOK OK
    22  
    23  swagger:response updateOneOK
    24  */
    25  type UpdateOneOK struct {
    26  
    27  	/*
    28  	  In: Body
    29  	*/
    30  	Payload *models.Item `json:"body,omitempty"`
    31  }
    32  
    33  // NewUpdateOneOK creates UpdateOneOK with default headers values
    34  func NewUpdateOneOK() *UpdateOneOK {
    35  
    36  	return &UpdateOneOK{}
    37  }
    38  
    39  // WithPayload adds the payload to the update one o k response
    40  func (o *UpdateOneOK) WithPayload(payload *models.Item) *UpdateOneOK {
    41  	o.Payload = payload
    42  	return o
    43  }
    44  
    45  // SetPayload sets the payload to the update one o k response
    46  func (o *UpdateOneOK) SetPayload(payload *models.Item) {
    47  	o.Payload = payload
    48  }
    49  
    50  // WriteResponse to the client
    51  func (o *UpdateOneOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    52  
    53  	rw.WriteHeader(200)
    54  	if o.Payload != nil {
    55  		payload := o.Payload
    56  		if err := producer.Produce(rw, payload); err != nil {
    57  			panic(err) // let the recovery middleware deal with this
    58  		}
    59  	}
    60  }
    61  
    62  func (o *UpdateOneOK) UpdateOneResponder() {}
    63  
    64  /*
    65  UpdateOneDefault error
    66  
    67  swagger:response updateOneDefault
    68  */
    69  type UpdateOneDefault struct {
    70  	_statusCode int
    71  
    72  	/*
    73  	  In: Body
    74  	*/
    75  	Payload *models.Error `json:"body,omitempty"`
    76  }
    77  
    78  // NewUpdateOneDefault creates UpdateOneDefault with default headers values
    79  func NewUpdateOneDefault(code int) *UpdateOneDefault {
    80  	if code <= 0 {
    81  		code = 500
    82  	}
    83  
    84  	return &UpdateOneDefault{
    85  		_statusCode: code,
    86  	}
    87  }
    88  
    89  // WithStatusCode adds the status to the update one default response
    90  func (o *UpdateOneDefault) WithStatusCode(code int) *UpdateOneDefault {
    91  	o._statusCode = code
    92  	return o
    93  }
    94  
    95  // SetStatusCode sets the status to the update one default response
    96  func (o *UpdateOneDefault) SetStatusCode(code int) {
    97  	o._statusCode = code
    98  }
    99  
   100  // WithPayload adds the payload to the update one default response
   101  func (o *UpdateOneDefault) WithPayload(payload *models.Error) *UpdateOneDefault {
   102  	o.Payload = payload
   103  	return o
   104  }
   105  
   106  // SetPayload sets the payload to the update one default response
   107  func (o *UpdateOneDefault) SetPayload(payload *models.Error) {
   108  	o.Payload = payload
   109  }
   110  
   111  // WriteResponse to the client
   112  func (o *UpdateOneDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   113  
   114  	rw.WriteHeader(o._statusCode)
   115  	if o.Payload != nil {
   116  		payload := o.Payload
   117  		if err := producer.Produce(rw, payload); err != nil {
   118  			panic(err) // let the recovery middleware deal with this
   119  		}
   120  	}
   121  }
   122  
   123  func (o *UpdateOneDefault) UpdateOneResponder() {}
   124  
   125  type UpdateOneNotImplementedResponder struct {
   126  	middleware.Responder
   127  }
   128  
   129  func (*UpdateOneNotImplementedResponder) UpdateOneResponder() {}
   130  
   131  func UpdateOneNotImplemented() UpdateOneResponder {
   132  	return &UpdateOneNotImplementedResponder{
   133  		middleware.NotImplemented(
   134  			"operation authentication.UpdateOne has not yet been implemented",
   135  		),
   136  	}
   137  }
   138  
   139  type UpdateOneResponder interface {
   140  	middleware.Responder
   141  	UpdateOneResponder()
   142  }