2023-12-04 18:21:07 +08:00
|
|
|
|
syntax = "proto3"; //版本声明,使用v3版本
|
|
|
|
|
|
|
|
|
|
package resource;
|
|
|
|
|
option go_package = "gitlab.fusenpack.com/backend/resource;service";
|
|
|
|
|
|
|
|
|
|
// 导入google/api/annotations.proto 注释依赖
|
|
|
|
|
import "google/api/annotations.proto";
|
|
|
|
|
import "service/basic.proto";
|
|
|
|
|
import "google/protobuf/struct.proto";
|
|
|
|
|
import "google/protobuf/any.proto";
|
|
|
|
|
|
|
|
|
|
//定义服务
|
2023-12-06 16:18:22 +08:00
|
|
|
|
service resource {
|
|
|
|
|
|
2023-12-04 18:21:07 +08:00
|
|
|
|
// 获取资源详情
|
2023-12-05 15:40:46 +08:00
|
|
|
|
rpc GetResourceInfo(GetResourceInfoReq) returns (basic.Response) {
|
2023-12-04 18:21:07 +08:00
|
|
|
|
option (google.api.http) = {
|
|
|
|
|
get: "/api/resource/info"
|
|
|
|
|
};
|
|
|
|
|
}
|
2023-12-05 16:12:13 +08:00
|
|
|
|
|
|
|
|
|
// 获取资源列表
|
|
|
|
|
rpc GetResourceList(GetResourceListReq) returns (basic.Response) {
|
|
|
|
|
option (google.api.http) = {
|
|
|
|
|
get: "/api/resource/list"
|
|
|
|
|
};
|
|
|
|
|
}
|
2023-12-06 16:18:22 +08:00
|
|
|
|
|
|
|
|
|
// 后端上传--单文件
|
|
|
|
|
rpc UploadFileBackend(UploadFileBackendReq) returns (UploadFileBackendRes) {
|
|
|
|
|
option (google.api.http) = {
|
|
|
|
|
post: "/api/resource/upload-file-backend",
|
|
|
|
|
body: "*"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 后端上传--分片上传
|
|
|
|
|
rpc UploadFileBackendFragment(UploadFileBackendFragmentReq) returns (UploadFileBackendFragmentRes) {
|
|
|
|
|
option (google.api.http) = {
|
|
|
|
|
post: "/api/resource/upload-file-backend-fragment",
|
|
|
|
|
body: "*"
|
|
|
|
|
};
|
|
|
|
|
}
|
2023-12-05 16:12:13 +08:00
|
|
|
|
}
|
2023-12-06 16:18:22 +08:00
|
|
|
|
|
|
|
|
|
/* 后端上传--分片上传 */
|
|
|
|
|
message UploadFileBackendFragmentReq {
|
|
|
|
|
string file_name = 1; // 文件名
|
|
|
|
|
bytes file_content = 2; // 文件流
|
|
|
|
|
bytes file_header = 3; // 文件头
|
|
|
|
|
string file_data = 4; // base64
|
|
|
|
|
|
|
|
|
|
int64 chunk_number = 5; // 当前分片号:1、2、3
|
|
|
|
|
int64 total_chunks = 6; // 总分片数:3
|
|
|
|
|
int64 user_id = 7;
|
|
|
|
|
int64 guest_id = 8;
|
|
|
|
|
|
|
|
|
|
int64 api_type = 10; // 请求类型:1=对外,2=对内'
|
|
|
|
|
int64 upload_bucket = 11; // 上传桶类型
|
|
|
|
|
string file_key = 12; // 哈希
|
|
|
|
|
string source = 13;// 来源
|
|
|
|
|
string metadata = 14; // json格式
|
|
|
|
|
int64 refresh = 15; // 是否覆盖
|
|
|
|
|
string resource_id = 16; // 资源ID
|
|
|
|
|
string backup_type = 17; // 资源备份:oss
|
|
|
|
|
string upload_type = 18; // 上传方式:s3
|
|
|
|
|
}
|
|
|
|
|
message UploadFileBackendFragmentRes {
|
|
|
|
|
string resource_type = 5;
|
|
|
|
|
string resource_id = 4;
|
|
|
|
|
string resource_url = 6;
|
|
|
|
|
}
|
|
|
|
|
/* 后端上传--分片上传 */
|
|
|
|
|
|
|
|
|
|
/* 后端上传--单文件 */
|
|
|
|
|
message UploadFileBackendReq {
|
|
|
|
|
string file_name = 1; // 文件名
|
|
|
|
|
bytes file_content = 2; // 文件流
|
|
|
|
|
bytes file_header = 3; // 文件头
|
|
|
|
|
int64 user_id = 4;
|
|
|
|
|
int64 guest_id = 5;
|
|
|
|
|
string file_data = 6; // base64
|
|
|
|
|
|
|
|
|
|
int64 api_type = 10; // 请求类型:1=对外,2=对内'
|
|
|
|
|
int64 upload_bucket = 11; // 上传桶类型
|
|
|
|
|
string file_key = 12; // 哈希
|
|
|
|
|
string source = 13;// 来源
|
|
|
|
|
string metadata = 14; // json格式
|
|
|
|
|
int64 refresh = 15; // 是否覆盖
|
|
|
|
|
string resource_id = 16; // 资源ID
|
|
|
|
|
string backup_type = 17; // 资源备份:oss
|
|
|
|
|
string upload_type = 18; // 上传方式:s3
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message UploadFileBackendRes{
|
|
|
|
|
string resource_type = 5;
|
|
|
|
|
string resource_id = 4;
|
|
|
|
|
string resource_url = 6;
|
|
|
|
|
}
|
|
|
|
|
/* 后端上传--文件流--单文件 */
|
|
|
|
|
|
2023-12-05 16:12:13 +08:00
|
|
|
|
/* 获取资源列表 */
|
2023-12-05 16:19:54 +08:00
|
|
|
|
message GetResourceListReq{
|
2023-12-05 16:12:13 +08:00
|
|
|
|
optional string resource_id = 1;
|
|
|
|
|
optional int64 guest_id =2;
|
|
|
|
|
optional int64 user_id =3;
|
|
|
|
|
optional string resource_type = 4;
|
|
|
|
|
optional string resource_url = 5;
|
|
|
|
|
optional string version = 6;
|
|
|
|
|
optional int64 api_type = 7;
|
|
|
|
|
optional string bucket_name = 8;
|
|
|
|
|
optional string source = 9;
|
|
|
|
|
|
2023-12-05 17:31:28 +08:00
|
|
|
|
optional int64 current_page =101;
|
|
|
|
|
optional int64 per_page =102;
|
|
|
|
|
optional string order_by = 103;
|
2023-12-04 18:21:07 +08:00
|
|
|
|
}
|
2023-12-05 16:12:13 +08:00
|
|
|
|
/* 获取资源列表 */
|
2023-12-04 18:21:07 +08:00
|
|
|
|
|
|
|
|
|
/* 获取资源详情 */
|
|
|
|
|
message GetResourceInfoReq{
|
|
|
|
|
optional string resource_id = 1;
|
|
|
|
|
optional int64 guest_id =2;
|
|
|
|
|
optional int64 user_id =3;
|
|
|
|
|
optional string resource_type = 4;
|
|
|
|
|
optional string resource_url = 5;
|
|
|
|
|
optional string version = 6;
|
|
|
|
|
optional int64 api_type = 7;
|
|
|
|
|
optional string bucket_name = 8;
|
|
|
|
|
optional string source = 9;
|
|
|
|
|
}
|
|
|
|
|
/* 获取资源详情 */
|