Files
ai_soc_sw/projects/P01_errlens_app/docs/03_接口定义.md
T

95 lines
1.1 KiB
Markdown
Raw Normal View History

# P01_errlens_app - 接口定义
## API 基础路径
`/api/v1`
## 认证方式
JWT Token,放在 Authorization 头:
```
Authorization: Bearer <token>
```
## 接口列表
### 1. 代码分析
#### POST /api/v1/analyze
分析代码中的错误
**请求体:**
```json
{
"code": "string",
"language": "string",
"options": {
"strict": true
}
}
```
**响应:**
```json
{
"success": true,
"errors": [
{
"line": 10,
"column": 5,
"type": "error",
"message": "变量未定义",
"suggestion": "建议在使用前定义变量"
}
]
}
```
### 2. 用户管理
#### POST /api/v1/users/login
用户登录
**请求体:**
```json
{
"email": "string",
"password": "string"
}
```
**响应:**
```json
{
"success": true,
"token": "string",
"user": {
"id": "string",
"email": "string",
"name": "string"
}
}
```
### 3. 修复建议
#### POST /api/v1/fix
获取修复建议
**请求体:**
```json
{
"code": "string",
"error": {
"type": "string",
"message": "string"
}
}
```
**响应:**
```json
{
"success": true,
"fixedCode": "string",
"explanation": "string"
}
```