mirror of https://github.com/rocboss/paopao-ce
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.
357 lines
9.3 KiB
357 lines
9.3 KiB
2 years ago
|
// 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"
|
||
|
)
|
||
|
|
||
2 years ago
|
type Priv interface {
|
||
2 years ago
|
// Chain provide handlers chain for gin
|
||
|
Chain() gin.HandlersChain
|
||
|
|
||
|
DeleteCommentReply() mir.Error
|
||
|
CreateCommentReply() mir.Error
|
||
|
DeleteComment() mir.Error
|
||
|
CreateComment() mir.Error
|
||
|
VisiblePost() mir.Error
|
||
|
StickTweet() mir.Error
|
||
|
LockTweet() mir.Error
|
||
|
CollectionTweet() mir.Error
|
||
|
StarTweet() mir.Error
|
||
|
DeleteTweet() mir.Error
|
||
|
CreateTweet(*web.CreateTweetReq) (*web.CreateTweetResp, mir.Error)
|
||
|
DownloadAttachment() mir.Error
|
||
|
DownloadAttachmentPrecheck() mir.Error
|
||
|
UploadAttachment() mir.Error
|
||
|
|
||
2 years ago
|
mustEmbedUnimplementedPrivServant()
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
type PrivBinding interface {
|
||
2 years ago
|
BindCreateTweet(*gin.Context) (*web.CreateTweetReq, mir.Error)
|
||
|
|
||
2 years ago
|
mustEmbedUnimplementedPrivBinding()
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
type PrivRender interface {
|
||
2 years ago
|
RenderDeleteCommentReply(*gin.Context, mir.Error)
|
||
|
RenderCreateCommentReply(*gin.Context, mir.Error)
|
||
|
RenderDeleteComment(*gin.Context, mir.Error)
|
||
|
RenderCreateComment(*gin.Context, mir.Error)
|
||
|
RenderVisiblePost(*gin.Context, mir.Error)
|
||
|
RenderStickTweet(*gin.Context, mir.Error)
|
||
|
RenderLockTweet(*gin.Context, mir.Error)
|
||
|
RenderCollectionTweet(*gin.Context, mir.Error)
|
||
|
RenderStarTweet(*gin.Context, mir.Error)
|
||
|
RenderDeleteTweet(*gin.Context, mir.Error)
|
||
|
RenderCreateTweet(*gin.Context, *web.CreateTweetResp, mir.Error)
|
||
|
RenderDownloadAttachment(*gin.Context, mir.Error)
|
||
|
RenderDownloadAttachmentPrecheck(*gin.Context, mir.Error)
|
||
|
RenderUploadAttachment(*gin.Context, mir.Error)
|
||
|
|
||
2 years ago
|
mustEmbedUnimplementedPrivRender()
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
// RegisterPrivServant register Priv servant to gin
|
||
|
func RegisterPrivServant(e *gin.Engine, s Priv, b PrivBinding, r PrivRender) {
|
||
2 years ago
|
router := e.Group("v1")
|
||
|
// use chain for router
|
||
|
middlewares := s.Chain()
|
||
|
router.Use(middlewares...)
|
||
|
|
||
|
// register routes info to router
|
||
|
router.Handle("DELETE", "/post/comment/reply", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderDeleteCommentReply(c, s.DeleteCommentReply())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/post/comment/reply", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderCreateCommentReply(c, s.CreateCommentReply())
|
||
|
})
|
||
|
|
||
|
router.Handle("DELETE", "/post/comment", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderDeleteComment(c, s.DeleteComment())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/post/comment", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderCreateComment(c, s.CreateComment())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/post/visibility", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderVisiblePost(c, s.VisiblePost())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/post/stick", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderStickTweet(c, s.StickTweet())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/post/lock", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderLockTweet(c, s.LockTweet())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/post/collection", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderCollectionTweet(c, s.CollectionTweet())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/post/start", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderStarTweet(c, s.StarTweet())
|
||
|
})
|
||
|
|
||
|
router.Handle("DELETE", "/post", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderDeleteTweet(c, s.DeleteTweet())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/post", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
req, err := b.BindCreateTweet(c)
|
||
|
if err != nil {
|
||
|
r.RenderCreateTweet(c, nil, err)
|
||
|
return
|
||
|
}
|
||
|
resp, err := s.CreateTweet(req)
|
||
|
r.RenderCreateTweet(c, resp, err)
|
||
|
})
|
||
|
|
||
|
router.Handle("GET", "/attachment", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderDownloadAttachment(c, s.DownloadAttachment())
|
||
|
})
|
||
|
|
||
|
router.Handle("GET", "/attachment/precheck", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderDownloadAttachmentPrecheck(c, s.DownloadAttachmentPrecheck())
|
||
|
})
|
||
|
|
||
|
router.Handle("POST", "/attachment", func(c *gin.Context) {
|
||
|
select {
|
||
|
case <-c.Request.Context().Done():
|
||
|
return
|
||
|
default:
|
||
|
}
|
||
|
|
||
|
r.RenderUploadAttachment(c, s.UploadAttachment())
|
||
|
})
|
||
|
|
||
|
}
|
||
|
|
||
2 years ago
|
// UnimplementedPrivServant can be embedded to have forward compatible implementations.
|
||
|
type UnimplementedPrivServant struct {
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) Chain() gin.HandlersChain {
|
||
2 years ago
|
return nil
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) DeleteCommentReply() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) CreateCommentReply() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) DeleteComment() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) CreateComment() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) VisiblePost() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) StickTweet() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) LockTweet() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) CollectionTweet() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) StarTweet() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) DeleteTweet() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) CreateTweet(req *web.CreateTweetReq) (*web.CreateTweetResp, mir.Error) {
|
||
2 years ago
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) DownloadAttachment() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) DownloadAttachmentPrecheck() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) UploadAttachment() mir.Error {
|
||
2 years ago
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
||
|
}
|
||
|
|
||
2 years ago
|
func (UnimplementedPrivServant) mustEmbedUnimplementedPrivServant() {}
|
||
2 years ago
|
|
||
2 years ago
|
// UnimplementedPrivRender can be embedded to have forward compatible implementations.
|
||
|
type UnimplementedPrivRender struct {
|
||
2 years ago
|
RenderAny func(*gin.Context, any, mir.Error)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderDeleteCommentReply(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderCreateCommentReply(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderDeleteComment(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderCreateComment(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderVisiblePost(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderStickTweet(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderLockTweet(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderCollectionTweet(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderStarTweet(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderDeleteTweet(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderCreateTweet(c *gin.Context, data *web.CreateTweetResp, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, data, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderDownloadAttachment(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderDownloadAttachmentPrecheck(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) RenderUploadAttachment(c *gin.Context, err mir.Error) {
|
||
2 years ago
|
r.RenderAny(c, nil, err)
|
||
|
}
|
||
|
|
||
2 years ago
|
func (r *UnimplementedPrivRender) mustEmbedUnimplementedPrivRender() {}
|
||
2 years ago
|
|
||
2 years ago
|
// UnimplementedPrivBinding can be embedded to have forward compatible implementations.
|
||
|
type UnimplementedPrivBinding struct {
|
||
2 years ago
|
BindAny func(*gin.Context, any) mir.Error
|
||
|
}
|
||
|
|
||
2 years ago
|
func (b *UnimplementedPrivBinding) BindCreateTweet(c *gin.Context) (*web.CreateTweetReq, mir.Error) {
|
||
2 years ago
|
obj := new(web.CreateTweetReq)
|
||
|
err := b.BindAny(c, obj)
|
||
|
return obj, err
|
||
|
}
|
||
|
|
||
2 years ago
|
func (b *UnimplementedPrivBinding) mustEmbedUnimplementedPrivBinding() {}
|