You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/auto/api/v1/web_admin.go

96 lines
2.5 KiB

// Code generated by go-mir. DO NOT EDIT.
package v1
import (
"net/http"
"github.com/alimy/mir/v3"
"github.com/gin-gonic/gin"
"github.com/rocboss/paopao-ce/internal/model/web"
)
type WebAdmin interface {
// Chain provide handlers chain for gin
Chain() gin.HandlersChain
ChangeUserStatus(*web.ChangeUserStatusReq) mir.Error
mustEmbedUnimplementedWebAdminServant()
}
type WebAdminBinding interface {
BindChangeUserStatus(*gin.Context) (*web.ChangeUserStatusReq, mir.Error)
mustEmbedUnimplementedWebAdminBinding()
}
type WebAdminRender interface {
RenderChangeUserStatus(*gin.Context, mir.Error)
mustEmbedUnimplementedWebAdminRender()
}
// RegisterWebAdminServant register WebAdmin servant to gin
func RegisterWebAdminServant(e *gin.Engine, s WebAdmin, b WebAdminBinding, r WebAdminRender) {
router := e.Group("v1")
// use chain for router
middlewares := s.Chain()
router.Use(middlewares...)
// register routes info to router
router.Handle("POST", "/admin/user/status", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req, err := b.BindChangeUserStatus(c)
if err != nil {
r.RenderChangeUserStatus(c, err)
return
}
r.RenderChangeUserStatus(c, s.ChangeUserStatus(req))
})
}
// UnimplementedWebAdminServant can be embedded to have forward compatible implementations.
type UnimplementedWebAdminServant struct {
}
func (UnimplementedWebAdminServant) Chain() gin.HandlersChain {
return nil
}
func (UnimplementedWebAdminServant) ChangeUserStatus(req *web.ChangeUserStatusReq) mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedWebAdminServant) mustEmbedUnimplementedWebAdminServant() {}
// UnimplementedWebAdminRender can be embedded to have forward compatible implementations.
type UnimplementedWebAdminRender struct {
RenderAny func(*gin.Context, any, mir.Error)
}
func (r *UnimplementedWebAdminRender) RenderChangeUserStatus(c *gin.Context, err mir.Error) {
r.RenderAny(c, nil, err)
}
func (r *UnimplementedWebAdminRender) mustEmbedUnimplementedWebAdminRender() {}
// UnimplementedWebAdminBinding can be embedded to have forward compatible implementations.
type UnimplementedWebAdminBinding struct {
BindAny func(*gin.Context, any) mir.Error
}
func (b *UnimplementedWebAdminBinding) BindChangeUserStatus(c *gin.Context) (*web.ChangeUserStatusReq, mir.Error) {
obj := new(web.ChangeUserStatusReq)
err := b.BindAny(c, obj)
return obj, err
}
func (b *UnimplementedWebAdminBinding) mustEmbedUnimplementedWebAdminBinding() {}