pkgdash/proto/pkgdash.proto

201 lines
4.8 KiB
Protocol Buffer

syntax = "proto3";
package pkgdash;
option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb";
import "api/annotations.proto";
import "openapiv3/annotations.proto";
import "validate/validate.proto";
import "google/protobuf/empty.proto";
service PkgdashService {
rpc ListPackage(google.protobuf.Empty) returns (ListPackageRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "ListPackage";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
get: "/v1/packages";
};
};
rpc UpdatePackage(UpdatePackageReq) returns (UpdatePackageRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "UpdateInfo";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
post: "/v1/package/{id}";
body: "*";
};
};
rpc AddComment(AddCommentReq) returns (AddCommentRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "AddComment";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
post: "/v1/package/{pkg}/comment";
body: "*";
};
};
rpc AddPackage(AddPackageReq) returns (AddPackageRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "AddPackage";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
post: "/v1/package";
body: "*";
};
};
rpc GetModule(GetModuleReq) returns (GetModuleRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "GetModule";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
get: "/v1/module";
};
};
rpc GetComments(GetCommentsReq) returns (GetCommentsRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "GetComments";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
get: "/v1/comment";
};
}
};
message ErrorRsp {
Error error = 1 [json_name = "error"];
}
message Error {
string code = 1 [json_name = "code"];
string title = 2 [json_name = "title"];
string uuid = 3 [json_name = "uuid"];
string details = 4 [json_name = "details"];
}
message Package {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
string name = 2 [(validate.rules).string.min_len = 1];
string url = 3 [(validate.rules).string.min_len = 1];
repeated uint64 modules = 4;
repeated uint64 issues = 5;
repeated uint64 comments = 6;
};
message Module {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
string name = 2 [(validate.rules).string.min_len = 1];
string version = 3 [(validate.rules).string.min_len = 1];
uint64 package = 4 [(validate.rules).uint64.gt = 0];
string last_version = 5 [(validate.rules).string.min_len = 1];
}
message Issue {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
uint64 status = 2 [(validate.rules).uint64.gt = 0];
string desc = 3 [(validate.rules).string.min_len = 1];
uint64 package = 4 [(validate.rules).uint64.gt = 0];
repeated uint64 modules = 5;
}
message Comment {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
uint64 package = 2 [(validate.rules).uint64.gt = 0];
string text = 3;
string created = 4 ;
string updated = 5 ;
}
message ListPackageReq {}
message ListPackageRsp{
repeated Package packages = 1;
}
message UpdatePackageReq {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
string name = 2 [(validate.rules).string.min_len = 1];
string url = 3 [(validate.rules).string.min_len = 1];
repeated uint64 modules = 4 ;
repeated uint64 issues = 5 ;
}
message UpdatePackageRsp {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
}
message CommentReq {
uint64 pkg = 1 [(validate.rules).uint64.gt = 0];
string text = 2;
}
message AddCommentReq {
uint64 idPackage = 1 [(validate.rules).uint64.gt = 0];
string text = 2;
}
message AddCommentRsp {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
}
message AddPackageReq {
string name = 1 [(validate.rules).string.min_len = 1];
string url = 2 [(validate.rules).string.min_len = 1];
repeated uint64 modules = 3;
}
message AddPackageRsp{
string status = 1 [(validate.rules).string.min_len = 1];
}
message GetModuleReq {
repeated uint64 id = 1 ;
}
message GetModuleRsp {
repeated Module modules = 1 ;
}
message GetCommentsReq {
repeated uint64 id = 1 [(validate.rules).repeated = {
unique: true
min_items: 1
items: {
uint64: {
gt: 0
}
}
}] ;
}
message GetCommentsRsp {
repeated Comment comments = 1;
}