53 lines
899 B
Protocol Buffer
53 lines
899 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
package file;
|
|
|
|
option go_package = "./file";
|
|
|
|
// ---------- 通用消息 ----------
|
|
|
|
message CommonResp {
|
|
int64 code = 1;
|
|
string msg = 2;
|
|
}
|
|
|
|
// ---------- 文件信息 ----------
|
|
|
|
message FileInfo {
|
|
string id = 1;
|
|
string name = 2;
|
|
string url = 3;
|
|
string tag = 4;
|
|
string key = 5;
|
|
string suffix = 6;
|
|
string md5 = 7;
|
|
int64 createdAt = 8;
|
|
}
|
|
|
|
// ---------- 请求/响应 ----------
|
|
|
|
message GetFileByIdReq {
|
|
string id = 1;
|
|
}
|
|
|
|
message GetFileByIdResp {
|
|
FileInfo file = 1;
|
|
}
|
|
|
|
message GetFilesByIdsReq {
|
|
repeated string ids = 1;
|
|
}
|
|
|
|
message GetFilesByIdsResp {
|
|
repeated FileInfo files = 1;
|
|
}
|
|
|
|
// ---------- 服务定义 ----------
|
|
|
|
service FileService {
|
|
// 根据ID获取文件信息
|
|
rpc GetFileById(GetFileByIdReq) returns (GetFileByIdResp);
|
|
// 根据ID列表批量获取文件信息
|
|
rpc GetFilesByIds(GetFilesByIdsReq) returns (GetFilesByIdsResp);
|
|
}
|