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