2022-08-19 22:03:00 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
// TODO: couldn't solve out how to set "main" package. Needs to fix by hand after export
|
|
|
|
// export:
|
|
|
|
// protoc --proto_path=./ --go_out=./ --go-grpc_out=./ --go_opt=paths=source_relative tree.proto
|
|
|
|
option go_package = ".";
|
|
|
|
|
|
|
|
package main;
|
|
|
|
|
|
|
|
service TreeManager {
|
|
|
|
rpc GetSummery(TreeRequest) returns (Tree) {}
|
|
|
|
rpc GetFile(FileRequest) returns (FileContent) {}
|
2022-08-22 19:53:27 +00:00
|
|
|
rpc RebuildTree(TreeSecret) returns (RebuildResponse) {}
|
2023-06-27 13:57:14 +00:00
|
|
|
rpc DownloadAttachment(AttachmentRequest) returns (stream AttachmentResponse) {}
|
2022-08-22 19:53:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message TreeSecret {
|
|
|
|
string key = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RebuildResponse {
|
|
|
|
bool success = 1;
|
2022-08-19 22:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message FileRequest {
|
|
|
|
string id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TreeRequest {
|
|
|
|
message Filter {
|
|
|
|
string key = 1;
|
|
|
|
string value = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
optional string path = 1;
|
|
|
|
repeated Filter filter = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TreeFile {
|
|
|
|
string name = 1;
|
|
|
|
repeated string category = 2;
|
|
|
|
string description = 3;
|
|
|
|
string id = 4;
|
|
|
|
string lang = 5;
|
|
|
|
string copyright = 6;
|
|
|
|
repeated string tags = 7;
|
|
|
|
string created = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
message Tree {
|
|
|
|
repeated TreeFile files = 1;
|
2022-08-20 20:44:07 +00:00
|
|
|
repeated TreeFile rootFiles = 4;
|
2022-08-19 22:03:00 +00:00
|
|
|
map<string, int32> tags = 2;
|
|
|
|
map<string, int32> categories = 3;
|
2022-08-20 22:34:53 +00:00
|
|
|
string path = 5;
|
|
|
|
string rootPath = 6;
|
2022-08-19 22:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message FileContent {
|
|
|
|
TreeFile file = 1;
|
|
|
|
string content = 2;
|
|
|
|
}
|
2023-06-27 13:57:14 +00:00
|
|
|
|
|
|
|
message AttachmentRequest {
|
|
|
|
string path = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message AttachmentResponse {
|
|
|
|
bytes chunk = 1;
|
|
|
|
}
|