feat(reset): 以构造器模式重构
- 加了大文件传输自定义分片协议 BREAKING CHANGES: 0.1.0(latest)
This commit is contained in:
59
api/index.ts
59
api/index.ts
@@ -1,19 +1,44 @@
|
||||
// 导出API工厂函数和默认实例
|
||||
export { createApi, api } from './factory';
|
||||
// 导出公共接口和常量
|
||||
export { API_ENDPOINTS } from './common';
|
||||
export type { ApiError } from './common';
|
||||
|
||||
// 导出API类型和配置
|
||||
export {
|
||||
API_ENDPOINTS,
|
||||
ApiStatusCode,
|
||||
ApiErrorType,
|
||||
DEFAULT_REQUEST_CONFIG,
|
||||
DEFAULT_PAGINATION_CONFIG,
|
||||
type ApiClient,
|
||||
type ApiResponse,
|
||||
type PaginatedResponse,
|
||||
type ErrorResponse
|
||||
} from './types';
|
||||
// 导出帖子相关API
|
||||
export { PostApiService } from './post-api';
|
||||
|
||||
// 向后兼容的导出
|
||||
export { apiClient } from './client';
|
||||
export { postApi, userApi, chatApi, modelApi } from './modules';
|
||||
// 导出聊天相关API
|
||||
export { ChatApiService } from './chat-api';
|
||||
|
||||
// 导出模型相关API
|
||||
export { ModelApiService } from './model-api';
|
||||
|
||||
// 导出用户相关API
|
||||
export { UserApiService } from './user-api';
|
||||
|
||||
// 导出上传相关API
|
||||
export { UploadApiService } from './upload-api';
|
||||
|
||||
/**
|
||||
* API模块入口
|
||||
*
|
||||
* 本模块提供了所有业务相关的API服务,包括:
|
||||
* - 帖子相关:创建、查询、点赞、收藏等操作
|
||||
* - 聊天相关:会话管理、消息发送与接收
|
||||
* - 模型相关:模型查询、评论、点赞等
|
||||
* - 用户相关:登录、注册、个人资料管理
|
||||
*
|
||||
* 所有API服务都使用装饰器模式实现,通过ApiClientBound装饰器注入HTTP客户端实例,
|
||||
* 使用HTTP方法装饰器(GET、POST等)定义请求方法和路径,
|
||||
* 通过Request装饰器自动处理请求逻辑。
|
||||
*/
|
||||
import { postApi } from './post-api';
|
||||
import { chatApi } from './chat-api';
|
||||
import { modelApi } from './model-api';
|
||||
import { userApi } from './user-api';
|
||||
import { uploadApi } from './upload-api';
|
||||
export const api = {
|
||||
post: postApi,
|
||||
chat: chatApi,
|
||||
model: modelApi,
|
||||
user: userApi,
|
||||
upload: uploadApi,
|
||||
};
|
||||
Reference in New Issue
Block a user