github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/kitex_gen/pb/example2/testservice2/client.go (about) 1 // Code generated by Kitex v0.7.2. DO NOT EDIT. 2 3 package testservice2 4 5 import ( 6 "context" 7 example2 "github.com/cloudwego/dynamicgo/testdata/kitex_gen/pb/example2" 8 client "github.com/cloudwego/kitex/client" 9 callopt "github.com/cloudwego/kitex/client/callopt" 10 ) 11 12 // Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework. 13 type Client interface { 14 ExampleMethod(ctx context.Context, Req *example2.ExampleReq, callOptions ...callopt.Option) (r *example2.ExampleResp, err error) 15 ExamplePartialMethod(ctx context.Context, Req *example2.ExampleReqPartial, callOptions ...callopt.Option) (r *example2.A, err error) 16 ExamplePartialMethod2(ctx context.Context, Req *example2.ExampleReqPartial, callOptions ...callopt.Option) (r *example2.ExampleRespPartial, err error) 17 ExampleSuperMethod(ctx context.Context, Req *example2.ExampleSuper, callOptions ...callopt.Option) (r *example2.A, err error) 18 Int2FloatMethod(ctx context.Context, Req *example2.ExampleInt2Float, callOptions ...callopt.Option) (r *example2.ExampleInt2Float, err error) 19 Foo(ctx context.Context, Req *example2.A, callOptions ...callopt.Option) (r *example2.A, err error) 20 Ping(ctx context.Context, Req *example2.A, callOptions ...callopt.Option) (r *example2.PingResponse, err error) 21 Oneway(ctx context.Context, Req *example2.OnewayRequest, callOptions ...callopt.Option) (r *example2.VoidResponse, err error) 22 Void(ctx context.Context, Req *example2.VoidRequest, callOptions ...callopt.Option) (r *example2.VoidResponse, err error) 23 } 24 25 // NewClient creates a client for the service defined in IDL. 26 func NewClient(destService string, opts ...client.Option) (Client, error) { 27 var options []client.Option 28 options = append(options, client.WithDestService(destService)) 29 30 options = append(options, opts...) 31 32 kc, err := client.NewClient(serviceInfo(), options...) 33 if err != nil { 34 return nil, err 35 } 36 return &kTestService2Client{ 37 kClient: newServiceClient(kc), 38 }, nil 39 } 40 41 // MustNewClient creates a client for the service defined in IDL. It panics if any error occurs. 42 func MustNewClient(destService string, opts ...client.Option) Client { 43 kc, err := NewClient(destService, opts...) 44 if err != nil { 45 panic(err) 46 } 47 return kc 48 } 49 50 type kTestService2Client struct { 51 *kClient 52 } 53 54 func (p *kTestService2Client) ExampleMethod(ctx context.Context, Req *example2.ExampleReq, callOptions ...callopt.Option) (r *example2.ExampleResp, err error) { 55 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 56 return p.kClient.ExampleMethod(ctx, Req) 57 } 58 59 func (p *kTestService2Client) ExamplePartialMethod(ctx context.Context, Req *example2.ExampleReqPartial, callOptions ...callopt.Option) (r *example2.A, err error) { 60 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 61 return p.kClient.ExamplePartialMethod(ctx, Req) 62 } 63 64 func (p *kTestService2Client) ExamplePartialMethod2(ctx context.Context, Req *example2.ExampleReqPartial, callOptions ...callopt.Option) (r *example2.ExampleRespPartial, err error) { 65 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 66 return p.kClient.ExamplePartialMethod2(ctx, Req) 67 } 68 69 func (p *kTestService2Client) ExampleSuperMethod(ctx context.Context, Req *example2.ExampleSuper, callOptions ...callopt.Option) (r *example2.A, err error) { 70 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 71 return p.kClient.ExampleSuperMethod(ctx, Req) 72 } 73 74 func (p *kTestService2Client) Int2FloatMethod(ctx context.Context, Req *example2.ExampleInt2Float, callOptions ...callopt.Option) (r *example2.ExampleInt2Float, err error) { 75 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 76 return p.kClient.Int2FloatMethod(ctx, Req) 77 } 78 79 func (p *kTestService2Client) Foo(ctx context.Context, Req *example2.A, callOptions ...callopt.Option) (r *example2.A, err error) { 80 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 81 return p.kClient.Foo(ctx, Req) 82 } 83 84 func (p *kTestService2Client) Ping(ctx context.Context, Req *example2.A, callOptions ...callopt.Option) (r *example2.PingResponse, err error) { 85 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 86 return p.kClient.Ping(ctx, Req) 87 } 88 89 func (p *kTestService2Client) Oneway(ctx context.Context, Req *example2.OnewayRequest, callOptions ...callopt.Option) (r *example2.VoidResponse, err error) { 90 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 91 return p.kClient.Oneway(ctx, Req) 92 } 93 94 func (p *kTestService2Client) Void(ctx context.Context, Req *example2.VoidRequest, callOptions ...callopt.Option) (r *example2.VoidResponse, err error) { 95 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 96 return p.kClient.Void(ctx, Req) 97 }