File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ type MessageParams struct {
38
38
ScheduledDatetime time.Time
39
39
}
40
40
41
+ type MessageQueryParams struct {
42
+ Originator string
43
+ Direction string
44
+ Limit int
45
+ Offset int
46
+ }
47
+
41
48
// paramsForMessage converts the specified MessageParams struct to a
42
49
// url.Values pointer and returns it.
43
50
func paramsForMessage (params * MessageParams ) (* url.Values , error ) {
@@ -82,3 +89,27 @@ func paramsForMessage(params *MessageParams) (*url.Values, error) {
82
89
83
90
return urlParams , nil
84
91
}
92
+
93
+ func paramsForMessageQuery (params * MessageQueryParams ) (* url.Values , error ) {
94
+ urlParams := & url.Values {}
95
+
96
+ if params == nil {
97
+ return urlParams , nil
98
+ }
99
+
100
+ if params .Direction != "" {
101
+ urlParams .Set ("direction" , params .Direction )
102
+ }
103
+
104
+ if params .Originator != "" {
105
+ urlParams .Set ("originator" , params .Originator )
106
+ }
107
+
108
+ if params .Limit != 0 {
109
+ urlParams .Set ("limit" , strconv .Itoa (params .Limit ))
110
+ }
111
+
112
+ urlParams .Set ("offset" , strconv .Itoa (params .Offset ))
113
+
114
+ return urlParams , nil
115
+ }
You can’t perform that action at this time.
0 commit comments