Ai
1 Star 0 Fork 0

KathentGitee/go-swagger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
create_responses.go 2.63 KB
一键复制 编辑 原始数据 按行查看 历史
// Code generated by go-swagger; DO NOT EDIT.
package customers
// 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/go-swagger/go-swagger/examples/oauth2/models"
)
// CreateCreatedCode is the HTTP code returned for type CreateCreated
const CreateCreatedCode int = 201
/*CreateCreated created
swagger:response createCreated
*/
type CreateCreated struct {
/*
In: Body
*/
Payload *models.Customer `json:"body,omitempty"`
}
// NewCreateCreated creates CreateCreated with default headers values
func NewCreateCreated() *CreateCreated {
return &CreateCreated{}
}
// WithPayload adds the payload to the create created response
func (o *CreateCreated) WithPayload(payload *models.Customer) *CreateCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the create created response
func (o *CreateCreated) SetPayload(payload *models.Customer) {
o.Payload = payload
}
// WriteResponse to the client
func (o *CreateCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(201)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*CreateDefault error
swagger:response createDefault
*/
type CreateDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewCreateDefault creates CreateDefault with default headers values
func NewCreateDefault(code int) *CreateDefault {
if code <= 0 {
code = 500
}
return &CreateDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the create default response
func (o *CreateDefault) WithStatusCode(code int) *CreateDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the create default response
func (o *CreateDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the create default response
func (o *CreateDefault) WithPayload(payload *models.Error) *CreateDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the create default response
func (o *CreateDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *CreateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/kathent/go-swagger.git
git@gitee.com:kathent/go-swagger.git
kathent
go-swagger
go-swagger
v0.19.0

搜索帮助