import { GET, POST, ApiClientBound, Request } from '../decorators'; import { API_ENDPOINTS } from './common'; import type { GetModelsRequest, GetModelsResponse, GetModelCommentsRequest, GetModelCommentsResponse, CreateModelCommentRequest, CreateModelCommentResponse, LikeModelRequest, LikeModelResponse, } from '../types/model/api'; import type { AxiosHttpClient } from '../client'; /** * 模型相关API服务类 */ @ApiClientBound export class ModelApiService { // 语法要求 declare client: AxiosHttpClient; /** * 获取模型列表 * @param request 获取模型列表请求参数 * @returns 获取模型列表响应 * @throws ApiError 当请求失败时抛出 */ @GET(API_ENDPOINTS.MODELS) @Request async getModels(_request: GetModelsRequest): Promise { throw new Error('Decorated by @Request and should never be executed.'); } /** * 获取模型评论列表 * @param request 获取模型评论列表请求参数 * @returns 获取模型评论列表响应 * @throws ApiError 当请求失败时抛出 */ @GET(API_ENDPOINTS.MODEL_ONE_COMMENTS) @Request async getModelComments(_request: GetModelCommentsRequest): Promise { // 实际请求逻辑由Request装饰器处理 throw new Error('Decorated by @Request and should never be executed.'); } /** * 发表模型评论 * @param request 发表模型评论请求参数 * @returns 发表模型评论响应 * @throws ApiError 当请求失败时抛出 */ @POST(API_ENDPOINTS.MODEL_ONE_COMMENTS) @Request async createModelComment(_request: CreateModelCommentRequest): Promise { // 实际请求逻辑由Request装饰器处理 throw new Error('Decorated by @Request and should never be executed.'); } /** * 点赞模型 * @param request 包含modelId的请求参数 * @returns 点赞响应 * @throws ApiError 当请求失败时抛出 */ @POST(API_ENDPOINTS.MODEL_ONE_LIKES) @Request async likeModel(_request: LikeModelRequest): Promise { // 实际请求逻辑由Request装饰器处理 throw new Error('Decorated by @Request and should never be executed.'); } } // 创建单例实例 export const modelApi = new ModelApiService();