Documentation
¶
Overview ¶
Package api is the API layer of the application. It defines the API of the application.
Index ¶
- Variables
- func WrapperFunc[Req any, Resp any](biz func(context.Context, *Req) (*Resp, error)) echo.HandlerFunc
- type API
- func NewCommentAction(action *logic.CommentAction) *API
- func NewCommentList(list *logic.CommentList) *API
- func NewFavoriteAction(like *logic.Like) *API
- func NewFavoriteList(list *logic.LikeList) *API
- func NewFeed(f *logic.Feed) *API
- func NewLogin(l *logic.Login) *API
- func NewMessageAction() *API
- func NewMessageChat() *API
- func NewPublishList(list *logic.PublishList) *API
- func NewRegister(l *logic.Register) *API
- func NewRelationAction(action *logic.FollowAction) *API
- func NewRelationFollowList() *API
- func NewRelationFollowerList() *API
- func NewRelationFriendList() *API
- func NewUpload(upload *logic.Upload) *API
- func NewUserInfo(profile *logic.UserProfile) *API
- type CustomValidator
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Module("api", fx.Provide( wrapPublic(NewRegister), wrapPublic(NewLogin), wrapOptional(NewUserInfo), wrapOptional(NewFeed), wrapOptional(NewPublishList), wrapOptional(NewCommentList), wrapOptional(NewFavoriteList), wrapPrivate(NewUpload), wrapPrivate(NewFavoriteAction), wrapPrivate(NewCommentAction), wrapPrivate(NewRelationAction), wrapPrivate(NewRelationFollowList), wrapPrivate(NewRelationFollowerList), wrapPrivate(NewRelationFriendList), wrapPrivate(NewMessageChat), wrapPrivate(NewMessageAction), ), )
Module is the module for api it provides all the APIs
Functions ¶
func WrapperFunc ¶
func WrapperFunc[Req any, Resp any](biz func(context.Context, *Req) (*Resp, error)) echo.HandlerFunc
WrapperFunc wrapper function to echo.HandlerFunc
Types ¶
type API ¶
type API struct {
Method string
Path string
Handler echo.HandlerFunc
}
API is a struct for organizing echo.HandlerFunc
func NewCommentAction ¶
func NewCommentAction(action *logic.CommentAction) *API
NewCommentAction godoc @Summary 评论操作 @Description 评论操作 @Tags 互动接口 @Accept x-www-form-urlencoded @Produce json @Param user formData types.CommentActionReq true "评论信息" @Success 200 {object} types.CommentActionResp @Router /comment/action/ [post]
func NewCommentList ¶
func NewCommentList(list *logic.CommentList) *API
NewCommentList godoc @Summary 评论列表 @Description 评论列表 @Tags 互动接口 @Produce json @Param user_id query types.CommentListReq true "用户信息" @Success 200 {object} types.CommentListResp @Router /comment/list/ [get]
func NewFavoriteAction ¶
NewFavoriteAction godoc @Summary 赞操作 @Description 赞操作 @Tags 互动接口 @Produce json @Param favorite formData types.FavoriteActionReq true "用户消息信息" @Success 200 {object} types.FavoriteActionResp @Router /favorite/action/ [POST]
func NewFavoriteList ¶
NewFavoriteList godoc @Summary 点赞列表 @Description 点赞列表 @Tags 互动接口 @Produce json @Param favorite query types.FavoriteListReq true "请求信息" @Success 200 {object} types.FavoriteListResp @Router /favorite/list/ [get]
func NewFeed ¶
NewFeed godoc @Summary 获取视频列表 @Description 获取视频列表 @Tags 基础接口 @Accept x-www-form-urlencoded @Produce json @Param feed query types.FeedReq true "视频列表请求参数" @Success 200 {object} types.FeedResp @Router /feed/ [get]
func NewLogin ¶
NewLogin godoc @Summary 用户登陆 @Description 用户登陆 @Tags 基础接口 @Accept x-www-form-urlencoded @Produce json @Param user formData types.UserReq true "用户信息" @Success 200 {object} types.UserResp @Router /user/login/ [post]
func NewMessageAction ¶
func NewMessageAction() *API
NewMessageAction godoc @Summary 消息操作 @Description 消息操作 @Tags 社交接口 @Accept x-www-form-urlencoded @Produce json @Param message query types.MessageActionReq true "用户消息" @Success 200 {object} types.MessageActionResp @Router /message/action/ [post]
func NewMessageChat ¶
func NewMessageChat() *API
NewMessageChat godoc @Summary 聊天记录 @Description 聊天记录 @Tags 社交接口 @Accept x-www-form-urlencoded @Produce json @Param message query types.MessageListReq true "用户信息" @Success 200 {object} types.MessageListResp @Router /message/chat/ [get]
func NewPublishList ¶
func NewPublishList(list *logic.PublishList) *API
NewPublishList godoc @Summary 获取视频列表 @Description 获取视频列表 @Tags 基础接口 @Produce json @Param param query types.PublishListReq true "获取视频列表参数" @Success 200 {object} types.PublishListResp @Router /publish/list/ [get]
func NewRegister ¶
NewRegister godoc @Summary 用户注册 @Description 用户注册 @Tags 基础接口 @Accept x-www-form-urlencoded @Produce json @Param user formData types.UserReq true "用户信息" @Success 200 {object} types.UserResp @Router /user/register/ [post]
func NewRelationAction ¶
func NewRelationAction(action *logic.FollowAction) *API
NewRelationAction godoc @Summary 关系操作 @Description 关系操作 @Tags 社交接口 @Accept x-www-form-urlencoded @Produce json @Param relation formData types.RelationActionReq true "用户信息" @Success 200 {object} types.RelationActionResp @Router /relation/action/ [post]
func NewRelationFollowList ¶
func NewRelationFollowList() *API
NewRelationFollowList godoc @Summary 用户关注列表 @Description 用户关注列表 @Tags 社交接口 @Accept x-www-form-urlencoded @Produce json @Param relation formData types.RelationFollowListReq true "用户信息" @Success 200 {object} types.RelationFollowListResp @Router /relation/follow/list/ [get]
func NewRelationFollowerList ¶
func NewRelationFollowerList() *API
NewRelationFollowerList godoc @Summary 用户粉丝列表 @Description 用户粉丝列表 @Tags 社交接口 @Accept x-www-form-urlencoded @Produce json @Param relation formData types.RelationFollowerListReq true "用户信息" @Success 200 {object} types.RelationFollowerListResp @Router /relation/follower/list/ [get]
func NewRelationFriendList ¶
func NewRelationFriendList() *API
NewRelationFriendList godoc @Summary 用户好友列表 @Description 用户好友列表 @Tags 社交接口 @Accept x-www-form-urlencoded @Produce json @Param relation formData types.RelationFriendListReq true "用户信息" @Success 200 {object} types.RelationFriendListResp @Router /relation/friend/list/ [get]
func NewUpload ¶
NewUpload upload video @Summary 上传视频 @Description 上传视频 @Tags 基础接口 @Produce json @Accept mpfd @Param token formData string true "Authorization token" @Param title formData string true "Data title" @Param data formData file true "Data" @Success 200 {object} types.UploadResp @Router /publish/action/ [post]
func NewUserInfo ¶
func NewUserInfo(profile *logic.UserProfile) *API
NewUserInfo godoc @Summary 用户信息 @Description 用户信息 @Tags 基础接口 @Accept x-www-form-urlencoded @Produce json @Param user query types.UserInfoReq true "用户信息" @Success 200 {object} types.UserInfoResp @Router /user/ [get]
type CustomValidator ¶
type CustomValidator struct {
// contains filtered or unexported fields
}
CustomValidator is the custom validator for echo
func NewCustomValidator ¶
func NewCustomValidator() *CustomValidator
NewCustomValidator returns a new CustomValidator
func (*CustomValidator) Validate ¶
func (cv *CustomValidator) Validate(i any) error
Validate validates the input