github.com/circl-dev/go-swagger@v0.31.0/examples/generated/restapi/operations/pet/find_pets_by_status_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package pet
     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/generated/models"
    14  )
    15  
    16  // FindPetsByStatusOKCode is the HTTP code returned for type FindPetsByStatusOK
    17  const FindPetsByStatusOKCode int = 200
    18  
    19  /*FindPetsByStatusOK successful operation
    20  
    21  swagger:response findPetsByStatusOK
    22  */
    23  type FindPetsByStatusOK struct {
    24  
    25  	/*
    26  	  In: Body
    27  	*/
    28  	Payload []*models.Pet `json:"body,omitempty"`
    29  }
    30  
    31  // NewFindPetsByStatusOK creates FindPetsByStatusOK with default headers values
    32  func NewFindPetsByStatusOK() *FindPetsByStatusOK {
    33  
    34  	return &FindPetsByStatusOK{}
    35  }
    36  
    37  // WithPayload adds the payload to the find pets by status o k response
    38  func (o *FindPetsByStatusOK) WithPayload(payload []*models.Pet) *FindPetsByStatusOK {
    39  	o.Payload = payload
    40  	return o
    41  }
    42  
    43  // SetPayload sets the payload to the find pets by status o k response
    44  func (o *FindPetsByStatusOK) SetPayload(payload []*models.Pet) {
    45  	o.Payload = payload
    46  }
    47  
    48  // WriteResponse to the client
    49  func (o *FindPetsByStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    50  
    51  	rw.WriteHeader(200)
    52  	payload := o.Payload
    53  	if payload == nil {
    54  		// return empty array
    55  		payload = make([]*models.Pet, 0, 50)
    56  	}
    57  
    58  	if err := producer.Produce(rw, payload); err != nil {
    59  		panic(err) // let the recovery middleware deal with this
    60  	}
    61  }
    62  
    63  // FindPetsByStatusBadRequestCode is the HTTP code returned for type FindPetsByStatusBadRequest
    64  const FindPetsByStatusBadRequestCode int = 400
    65  
    66  /*FindPetsByStatusBadRequest Invalid status value
    67  
    68  swagger:response findPetsByStatusBadRequest
    69  */
    70  type FindPetsByStatusBadRequest struct {
    71  }
    72  
    73  // NewFindPetsByStatusBadRequest creates FindPetsByStatusBadRequest with default headers values
    74  func NewFindPetsByStatusBadRequest() *FindPetsByStatusBadRequest {
    75  
    76  	return &FindPetsByStatusBadRequest{}
    77  }
    78  
    79  // WriteResponse to the client
    80  func (o *FindPetsByStatusBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    81  
    82  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    83  
    84  	rw.WriteHeader(400)
    85  }