pkgdash/proto/pkgdash.proto

288 lines
7.4 KiB
Protocol Buffer
Raw Normal View History

2023-08-07 21:30:30 +03:00
syntax = "proto3";
package pkgdash;
2023-08-07 21:30:30 +03:00
import "api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "openapiv3/annotations.proto";
2023-08-07 21:30:30 +03:00
import "validate/validate.proto";
option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb";
2023-08-07 21:30:30 +03:00
service PkgdashService {
rpc PackagesLookup(PackagesLookupReq) returns (PackagesLookupRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "PackagesLookup";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
get: "/v1/packages/{id}";
};
}
rpc PackagesCreate(PackagesCreateReq) returns (PackagesCreateRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "PackagesCreate";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
post: "/v1/packages";
body: "*";
};
}
rpc PackagesDelete(PackagesDeleteReq) returns (PackagesDeleteRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "PackagesDelete";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {delete: "/v1/packages/{id}"};
}
rpc PackagesList(PackagesListReq) returns (PackagesListRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "PackagesList";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {get: "/v1/packages"};
}
rpc PackagesModules(PackagesModulesReq) returns (PackagesModulesRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "PackagesModules";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {get: "/v1/packages/{package}/modules"};
}
rpc PackagesUpdate(PackagesUpdateReq) returns (PackagesUpdateRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "PackagesUpdate";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
put: "/v1/packages/{id}";
body: "*";
};
}
rpc CommentsCreate(CommentsCreateReq) returns (CommentsCreateRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "CommentsCreate";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
post: "/v1/packages/{package}/comments";
body: "*";
};
}
rpc CommentsLookup(CommentsLookupReq) returns (CommentsLookupRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "CommentsLookup";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
get: "/v1/comments/{id}/comments";
additional_bindings {get: "/v1/comments/{package}/comments/{id}"};
};
}
rpc CommentsList(CommentsListReq) returns (CommentsListRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "CommentsList";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {get: "/v1/packages/{package}/comments"};
}
rpc CommentsDelete(CommentsDeleteReq) returns (CommentsDeleteRsp) {
2023-08-14 14:27:29 +03:00
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "CommentsDelete";
2023-08-14 14:27:29 +03:00
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {
delete: "/v1/packages/{package_id}/comments/{id}";
additional_bindings {delete: "/v1/comments/{id}"};
2023-08-14 14:27:29 +03:00
};
}
rpc ModulesList(ModulesListReq) returns (ModulesListRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "ModulesList";
responses: {
default: {
reference: {_ref: ".pkgdash.ErrorRsp"};
};
};
};
option (micro.api.http) = {get: "/v1/modules"};
}
}
message PackagesModulesReq {
uint64 package = 1 [json_name = "package"];
}
message PackagesModulesRsp {
repeated Module modules = 1 [json_name = "modules"];
}
message PackagesLookupReq {
uint64 id = 1 [json_name = "id"];
}
message PackagesLookupRsp {
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"];
}
2023-08-07 21:30:30 +03:00
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];
uint64 modules = 4;
uint64 issues = 5;
uint64 comments = 6;
google.protobuf.Timestamp created = 7;
google.protobuf.Timestamp updated = 8;
google.protobuf.Timestamp last_check = 9;
}
2023-08-07 21:30:30 +03:00
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;
2023-08-07 21:30:30 +03:00
}
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;
2023-08-07 21:30:30 +03:00
}
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 CommentsDeleteReq {
uint64 id = 1 [json_name = "id"];
uint64 package_id = 2 [json_name = "package_id"];
}
message CommentsDeleteRsp {}
message PackagesDeleteReq {
uint64 id = 1 [json_name = "id"];
2023-08-07 21:30:30 +03:00
}
message PackagesDeleteRsp {}
message PackagesListReq {}
message PackagesListRsp {
2023-08-07 21:30:30 +03:00
repeated Package packages = 1;
}
message PackagesUpdateReq {
2023-08-12 19:26:50 +03:00
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;
2023-08-07 21:30:30 +03:00
}
message PackagesUpdateRsp {
Package package = 1 [json_name = "package"];
2023-08-07 21:30:30 +03:00
}
message CommentsCreateReq {
uint64 package_id = 1 [
json_name = "package_id",
(validate.rules).uint64.gt = 0
];
string comment = 2;
2023-08-07 21:30:30 +03:00
}
message CommentsCreateRsp {
Comment comment = 1 [json_name = "comment"];
}
message PackagesCreateReq {
2023-08-12 19:26:50 +03:00
string name = 1 [(validate.rules).string.min_len = 1];
string url = 2 [(validate.rules).string.min_len = 1];
repeated uint64 modules = 3;
}
message PackagesCreateRsp {
Package package = 1 [json_name="package"];
2023-08-12 19:26:50 +03:00
}
message ModulesListReq {}
message ModulesListRsp {
repeated Module modules = 1 [json_name="modules"];
}
message CommentsListReq {
uint64 package_id = 1 [json_name = "package_id"];
2023-08-14 14:27:29 +03:00
}
message CommentsListRsp {
repeated Comment comments = 1 [json_name = "comments"];
2023-08-14 14:27:29 +03:00
}
message CommentsLookupReq {
uint64 id = 1 [json_name = "id"];
uint64 package_id = 2 [json_name = "package_id"];
}
message CommentsLookupRsp {
Comment comment = 1 [json_name = "comment"];
}