gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/agent/proto/bot.pb.micro.go (about)

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