go-swagger-tutorial/restapi/operations/time_get_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"
)
// TimeGetOKCode is the HTTP code returned for type TimeGetOK
const TimeGetOKCode int = 200
/*TimeGetOK Returns the time of day.
swagger:response timeGetOK
*/
type TimeGetOK struct {
/*
In: Body
*/
Payload *models.Timeofday `json:"body,omitempty"`
}
// NewTimeGetOK creates TimeGetOK with default headers values
func NewTimeGetOK() *TimeGetOK {
return &TimeGetOK{}
}
// WithPayload adds the payload to the time get o k response
func (o *TimeGetOK) WithPayload(payload *models.Timeofday) *TimeGetOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the time get o k response
func (o *TimeGetOK) SetPayload(payload *models.Timeofday) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TimeGetOK) 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
}
}
}
// TimeGetNotFoundCode is the HTTP code returned for type TimeGetNotFound
const TimeGetNotFoundCode int = 404
/*TimeGetNotFound Time zone not found
swagger:response timeGetNotFound
*/
type TimeGetNotFound struct {
/*
In: Body
*/
Payload *models.ErrorResponse `json:"body,omitempty"`
}
// NewTimeGetNotFound creates TimeGetNotFound with default headers values
func NewTimeGetNotFound() *TimeGetNotFound {
return &TimeGetNotFound{}
}
// WithPayload adds the payload to the time get not found response
func (o *TimeGetNotFound) WithPayload(payload *models.ErrorResponse) *TimeGetNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the time get not found response
func (o *TimeGetNotFound) SetPayload(payload *models.ErrorResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TimeGetNotFound) 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
}
}
}
// TimeGetInternalServerErrorCode is the HTTP code returned for type TimeGetInternalServerError
const TimeGetInternalServerErrorCode int = 500
/*TimeGetInternalServerError Something has gone horribly wrong
swagger:response timeGetInternalServerError
*/
type TimeGetInternalServerError struct {
/*
In: Body
*/
Payload *models.ErrorResponse `json:"body,omitempty"`
}
// NewTimeGetInternalServerError creates TimeGetInternalServerError with default headers values
func NewTimeGetInternalServerError() *TimeGetInternalServerError {
return &TimeGetInternalServerError{}
}
// WithPayload adds the payload to the time get internal server error response
func (o *TimeGetInternalServerError) WithPayload(payload *models.ErrorResponse) *TimeGetInternalServerError {
o.Payload = payload
return o
}
// SetPayload sets the payload to the time get internal server error response
func (o *TimeGetInternalServerError) SetPayload(payload *models.ErrorResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TimeGetInternalServerError) 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
}
}
}