319 lines
8.2 KiB
Protocol Buffer
319 lines
8.2 KiB
Protocol Buffer
|
syntax = "proto3";
|
||
|
|
||
|
package pkgdash;
|
||
|
|
||
|
import "api/annotations.proto";
|
||
|
import "google/protobuf/timestamp.proto";
|
||
|
import "openapiv3/annotations.proto";
|
||
|
import "validate/validate.proto";
|
||
|
|
||
|
option go_package = "go.unistack.org/pkgdash/proto;pkgdashpb";
|
||
|
|
||
|
service Pkgdash {
|
||
|
rpc PackageLookup(PackageLookupReq) returns (PackageLookupRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "PackageLookup";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {get: "/v1/packages/{id}"};
|
||
|
}
|
||
|
rpc PackageCreate(PackageCreateReq) returns (PackageCreateRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "PackageCreate";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {
|
||
|
post: "/v1/packages";
|
||
|
body: "*";
|
||
|
};
|
||
|
}
|
||
|
rpc PackageDelete(PackageDeleteReq) returns (PackageDeleteRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "PackageDelete";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {delete: "/v1/packages/{id}"};
|
||
|
}
|
||
|
rpc PackageList(PackageListReq) returns (PackageListRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "PackageList";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {get: "/v1/packages"};
|
||
|
}
|
||
|
rpc HandlerList(HandlerListReq) returns (HandlerListRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "HandlerList";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {get: "/v1/packages/{package}/handlers"};
|
||
|
}
|
||
|
rpc PackageModules(PackageModulesReq) returns (PackageModulesRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "PackageModules";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {get: "/v1/packages/{package}/modules"};
|
||
|
}
|
||
|
rpc PackageUpdate(PackageUpdateReq) returns (PackageUpdateRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "PackageUpdate";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {
|
||
|
put: "/v1/packages/{id}";
|
||
|
body: "*";
|
||
|
};
|
||
|
}
|
||
|
rpc CommentCreate(CommentCreateReq) returns (CommentCreateRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "CommentCreate";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {
|
||
|
post: "/v1/packages/{package}/comments";
|
||
|
body: "*";
|
||
|
};
|
||
|
}
|
||
|
rpc CommentLookup(CommentLookupReq) returns (CommentLookupRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "CommentLookup";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {
|
||
|
get: "/v1/comments/{id}";
|
||
|
additional_bindings {get: "/v1/comments/{package}/comments/{id}"};
|
||
|
};
|
||
|
}
|
||
|
rpc CommentList(CommentListReq) returns (CommentListRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "CommentList";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {get: "/v1/packages/{package}/comments"};
|
||
|
}
|
||
|
rpc CommentDelete(CommentDeleteReq) returns (CommentDeleteRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "CommentDelete";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {
|
||
|
delete: "/v1/packages/{package_id}/comments/{id}";
|
||
|
additional_bindings {delete: "/v1/comments/{id}"};
|
||
|
};
|
||
|
}
|
||
|
rpc ModuleList(ModuleListReq) returns (ModuleListRsp) {
|
||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||
|
operation_id: "ModuleList";
|
||
|
responses: {
|
||
|
default: {
|
||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
option (micro.api.http) = {get: "/v1/modules"};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
message HandlerListReq {
|
||
|
uint64 package = 1;
|
||
|
}
|
||
|
|
||
|
message HandlerListRsp {
|
||
|
repeated Handler handlers = 1;
|
||
|
}
|
||
|
|
||
|
message PackageModulesReq {
|
||
|
uint64 package = 1 [json_name = "package"];
|
||
|
}
|
||
|
|
||
|
message PackageModulesRsp {
|
||
|
repeated Module modules = 1 [json_name = "modules"];
|
||
|
}
|
||
|
|
||
|
message PackageLookupReq {
|
||
|
uint64 id = 1 [json_name = "id"];
|
||
|
}
|
||
|
|
||
|
message PackageLookupRsp {
|
||
|
Package package = 1 [json_name = "package"];
|
||
|
}
|
||
|
|
||
|
message ErrorRsp {
|
||
|
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];
|
||
|
string description = 4 [(validate.rules).string.min_len = 1];
|
||
|
uint64 modules = 5;
|
||
|
uint64 issues = 6;
|
||
|
uint64 comments = 7;
|
||
|
uint64 handlers = 8;
|
||
|
google.protobuf.Timestamp created = 9;
|
||
|
google.protobuf.Timestamp updated = 10;
|
||
|
google.protobuf.Timestamp last_check = 11;
|
||
|
string type = 12;
|
||
|
double coverage = 13;
|
||
|
}
|
||
|
|
||
|
message Handler {
|
||
|
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
||
|
uint64 package = 2 [(validate.rules).uint64.gt = 0];
|
||
|
string name = 3 [(validate.rules).string.min_len = 1];
|
||
|
double coverage = 4;
|
||
|
}
|
||
|
|
||
|
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];
|
||
|
google.protobuf.Timestamp last_check = 8;
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
google.protobuf.Timestamp created = 6;
|
||
|
google.protobuf.Timestamp updated = 7;
|
||
|
}
|
||
|
|
||
|
message Comment {
|
||
|
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
||
|
uint64 package = 2 [(validate.rules).uint64.gt = 0];
|
||
|
string comment = 3;
|
||
|
google.protobuf.Timestamp created = 4;
|
||
|
google.protobuf.Timestamp updated = 5;
|
||
|
}
|
||
|
|
||
|
message CommentDeleteReq {
|
||
|
uint64 id = 1 [json_name = "id"];
|
||
|
uint64 package_id = 2 [json_name = "package_id"];
|
||
|
}
|
||
|
|
||
|
message CommentDeleteRsp {}
|
||
|
|
||
|
message PackageDeleteReq {
|
||
|
uint64 id = 1 [json_name = "id"];
|
||
|
}
|
||
|
|
||
|
message PackageDeleteRsp {}
|
||
|
|
||
|
message PackageListReq {}
|
||
|
|
||
|
message PackageListRsp {
|
||
|
repeated Package packages = 1;
|
||
|
}
|
||
|
|
||
|
message PackageUpdateReq {
|
||
|
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;
|
||
|
bytes coverprofile = 6;
|
||
|
}
|
||
|
|
||
|
message PackageUpdateRsp {
|
||
|
Package package = 1 [json_name = "package"];
|
||
|
}
|
||
|
|
||
|
message CommentCreateReq {
|
||
|
uint64 package_id = 1 [
|
||
|
json_name = "package_id",
|
||
|
(validate.rules).uint64.gt = 0
|
||
|
];
|
||
|
string comment = 2;
|
||
|
}
|
||
|
|
||
|
message CommentCreateRsp {
|
||
|
Comment comment = 1 [json_name = "comment"];
|
||
|
}
|
||
|
|
||
|
message PackageCreateReq {
|
||
|
string name = 1 [(validate.rules).string.min_len = 1];
|
||
|
string url = 2 [(validate.rules).string.min_len = 1];
|
||
|
string description = 3;
|
||
|
}
|
||
|
|
||
|
message PackageCreateRsp {
|
||
|
Package package = 1 [json_name = "package"];
|
||
|
}
|
||
|
|
||
|
message ModuleListReq {
|
||
|
uint64 package = 1 [json_name = "package"];
|
||
|
}
|
||
|
|
||
|
message ModuleListRsp {
|
||
|
repeated Module modules = 1 [json_name = "modules"];
|
||
|
}
|
||
|
|
||
|
message CommentListReq {
|
||
|
uint64 package = 1 [json_name = "package"];
|
||
|
}
|
||
|
|
||
|
message CommentListRsp {
|
||
|
repeated Comment comments = 1 [json_name = "comments"];
|
||
|
}
|
||
|
|
||
|
message CommentLookupReq {
|
||
|
uint64 id = 1 [json_name = "id"];
|
||
|
uint64 package = 2 [json_name = "package"];
|
||
|
}
|
||
|
|
||
|
message CommentLookupRsp {
|
||
|
Comment comment = 1 [json_name = "comment"];
|
||
|
}
|