|
|
|
// Code generated by go-mir. DO NOT EDIT.
|
|
|
|
// versions:
|
|
|
|
// - mir v4.0.0
|
|
|
|
|
|
|
|
package v1
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/alimy/mir/v4"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/rocboss/paopao-ce/internal/model/web"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Priv interface {
|
|
|
|
_default_
|
|
|
|
|
|
|
|
// Chain provide handlers chain for gin
|
|
|
|
Chain() gin.HandlersChain
|
|
|
|
|
|
|
|
UnfollowTopic(*web.UnfollowTopicReq) mir.Error
|
|
|
|
FollowTopic(*web.FollowTopicReq) mir.Error
|
|
|
|
StickTopic(*web.StickTopicReq) (*web.StickTopicResp, mir.Error)
|
|
|
|
ThumbsDownTweetReply(*web.TweetReplyThumbsReq) mir.Error
|
|
|
|
ThumbsUpTweetReply(*web.TweetReplyThumbsReq) mir.Error
|
|
|
|
ThumbsDownTweetComment(*web.TweetCommentThumbsReq) mir.Error
|
|
|
|
ThumbsUpTweetComment(*web.TweetCommentThumbsReq) mir.Error
|
|
|
|
DeleteCommentReply(*web.DeleteCommentReplyReq) mir.Error
|
|
|
|
CreateCommentReply(*web.CreateCommentReplyReq) (*web.CreateCommentReplyResp, mir.Error)
|
|
|
|
DeleteComment(*web.DeleteCommentReq) mir.Error
|
|
|
|
CreateComment(*web.CreateCommentReq) (*web.CreateCommentResp, mir.Error)
|
|
|
|
VisibleTweet(*web.VisibleTweetReq) (*web.VisibleTweetResp, mir.Error)
|
|
|
|
HighlightTweet(*web.HighlightTweetReq) (*web.HighlightTweetResp, mir.Error)
|
|
|
|
StickTweet(*web.StickTweetReq) (*web.StickTweetResp, mir.Error)
|
|
|
|
LockTweet(*web.LockTweetReq) (*web.LockTweetResp, mir.Error)
|
|
|
|
CollectionTweet(*web.CollectionTweetReq) (*web.CollectionTweetResp, mir.Error)
|
|
|
|
StarTweet(*web.StarTweetReq) (*web.StarTweetResp, mir.Error)
|
|
|
|
DeleteTweet(*web.DeleteTweetReq) mir.Error
|
|
|
|
CreateTweet(*web.CreateTweetReq) (*web.CreateTweetResp, mir.Error)
|
|
|
|
DownloadAttachment(*web.DownloadAttachmentReq) (*web.DownloadAttachmentResp, mir.Error)
|
|
|
|
DownloadAttachmentPrecheck(*web.DownloadAttachmentPrecheckReq) (*web.DownloadAttachmentPrecheckResp, mir.Error)
|
|
|
|
UploadAttachment(*web.UploadAttachmentReq) (*web.UploadAttachmentResp, mir.Error)
|
|
|
|
|
|
|
|
mustEmbedUnimplementedPrivServant()
|
|
|
|
}
|
|
|
|
|
|
|
|
// RegisterPrivServant register Priv servant to gin
|
|
|
|
func RegisterPrivServant(e *gin.Engine, s Priv) {
|
|
|
|
router := e.Group("v1")
|
|
|
|
// use chain for router
|
|
|
|
middlewares := s.Chain()
|
|
|
|
router.Use(middlewares...)
|
|
|
|
|
|
|
|
// register routes info to router
|
|
|
|
router.Handle("POST", "/topic/unfollow", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.UnfollowTopicReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.UnfollowTopic(req))
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/topic/follow", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.FollowTopicReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.FollowTopic(req))
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/topic/stick", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.StickTopicReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.StickTopic(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/tweet/reply/thumbsdown", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.TweetReplyThumbsReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.ThumbsDownTweetReply(req))
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/tweet/reply/thumbsup", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.TweetReplyThumbsReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.ThumbsUpTweetReply(req))
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/tweet/comment/thumbsdown", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.TweetCommentThumbsReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.ThumbsDownTweetComment(req))
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/tweet/comment/thumbsup", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.TweetCommentThumbsReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.ThumbsUpTweetComment(req))
|
|
|
|
})
|
|
|
|
router.Handle("DELETE", "/post/comment/reply", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.DeleteCommentReplyReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.DeleteCommentReply(req))
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post/comment/reply", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.CreateCommentReplyReq)
|
|
|
|
var bv _binding_ = req
|
|
|
|
if err := bv.Bind(c); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.CreateCommentReply(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("DELETE", "/post/comment", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.DeleteCommentReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.DeleteComment(req))
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post/comment", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.CreateCommentReq)
|
|
|
|
var bv _binding_ = req
|
|
|
|
if err := bv.Bind(c); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.CreateComment(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post/visibility", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.VisibleTweetReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.VisibleTweet(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post/highlight", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.HighlightTweetReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.HighlightTweet(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post/stick", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.StickTweetReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.StickTweet(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post/lock", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.LockTweetReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.LockTweet(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post/collection", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.CollectionTweetReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.CollectionTweet(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post/star", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.StarTweetReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.StarTweet(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("DELETE", "/post", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.DeleteTweetReq)
|
|
|
|
if err := s.Bind(c, req); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Render(c, nil, s.DeleteTweet(req))
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/post", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.CreateTweetReq)
|
|
|
|
var bv _binding_ = req
|
|
|
|
if err := bv.Bind(c); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.CreateTweet(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("GET", "/attachment", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.DownloadAttachmentReq)
|
|
|
|
var bv _binding_ = req
|
|
|
|
if err := bv.Bind(c); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.DownloadAttachment(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("GET", "/attachment/precheck", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.DownloadAttachmentPrecheckReq)
|
|
|
|
var bv _binding_ = req
|
|
|
|
if err := bv.Bind(c); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.DownloadAttachmentPrecheck(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
router.Handle("POST", "/attachment", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
req := new(web.UploadAttachmentReq)
|
|
|
|
var bv _binding_ = req
|
|
|
|
if err := bv.Bind(c); err != nil {
|
|
|
|
s.Render(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.UploadAttachment(req)
|
|
|
|
s.Render(c, resp, err)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnimplementedPrivServant can be embedded to have forward compatible implementations.
|
|
|
|
type UnimplementedPrivServant struct{}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) Chain() gin.HandlersChain {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) UnfollowTopic(req *web.UnfollowTopicReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) FollowTopic(req *web.FollowTopicReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) StickTopic(req *web.StickTopicReq) (*web.StickTopicResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) ThumbsDownTweetReply(req *web.TweetReplyThumbsReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) ThumbsUpTweetReply(req *web.TweetReplyThumbsReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) ThumbsDownTweetComment(req *web.TweetCommentThumbsReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) ThumbsUpTweetComment(req *web.TweetCommentThumbsReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) DeleteCommentReply(req *web.DeleteCommentReplyReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) CreateCommentReply(req *web.CreateCommentReplyReq) (*web.CreateCommentReplyResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) DeleteComment(req *web.DeleteCommentReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) CreateComment(req *web.CreateCommentReq) (*web.CreateCommentResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) VisibleTweet(req *web.VisibleTweetReq) (*web.VisibleTweetResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) HighlightTweet(req *web.HighlightTweetReq) (*web.HighlightTweetResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) StickTweet(req *web.StickTweetReq) (*web.StickTweetResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) LockTweet(req *web.LockTweetReq) (*web.LockTweetResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) CollectionTweet(req *web.CollectionTweetReq) (*web.CollectionTweetResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) StarTweet(req *web.StarTweetReq) (*web.StarTweetResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) DeleteTweet(req *web.DeleteTweetReq) mir.Error {
|
|
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) CreateTweet(req *web.CreateTweetReq) (*web.CreateTweetResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) DownloadAttachment(req *web.DownloadAttachmentReq) (*web.DownloadAttachmentResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) DownloadAttachmentPrecheck(req *web.DownloadAttachmentPrecheckReq) (*web.DownloadAttachmentPrecheckResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) UploadAttachment(req *web.UploadAttachmentReq) (*web.UploadAttachmentResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedPrivServant) mustEmbedUnimplementedPrivServant() {}
|