feat(api): 添加热门卡片与榜单接口及实现
- 新增热门帖子、热门作者、榜单接口及实现 - 新增api-documentation,更好的ai协作 - 修复types没有导出的问题 BREAKING CHANGES: 1.0.0->1.1.0(latest)
This commit is contained in:
@@ -16,7 +16,11 @@ import type {
|
||||
GetCommentsRequest,
|
||||
GetCommentsResponse,
|
||||
LikeCommentRequest,
|
||||
LikeCommentResponse
|
||||
LikeCommentResponse,
|
||||
GetHotPostsRequest,
|
||||
GetHotPostsResponse,
|
||||
GetPostRankingRequest,
|
||||
GetPostRankingResponse
|
||||
} from '@/types/post/api';
|
||||
|
||||
// 帖子API服务工厂函数
|
||||
@@ -61,5 +65,15 @@ export const postApi = (client: ApiClient) => ({
|
||||
// 点赞评论
|
||||
likeComment: ({ commentId }: LikeCommentRequest): Promise<LikeCommentResponse> => {
|
||||
return client.put(`/comments/${commentId}/like`);
|
||||
},
|
||||
|
||||
// 获取热门帖子
|
||||
getHotPosts: (params: GetHotPostsRequest = {}): Promise<GetHotPostsResponse> => {
|
||||
return client.get('/posts/hot', { params });
|
||||
},
|
||||
|
||||
// 获取帖子榜单
|
||||
getPostRanking: (params: GetPostRankingRequest = {}): Promise<GetPostRankingResponse> => {
|
||||
return client.get('/posts/ranking', { params });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,7 +9,11 @@ import type {
|
||||
UserProfileUpdateRequest,
|
||||
UserProfileUpdateResponse,
|
||||
UserFollowRequest,
|
||||
UserFollowResponse
|
||||
UserFollowResponse,
|
||||
GetHotAuthorsRequest,
|
||||
GetHotAuthorsResponse,
|
||||
GetAuthorRankingRequest,
|
||||
GetAuthorRankingResponse
|
||||
} from '@/types/user';
|
||||
|
||||
// 用户API服务工厂函数
|
||||
@@ -47,5 +51,15 @@ export const userApi = (client: ApiClient) => ({
|
||||
// 取消关注用户
|
||||
unfollowUser: ({ userId }: UserFollowRequest): Promise<UserFollowResponse> => {
|
||||
return client.delete(`/user/follow/${userId}`);
|
||||
},
|
||||
|
||||
// 获取热门作者
|
||||
getHotAuthors: (params: GetHotAuthorsRequest = {}): Promise<GetHotAuthorsResponse> => {
|
||||
return client.get('/user/hot', { params });
|
||||
},
|
||||
|
||||
// 获取作者榜单
|
||||
getAuthorRanking: (params: GetAuthorRankingRequest = {}): Promise<GetAuthorRankingResponse> => {
|
||||
return client.get('/user/ranking', { params });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user