forked from ebhomengo/niki
1
0
Fork 0
niki/vendor/github.com/kavenegar/kavenegar-go/message_sendByPostalCode.go

30 lines
915 B
Go
Raw Normal View History

2024-02-18 10:42:21 +00:00
package kavenegar
import (
"net/url"
"strconv"
"time"
)
2024-06-14 08:41:36 +00:00
// SendPostalCode ...
2024-02-18 10:42:21 +00:00
func (m *MessageService) SendPostalCode(postalcode int64, sender string, message string, mcistartindex int, mcicount int, mtnstartindex int, mtncount int, date time.Time) ([]Message, error) {
v := url.Values{}
v.Set("postalcode", strconv.FormatInt(postalcode, 10))
v.Set("sender", sender)
v.Set("message", message)
v.Set("mcistartind", strconv.Itoa(mcistartindex))
v.Set("mcicount", strconv.Itoa(mcicount))
v.Set("mtnstartind", strconv.Itoa(mtnstartindex))
v.Set("mtncount", strconv.Itoa(mtncount))
v.Set("date", ToUnix(date))
return m.CreateSendPostalCode(v)
}
2024-06-14 08:41:36 +00:00
// CreateSendPostalCode ...
2024-02-18 10:42:21 +00:00
func (m *MessageService) CreateSendPostalCode(v url.Values) ([]Message, error) {
2024-06-14 08:41:36 +00:00
u := m.client.EndPoint("sms", "sendbypostalcode")
2024-02-18 10:42:21 +00:00
res := new(MessageResult)
err := m.client.Execute(u.String(), v, res)
return res.Entries, err
}