micro-filebrowser/api/files/files.proto

194 lines
4.0 KiB
Protocol Buffer
Raw Normal View History

2025-05-22 06:26:07 +00:00
syntax = "proto3";
package files;
option go_package = "./;files";
2025-06-24 07:13:27 +00:00
service File {
rpc List(FileListReq) returns (FileListResp) {} // 获取当前路径下的文件列表
rpc Info(FileInfoReq) returns (FileInfoResp) {} // 获取文件信息
rpc Create(CreateReq) returns (CreateResp) {} // 创建文件夹
rpc Delete(DeleteReq) returns (DeleteResp) {} // 删除文件或文件夹
rpc Search(searchReq) returns (searchResp) {} // 搜索
rpc Upload(UploadReq) returns (UploadResp) {} // 文件上传
rpc TusCreate(TusCreateReq) returns (TusCreateResp) {
} // 分块文件上传:创建文件
rpc TusUpload(TusUploadReq) returns (TusUploadResp) {
} // 分块文件上传:上传文件块
rpc ResumableTransfer(ResumableTransferReq) returns (ResumableTransferResp) {
} // 断点续传的grpc实现
rpc Preview(PreviewReq) returns (PreviewResp) {} // 文件预览
rpc Action(ActionReq) returns (ActionResp) {} // 移动文件或重命名文件
rpc DirDownload(DirDownloadReq) returns (stream DirDownloadResp) {
} // 文件夹压缩下载
rpc Usage(UsageReq) returns (UsageResp) {} //查看磁盘使用率
}
message FileListReq {
string path = 1; // 目标文件夹路径
string userSpacePath = 2; // 用户空间的路径
Sorting sorting = 3;
2025-05-22 06:26:07 +00:00
}
message Items {
2025-06-24 07:13:27 +00:00
string path = 1;
string name = 2;
int64 size = 3;
string extension = 4;
string modified = 5;
int64 modTime = 6;
string mode = 7;
bool isDir = 8;
bool isSymlink = 9;
string type = 10;
2025-05-22 06:26:07 +00:00
}
message Sorting {
2025-06-24 07:13:27 +00:00
string by = 1;
bool asc = 2;
2025-05-22 06:26:07 +00:00
}
message FileListResp {
2025-06-24 07:13:27 +00:00
repeated Items items = 1;
int32 numDirs = 2;
int32 numFiles = 3;
Sorting sorting = 4;
string path = 5;
string name = 6;
int64 size = 7;
string extension = 8;
string modified = 9;
int64 modTime = 10;
string mode = 11;
bool isDir = 12;
bool isSymlink = 13;
string type = 14;
2025-05-22 06:26:07 +00:00
}
2025-06-24 07:13:27 +00:00
message CreateReq {
string path = 1;
string userSpacePath = 2;
2025-05-22 06:26:07 +00:00
}
2025-06-24 07:13:27 +00:00
message CreateResp {}
2025-05-22 06:26:07 +00:00
2025-06-24 07:13:27 +00:00
message DeleteReq {
string path = 1;
string userSpacePath = 2;
2025-05-22 06:26:07 +00:00
}
2025-06-24 07:13:27 +00:00
message DeleteResp {}
2025-05-22 06:26:07 +00:00
2025-06-24 07:13:27 +00:00
message UploadReq {
string path = 1;
string userSpacePath = 2;
bytes content = 3;
2025-05-22 06:26:07 +00:00
}
2025-06-24 07:13:27 +00:00
message UploadResp {}
2025-05-22 06:26:07 +00:00
2025-06-24 07:13:27 +00:00
message searchReq {
string path = 1;
string userSpacePath = 2;
string query = 3;
2025-05-22 06:26:07 +00:00
}
2025-06-24 07:13:27 +00:00
message searchResp {
message Nested {
bool isDir = 1;
string path = 2;
string name = 3;
int64 size = 4;
int64 modTime = 5;
}
2025-05-22 06:26:07 +00:00
2025-06-24 07:13:27 +00:00
repeated Nested items = 1;
2025-05-22 08:23:11 +00:00
}
2025-06-24 07:13:27 +00:00
message TusCreateReq {
string path = 1;
string userSpacePath = 2;
bool override = 3;
2025-05-22 08:23:11 +00:00
}
2025-06-24 07:13:27 +00:00
message TusCreateResp {
int64 uploadLength = 1;
int64 uploadOffset = 2;
2025-05-22 08:23:11 +00:00
}
2025-06-24 07:13:27 +00:00
message TusUploadReq {
string path = 1;
string userSpacePath = 2;
int64 uploadOffset = 3;
bytes content = 4;
2025-05-22 08:23:11 +00:00
}
2025-06-24 07:13:27 +00:00
message TusUploadResp { int64 uploadOffset = 1; }
2025-05-23 02:35:22 +00:00
2025-06-24 07:13:27 +00:00
message ResumableTransferReq {
string path = 1;
string userSpacePath = 2;
int64 offset = 3;
int64 length = 4;
2025-05-23 02:35:22 +00:00
}
2025-06-24 07:13:27 +00:00
message ResumableTransferResp { bytes content = 1; }
2025-05-23 02:35:22 +00:00
2025-06-24 07:13:27 +00:00
message FileInfoReq {
string path = 1;
string userSpacePath = 2;
2025-05-23 02:35:22 +00:00
}
2025-06-24 07:13:27 +00:00
message FileInfoResp {
string path = 1;
string name = 2;
int64 size = 3;
string extension = 4;
string modified = 5;
string mode = 6;
int64 modTime = 7;
bool isDir = 8;
bool isSymlink = 9;
string type = 10;
2025-05-26 03:03:37 +00:00
}
2025-06-24 07:13:27 +00:00
message PreviewReq {
string path = 1;
string userSpacePath = 2;
uint32 size = 3; // 预览大小 0256x256, 1:1080x1080
2025-05-26 03:03:37 +00:00
}
2025-06-24 07:13:27 +00:00
message PreviewResp {
bytes content = 1;
string fileName = 2;
int64 modTime = 3;
2025-05-30 08:17:28 +00:00
}
2025-06-24 07:13:27 +00:00
message ActionReq {
string path = 1;
string userSpacePath = 2;
string action = 3;
string destination = 4;
bool override = 5;
bool rename = 6;
2025-05-30 08:17:28 +00:00
}
2025-06-24 07:13:27 +00:00
message ActionResp {}
2025-06-03 02:50:42 +00:00
message DirDownloadReq {
2025-06-24 07:13:27 +00:00
string path = 1;
string userSpacePath = 2;
repeated string files = 3;
string algo = 4;
2025-05-30 08:17:28 +00:00
}
2025-06-24 07:13:27 +00:00
message DirDownloadResp { bytes content = 1; }
2025-06-15 07:51:19 +00:00
2025-06-24 07:13:27 +00:00
message UsageReq {
string path = 1;
string userSpacePath = 2;
2025-06-15 07:51:19 +00:00
}
2025-06-24 07:13:27 +00:00
message UsageResp {
int64 total = 1;
int64 used = 2;
2025-06-15 07:51:19 +00:00
}