wallet.pb.micro.go 2.66 KB
Newer Older
kzkzzzz's avatar
kzkzzzz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: wallet.proto

package wallet

import (
	fmt "fmt"
	proto "google.golang.org/protobuf/proto"
	_ "google.golang.org/protobuf/types/known/timestamppb"
	math "math"
)

import (
	context "context"
	api "go-micro.dev/v4/api"
	client "go-micro.dev/v4/client"
	server "go-micro.dev/v4/server"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option

// Api Endpoints for Wallet service

func NewWalletEndpoints() []*api.Endpoint {
	return []*api.Endpoint{}
}

// Client API for Wallet service

type WalletService interface {
40 41
	AddGold(ctx context.Context, in *AddGoldReq, opts ...client.CallOption) (*AddGoldResp, error)
	ChargeOne(ctx context.Context, in *ChargeOneReq, opts ...client.CallOption) (*ChargeOneResp, error)
kzkzzzz's avatar
kzkzzzz committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55
}

type walletService struct {
	c    client.Client
	name string
}

func NewWalletService(name string, c client.Client) WalletService {
	return &walletService{
		c:    c,
		name: name,
	}
}

56 57 58
func (c *walletService) AddGold(ctx context.Context, in *AddGoldReq, opts ...client.CallOption) (*AddGoldResp, error) {
	req := c.c.NewRequest(c.name, "Wallet.AddGold", in)
	out := new(AddGoldResp)
kzkzzzz's avatar
kzkzzzz committed
59 60 61 62 63 64 65
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

66 67 68
func (c *walletService) ChargeOne(ctx context.Context, in *ChargeOneReq, opts ...client.CallOption) (*ChargeOneResp, error) {
	req := c.c.NewRequest(c.name, "Wallet.ChargeOne", in)
	out := new(ChargeOneResp)
kzkzzzz's avatar
kzkzzzz committed
69 70 71 72 73 74 75 76 77 78
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for Wallet service

type WalletHandler interface {
79 80
	AddGold(context.Context, *AddGoldReq, *AddGoldResp) error
	ChargeOne(context.Context, *ChargeOneReq, *ChargeOneResp) error
kzkzzzz's avatar
kzkzzzz committed
81 82 83 84
}

func RegisterWalletHandler(s server.Server, hdlr WalletHandler, opts ...server.HandlerOption) error {
	type wallet interface {
85 86
		AddGold(ctx context.Context, in *AddGoldReq, out *AddGoldResp) error
		ChargeOne(ctx context.Context, in *ChargeOneReq, out *ChargeOneResp) error
kzkzzzz's avatar
kzkzzzz committed
87 88 89 90 91 92 93 94 95 96 97 98
	}
	type Wallet struct {
		wallet
	}
	h := &walletHandler{hdlr}
	return s.Handle(s.NewHandler(&Wallet{h}, opts...))
}

type walletHandler struct {
	WalletHandler
}

99 100
func (h *walletHandler) AddGold(ctx context.Context, in *AddGoldReq, out *AddGoldResp) error {
	return h.WalletHandler.AddGold(ctx, in, out)
kzkzzzz's avatar
kzkzzzz committed
101 102
}

103 104
func (h *walletHandler) ChargeOne(ctx context.Context, in *ChargeOneReq, out *ChargeOneResp) error {
	return h.WalletHandler.ChargeOne(ctx, in, out)
kzkzzzz's avatar
kzkzzzz committed
105
}