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

49 lines
726 B
Go
Raw Normal View History

2024-02-18 10:42:21 +00:00
package kavenegar
import (
"net/url"
"time"
)
2024-06-14 08:41:36 +00:00
// SelectOutbox ...
2024-02-18 10:42:21 +00:00
func (message *MessageService) SelectOutbox(startdate time.Time, endate time.Time, sender string) ([]Message, error) {
v := url.Values{}
if !startdate.IsZero() {
2024-02-18 10:42:21 +00:00
v.Set("startdate", ToUnix(startdate))
2024-02-18 10:42:21 +00:00
}
2024-02-18 10:42:21 +00:00
if !endate.IsZero() {
2024-02-18 10:42:21 +00:00
v.Set("endate", ToUnix(endate))
2024-02-18 10:42:21 +00:00
}
2024-02-18 10:42:21 +00:00
if v.Get("sender") != "" {
2024-02-18 10:42:21 +00:00
v.Set("sender", v.Get("sender"))
2024-02-18 10:42:21 +00:00
}
return message.CreateSelectOutbox(v)
2024-02-18 10:42:21 +00:00
}
2024-06-14 08:41:36 +00:00
// CreateSelectOutbox ...
2024-02-18 10:42:21 +00:00
func (message *MessageService) CreateSelectOutbox(v url.Values) ([]Message, error) {
2024-02-18 10:42:21 +00:00
u := message.client.EndPoint("sms", "selectoutbox")
2024-02-18 10:42:21 +00:00
m := new(MessageResult)
2024-02-18 10:42:21 +00:00
err := message.client.Execute(u.String(), v, m)
2024-02-18 10:42:21 +00:00
return m.Entries, err
2024-02-18 10:42:21 +00:00
}