handler

package
v0.0.0-...-b7604bf Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler definition

func New

New returns a new handler with logger and database

func (*Handler) CreateArticle

func (h *Handler) CreateArticle(ctx context.Context, req *pb.CreateAritcleRequest) (*pb.ArticleResponse, error)

CreateArticle creates a article

func (*Handler) CreateComment

func (h *Handler) CreateComment(ctx context.Context, req *pb.CreateCommentRequest) (*pb.CommentResponse, error)

CreateComment create a comment for an article

func (*Handler) CreateUser

func (h *Handler) CreateUser(ctx context.Context, req *pb.CreateUserRequest) (*pb.UserResponse, error)

CreateUser registers a new user

func (*Handler) CurrentUser

func (h *Handler) CurrentUser(ctx context.Context, req *pb.Empty) (*pb.UserResponse, error)

CurrentUser gets a current user

func (*Handler) DeleteArticle

func (h *Handler) DeleteArticle(ctx context.Context, req *pb.DeleteArticleRequest) (*pb.Empty, error)

DeleteArticle deletes an article

func (*Handler) DeleteComment

func (h *Handler) DeleteComment(ctx context.Context, req *pb.DeleteCommentRequest) (*pb.Empty, error)

DeleteComment delete a commnet of the article

func (*Handler) FavoriteArticle

func (h *Handler) FavoriteArticle(ctx context.Context, req *pb.FavoriteArticleRequest) (*pb.ArticleResponse, error)

FavoriteArticle add an article to user favorites

func (*Handler) FollowUser

func (h *Handler) FollowUser(ctx context.Context, req *pb.FollowRequest) (*pb.ProfileResponse, error)

FollowUser follow a user

func (*Handler) GetArticle

func (h *Handler) GetArticle(ctx context.Context, req *pb.GetArticleRequest) (*pb.ArticleResponse, error)

GetArticle gets a article

func (*Handler) GetArticles

func (h *Handler) GetArticles(ctx context.Context, req *pb.GetArticlesRequest) (*pb.ArticlesResponse, error)

GetArticles gets recent articles globally

func (*Handler) GetComments

func (h *Handler) GetComments(ctx context.Context, req *pb.GetCommentsRequest) (*pb.CommentsResponse, error)

GetComments gets comments of the article

func (*Handler) GetFeedArticles

func (h *Handler) GetFeedArticles(ctx context.Context, req *pb.GetFeedArticlesRequest) (*pb.ArticlesResponse, error)

GetFeedArticles gets recent articles from users current user follow

func (*Handler) GetTags

func (h *Handler) GetTags(ctx context.Context, req *pb.Empty) (*pb.TagsResponse, error)

GetTags returns all of tags

func (*Handler) LoginUser

func (h *Handler) LoginUser(ctx context.Context, req *pb.LoginUserRequest) (*pb.UserResponse, error)

LoginUser is existing user login

func (*Handler) ShowProfile

func (h *Handler) ShowProfile(ctx context.Context, req *pb.ShowProfileRequest) (*pb.ProfileResponse, error)

ShowProfile gets a profile

func (*Handler) UnfavoriteArticle

func (h *Handler) UnfavoriteArticle(ctx context.Context, req *pb.UnfavoriteArticleRequest) (*pb.ArticleResponse, error)

UnfavoriteArticle removes an article from user favorites

func (*Handler) UnfollowUser

func (h *Handler) UnfollowUser(ctx context.Context, req *pb.UnfollowRequest) (*pb.ProfileResponse, error)

UnfollowUser unfollow a user

func (*Handler) UpdateArticle

func (h *Handler) UpdateArticle(ctx context.Context, req *pb.UpdateArticleRequest) (*pb.ArticleResponse, error)

UpdateArticle updates an article

func (*Handler) UpdateUser

func (h *Handler) UpdateUser(ctx context.Context, req *pb.UpdateUserRequest) (*pb.UserResponse, error)

UpdateUser updates current user

Jump to

Keyboard shortcuts

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