-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusage.go
41 lines (33 loc) · 1 KB
/
usage.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 mailosaur
import (
"time"
)
type UsageService struct {
client *MailosaurClient
}
type UsageAccountLimit struct {
Limit int `json:"limit"`
Current int `json:"current"`
}
type UsageAccountLimits struct {
Servers *UsageAccountLimit `json:"servers"`
Users *UsageAccountLimit `json:"users"`
Email *UsageAccountLimit `json:"email"`
Sms *UsageAccountLimit `json:"sms"`
}
type UsageTransaction struct {
Timestamp time.Time `json:"timestamp"`
Email int `json:"email"`
Sms int `json:"sms"`
}
type UsageTransactionListResult struct {
Items []*UsageTransaction `json:"items"`
}
func (s *UsageService) Limits() (*UsageAccountLimits, error) {
result, err := s.client.HttpGet(&UsageAccountLimits{}, "api/usage/limits")
return result.(*UsageAccountLimits), err
}
func (s *UsageService) Transactions() (*UsageTransactionListResult, error) {
result, err := s.client.HttpGet(&UsageTransactionListResult{}, "api/usage/transactions")
return result.(*UsageTransactionListResult), err
}