api

package
v0.0.0-...-611b6d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package api is the API layer of the application. It defines the API of the application.

Index

Constants

This section is empty.

Variables

View Source
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

func NewFavoriteAction(like *logic.Like) *API

NewFavoriteAction godoc @Summary 赞操作 @Description 赞操作 @Tags 互动接口 @Produce json @Param favorite formData types.FavoriteActionReq true "用户消息信息" @Success 200 {object} types.FavoriteActionResp @Router /favorite/action/ [POST]

func NewFavoriteList

func NewFavoriteList(list *logic.LikeList) *API

NewFavoriteList godoc @Summary 点赞列表 @Description 点赞列表 @Tags 互动接口 @Produce json @Param favorite query types.FavoriteListReq true "请求信息" @Success 200 {object} types.FavoriteListResp @Router /favorite/list/ [get]

func NewFeed

func NewFeed(f *logic.Feed) *API

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

func NewLogin(l *logic.Login) *API

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

func NewRegister(l *logic.Register) *API

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

func NewUpload(upload *logic.Upload) *API

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL