pkgdash/proto/pkgdash_micro_http.pb.go

199 lines
5.6 KiB
Go
Raw Normal View History

// Code generated by protoc-gen-go-micro. DO NOT EDIT.
2023-08-12 20:55:20 +03:00
// protoc-gen-go-micro version: v4.0.2
// source: pkgdash.proto
package pkgdashpb
import (
context "context"
2023-08-12 20:55:20 +03:00
v41 "go.unistack.org/micro-client-http/v4"
v4 "go.unistack.org/micro-server-http/v4"
client "go.unistack.org/micro/v4/client"
server "go.unistack.org/micro/v4/server"
2023-08-12 19:26:50 +03:00
emptypb "google.golang.org/protobuf/types/known/emptypb"
http "net/http"
)
2023-08-12 20:55:20 +03:00
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
}
func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient {
return &pkgdashServiceClient{c: c, name: name}
}
2023-08-12 19:26:50 +03:00
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,
2023-08-12 20:55:20 +03:00
v41.ErrorMap(errmap),
)
opts = append(opts,
2023-08-12 20:55:20 +03:00
v41.Method(http.MethodGet),
v41.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
}
2023-08-12 19:26:50 +03:00
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,
2023-08-12 20:55:20 +03:00
v41.ErrorMap(errmap),
)
opts = append(opts,
2023-08-12 20:55:20 +03:00
v41.Method(http.MethodPost),
v41.Path("/v1/package/{id}"),
v41.Body("*"),
)
rsp := &UpdatePackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.UpdatePackage", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
2023-08-12 19:26:50 +03:00
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,
2023-08-12 20:55:20 +03:00
v41.ErrorMap(errmap),
)
opts = append(opts,
2023-08-12 20:55:20 +03:00
v41.Method(http.MethodPost),
v41.Path("/v1/package/{pkg}/comment"),
v41.Body("*"),
)
rsp := &AddCommentRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddComment", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
2023-08-12 19:26:50 +03:00
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,
2023-08-12 20:55:20 +03:00
v41.ErrorMap(errmap),
)
opts = append(opts,
2023-08-12 20:55:20 +03:00
v41.Method(http.MethodPost),
v41.Path("/v1/package"),
v41.Body("*"),
)
rsp := &AddPackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddPackage", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
2023-08-12 19:26:50 +03:00
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,
2023-08-12 20:55:20 +03:00
v41.ErrorMap(errmap),
)
opts = append(opts,
2023-08-12 20:55:20 +03:00
v41.Method(http.MethodGet),
v41.Path("/v1/module"),
)
rsp := &GetModuleRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.GetModule", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
type pkgdashServiceServer struct {
PkgdashServiceServer
}
2023-08-12 19:26:50 +03:00
func (h *pkgdashServiceServer) ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error {
return h.PkgdashServiceServer.ListPackage(ctx, req, rsp)
}
func (h *pkgdashServiceServer) UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error {
return h.PkgdashServiceServer.UpdatePackage(ctx, req, rsp)
}
func (h *pkgdashServiceServer) AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error {
return h.PkgdashServiceServer.AddComment(ctx, req, rsp)
}
func (h *pkgdashServiceServer) AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error {
return h.PkgdashServiceServer.AddPackage(ctx, req, rsp)
}
func (h *pkgdashServiceServer) GetModule(ctx context.Context, req *GetModuleReq, rsp *GetModuleRsp) error {
return h.PkgdashServiceServer.GetModule(ctx, req, rsp)
}
2023-08-12 19:26:50 +03:00
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...server.HandlerOption) error {
type pkgdashService interface {
2023-08-12 19:26:50 +03:00
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
GetModule(ctx context.Context, req *GetModuleReq, rsp *GetModuleRsp) error
}
type PkgdashService struct {
pkgdashService
}
h := &pkgdashServiceServer{sh}
2023-08-12 19:26:50 +03:00
var nopts []server.HandlerOption
2023-08-12 20:55:20 +03:00
nopts = append(nopts, v4.HandlerEndpoints(PkgdashServiceServerEndpoints))
2023-08-12 19:26:50 +03:00
return s.Handle(s.NewHandler(&PkgdashService{h}, append(nopts, opts...)...))
}