github.com/btccom/go-micro/v2@v2.9.3/api/service/proto/api.pb.micro.go (about)

     1  // Code generated by protoc-gen-micro. DO NOT EDIT.
     2  // source: api/service/proto/api.proto
     3  
     4  package go_micro_api
     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/btccom/go-micro/v2/api"
    15  	client "github.com/btccom/go-micro/v2/client"
    16  	server "github.com/btccom/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 Api service
    37  
    38  func NewApiEndpoints() []*api.Endpoint {
    39  	return []*api.Endpoint{}
    40  }
    41  
    42  // Client API for Api service
    43  
    44  type ApiService interface {
    45  	Register(ctx context.Context, in *Endpoint, opts ...client.CallOption) (*EmptyResponse, error)
    46  	Deregister(ctx context.Context, in *Endpoint, opts ...client.CallOption) (*EmptyResponse, error)
    47  }
    48  
    49  type apiService struct {
    50  	c    client.Client
    51  	name string
    52  }
    53  
    54  func NewApiService(name string, c client.Client) ApiService {
    55  	return &apiService{
    56  		c:    c,
    57  		name: name,
    58  	}
    59  }
    60  
    61  func (c *apiService) Register(ctx context.Context, in *Endpoint, opts ...client.CallOption) (*EmptyResponse, error) {
    62  	req := c.c.NewRequest(c.name, "Api.Register", in)
    63  	out := new(EmptyResponse)
    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 *apiService) Deregister(ctx context.Context, in *Endpoint, opts ...client.CallOption) (*EmptyResponse, error) {
    72  	req := c.c.NewRequest(c.name, "Api.Deregister", in)
    73  	out := new(EmptyResponse)
    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 Api service
    82  
    83  type ApiHandler interface {
    84  	Register(context.Context, *Endpoint, *EmptyResponse) error
    85  	Deregister(context.Context, *Endpoint, *EmptyResponse) error
    86  }
    87  
    88  func RegisterApiHandler(s server.Server, hdlr ApiHandler, opts ...server.HandlerOption) error {
    89  	type api interface {
    90  		Register(ctx context.Context, in *Endpoint, out *EmptyResponse) error
    91  		Deregister(ctx context.Context, in *Endpoint, out *EmptyResponse) error
    92  	}
    93  	type Api struct {
    94  		api
    95  	}
    96  	h := &apiHandler{hdlr}
    97  	return s.Handle(s.NewHandler(&Api{h}, opts...))
    98  }
    99  
   100  type apiHandler struct {
   101  	ApiHandler
   102  }
   103  
   104  func (h *apiHandler) Register(ctx context.Context, in *Endpoint, out *EmptyResponse) error {
   105  	return h.ApiHandler.Register(ctx, in, out)
   106  }
   107  
   108  func (h *apiHandler) Deregister(ctx context.Context, in *Endpoint, out *EmptyResponse) error {
   109  	return h.ApiHandler.Deregister(ctx, in, out)
   110  }