/
api_op_client.go
63 lines (55 loc) · 1.83 KB
/
api_op_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
// Package user contains auto-generated files. DO NOT MODIFY
package user
import (
"github.com/RJPearson94/twilio-sdk-go/client"
"github.com/RJPearson94/twilio-sdk-go/service/chat/v2/service/user/binding"
"github.com/RJPearson94/twilio-sdk-go/service/chat/v2/service/user/bindings"
"github.com/RJPearson94/twilio-sdk-go/service/chat/v2/service/user/channel"
"github.com/RJPearson94/twilio-sdk-go/service/chat/v2/service/user/channels"
)
// Client for managing a specific user resource
// See https://www.twilio.com/docs/chat/rest/user-resource for more details
type Client struct {
client *client.Client
serviceSid string
sid string
Binding func(string) *binding.Client
Bindings *bindings.Client
Channel func(string) *channel.Client
Channels *channels.Client
}
// ClientProperties are the properties required to manage the user resources
type ClientProperties struct {
ServiceSid string
Sid string
}
// New creates a new instance of the user client
func New(client *client.Client, properties ClientProperties) *Client {
return &Client{
client: client,
serviceSid: properties.ServiceSid,
sid: properties.Sid,
Binding: func(bindingSid string) *binding.Client {
return binding.New(client, binding.ClientProperties{
ServiceSid: properties.ServiceSid,
Sid: bindingSid,
UserSid: properties.Sid,
})
},
Bindings: bindings.New(client, bindings.ClientProperties{
ServiceSid: properties.ServiceSid,
UserSid: properties.Sid,
}),
Channel: func(channelSid string) *channel.Client {
return channel.New(client, channel.ClientProperties{
ServiceSid: properties.ServiceSid,
Sid: channelSid,
UserSid: properties.Sid,
})
},
Channels: channels.New(client, channels.ClientProperties{
ServiceSid: properties.ServiceSid,
UserSid: properties.Sid,
}),
}
}