-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.go
More file actions
90 lines (69 loc) · 2.86 KB
/
Copy pathclient.go
File metadata and controls
90 lines (69 loc) · 2.86 KB
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
88
89
90
package mango
import (
"github.com/TrashPony/Mango-api-wrapper/mango_client"
"github.com/TrashPony/Mango-api-wrapper/mango_commands"
"github.com/TrashPony/Mango-api-wrapper/mango_events"
"github.com/TrashPony/Mango-api-wrapper/mango_objects"
)
type Client struct {
apiKey string
apiSing string
apiUrl string
}
func (c *Client) SetApiKey(key string) {
c.apiKey = key
}
func (c *Client) SetApiSing(sing string) {
c.apiSing = sing
}
func (c *Client) SetApiUrl(url string) {
c.apiUrl = url
}
func (c *Client) GetBalance() *mango_client.Balance {
return mango_client.GetBalance(c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) GetUserByExtension(extension string) *mango_objects.User {
return mango_client.GetUserByExtension(extension, c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) GetUsers() *mango_objects.Users {
return mango_client.GetUsers(c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) EndCall(callID string) *mango_objects.Result {
return mango_commands.EndCall(callID, c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) InitCallOfGroup(from, to, lineNumber string) *mango_objects.Result {
return mango_commands.InitCallOfGroup(from, to, lineNumber, c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) InitCallOfUser(extension, callerNumber, toNumber, lineNumber, sipHeaders string) *mango_objects.Result {
return mango_commands.InitCallOfUser(extension, callerNumber, toNumber, lineNumber, sipHeaders, c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) RoutingCall(callID, toNumber, sipHeaders string) *mango_objects.Result {
return mango_commands.RoutingCall(callID, toNumber, sipHeaders, c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) SendSms(fromExtension, toNumber, smsSender, text string) *mango_objects.Result {
return mango_commands.SendSms(fromExtension, toNumber, smsSender, text, c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) TransferCall(callID, method, toNumber, initiator string) *mango_objects.Result {
return mango_commands.TransferCall(callID, method, toNumber, initiator, c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) TurnOnRecordingCall(callID, callPartyNumber string) *mango_objects.Result {
return mango_commands.TurnOnRecordingCall(callID, callPartyNumber, c.apiKey, c.apiSing, c.apiUrl)
}
func (c *Client) GetCallEvents() <-chan *mango_objects.Call {
return mango_events.Events.GetAddCallChan()
}
func (c *Client) GetDTMFEvents() <-chan *mango_objects.DTMF {
return mango_events.Events.GetDTMF()
}
func (c *Client) GetEndCallsEvents() <-chan *mango_objects.Call {
return mango_events.Events.GetEndCalls()
}
func (c *Client) GetAddRecordEvents() <-chan *mango_objects.Record {
return mango_events.Events.GetAddedRecords()
}
func (c *Client) GetStartRecordEvents() <-chan *mango_objects.Record {
return mango_events.Events.GetStartedRecord()
}
func (c *Client) GetSMSEvents() <-chan *mango_objects.SMS {
return mango_events.Events.GetSMS()
}