Skip to content

Commit d2f0291

Browse files
authored
Merge pull request #37 from khrt/reportUrl
Add ReportURL to Message
2 parents de37532 + 028cbdc commit d2f0291

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

message.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type Message struct {
2525
TypeDetails TypeDetails
2626
DataCoding string
2727
MClass int
28+
ReportURL string
2829
ScheduledDatetime *time.Time
2930
CreatedDatetime *time.Time
3031
Recipients Recipients
@@ -49,6 +50,7 @@ type MessageParams struct {
4950
Gateway int
5051
TypeDetails TypeDetails
5152
DataCoding string
53+
ReportURL string
5254
ScheduledDatetime time.Time
5355
}
5456

@@ -72,6 +74,7 @@ type messageRequest struct {
7274
TypeDetails TypeDetails `json:"typeDetails,omitempty"`
7375
DataCoding string `json:"datacoding,omitempty"`
7476
MClass int `json:"mclass,omitempty"`
77+
ReportURL string `json:"reportUrl,omitempty"`
7578
ScheduledDatetime string `json:"scheduledDatetime,omitempty"`
7679
}
7780

@@ -112,6 +115,7 @@ func requestDataForMessage(originator string, recipients []string, body string,
112115
request.Gateway = params.Gateway
113116
request.TypeDetails = params.TypeDetails
114117
request.DataCoding = params.DataCoding
118+
request.ReportURL = params.ReportURL
115119

116120
return request, nil
117121
}

verify.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type VerifyParams struct {
2525
Type string
2626
Template string
2727
DataCoding string
28+
ReportURL string
2829
Voice string
2930
Language string
3031
Timeout int
@@ -38,6 +39,7 @@ type verifyRequest struct {
3839
Type string `json:"type,omitempty"`
3940
Template string `json:"template,omitempty"`
4041
DataCoding string `json:"dataCoding,omitempty"`
42+
ReportURL string `json:"reportUrl,omitempty"`
4143
Voice string `json:"voice,omitempty"`
4244
Language string `json:"language,omitempty"`
4345
Timeout int `json:"timeout,omitempty"`
@@ -62,6 +64,7 @@ func requestDataForVerify(recipient string, params *VerifyParams) (*verifyReques
6264
request.Type = params.Type
6365
request.Template = params.Template
6466
request.DataCoding = params.DataCoding
67+
request.ReportURL = params.ReportURL
6568
request.Voice = params.Voice
6669
request.Language = params.Language
6770
request.Timeout = params.Timeout

verify_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ func TestRequestDataForVerify(t *testing.T) {
144144
Type: "sms",
145145
Template: "Your code is: %token",
146146
DataCoding: "plain",
147+
ReportURL: "http://example.com/report",
147148
Voice: "male",
148149
Language: "en-gb",
149150
Timeout: 20,
@@ -170,6 +171,9 @@ func TestRequestDataForVerify(t *testing.T) {
170171
if requestData.DataCoding != "plain" {
171172
t.Errorf("Unexpected data coding: %s, expected: plain", requestData.DataCoding)
172173
}
174+
if requestData.ReportURL != "http://example.com/report" {
175+
t.Errorf("Unexpected report URL: %s, expected: http://example.com/repot", requestData.ReportURL)
176+
}
173177
if requestData.Voice != "male" {
174178
t.Errorf("Unexpected voice: %s, expected: male", requestData.Voice)
175179
}

0 commit comments

Comments
 (0)