60 lines
1.3 KiB
Markdown
60 lines
1.3 KiB
Markdown
# API 参考
|
||
|
||
## 基础地址
|
||
|
||
```
|
||
https://suites.mercator.cn
|
||
```
|
||
|
||
## 认证
|
||
|
||
```bash
|
||
Authorization: Bearer mk_xxxxxxxxxxxxx
|
||
```
|
||
|
||
API Key 从 https://auth.mercator.cn 获取。
|
||
|
||
## 套件 API
|
||
|
||
| 方法 | 端点 | 说明 |
|
||
|------|------|------|
|
||
| GET | `/api/v1/suites` | 套件列表(支持 `?category=` `?platform=linux/windows/all` 筛选) |
|
||
| GET | `/api/v1/suites/{id}` | 套件详情 |
|
||
| PATCH | `/api/v1/suites/{id}` | 更新套件 |
|
||
|
||
## 发布 API
|
||
|
||
| 方法 | 端点 | 说明 |
|
||
|------|------|------|
|
||
| POST | `/api/v1/publish/upload` | 发布套件(上传 TGZ 包 + `platform` 字段 + 需 Gitea Token) |
|
||
|
||
## 完整文档
|
||
|
||
自动生成的全量 API 文档:
|
||
[https://suites.mercator.cn/docs](https://suites.mercator.cn/docs)
|
||
|
||
## 错误码
|
||
|
||
| 状态码 | 说明 |
|
||
|--------|------|
|
||
| 200 | 成功 |
|
||
| 201 | 创建成功 |
|
||
| 400 | 请求参数错误 |
|
||
| 401 | 未认证或 API Key 无效 |
|
||
| 403 | 权限不足 |
|
||
| 404 | 资源不存在 |
|
||
| 409 | 资源冲突 |
|
||
| 422 | 参数校验失败 |
|
||
| 500 | 服务器内部错误 |
|
||
|
||
|
||
### POST /api/v1/publish/upload
|
||
|
||
**参数:**
|
||
|
||
| 参数 | 必填 | 类型 | 说明 |
|
||
|------|------|------|------|
|
||
| `file` | ✅ | File | 套件压缩包(含 workflow.yaml + scripts/)|
|
||
| `gitea_token` | ✅ | string | 发布者的 Gitea Token(需包写入权限) |
|
||
|
||
发布到 `SuiteHub` 组织下,包名为英文 slug。 |