github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/kitex_gen/pb/example/testservice/client.go (about) 1 // Code generated by Kitex v0.5.2. DO NOT EDIT. 2 3 package testservice 4 5 import ( 6 "context" 7 example "github.com/cloudwego/dynamicgo/testdata/kitex_gen/pb/example" 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 ScalarsMethodTest(ctx context.Context, Req *example.ExampleScalarsReq, callOptions ...callopt.Option) (r *example.ExampleScalarsResp, err error) 15 MessageMethodTest(ctx context.Context, Req *example.ExampleMessageReq, callOptions ...callopt.Option) (r *example.ExampleMessageResp, err error) 16 NestedMethodTest(ctx context.Context, Req *example.ExampleNestedReq, callOptions ...callopt.Option) (r *example.ExampleNestedResp, err error) 17 PartialMethodTest(ctx context.Context, Req *example.ExampleParitalReq, callOptions ...callopt.Option) (r *example.ExamplePartialResp, err error) 18 ListMethodTest(ctx context.Context, Req *example.ExampleListReq, callOptions ...callopt.Option) (r *example.ExampleListResp, err error) 19 MapMethodTest(ctx context.Context, Req *example.ExampleMapReq, callOptions ...callopt.Option) (r *example.ExampleMapResp, err error) 20 OneofMethodTest(ctx context.Context, Req *example.ExampleOneofReq, callOptions ...callopt.Option) (r *example.ExampleOneofResp, err error) 21 } 22 23 // NewClient creates a client for the service defined in IDL. 24 func NewClient(destService string, opts ...client.Option) (Client, error) { 25 var options []client.Option 26 options = append(options, client.WithDestService(destService)) 27 28 options = append(options, opts...) 29 30 kc, err := client.NewClient(serviceInfo(), options...) 31 if err != nil { 32 return nil, err 33 } 34 return &kTestServiceClient{ 35 kClient: newServiceClient(kc), 36 }, nil 37 } 38 39 // MustNewClient creates a client for the service defined in IDL. It panics if any error occurs. 40 func MustNewClient(destService string, opts ...client.Option) Client { 41 kc, err := NewClient(destService, opts...) 42 if err != nil { 43 panic(err) 44 } 45 return kc 46 } 47 48 type kTestServiceClient struct { 49 *kClient 50 } 51 52 func (p *kTestServiceClient) ScalarsMethodTest(ctx context.Context, Req *example.ExampleScalarsReq, callOptions ...callopt.Option) (r *example.ExampleScalarsResp, err error) { 53 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 54 return p.kClient.ScalarsMethodTest(ctx, Req) 55 } 56 57 func (p *kTestServiceClient) MessageMethodTest(ctx context.Context, Req *example.ExampleMessageReq, callOptions ...callopt.Option) (r *example.ExampleMessageResp, err error) { 58 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 59 return p.kClient.MessageMethodTest(ctx, Req) 60 } 61 62 func (p *kTestServiceClient) NestedMethodTest(ctx context.Context, Req *example.ExampleNestedReq, callOptions ...callopt.Option) (r *example.ExampleNestedResp, err error) { 63 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 64 return p.kClient.NestedMethodTest(ctx, Req) 65 } 66 67 func (p *kTestServiceClient) PartialMethodTest(ctx context.Context, Req *example.ExampleParitalReq, callOptions ...callopt.Option) (r *example.ExamplePartialResp, err error) { 68 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 69 return p.kClient.PartialMethodTest(ctx, Req) 70 } 71 72 func (p *kTestServiceClient) ListMethodTest(ctx context.Context, Req *example.ExampleListReq, callOptions ...callopt.Option) (r *example.ExampleListResp, err error) { 73 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 74 return p.kClient.ListMethodTest(ctx, Req) 75 } 76 77 func (p *kTestServiceClient) MapMethodTest(ctx context.Context, Req *example.ExampleMapReq, callOptions ...callopt.Option) (r *example.ExampleMapResp, err error) { 78 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 79 return p.kClient.MapMethodTest(ctx, Req) 80 } 81 82 func (p *kTestServiceClient) OneofMethodTest(ctx context.Context, Req *example.ExampleOneofReq, callOptions ...callopt.Option) (r *example.ExampleOneofResp, err error) { 83 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 84 return p.kClient.OneofMethodTest(ctx, Req) 85 }