Files
2025-11-18 03:36:49 +08:00

115 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# FileService
> 文件相关服务
---
## createFile
> 创建文件
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/FileService/createFile`
- RPC`rpc createFile (CreateFileRequest) returns (CreateFileResponse);`
**请求对象 (`CreateFileRequest`)**
```json
{
"filename": "string // 文件名",
"size": "int64 // 数量通常不能小于0",
"isPublic": "bool",
"mimeType": "string",
"type": "string"
}
```
**响应对象 (`CreateFileResponse`)**
```json
{
"fileId": "int64 // 文件ID"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/FileService/createFile" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## findEnabledFile
> 查找文件
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/FileService/findEnabledFile`
- RPC`rpc findEnabledFile (FindEnabledFileRequest) returns (FindEnabledFileResponse);`
**请求对象 (`FindEnabledFileRequest`)**
```json
{
"fileId": "int64 // 文件ID"
}
```
**响应对象 (`FindEnabledFileResponse`)**
```json
{
"file": "File // 文件信息"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/FileService/findEnabledFile" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## updateFileFinished
> 将文件置为已完成
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/FileService/updateFileFinished`
- RPC`rpc updateFileFinished (UpdateFileFinishedRequest) returns (RPCSuccess);`
**请求对象 (`UpdateFileFinishedRequest`)**
```json
{
"fileId": "int64 // 文件ID"
}
```
**响应对象 (`RPCSuccess`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/FileService/updateFileFinished" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---