-
Notifications
You must be signed in to change notification settings - Fork 2
/
call_client.go
68 lines (58 loc) · 2.14 KB
/
call_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
64
65
66
67
68
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING;
// Autogenerated by clientgenerator -r Call -m CR DO NOT EDIT
package api
import (
"github.com/exotel/goapi/assets/types"
"github.com/exotel/goapi/resources"
)
//CallService is the struct that defines the call information and has fubnctions to perform call level
type CallService struct {
Client
}
//Create sets the action as create
func (__receiver_CService *CallService) Create() *CallService {
__receiver_CService.action = types.CREATE
__receiver_CService.data = resources.CallDetails{}
__receiver_CService.url = resources.CallURLS[types.CREATE]
return __receiver_CService
}
//Get sets the action as types.READ
func (__receiver_CService *CallService) Get() *CallService {
if len(__receiver_CService.ResourceID) == 0 {
__receiver_CService.action = types.BULKREAD
__receiver_CService.data = resources.CallFilter{}
__receiver_CService.url = resources.CallURLS[types.BULKREAD]
} else {
__receiver_CService.data = struct{}{}
__receiver_CService.url = resources.CallURLS[types.READ]
__receiver_CService.action = types.READ
}
return __receiver_CService
}
//ID sets the id for the resource request
func (__receiver_CService *CallService) ID(id string) *CallService {
__receiver_CService.ResourceID = id
switch __receiver_CService.action {
case types.BULKREAD:
__receiver_CService.data = struct{}{}
__receiver_CService.url = resources.CallURLS[types.READ]
__receiver_CService.action = types.READ
}
return __receiver_CService
}
//Filter set the filter for read operation for read
func (__receiver_CService *CallService) Filter(filter resources.CallFilter) *CallService {
__receiver_CService.data = filter
return __receiver_CService
}
//Details set the resource details for create resource requests
func (__receiver_CService *CallService) Details(details resources.CallDetails) *CallService {
__receiver_CService.data = details
return __receiver_CService
}
//Call returns an instance of CallService
func (c *Client) Call() *CallService {
callService := CallService{Client: *c}
callService.validActions = types.CREATE | types.READ | types.BULKREAD | 0x00
return &callService
}