github.com/circl-dev/go-swagger@v0.31.0/examples/stream-server/restapi/operations/elapse_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package operations
     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  	"io"
    10  	"net/http"
    11  
    12  	"github.com/circl-dev/runtime"
    13  )
    14  
    15  // ElapseOKCode is the HTTP code returned for type ElapseOK
    16  const ElapseOKCode int = 200
    17  
    18  /*ElapseOK Secondly update on remaining time
    19  
    20  swagger:response elapseOK
    21  */
    22  type ElapseOK struct {
    23  
    24  	/*
    25  	  In: Body
    26  	*/
    27  	Payload io.ReadCloser `json:"body,omitempty"`
    28  }
    29  
    30  // NewElapseOK creates ElapseOK with default headers values
    31  func NewElapseOK() *ElapseOK {
    32  
    33  	return &ElapseOK{}
    34  }
    35  
    36  // WithPayload adds the payload to the elapse o k response
    37  func (o *ElapseOK) WithPayload(payload io.ReadCloser) *ElapseOK {
    38  	o.Payload = payload
    39  	return o
    40  }
    41  
    42  // SetPayload sets the payload to the elapse o k response
    43  func (o *ElapseOK) SetPayload(payload io.ReadCloser) {
    44  	o.Payload = payload
    45  }
    46  
    47  // WriteResponse to the client
    48  func (o *ElapseOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    49  
    50  	rw.WriteHeader(200)
    51  	payload := o.Payload
    52  	if err := producer.Produce(rw, payload); err != nil {
    53  		panic(err) // let the recovery middleware deal with this
    54  	}
    55  }
    56  
    57  // ElapseForbiddenCode is the HTTP code returned for type ElapseForbidden
    58  const ElapseForbiddenCode int = 403
    59  
    60  /*ElapseForbidden Contrived - thrown when length of 11 is chosen
    61  
    62  swagger:response elapseForbidden
    63  */
    64  type ElapseForbidden struct {
    65  }
    66  
    67  // NewElapseForbidden creates ElapseForbidden with default headers values
    68  func NewElapseForbidden() *ElapseForbidden {
    69  
    70  	return &ElapseForbidden{}
    71  }
    72  
    73  // WriteResponse to the client
    74  func (o *ElapseForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    75  
    76  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    77  
    78  	rw.WriteHeader(403)
    79  }