github.com/annwntech/go-micro/v2@v2.9.5/agent/proto/bot.pb.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: agent/proto/bot.proto 3 4 package go_micro_bot 5 6 import ( 7 fmt "fmt" 8 proto "github.com/golang/protobuf/proto" 9 math "math" 10 ) 11 12 import ( 13 context "context" 14 api "github.com/annwntech/go-micro/v2/api" 15 client "github.com/annwntech/go-micro/v2/client" 16 server "github.com/annwntech/go-micro/v2/server" 17 ) 18 19 // Reference imports to suppress errors if they are not otherwise used. 20 var _ = proto.Marshal 21 var _ = fmt.Errorf 22 var _ = math.Inf 23 24 // This is a compile-time assertion to ensure that this generated file 25 // is compatible with the proto package it is being compiled against. 26 // A compilation error at this line likely means your copy of the 27 // proto package needs to be updated. 28 const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 29 30 // Reference imports to suppress errors if they are not otherwise used. 31 var _ api.Endpoint 32 var _ context.Context 33 var _ client.Option 34 var _ server.Option 35 36 // Api Endpoints for Command service 37 38 func NewCommandEndpoints() []*api.Endpoint { 39 return []*api.Endpoint{} 40 } 41 42 // Client API for Command service 43 44 type CommandService interface { 45 Help(ctx context.Context, in *HelpRequest, opts ...client.CallOption) (*HelpResponse, error) 46 Exec(ctx context.Context, in *ExecRequest, opts ...client.CallOption) (*ExecResponse, error) 47 } 48 49 type commandService struct { 50 c client.Client 51 name string 52 } 53 54 func NewCommandService(name string, c client.Client) CommandService { 55 return &commandService{ 56 c: c, 57 name: name, 58 } 59 } 60 61 func (c *commandService) Help(ctx context.Context, in *HelpRequest, opts ...client.CallOption) (*HelpResponse, error) { 62 req := c.c.NewRequest(c.name, "Command.Help", in) 63 out := new(HelpResponse) 64 err := c.c.Call(ctx, req, out, opts...) 65 if err != nil { 66 return nil, err 67 } 68 return out, nil 69 } 70 71 func (c *commandService) Exec(ctx context.Context, in *ExecRequest, opts ...client.CallOption) (*ExecResponse, error) { 72 req := c.c.NewRequest(c.name, "Command.Exec", in) 73 out := new(ExecResponse) 74 err := c.c.Call(ctx, req, out, opts...) 75 if err != nil { 76 return nil, err 77 } 78 return out, nil 79 } 80 81 // Server API for Command service 82 83 type CommandHandler interface { 84 Help(context.Context, *HelpRequest, *HelpResponse) error 85 Exec(context.Context, *ExecRequest, *ExecResponse) error 86 } 87 88 func RegisterCommandHandler(s server.Server, hdlr CommandHandler, opts ...server.HandlerOption) error { 89 type command interface { 90 Help(ctx context.Context, in *HelpRequest, out *HelpResponse) error 91 Exec(ctx context.Context, in *ExecRequest, out *ExecResponse) error 92 } 93 type Command struct { 94 command 95 } 96 h := &commandHandler{hdlr} 97 return s.Handle(s.NewHandler(&Command{h}, opts...)) 98 } 99 100 type commandHandler struct { 101 CommandHandler 102 } 103 104 func (h *commandHandler) Help(ctx context.Context, in *HelpRequest, out *HelpResponse) error { 105 return h.CommandHandler.Help(ctx, in, out) 106 } 107 108 func (h *commandHandler) Exec(ctx context.Context, in *ExecRequest, out *ExecResponse) error { 109 return h.CommandHandler.Exec(ctx, in, out) 110 }