pkgdash/proto/pkgdash_micro_http.pb.go
Vasiliy Tolstov 2ef12956ac initial rewrite, use micro v4 and not cms-xxx stuff
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-08-11 21:27:38 +03:00

137 lines
3.8 KiB
Go

// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.4
// source: pkgdash.proto
package pkgdashpb
import (
context "context"
v31 "go.unistack.org/micro-client-http/v3"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
http "net/http"
)
var (
PkgdashServiceServerEndpoints = []v3.EndpointMetadata{
{
Name: "PkgdashService.ListPackage",
Path: "/v1/packages",
Method: "GET",
Body: "",
Stream: false,
},
{
Name: "PkgdashService.UpdateInfo",
Path: "/v1/package/{id}",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.AddComment",
Path: "/v1/package/{pkg}/comment",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
type pkgdashServiceClient struct {
c client.Client
name string
}
func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient {
return &pkgdashServiceClient{c: c, name: name}
}
func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *ListPackageReq, opts ...client.CallOption) (*ListPackageRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v31.ErrorMap(errmap),
)
opts = append(opts,
v31.Method(http.MethodGet),
v31.Path("/v1/packages"),
)
rsp := &ListPackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.ListPackage", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *pkgdashServiceClient) UpdateInfo(ctx context.Context, req *UpdateInfoPackageReq, opts ...client.CallOption) (*UpdateInfoPackageRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v31.ErrorMap(errmap),
)
opts = append(opts,
v31.Method(http.MethodPost),
v31.Path("/v1/package/{id}"),
v31.Body("*"),
)
rsp := &UpdateInfoPackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.UpdateInfo", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *CommentReq, opts ...client.CallOption) (*CommentRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v31.ErrorMap(errmap),
)
opts = append(opts,
v31.Method(http.MethodPost),
v31.Path("/v1/package/{pkg}/comment"),
v31.Body("*"),
)
rsp := &CommentRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddComment", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
type pkgdashServiceServer struct {
PkgdashServiceServer
}
func (h *pkgdashServiceServer) ListPackage(ctx context.Context, req *ListPackageReq, rsp *ListPackageRsp) error {
return h.PkgdashServiceServer.ListPackage(ctx, req, rsp)
}
func (h *pkgdashServiceServer) UpdateInfo(ctx context.Context, req *UpdateInfoPackageReq, rsp *UpdateInfoPackageRsp) error {
return h.PkgdashServiceServer.UpdateInfo(ctx, req, rsp)
}
func (h *pkgdashServiceServer) AddComment(ctx context.Context, req *CommentReq, rsp *CommentRsp) error {
return h.PkgdashServiceServer.AddComment(ctx, req, rsp)
}
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...server.HandlerOption) error {
type pkgdashService interface {
ListPackage(ctx context.Context, req *ListPackageReq, rsp *ListPackageRsp) error
UpdateInfo(ctx context.Context, req *UpdateInfoPackageReq, rsp *UpdateInfoPackageRsp) error
AddComment(ctx context.Context, req *CommentReq, rsp *CommentRsp) error
}
type PkgdashService struct {
pkgdashService
}
h := &pkgdashServiceServer{sh}
var nopts []server.HandlerOption
nopts = append(nopts, v3.HandlerEndpoints(PkgdashServiceServerEndpoints))
return s.Handle(s.NewHandler(&PkgdashService{h}, append(nopts, opts...)...))
}