/
client.go
48 lines (40 loc) · 1.38 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
// Package v1 contains auto-generated files. DO NOT MODIFY
package v1
import (
"github.com/RJPearson94/twilio-sdk-go/client"
"github.com/RJPearson94/twilio-sdk-go/service/trunking/v1/trunk"
"github.com/RJPearson94/twilio-sdk-go/service/trunking/v1/trunks"
"github.com/RJPearson94/twilio-sdk-go/session"
)
// Trunking client is used to manage resources for Twilio SIP Trunking
// See https://www.twilio.com/docs/sip-trunking for more details
// This client is currently in beta and subject to change. Please use with caution
type Trunking struct {
client *client.Client
Trunk func(string) *trunk.Client
Trunks *trunks.Client
}
// NewWithClient creates a new instance of the client with a HTTP client
func NewWithClient(client *client.Client) *Trunking {
return &Trunking{
client: client,
Trunk: func(trunkSid string) *trunk.Client {
return trunk.New(client, trunk.ClientProperties{
Sid: trunkSid,
})
},
Trunks: trunks.New(client),
}
}
// GetClient is used for testing purposes only
func (s Trunking) GetClient() *client.Client {
return s.client
}
// New creates a new instance of the client using session data and config
func New(sess *session.Session, clientConfig *client.Config) *Trunking {
config := client.NewAPIClientConfig(clientConfig)
config.Beta = true
config.SubDomain = "trunking"
config.APIVersion = "v1"
return NewWithClient(client.New(sess, config))
}