handlers

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

定义 Gin HTTP API 的 handler

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommentAction

func CommentAction(c *gin.Context)

传递 评论操作 的上下文至 Comment 服务的 RPC 客户端, 并获取相应的响应.

func CommentList

func CommentList(c *gin.Context)

传递 获取评论列表操作 的上下文至 Comment 服务的 RPC 客户端, 并获取相应的响应.

func FavoriteAction

func FavoriteAction(c *gin.Context)

传递 点赞操作 的上下文至 Favorite 服务的 RPC 客户端, 并获取相应的响应.

func FavoriteList

func FavoriteList(c *gin.Context)

传递 获取点赞列表操作 的上下文至 Favorite 服务的 RPC 客户端, 并获取相应的响应.

func GetUserById

func GetUserById(c *gin.Context)

传递 获取注册用户`UserID`操作 的上下文至 User 服务的 RPC 客户端, 并获取相应的响应.

func GetUserFeed

func GetUserFeed(c *gin.Context)

传递 获取用户视频流操作 的上下文至 Feed 服务的 RPC 客户端, 并获取相应的响应.

func Login

func Login(c *gin.Context)

传递 注册用户登录操作 的上下文至 User 服务的 RPC 客户端, 并获取相应的响应.

func PublishAction

func PublishAction(c *gin.Context)

传递 发布视频操作 的上下文至 Publish 服务的 RPC 客户端, 并获取相应的响应.

func PublishList

func PublishList(c *gin.Context)

传递 获取视频列表操作 的上下文至 Publish 服务的 RPC 客户端, 并获取相应的响应.

func Register

func Register(c *gin.Context)

传递 注册用户操作 的上下文至 User 服务的 RPC 客户端, 并获取相应的响应.

func RelationAction

func RelationAction(c *gin.Context)

传递 关注操作 的上下文至 Relation 服务的 RPC 客户端, 并获取相应的响应.

func RelationFollowList

func RelationFollowList(c *gin.Context)

传递 获取正在关注列表操作 的上下文至 Relation 服务的 RPC 客户端, 并获取相应的响应.

func RelationFollowerList

func RelationFollowerList(c *gin.Context)

传递 获取粉丝列表操作 的上下文至 Relation 服务的 RPC 客户端, 并获取相应的响应.

func SendResponse

func SendResponse(c *gin.Context, response interface{})

SendResponse pack response

Types

type CommentActionParam

type CommentActionParam struct {
	UserId      int64   `json:"user_id,omitempty"`      // 用户id
	Token       string  `json:"token,omitempty"`        // 用户鉴权token
	VideoId     int64   `json:"video_id,omitempty"`     // 视频id
	ActionType  int32   `json:"action_type,omitempty"`  // 1-发布评论,2-删除评论
	CommentText *string `json:"comment_text,omitempty"` // 用户填写的评论内容,在action_type=1的时候使用
	CommentId   *int64  `json:"comment_id,omitempty"`   // 要删除的评论id,在action_type=2的时候使用
}

评论操作 handler 输入参数

type CommentListParam

type CommentListParam struct {
	Token   string `json:"token,omitempty"`    // 用户鉴权token
	VideoId int64  `json:"video_id,omitempty"` // 视频id
}

获取评论列表 handler 输入参数

type FavoriteActionParam

type FavoriteActionParam struct {
	UserId     int64  `json:"user_id,omitempty"`     // 用户id
	Token      string `json:"token,omitempty"`       // 用户鉴权token
	VideoId    int64  `json:"video_id,omitempty"`    // 视频id
	ActionType int32  `json:"action_type,omitempty"` // 1-点赞,2-取消点赞
}

点赞操作 handler 输入参数

type FeedParam

type FeedParam struct {
	LatestTime *int64  `json:"latest_time,omitempty"` // 可选参数,限制返回视频的最新投稿时间戳,精确到秒,不填表示当前时间
	Token      *string `json:"token,omitempty"`       // 可选参数,登录用户设置
}

视频流 handler 输入参数

type PublishActionParam

type PublishActionParam struct {
	Token string `json:"token,omitempty"` // 用户鉴权token
	Data  []byte `json:"data,omitempty"`  // 视频数据
	Title string `json:"title,omitempty"` // 视频标题
}

发布视频操作 handler 输入参数

type RelationActionParam

type RelationActionParam struct {
	UserId     int64  `json:"user_id,omitempty"`     // 用户id
	Token      string `json:"token,omitempty"`       // 用户鉴权token
	ToUserId   int64  `json:"to_user_id,omitempty"`  // 对方用户id
	ActionType int32  `json:"action_type,omitempty"` // 1-关注,2-取消关注
}

关注操作 handler 输入参数

type UserParam

type UserParam struct {
	UserId int64  `json:"user_id,omitempty"` // 用户id
	Token  string `json:"token,omitempty"`   // 用户鉴权token
}

用户信息 输出参数

type UserRegisterParam

type UserRegisterParam struct {
	UserName string `json:"username"` // 用户名
	PassWord string `json:"password"` // 用户密码
}

用户注册 handler 输入参数

Jump to

Keyboard shortcuts

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