69 lines
2.5 KiB
Go
69 lines
2.5 KiB
Go
// Code generated by Kitex v0.9.1. 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 {
|
|
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)
|
|
List(ctx context.Context, req *push.ListPusherRequest, callOptions ...callopt.Option) (r *push.ListPusherResponse, err error)
|
|
GetPusherOptions(ctx context.Context, callOptions ...callopt.Option) (r *push.GetPusherOptionsResponse, err error)
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
func (p *kPushServiceClient) Push(ctx context.Context, req *push.PushReq, callOptions ...callopt.Option) (r *push.Resp, err error) {
|
|
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
|
|
return p.kClient.Push(ctx, req)
|
|
}
|
|
|
|
func (p *kPushServiceClient) Add(ctx context.Context, req *config.PusherConfig, callOptions ...callopt.Option) (r *push.Resp, err error) {
|
|
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)
|
|
}
|
|
|
|
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)
|
|
}
|