pusher/kitex_gen/push/pushservice/client.go

69 lines
2.5 KiB
Go
Raw Normal View History

2024-05-17 18:02:10 +08:00
// Code generated by Kitex v0.9.0. DO NOT EDIT.
package pushservice
import (
"context"
config "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/config"
push "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/push"
client "github.com/cloudwego/kitex/client"
callopt "github.com/cloudwego/kitex/client/callopt"
)
// Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
type Client interface {
2024-05-20 17:57:25 +08:00
Push(ctx context.Context, req *push.PushReq, callOptions ...callopt.Option) (r *push.Resp, err error)
Add(ctx context.Context, req *config.PusherConfig, callOptions ...callopt.Option) (r *push.Resp, err error)
2024-05-17 18:02:10 +08:00
List(ctx context.Context, req *push.ListPusherRequest, callOptions ...callopt.Option) (r *push.ListPusherResponse, err error)
2024-05-20 17:57:25 +08:00
GetPusherOptions(ctx context.Context, callOptions ...callopt.Option) (r *push.GetPusherOptionsResponse, err error)
2024-05-17 18:02:10 +08:00
}
// NewClient creates a client for the service defined in IDL.
func NewClient(destService string, opts ...client.Option) (Client, error) {
var options []client.Option
options = append(options, client.WithDestService(destService))
options = append(options, opts...)
kc, err := client.NewClient(serviceInfoForClient(), options...)
if err != nil {
return nil, err
}
return &kPushServiceClient{
kClient: newServiceClient(kc),
}, nil
}
// MustNewClient creates a client for the service defined in IDL. It panics if any error occurs.
func MustNewClient(destService string, opts ...client.Option) Client {
kc, err := NewClient(destService, opts...)
if err != nil {
panic(err)
}
return kc
}
type kPushServiceClient struct {
*kClient
}
2024-05-20 17:57:25 +08:00
func (p *kPushServiceClient) Push(ctx context.Context, req *push.PushReq, callOptions ...callopt.Option) (r *push.Resp, err error) {
2024-05-17 18:02:10 +08:00
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.Push(ctx, req)
}
2024-05-20 17:57:25 +08:00
func (p *kPushServiceClient) Add(ctx context.Context, req *config.PusherConfig, callOptions ...callopt.Option) (r *push.Resp, err error) {
2024-05-17 18:02:10 +08:00
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.Add(ctx, req)
}
func (p *kPushServiceClient) List(ctx context.Context, req *push.ListPusherRequest, callOptions ...callopt.Option) (r *push.ListPusherResponse, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.List(ctx, req)
}
2024-05-20 17:57:25 +08:00
func (p *kPushServiceClient) GetPusherOptions(ctx context.Context, callOptions ...callopt.Option) (r *push.GetPusherOptionsResponse, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.GetPusherOptions(ctx)
}