-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.go
43 lines (32 loc) · 1.09 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
package service
import (
"context"
"github.com/go-orb/go-orb/client"
"github.com/go-orb/service/httpgateway/proto/httpgateway_v1"
"google.golang.org/protobuf/types/known/emptypb"
)
type Client struct {
serviceName string
clientWire client.Type
}
func New(serviceName string, clientWire client.Type) *Client {
return &Client{
serviceName: serviceName,
clientWire: clientWire,
}
}
func (c *Client) ServiceName() string {
return c.serviceName
}
func (c *Client) AddRoutes(ctx context.Context, routes *httpgateway_v1.Routes) (*emptypb.Empty, error) {
cli := httpgateway_v1.NewHttpGatewayClient(c.clientWire)
return cli.AddRoutes(ctx, c.serviceName, routes)
}
func (c *Client) SetRoutes(ctx context.Context, routes *httpgateway_v1.Routes) (*emptypb.Empty, error) {
cli := httpgateway_v1.NewHttpGatewayClient(c.clientWire)
return cli.SetRoutes(ctx, c.serviceName, routes)
}
func (c *Client) RemoveRoutes(ctx context.Context, paths *httpgateway_v1.Paths) (*emptypb.Empty, error) {
cli := httpgateway_v1.NewHttpGatewayClient(c.clientWire)
return cli.RemoveRoutes(ctx, c.serviceName, paths)
}