99 lines
1.7 KiB
Protocol Buffer
99 lines
1.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
package files;
|
|
|
|
option go_package = "./;files";
|
|
|
|
|
|
service File{
|
|
rpc List(FileListReq) returns (FileListResp) {} // 获取当前路径下的文件列表
|
|
rpc Create(CreateReq) returns (CreateResp) {} // 创建文件夹
|
|
rpc Delete(DeleteReq) returns (DeleteResp) {} // 删除文件或文件夹
|
|
rpc Upload(UploadReq) returns (UploadResp) {} // 上传文件
|
|
rpc Search(searchReq) returns (searchResp) {} // 搜索
|
|
}
|
|
|
|
message FileListReq{
|
|
string path = 1; // 目标文件夹路径
|
|
string UserSpacePath = 2; // 用户空间的路径
|
|
Sorting sorting = 3;
|
|
}
|
|
|
|
message Items {
|
|
string path = 1;
|
|
string name = 2;
|
|
int64 size = 3;
|
|
string extension = 4;
|
|
string modified = 5;
|
|
string mode = 6;
|
|
bool isDir = 7;
|
|
bool isSymlink = 8;
|
|
string type = 9;
|
|
}
|
|
|
|
message Sorting {
|
|
string by = 1;
|
|
bool asc = 2;
|
|
}
|
|
|
|
message FileListResp {
|
|
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;
|
|
string mode = 10;
|
|
bool isDir = 11;
|
|
bool isSymlink = 12;
|
|
string type = 13;
|
|
}
|
|
|
|
|
|
message CreateReq{
|
|
string path = 1;
|
|
string userSpacePath = 2;
|
|
}
|
|
|
|
message CreateResp{
|
|
|
|
}
|
|
|
|
|
|
message DeleteReq{
|
|
string path = 1;
|
|
string userSpacePath = 2;
|
|
}
|
|
|
|
message DeleteResp{
|
|
|
|
}
|
|
|
|
message UploadReq{
|
|
string path = 1;
|
|
string userSpacePath = 2;
|
|
bytes content =3;
|
|
|
|
}
|
|
|
|
message UploadResp{
|
|
|
|
}
|
|
|
|
message searchReq{
|
|
string path = 1;
|
|
string userSpacePath = 2;
|
|
string query = 3;
|
|
}
|
|
|
|
message searchResp{
|
|
|
|
message Nested {
|
|
bool dir = 1;
|
|
string path = 2;
|
|
}
|
|
|
|
repeated Nested items = 1;
|
|
} |