2024-02-18 10:42:21 +00:00
|
|
|
package kavenegar
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
|
2024-04-26 19:30:35 +00:00
|
|
|
// MessageCountPostalCode ...
|
2024-02-18 10:42:21 +00:00
|
|
|
type MessageCountPostalCode struct {
|
|
|
|
Section string `json:"section"`
|
|
|
|
Value int `json:"value"`
|
|
|
|
}
|
|
|
|
|
2024-04-26 19:30:35 +00:00
|
|
|
// MessageCountPostalCodeResult ...
|
2024-02-18 10:42:21 +00:00
|
|
|
type MessageCountPostalCodeResult struct {
|
|
|
|
*Return `json:"return"`
|
|
|
|
Entries []MessageCountPostalCode `json:"entries"`
|
|
|
|
}
|
|
|
|
|
2024-04-26 19:30:35 +00:00
|
|
|
// CountPostalCode ...
|
2024-02-18 10:42:21 +00:00
|
|
|
func (message *MessageService) CountPostalCode(postalcode int64) ([]MessageCountPostalCode, error) {
|
|
|
|
u := message.client.EndPoint("sms", "countpostalcode")
|
|
|
|
m := new(MessageCountPostalCodeResult)
|
|
|
|
v := url.Values{}
|
|
|
|
v.Set("postalcode", strconv.FormatInt(postalcode, 10))
|
|
|
|
err := message.client.Execute(u.String(), v, m)
|
|
|
|
return m.Entries, err
|
|
|
|
}
|