/** * Generated by orval v7.0.1 🍺 * Do not edit manually. * Serve API * Serve应用接口文档 * OpenAPI spec version: 0.0.1-SNAPSHOT */ import type { ListPostsParams, ListPreviousPostsParams, PostDto, ResponseCreatePostVo, ResponsePageVoListPostVo, ResponsePostVo, ResponseVoid, UpdateHitStatusDto, UpdateViewCountDto, } from "./models"; import { customAxiosInstance } from "../util/axios-instance"; export const getPostController = () => { /** * @summary 获取帖子详情 */ const getPostDetail = (id: number) => { return customAxiosInstance({ url: `/posts/${id}`, method: "GET", }); }; /** * @summary 更新帖子(管理员/本人) */ const updatePost = (id: number, postDto: PostDto) => { return customAxiosInstance({ url: `/posts/${id}`, method: "PUT", headers: { "Content-Type": "application/json" }, data: postDto, }); }; /** * @summary 删除帖子(管理员,逻辑删除) */ const deletePost = (id: number) => { return customAxiosInstance({ url: `/posts/${id}`, method: "DELETE", }); }; /** * @summary 修改查看人数(管理员) */ const updateViewCount = ( id: number, updateViewCountDto: UpdateViewCountDto, ) => { return customAxiosInstance({ url: `/posts/${id}/view-count`, method: "PUT", headers: { "Content-Type": "application/json" }, data: updateViewCountDto, }); }; /** * @summary 设置命中状态(管理员) */ const updateHitStatus = ( id: number, updateHitStatusDto: UpdateHitStatusDto, ) => { return customAxiosInstance({ url: `/posts/${id}/hit-status`, method: "PUT", headers: { "Content-Type": "application/json" }, data: updateHitStatusDto, }); }; /** * @summary 获取帖子列表 */ const listPosts = (params?: ListPostsParams) => { return customAxiosInstance({ url: `/posts`, method: "GET", params, }); }; /** * @summary 创建帖子(仅专家/管理员) */ const createPost = (postDto: PostDto) => { return customAxiosInstance({ url: `/posts`, method: "POST", headers: { "Content-Type": "application/json" }, data: postDto, }); }; /** * @summary 获取专家往期帖子 */ const listPreviousPosts = ( expertId: number, params?: ListPreviousPostsParams, ) => { return customAxiosInstance({ url: `/posts/expert/${expertId}/previous`, method: "GET", params, }); }; return { getPostDetail, updatePost, deletePost, updateViewCount, updateHitStatus, listPosts, createPost, listPreviousPosts, }; }; export type GetPostDetailResult = NonNullable< Awaited["getPostDetail"]>> >; export type UpdatePostResult = NonNullable< Awaited["updatePost"]>> >; export type DeletePostResult = NonNullable< Awaited["deletePost"]>> >; export type UpdateViewCountResult = NonNullable< Awaited["updateViewCount"]>> >; export type UpdateHitStatusResult = NonNullable< Awaited["updateHitStatus"]>> >; export type ListPostsResult = NonNullable< Awaited["listPosts"]>> >; export type CreatePostResult = NonNullable< Awaited["createPost"]>> >; export type ListPreviousPostsResult = NonNullable< Awaited["listPreviousPosts"]>> >;