Files
sundynix-micro-be/app/file/api/file.api
T
2026-04-27 00:02:18 +08:00

61 lines
1.1 KiB
Plaintext

syntax = "v1"
info (
title: "文件服务API"
desc: "文件上传、删除、查询等HTTP接口"
author: "sundynix"
version: "v1.0.0"
)
type (
// 文件信息
FileInfo {
Id string `json:"id"`
Name string `json:"name"`
Url string `json:"url"`
Tag string `json:"tag"`
Key string `json:"key"`
Suffix string `json:"suffix"`
Md5 string `json:"md5"`
}
// 批量ID请求
IdsReq {
Ids []string `json:"ids"`
}
// 文件列表查询
FileListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
Name string `json:"name,optional"`
}
// 文件ID请求
FileIdReq {
Id string `path:"id"`
}
)
// ========== 需要鉴权的接口 ==========
@server (
prefix: /api/file
group: file
jwt: Auth
)
service file-api {
@doc "上传文件"
@handler UploadFile
post /upload returns (FileInfo)
@doc "删除文件"
@handler DeleteFile
delete /delete (IdsReq)
@doc "文件列表"
@handler GetFileList
post /list (FileListReq)
@doc "获取文件信息"
@handler GetFileById
get /:id (FileIdReq) returns (FileInfo)
}