Merge branch 'master' into rewrite
# Conflicts: # proto/pkgdash.pb.go # proto/pkgdash.pb.validate.go # proto/pkgdash.proto
This commit is contained in:
1912
proto/pkgdash.pb.go
1912
proto/pkgdash.pb.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,15 +2,15 @@ syntax = "proto3";
|
||||
|
||||
package pkgdash;
|
||||
|
||||
import "api/annotations.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "openapiv3/annotations.proto";
|
||||
import "validate/validate.proto";
|
||||
|
||||
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(ListPackageReq) returns (ListPackageRsp) {
|
||||
rpc ListPackage(google.protobuf.Empty) returns (ListPackageRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "ListPackage";
|
||||
responses: {
|
||||
@@ -19,8 +19,10 @@ service PkgdashService {
|
||||
};
|
||||
};
|
||||
};
|
||||
option (micro.api.http) = {get: "/v1/packages"};
|
||||
}
|
||||
option (micro.api.http) = {
|
||||
get: "/v1/packages";
|
||||
};
|
||||
};
|
||||
rpc UpdatePackage(UpdatePackageReq) returns (UpdatePackageRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "UpdateInfo";
|
||||
@@ -34,7 +36,7 @@ service PkgdashService {
|
||||
post: "/v1/package/{id}";
|
||||
body: "*";
|
||||
};
|
||||
}
|
||||
};
|
||||
rpc AddComment(AddCommentReq) returns (AddCommentRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "AddComment";
|
||||
@@ -48,7 +50,7 @@ service PkgdashService {
|
||||
post: "/v1/package/{pkg}/comment";
|
||||
body: "*";
|
||||
};
|
||||
}
|
||||
};
|
||||
rpc AddPackage(AddPackageReq) returns (AddPackageRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "AddPackage";
|
||||
@@ -62,7 +64,7 @@ service PkgdashService {
|
||||
post: "/v1/package";
|
||||
body: "*";
|
||||
};
|
||||
}
|
||||
};
|
||||
rpc GetModule(GetModuleReq) returns (GetModuleRsp) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "GetModule";
|
||||
@@ -72,65 +74,11 @@ service PkgdashService {
|
||||
};
|
||||
};
|
||||
};
|
||||
option (micro.api.http) = {get: "/v1/module"};
|
||||
}
|
||||
}
|
||||
|
||||
message ListPackageReq {}
|
||||
|
||||
message ListPackageRsp {
|
||||
repeated Package packages = 1;
|
||||
}
|
||||
|
||||
message UpdatePackageReq {
|
||||
google.protobuf.UInt64Value id = 1 [(validate.rules).message.required = true];
|
||||
google.protobuf.StringValue name = 2 [(validate.rules).message.required = true];
|
||||
google.protobuf.StringValue url = 3 [(validate.rules).message.required = true];
|
||||
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 {
|
||||
google.protobuf.UInt64Value idPackage = 1 [(validate.rules).message.required = true];
|
||||
string text = 2;
|
||||
}
|
||||
|
||||
message AddCommentRsp {
|
||||
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
||||
}
|
||||
|
||||
message AddPackageReq {
|
||||
google.protobuf.StringValue name = 1 [(validate.rules).message.required = true];
|
||||
google.protobuf.StringValue url = 2 [(validate.rules).message.required = true];
|
||||
repeated uint64 modules = 3;
|
||||
}
|
||||
|
||||
message AddPackageRsp {}
|
||||
|
||||
message GetModuleReq {
|
||||
repeated uint64 id = 1;
|
||||
}
|
||||
message GetModuleRsp {
|
||||
repeated Module modules = 1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
option (micro.api.http) = {
|
||||
get: "/v1/module";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
message ErrorRsp {
|
||||
Error error = 1 [json_name = "error"];
|
||||
@@ -143,6 +91,15 @@ message Error {
|
||||
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];
|
||||
@@ -166,3 +123,50 @@ message Comment {
|
||||
uint64 created = 4 [(validate.rules).uint64.gt = 0];
|
||||
uint64 updated = 5 [(validate.rules).uint64.gt = 0];
|
||||
}
|
||||
|
||||
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 ;
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-micro v4.0.2
|
||||
// - protoc-gen-go-micro v3.10.3
|
||||
// - protoc v4.23.4
|
||||
// source: pkgdash.proto
|
||||
|
||||
@@ -8,24 +8,64 @@ package pkgdashpb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
_ "go.unistack.org/micro/v4/client"
|
||||
options "go.unistack.org/micro/v4/options"
|
||||
v3 "go.unistack.org/micro-server-http/v3"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
var (
|
||||
PkgdashServiceName = "PkgdashService"
|
||||
)
|
||||
var (
|
||||
PkgdashServiceServerEndpoints = []v3.EndpointMetadata{
|
||||
{
|
||||
Name: "PkgdashService.ListPackage",
|
||||
Path: "/v1/packages",
|
||||
Method: "GET",
|
||||
Body: "",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.UpdatePackage",
|
||||
Path: "/v1/package/{id}",
|
||||
Method: "POST",
|
||||
Body: "*",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.AddComment",
|
||||
Path: "/v1/package/{pkg}/comment",
|
||||
Method: "POST",
|
||||
Body: "*",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.AddPackage",
|
||||
Path: "/v1/package",
|
||||
Method: "POST",
|
||||
Body: "*",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.GetModule",
|
||||
Path: "/v1/module",
|
||||
Method: "GET",
|
||||
Body: "",
|
||||
Stream: false,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
type PkgdashServiceClient interface {
|
||||
ListPackage(ctx context.Context, req *ListPackageReq, opts ...options.Option) (*ListPackageRsp, error)
|
||||
UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error)
|
||||
AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error)
|
||||
AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error)
|
||||
GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error)
|
||||
ListPackage(ctx context.Context, req *emptypb.Empty, opts ...client.CallOption) (*ListPackageRsp, error)
|
||||
UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...client.CallOption) (*UpdatePackageRsp, error)
|
||||
AddComment(ctx context.Context, req *AddCommentReq, opts ...client.CallOption) (*AddCommentRsp, error)
|
||||
AddPackage(ctx context.Context, req *AddPackageReq, opts ...client.CallOption) (*AddPackageRsp, error)
|
||||
GetModule(ctx context.Context, req *GetModuleReq, opts ...client.CallOption) (*GetModuleRsp, error)
|
||||
}
|
||||
|
||||
type PkgdashServiceServer interface {
|
||||
ListPackage(ctx context.Context, req *ListPackageReq, rsp *ListPackageRsp) error
|
||||
ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error
|
||||
UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error
|
||||
AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error
|
||||
AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error
|
||||
|
@@ -1,59 +1,19 @@
|
||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||
// protoc-gen-go-micro version: v4.0.2
|
||||
// protoc-gen-go-micro version: v3.10.3
|
||||
// source: pkgdash.proto
|
||||
|
||||
package pkgdashpb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
v41 "go.unistack.org/micro-client-http/v4"
|
||||
v4 "go.unistack.org/micro-server-http/v4"
|
||||
client "go.unistack.org/micro/v4/client"
|
||||
options "go.unistack.org/micro/v4/options"
|
||||
server "go.unistack.org/micro/v4/server"
|
||||
v3 "go.unistack.org/micro-client-http/v3"
|
||||
v31 "go.unistack.org/micro-server-http/v3"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
server "go.unistack.org/micro/v3/server"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
http "net/http"
|
||||
)
|
||||
|
||||
var (
|
||||
PkgdashServiceServerEndpoints = []v4.EndpointMetadata{
|
||||
{
|
||||
Name: "PkgdashService.ListPackage",
|
||||
Path: "/v1/packages",
|
||||
Method: "GET",
|
||||
Body: "",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.UpdatePackage",
|
||||
Path: "/v1/package/{id}",
|
||||
Method: "POST",
|
||||
Body: "*",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.AddComment",
|
||||
Path: "/v1/package/{pkg}/comment",
|
||||
Method: "POST",
|
||||
Body: "*",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.AddPackage",
|
||||
Path: "/v1/package",
|
||||
Method: "POST",
|
||||
Body: "*",
|
||||
Stream: false,
|
||||
},
|
||||
{
|
||||
Name: "PkgdashService.GetModule",
|
||||
Path: "/v1/module",
|
||||
Method: "GET",
|
||||
Body: "",
|
||||
Stream: false,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
type pkgdashServiceClient struct {
|
||||
c client.Client
|
||||
name string
|
||||
@@ -63,15 +23,15 @@ func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient
|
||||
return &pkgdashServiceClient{c: c, name: name}
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *ListPackageReq, opts ...options.Option) (*ListPackageRsp, error) {
|
||||
func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *emptypb.Empty, opts ...client.CallOption) (*ListPackageRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
opts = append(opts,
|
||||
v41.ErrorMap(errmap),
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v41.Method(http.MethodGet),
|
||||
v41.Path("/v1/packages"),
|
||||
v3.Method(http.MethodGet),
|
||||
v3.Path("/v1/packages"),
|
||||
)
|
||||
rsp := &ListPackageRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.ListPackage", req), rsp, opts...)
|
||||
@@ -81,16 +41,16 @@ func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *ListPackage
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error) {
|
||||
func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...client.CallOption) (*UpdatePackageRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
opts = append(opts,
|
||||
v41.ErrorMap(errmap),
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v41.Method(http.MethodPost),
|
||||
v41.Path("/v1/package/{id}"),
|
||||
v41.Body("*"),
|
||||
v3.Method(http.MethodPost),
|
||||
v3.Path("/v1/package/{id}"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
rsp := &UpdatePackageRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.UpdatePackage", req), rsp, opts...)
|
||||
@@ -100,16 +60,16 @@ func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePac
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error) {
|
||||
func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentReq, opts ...client.CallOption) (*AddCommentRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
opts = append(opts,
|
||||
v41.ErrorMap(errmap),
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v41.Method(http.MethodPost),
|
||||
v41.Path("/v1/package/{pkg}/comment"),
|
||||
v41.Body("*"),
|
||||
v3.Method(http.MethodPost),
|
||||
v3.Path("/v1/package/{pkg}/comment"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
rsp := &AddCommentRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddComment", req), rsp, opts...)
|
||||
@@ -119,16 +79,16 @@ func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentRe
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error) {
|
||||
func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageReq, opts ...client.CallOption) (*AddPackageRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
opts = append(opts,
|
||||
v41.ErrorMap(errmap),
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v41.Method(http.MethodPost),
|
||||
v41.Path("/v1/package"),
|
||||
v41.Body("*"),
|
||||
v3.Method(http.MethodPost),
|
||||
v3.Path("/v1/package"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
rsp := &AddPackageRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddPackage", req), rsp, opts...)
|
||||
@@ -138,15 +98,15 @@ func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageRe
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *pkgdashServiceClient) GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error) {
|
||||
func (c *pkgdashServiceClient) GetModule(ctx context.Context, req *GetModuleReq, opts ...client.CallOption) (*GetModuleRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &ErrorRsp{}
|
||||
opts = append(opts,
|
||||
v41.ErrorMap(errmap),
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v41.Method(http.MethodGet),
|
||||
v41.Path("/v1/module"),
|
||||
v3.Method(http.MethodGet),
|
||||
v3.Path("/v1/module"),
|
||||
)
|
||||
rsp := &GetModuleRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.GetModule", req), rsp, opts...)
|
||||
@@ -160,7 +120,7 @@ type pkgdashServiceServer struct {
|
||||
PkgdashServiceServer
|
||||
}
|
||||
|
||||
func (h *pkgdashServiceServer) ListPackage(ctx context.Context, req *ListPackageReq, rsp *ListPackageRsp) error {
|
||||
func (h *pkgdashServiceServer) ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error {
|
||||
return h.PkgdashServiceServer.ListPackage(ctx, req, rsp)
|
||||
}
|
||||
|
||||
@@ -180,9 +140,9 @@ func (h *pkgdashServiceServer) GetModule(ctx context.Context, req *GetModuleReq,
|
||||
return h.PkgdashServiceServer.GetModule(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...options.Option) error {
|
||||
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...server.HandlerOption) error {
|
||||
type pkgdashService interface {
|
||||
ListPackage(ctx context.Context, req *ListPackageReq, rsp *ListPackageRsp) error
|
||||
ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error
|
||||
UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error
|
||||
AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error
|
||||
AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error
|
||||
@@ -192,7 +152,7 @@ func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts
|
||||
pkgdashService
|
||||
}
|
||||
h := &pkgdashServiceServer{sh}
|
||||
var nopts []options.Option
|
||||
nopts = append(nopts, v4.HandlerEndpoints(PkgdashServiceServerEndpoints))
|
||||
return s.Handle(&PkgdashService{h}, append(nopts, opts...)...)
|
||||
var nopts []server.HandlerOption
|
||||
nopts = append(nopts, v31.HandlerEndpoints(PkgdashServiceServerEndpoints))
|
||||
return s.Handle(s.NewHandler(&PkgdashService{h}, append(nopts, opts...)...))
|
||||
}
|
||||
|
Reference in New Issue
Block a user