github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/kitex_gen/pb/baseline/baselineservice/client.go (about) 1 // Code generated by Kitex v0.5.2. DO NOT EDIT. 2 3 package baselineservice 4 5 import ( 6 "context" 7 baseline "github.com/cloudwego/dynamicgo/testdata/kitex_gen/pb/baseline" 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 SimpleMethod(ctx context.Context, Req *baseline.Simple, callOptions ...callopt.Option) (r *baseline.Simple, err error) 15 PartialSimpleMethod(ctx context.Context, Req *baseline.PartialSimple, callOptions ...callopt.Option) (r *baseline.PartialSimple, err error) 16 NestingMethod(ctx context.Context, Req *baseline.Nesting, callOptions ...callopt.Option) (r *baseline.Nesting, err error) 17 PartialNestingMethod(ctx context.Context, Req *baseline.PartialNesting, callOptions ...callopt.Option) (r *baseline.PartialNesting, err error) 18 Nesting2Method(ctx context.Context, Req *baseline.Nesting2, callOptions ...callopt.Option) (r *baseline.Nesting2, err error) 19 } 20 21 // NewClient creates a client for the service defined in IDL. 22 func NewClient(destService string, opts ...client.Option) (Client, error) { 23 var options []client.Option 24 options = append(options, client.WithDestService(destService)) 25 26 options = append(options, opts...) 27 28 kc, err := client.NewClient(serviceInfo(), options...) 29 if err != nil { 30 return nil, err 31 } 32 return &kBaselineServiceClient{ 33 kClient: newServiceClient(kc), 34 }, nil 35 } 36 37 // MustNewClient creates a client for the service defined in IDL. It panics if any error occurs. 38 func MustNewClient(destService string, opts ...client.Option) Client { 39 kc, err := NewClient(destService, opts...) 40 if err != nil { 41 panic(err) 42 } 43 return kc 44 } 45 46 type kBaselineServiceClient struct { 47 *kClient 48 } 49 50 func (p *kBaselineServiceClient) SimpleMethod(ctx context.Context, Req *baseline.Simple, callOptions ...callopt.Option) (r *baseline.Simple, err error) { 51 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 52 return p.kClient.SimpleMethod(ctx, Req) 53 } 54 55 func (p *kBaselineServiceClient) PartialSimpleMethod(ctx context.Context, Req *baseline.PartialSimple, callOptions ...callopt.Option) (r *baseline.PartialSimple, err error) { 56 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 57 return p.kClient.PartialSimpleMethod(ctx, Req) 58 } 59 60 func (p *kBaselineServiceClient) NestingMethod(ctx context.Context, Req *baseline.Nesting, callOptions ...callopt.Option) (r *baseline.Nesting, err error) { 61 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 62 return p.kClient.NestingMethod(ctx, Req) 63 } 64 65 func (p *kBaselineServiceClient) PartialNestingMethod(ctx context.Context, Req *baseline.PartialNesting, callOptions ...callopt.Option) (r *baseline.PartialNesting, err error) { 66 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 67 return p.kClient.PartialNestingMethod(ctx, Req) 68 } 69 70 func (p *kBaselineServiceClient) Nesting2Method(ctx context.Context, Req *baseline.Nesting2, callOptions ...callopt.Option) (r *baseline.Nesting2, err error) { 71 ctx = client.NewCtxWithCallOptions(ctx, callOptions) 72 return p.kClient.Nesting2Method(ctx, Req) 73 }