115 lines
1.9 KiB
Markdown
115 lines
1.9 KiB
Markdown
# 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 '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|