-
Notifications
You must be signed in to change notification settings - Fork 21
/
message_countoutbox.go
41 lines (36 loc) · 1023 Bytes
/
message_countoutbox.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package kavenegar
import (
"net/url"
"time"
)
//MessageCountOutbox ...
type MessageCountOutbox struct {
*MessageCountInbox
Sumpart int `json:"sumpart"`
Cost int `json:"cost"`
}
//MessageCountOutboxResult ...
type MessageCountOutboxResult struct {
*Return `json:"return"`
Entries []MessageCountOutbox `json:"entries"`
}
//CountOutbox ...
func (message *MessageService) CountOutbox(startdate time.Time, endate time.Time, status MessageStatusType) (MessageCountOutbox, error) {
v := url.Values{}
v.Set("startdate", ToUnix(startdate))
if !endate.IsZero() {
v.Set("endate", ToUnix(startdate))
}
v.Set("status", status.String())
return message.CreateCountOutbox(v)
}
//CreateCountOutbox ...
func (message *MessageService) CreateCountOutbox(v url.Values) (MessageCountOutbox, error) {
u := message.client.EndPoint("sms", "countoutbox")
m := new(MessageCountOutboxResult)
err := message.client.Execute(u.String(), v, m)
if m.Entries==nil{
return MessageCountOutbox{},err
}
return m.Entries[0], err
}