-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
85 lines (70 loc) · 3.87 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Code generated by Kitex v0.9.1. DO NOT EDIT.
package liveservice
import (
"context"
client "github.com/cloudwego/kitex/client"
callopt "github.com/cloudwego/kitex/client/callopt"
live "github.com/jizizr/goligoli/server/kitex_gen/live"
)
// Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
type Client interface {
CreateLiveRoom(ctx context.Context, req *live.CreateLiveRoomRequest, callOptions ...callopt.Option) (r *live.CreateLiveRoomResponse, err error)
GetLiveRoomOwner(ctx context.Context, req *live.GetLiveRoomOwnerRequest, callOptions ...callopt.Option) (r *live.GetLiveRoomOwnerResponse, err error)
GetLiveRoomStatus(ctx context.Context, req *live.GetLiveRoomStatusRequest, callOptions ...callopt.Option) (r *live.GetLiveRoomStatusResponse, err error)
GetLiveRoom(ctx context.Context, req *live.GetLiveRoomRequest, callOptions ...callopt.Option) (r *live.GetLiveRoomResponse, err error)
GetLiveRoomKey(ctx context.Context, req *live.GetLiveRoomKeyRequest, callOptions ...callopt.Option) (r *live.GetLiveRoomKeyResponse, err error)
GetAllOnlineLiveRoom(ctx context.Context, callOptions ...callopt.Option) (r *live.GetAllOnlineLiveRoomResponse, err error)
StopLiveRoom(ctx context.Context, req *live.StopLiveRoomRequest, callOptions ...callopt.Option) (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 &kLiveServiceClient{
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 kLiveServiceClient struct {
*kClient
}
func (p *kLiveServiceClient) CreateLiveRoom(ctx context.Context, req *live.CreateLiveRoomRequest, callOptions ...callopt.Option) (r *live.CreateLiveRoomResponse, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.CreateLiveRoom(ctx, req)
}
func (p *kLiveServiceClient) GetLiveRoomOwner(ctx context.Context, req *live.GetLiveRoomOwnerRequest, callOptions ...callopt.Option) (r *live.GetLiveRoomOwnerResponse, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.GetLiveRoomOwner(ctx, req)
}
func (p *kLiveServiceClient) GetLiveRoomStatus(ctx context.Context, req *live.GetLiveRoomStatusRequest, callOptions ...callopt.Option) (r *live.GetLiveRoomStatusResponse, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.GetLiveRoomStatus(ctx, req)
}
func (p *kLiveServiceClient) GetLiveRoom(ctx context.Context, req *live.GetLiveRoomRequest, callOptions ...callopt.Option) (r *live.GetLiveRoomResponse, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.GetLiveRoom(ctx, req)
}
func (p *kLiveServiceClient) GetLiveRoomKey(ctx context.Context, req *live.GetLiveRoomKeyRequest, callOptions ...callopt.Option) (r *live.GetLiveRoomKeyResponse, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.GetLiveRoomKey(ctx, req)
}
func (p *kLiveServiceClient) GetAllOnlineLiveRoom(ctx context.Context, callOptions ...callopt.Option) (r *live.GetAllOnlineLiveRoomResponse, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.GetAllOnlineLiveRoom(ctx)
}
func (p *kLiveServiceClient) StopLiveRoom(ctx context.Context, req *live.StopLiveRoomRequest, callOptions ...callopt.Option) (err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.StopLiveRoom(ctx, req)
}