-
Notifications
You must be signed in to change notification settings - Fork 2
/
account_client.go
82 lines (70 loc) · 2.79 KB
/
account_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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING;
// Autogenerated by clientgenerator -r Account -m CRU DO NOT EDIT
package api
import (
"github.com/exotel/goapi/assets/types"
"github.com/exotel/goapi/resources"
)
//AccountService is the struct that defines the account information and has fubnctions to perform account level
type AccountService struct {
Client
}
//Create sets the action as create
func (__receiver_AService *AccountService) Create() *AccountService {
__receiver_AService.action = types.CREATE
__receiver_AService.data = resources.AccountDetails{}
__receiver_AService.url = resources.AccountURLS[types.CREATE]
return __receiver_AService
}
//Update sets the action as update
func (__receiver_AService *AccountService) Update() *AccountService {
__receiver_AService.action = types.UPDATE
__receiver_AService.data = resources.AccountUpdatableDetails{}
__receiver_AService.url = resources.AccountURLS[types.UPDATE]
return __receiver_AService
}
//Get sets the action as types.READ
func (__receiver_AService *AccountService) Get() *AccountService {
if len(__receiver_AService.ResourceID) == 0 {
__receiver_AService.action = types.BULKREAD
__receiver_AService.data = resources.AccountFilter{}
__receiver_AService.url = resources.AccountURLS[types.BULKREAD]
} else {
__receiver_AService.data = struct{}{}
__receiver_AService.url = resources.AccountURLS[types.READ]
__receiver_AService.action = types.READ
}
return __receiver_AService
}
//ID sets the id for the resource request
func (__receiver_AService *AccountService) ID(id string) *AccountService {
__receiver_AService.ResourceID = id
switch __receiver_AService.action {
case types.BULKREAD:
__receiver_AService.data = struct{}{}
__receiver_AService.url = resources.AccountURLS[types.READ]
__receiver_AService.action = types.READ
}
return __receiver_AService
}
//Filter set the filter for read operation for read
func (__receiver_AService *AccountService) Filter(filter resources.AccountFilter) *AccountService {
__receiver_AService.data = filter
return __receiver_AService
}
//Details set the resource details for create resource requests
func (__receiver_AService *AccountService) Details(details resources.AccountDetails) *AccountService {
__receiver_AService.data = details
return __receiver_AService
}
//UpdateDetails sets the details to be updated for the resource
func (__receiver_AService *AccountService) UpdateDetails(details resources.AccountUpdatableDetails) *AccountService {
__receiver_AService.data = details
return __receiver_AService
}
//Account returns an instance of AccountService
func (c *Client) Account() *AccountService {
accountService := AccountService{Client: *c}
accountService.validActions = types.CREATE | types.READ | types.BULKREAD | types.UPDATE | 0x00
return &accountService
}