-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtollfree_verification.go
148 lines (134 loc) · 7.3 KB
/
tollfree_verification.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package plivo
import "time"
// TollfreeVerificationService - TF verification service struct
type TollfreeVerificationService struct {
client *Client
}
// TollfreeVerificationResponse - Default response
type TollfreeVerificationResponse struct {
APIID string `json:"api_id" url:"api_id"`
Message string `json:"message,omitempty" url:"message,omitempty"`
}
// TollfreeVerificationCreateResponse - Default response
type TollfreeVerificationCreateResponse struct {
APIID string `json:"api_id" url:"api_id"`
Message string `json:"message,omitempty" url:"message,omitempty"`
UUID string `json:"uuid" url:"uuid"`
}
// TollfreeVerificationCreateParams - List of params to create a TF verification request
type TollfreeVerificationCreateParams struct {
ProfileUUID string `json:"profile_uuid,omitempty" url:"profile_uuid,omitempty"`
Usecase string `json:"usecase,omitempty" url:"usecase,omitempty"`
UsecaseSummary string `json:"usecase_summary,omitempty" url:"usecase_summary,omitempty"`
MessageSample string `json:"message_sample,omitempty" url:"message_sample,omitempty"`
OptInImageURL string `json:"optin_image_url,omitempty" url:"optin_image_url,omitempty"`
OptInType string `json:"optin_type,omitempty" url:"optin_type,omitempty"`
Volume string `json:"volume,omitempty" url:"volume,omitempty"`
AdditionalInformation string `json:"additional_information,omitempty" url:"additional_information,omitempty"`
ExtraData string `json:"extra_data,omitempty" url:"extra_data,omitempty"`
Number string `json:"number,omitempty" url:"number,omitempty"`
CallbackURL string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
CallbackMethod string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
}
// TollfreeVerificationUpdateParams - List of update params to update in TF verification request
type TollfreeVerificationUpdateParams struct {
ProfileUUID string `json:"profile_uuid,omitempty" url:"profile_uuid,omitempty"`
Usecase string `json:"usecase,omitempty" url:"usecase,omitempty"`
UsecaseSummary string `json:"usecase_summary,omitempty" url:"usecase_summary,omitempty"`
MessageSample string `json:"message_sample,omitempty" url:"message_sample,omitempty"`
OptInImageURL string `json:"optin_image_url,omitempty" url:"optin_image_url,omitempty"`
OptInType string `json:"optin_type,omitempty" url:"optin_type,omitempty"`
Volume string `json:"volume,omitempty" url:"volume,omitempty"`
AdditionalInformation string `json:"additional_information,omitempty" url:"additional_information,omitempty"`
ExtraData string `json:"extra_data,omitempty" url:"extra_data,omitempty"`
CallbackURL string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
CallbackMethod string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
}
// TollfreeVerificationListParams - List of params to search in list API
type TollfreeVerificationListParams struct {
Number string `json:"number,omitempty" url:"number,omitempty"`
Status string `json:"status,omitempty" url:"status,omitempty"`
ProfileUUID string `json:"profile_uuid,omitempty" url:"profile_uuid,omitempty"`
CreatedGT string `json:"created__gt,omitempty" url:"created__gt,omitempty"`
CreatedGTE string `json:"created__gte,omitempty" url:"created__gte,omitempty"`
CreatedLT string `json:"created__lt,omitempty" url:"created__lt,omitempty"`
CreatedLTE string `json:"created__lte,omitempty" url:"created__lte,omitempty"`
Usecase string `json:"usecase,omitempty" url:"usecase,omitempty"`
Limit int64 `json:"limit,omitempty" url:"limit,omitempty"`
Offset int64 `json:"offset,omitempty" url:"offset,omitempty"`
}
// TollfreeVerification struct
type TollfreeVerification struct {
UUID string `json:"uuid" url:"uuid"`
ProfileUUID string `json:"profile_uuid" url:"profile_uuid"`
Number string `json:"number" url:"number"`
Usecase string `json:"usecase" url:"usecase"`
UsecaseSummary string `json:"usecase_summary" url:"usecase_summary"`
MessageSample string `json:"message_sample" url:"message_sample"`
OptinImageURL *string `json:"optin_image_url" url:"optin_image_url"`
OptinType string `json:"optin_type" url:"optin_type"`
Volume string `json:"volume" url:"volume"`
AdditionalInformation string `json:"additional_information" url:"additional_information"`
ExtraData string `json:"extra_data" url:"extra_data"`
CallbackURL string `json:"callback_url" url:"callback_url"`
CallbackMethod string `json:"callback_method" url:"callback_method"`
Status string `json:"status" url:"status"`
ErrorMessage string `json:"error_message" url:"error_message"`
Created time.Time `json:"created" url:"created"`
LastModified time.Time `json:"last_modified" url:"last_modified"`
}
// TollfreeVerificationListResponse - list API response struct
type TollfreeVerificationListResponse struct {
APIID string `json:"api_id" url:"api_id"`
Meta *Meta `json:"meta,omitempty" url:"meta,omitempty"`
Objects []TollfreeVerification `json:"objects,omitempty" url:"objects,omitempty"`
}
// Create - create API for Tollfree Verification Request
func (service *TollfreeVerificationService) Create(params TollfreeVerificationCreateParams) (response *TollfreeVerificationCreateResponse, err error) {
req, err := service.client.NewRequest("POST", params, "TollfreeVerification")
if err != nil {
return
}
response = &TollfreeVerificationCreateResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
// Update - Update API for Tollfree Verification Request
func (service *TollfreeVerificationService) Update(UUID string, params TollfreeVerificationUpdateParams) (response *TollfreeVerificationResponse, err error) {
req, err := service.client.NewRequest("POST", params, "TollfreeVerification/%s", UUID)
if err != nil {
return
}
response = &TollfreeVerificationResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
// Get - Get API for Tollfree Verification Request
func (service *TollfreeVerificationService) Get(UUID string) (response *TollfreeVerification, err error) {
req, err := service.client.NewRequest("GET", nil, "TollfreeVerification/%s", UUID)
if err != nil {
return
}
response = &TollfreeVerification{}
err = service.client.ExecuteRequest(req, response)
return
}
// List - List API for Tollfree Verification Request
func (service *TollfreeVerificationService) List(params TollfreeVerificationListParams) (response *TollfreeVerificationListResponse, err error) {
req, err := service.client.NewRequest("GET", params, "TollfreeVerification")
if err != nil {
return
}
response = &TollfreeVerificationListResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
// Delete - Delete API for Tollfree Verification Request
func (service *TollfreeVerificationService) Delete(UUID string) (err error) {
req, err := service.client.NewRequest("DELETE", nil, "TollfreeVerification/%s", UUID)
if err != nil {
return
}
err = service.client.ExecuteRequest(req, nil)
return
}