github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_update_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/go-openapi/runtime"
    12  
    13  	"github.com/go-swagger/go-swagger/examples/contributed-templates/stratoscale/models"
    14  )
    15  
    16  // PetUpdateCreatedCode is the HTTP code returned for type PetUpdateCreated
    17  const PetUpdateCreatedCode int = 201
    18  
    19  /*
    20  PetUpdateCreated Updated successfully
    21  
    22  swagger:response petUpdateCreated
    23  */
    24  type PetUpdateCreated struct {
    25  
    26  	/*
    27  	  In: Body
    28  	*/
    29  	Payload *models.Pet `json:"body,omitempty"`
    30  }
    31  
    32  // NewPetUpdateCreated creates PetUpdateCreated with default headers values
    33  func NewPetUpdateCreated() *PetUpdateCreated {
    34  
    35  	return &PetUpdateCreated{}
    36  }
    37  
    38  // WithPayload adds the payload to the pet update created response
    39  func (o *PetUpdateCreated) WithPayload(payload *models.Pet) *PetUpdateCreated {
    40  	o.Payload = payload
    41  	return o
    42  }
    43  
    44  // SetPayload sets the payload to the pet update created response
    45  func (o *PetUpdateCreated) SetPayload(payload *models.Pet) {
    46  	o.Payload = payload
    47  }
    48  
    49  // WriteResponse to the client
    50  func (o *PetUpdateCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    51  
    52  	rw.WriteHeader(201)
    53  	if o.Payload != nil {
    54  		payload := o.Payload
    55  		if err := producer.Produce(rw, payload); err != nil {
    56  			panic(err) // let the recovery middleware deal with this
    57  		}
    58  	}
    59  }
    60  
    61  // PetUpdateBadRequestCode is the HTTP code returned for type PetUpdateBadRequest
    62  const PetUpdateBadRequestCode int = 400
    63  
    64  /*
    65  PetUpdateBadRequest Invalid ID supplied
    66  
    67  swagger:response petUpdateBadRequest
    68  */
    69  type PetUpdateBadRequest struct {
    70  }
    71  
    72  // NewPetUpdateBadRequest creates PetUpdateBadRequest with default headers values
    73  func NewPetUpdateBadRequest() *PetUpdateBadRequest {
    74  
    75  	return &PetUpdateBadRequest{}
    76  }
    77  
    78  // WriteResponse to the client
    79  func (o *PetUpdateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    80  
    81  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    82  
    83  	rw.WriteHeader(400)
    84  }
    85  
    86  // PetUpdateNotFoundCode is the HTTP code returned for type PetUpdateNotFound
    87  const PetUpdateNotFoundCode int = 404
    88  
    89  /*
    90  PetUpdateNotFound Pet not found
    91  
    92  swagger:response petUpdateNotFound
    93  */
    94  type PetUpdateNotFound struct {
    95  }
    96  
    97  // NewPetUpdateNotFound creates PetUpdateNotFound with default headers values
    98  func NewPetUpdateNotFound() *PetUpdateNotFound {
    99  
   100  	return &PetUpdateNotFound{}
   101  }
   102  
   103  // WriteResponse to the client
   104  func (o *PetUpdateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   105  
   106  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
   107  
   108  	rw.WriteHeader(404)
   109  }
   110  
   111  // PetUpdateMethodNotAllowedCode is the HTTP code returned for type PetUpdateMethodNotAllowed
   112  const PetUpdateMethodNotAllowedCode int = 405
   113  
   114  /*
   115  PetUpdateMethodNotAllowed Validation exception
   116  
   117  swagger:response petUpdateMethodNotAllowed
   118  */
   119  type PetUpdateMethodNotAllowed struct {
   120  }
   121  
   122  // NewPetUpdateMethodNotAllowed creates PetUpdateMethodNotAllowed with default headers values
   123  func NewPetUpdateMethodNotAllowed() *PetUpdateMethodNotAllowed {
   124  
   125  	return &PetUpdateMethodNotAllowed{}
   126  }
   127  
   128  // WriteResponse to the client
   129  func (o *PetUpdateMethodNotAllowed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   130  
   131  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
   132  
   133  	rw.WriteHeader(405)
   134  }