-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtwilio.go
87 lines (82 loc) · 3.3 KB
/
twilio.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
86
87
package twilio
import (
"github.com/RJPearson94/twilio-sdk-go/client"
"github.com/RJPearson94/twilio-sdk-go/service/accounts"
"github.com/RJPearson94/twilio-sdk-go/service/api"
"github.com/RJPearson94/twilio-sdk-go/service/autopilot"
"github.com/RJPearson94/twilio-sdk-go/service/chat"
"github.com/RJPearson94/twilio-sdk-go/service/conversations"
"github.com/RJPearson94/twilio-sdk-go/service/fax"
"github.com/RJPearson94/twilio-sdk-go/service/flex"
"github.com/RJPearson94/twilio-sdk-go/service/lookups"
"github.com/RJPearson94/twilio-sdk-go/service/messaging"
"github.com/RJPearson94/twilio-sdk-go/service/monitor"
"github.com/RJPearson94/twilio-sdk-go/service/notify"
"github.com/RJPearson94/twilio-sdk-go/service/proxy"
"github.com/RJPearson94/twilio-sdk-go/service/serverless"
"github.com/RJPearson94/twilio-sdk-go/service/studio"
"github.com/RJPearson94/twilio-sdk-go/service/sync"
"github.com/RJPearson94/twilio-sdk-go/service/taskrouter"
"github.com/RJPearson94/twilio-sdk-go/service/trunking"
"github.com/RJPearson94/twilio-sdk-go/service/verify"
"github.com/RJPearson94/twilio-sdk-go/service/video"
"github.com/RJPearson94/twilio-sdk-go/session"
"github.com/RJPearson94/twilio-sdk-go/session/credentials"
"github.com/RJPearson94/twilio-sdk-go/twiml"
)
// Twilio clients manage all the available Twilio services & resources within the SDK
type Twilio struct {
Accounts *accounts.Accounts
API *api.API
Autopilot *autopilot.Autopilot
Chat *chat.Chat
Conversations *conversations.Conversations
Fax *fax.Fax
Flex *flex.Flex
Lookups *lookups.Lookups
Messaging *messaging.Messaging
Monitor *monitor.Monitor
Notify *notify.Notify
Proxy *proxy.Proxy
Serverless *serverless.Serverless
Studio *studio.Studio
Sync *sync.Sync
TaskRouter *taskrouter.TaskRouter
Trunking *trunking.Trunking
TwiML *twiml.TwiML
Verify *verify.Verify
Video *video.Video
}
// New create a new instance of the client using session data
func New(sess *session.Session) *Twilio {
return NewWithConfig(sess, nil)
}
// NewWithConfig create a new instance of the client using session data and config
func NewWithConfig(sess *session.Session, config *client.Config) *Twilio {
return &Twilio{
Accounts: accounts.New(sess, config),
API: api.New(sess, config),
Autopilot: autopilot.New(sess, config),
Chat: chat.New(sess, config),
Conversations: conversations.New(sess, config),
Fax: fax.New(sess, config),
Flex: flex.New(sess, config),
Lookups: lookups.New(sess, config),
Messaging: messaging.New(sess, config),
Monitor: monitor.New(sess, config),
Notify: notify.New(sess, config),
Proxy: proxy.New(sess, config),
Serverless: serverless.New(sess, config),
Studio: studio.New(sess, config),
Sync: sync.New(sess, config),
TaskRouter: taskrouter.New(sess, config),
Trunking: trunking.New(sess, config),
TwiML: twiml.New(),
Verify: verify.New(sess, config),
Video: video.New(sess, config),
}
}
// NewWithCredentials creates a new instance of the client with credentials
func NewWithCredentials(creds *credentials.Credentials) *Twilio {
return New(session.New(creds))
}