go-swagger-tutorial/restapi/operations/time_post_responses.go

147 lines
3.7 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
models "github.com/elfsternberg/timeofday/models"
)
// TimePostOKCode is the HTTP code returned for type TimePostOK
const TimePostOKCode int = 200
/*TimePostOK Returns the time of day.
swagger:response timePostOK
*/
type TimePostOK struct {
/*
In: Body
*/
Payload *models.Timeofday `json:"body,omitempty"`
}
// NewTimePostOK creates TimePostOK with default headers values
func NewTimePostOK() *TimePostOK {
return &TimePostOK{}
}
// WithPayload adds the payload to the time post o k response
func (o *TimePostOK) WithPayload(payload *models.Timeofday) *TimePostOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the time post o k response
func (o *TimePostOK) SetPayload(payload *models.Timeofday) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TimePostOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// TimePostNotFoundCode is the HTTP code returned for type TimePostNotFound
const TimePostNotFoundCode int = 404
/*TimePostNotFound Time zone not found
swagger:response timePostNotFound
*/
type TimePostNotFound struct {
/*
In: Body
*/
Payload *models.ErrorResponse `json:"body,omitempty"`
}
// NewTimePostNotFound creates TimePostNotFound with default headers values
func NewTimePostNotFound() *TimePostNotFound {
return &TimePostNotFound{}
}
// WithPayload adds the payload to the time post not found response
func (o *TimePostNotFound) WithPayload(payload *models.ErrorResponse) *TimePostNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the time post not found response
func (o *TimePostNotFound) SetPayload(payload *models.ErrorResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TimePostNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(404)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// TimePostInternalServerErrorCode is the HTTP code returned for type TimePostInternalServerError
const TimePostInternalServerErrorCode int = 500
/*TimePostInternalServerError Something has gone horribly wrong
swagger:response timePostInternalServerError
*/
type TimePostInternalServerError struct {
/*
In: Body
*/
Payload *models.ErrorResponse `json:"body,omitempty"`
}
// NewTimePostInternalServerError creates TimePostInternalServerError with default headers values
func NewTimePostInternalServerError() *TimePostInternalServerError {
return &TimePostInternalServerError{}
}
// WithPayload adds the payload to the time post internal server error response
func (o *TimePostInternalServerError) WithPayload(payload *models.ErrorResponse) *TimePostInternalServerError {
o.Payload = payload
return o
}
// SetPayload sets the payload to the time post internal server error response
func (o *TimePostInternalServerError) SetPayload(payload *models.ErrorResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TimePostInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(500)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}