1 Star 0 Fork 0

gaogaoss/go-swagger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
update_task_responses.go 4.16 KB
一键复制 编辑 原始数据 按行查看 历史
gaogao 提交于 2024-07-30 09:49 +08:00 . first commit
package tasks
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"net/http"
"github.com/go-openapi/runtime"
"github.com/go-swagger/go-swagger/examples/task-tracker/models"
)
/*UpdateTaskOK Task details
swagger:response updateTaskOK
*/
type UpdateTaskOK struct {
// In: body
Payload *models.Task `json:"body,omitempty"`
}
// NewUpdateTaskOK creates UpdateTaskOK with default headers values
func NewUpdateTaskOK() *UpdateTaskOK {
return &UpdateTaskOK{}
}
// WithPayload adds the payload to the update task o k response
func (o *UpdateTaskOK) WithPayload(payload *models.Task) *UpdateTaskOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the update task o k response
func (o *UpdateTaskOK) SetPayload(payload *models.Task) {
o.Payload = payload
}
// WriteResponse to the client
func (o *UpdateTaskOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*UpdateTaskUnprocessableEntity Validation error
swagger:response updateTaskUnprocessableEntity
*/
type UpdateTaskUnprocessableEntity struct {
// In: body
Payload *models.ValidationError `json:"body,omitempty"`
}
// NewUpdateTaskUnprocessableEntity creates UpdateTaskUnprocessableEntity with default headers values
func NewUpdateTaskUnprocessableEntity() *UpdateTaskUnprocessableEntity {
return &UpdateTaskUnprocessableEntity{}
}
// WithPayload adds the payload to the update task unprocessable entity response
func (o *UpdateTaskUnprocessableEntity) WithPayload(payload *models.ValidationError) *UpdateTaskUnprocessableEntity {
o.Payload = payload
return o
}
// SetPayload sets the payload to the update task unprocessable entity response
func (o *UpdateTaskUnprocessableEntity) SetPayload(payload *models.ValidationError) {
o.Payload = payload
}
// WriteResponse to the client
func (o *UpdateTaskUnprocessableEntity) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(422)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*UpdateTaskDefault Error response
swagger:response updateTaskDefault
*/
type UpdateTaskDefault struct {
_statusCode int
/*
Required: true
*/
XErrorCode string `json:"X-Error-Code"`
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewUpdateTaskDefault creates UpdateTaskDefault with default headers values
func NewUpdateTaskDefault(code int) *UpdateTaskDefault {
if code <= 0 {
code = 500
}
return &UpdateTaskDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the update task default response
func (o *UpdateTaskDefault) WithStatusCode(code int) *UpdateTaskDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the update task default response
func (o *UpdateTaskDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithXErrorCode adds the xErrorCode to the update task default response
func (o *UpdateTaskDefault) WithXErrorCode(xErrorCode string) *UpdateTaskDefault {
o.XErrorCode = xErrorCode
return o
}
// SetXErrorCode sets the xErrorCode to the update task default response
func (o *UpdateTaskDefault) SetXErrorCode(xErrorCode string) {
o.XErrorCode = xErrorCode
}
// WithPayload adds the payload to the update task default response
func (o *UpdateTaskDefault) WithPayload(payload *models.Error) *UpdateTaskDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the update task default response
func (o *UpdateTaskDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *UpdateTaskDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
// response header X-Error-Code
rw.Header().Add("X-Error-Code", fmt.Sprintf("%v", o.XErrorCode))
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gaogaoss/go-swagger.git
git@gitee.com:gaogaoss/go-swagger.git
gaogaoss
go-swagger
go-swagger
da1ca328b83f

搜索帮助