70 lines
1.3 KiB
Protocol Buffer
70 lines
1.3 KiB
Protocol Buffer
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) {}
|
|
rpc RebuildTree(TreeSecret) returns (RebuildResponse) {}
|
|
rpc DownloadAttachment(AttachmentRequest) returns (stream AttachmentResponse) {}
|
|
}
|
|
|
|
message TreeSecret {
|
|
string key = 1;
|
|
}
|
|
|
|
message RebuildResponse {
|
|
bool success = 1;
|
|
}
|
|
|
|
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;
|
|
repeated TreeFile rootFiles = 4;
|
|
map<string, int32> tags = 2;
|
|
map<string, int32> categories = 3;
|
|
string path = 5;
|
|
string rootPath = 6;
|
|
}
|
|
|
|
message FileContent {
|
|
TreeFile file = 1;
|
|
string content = 2;
|
|
}
|
|
|
|
message AttachmentRequest {
|
|
string path = 1;
|
|
}
|
|
|
|
message AttachmentResponse {
|
|
bytes chunk = 1;
|
|
}
|