-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstats.go
31 lines (28 loc) · 953 Bytes
/
stats.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
package taigo
// StatsService is a handle to Stats operations
// -> https://taigaio.github.io/taiga-doc/dist/api.html#stats
type StatsService struct {
client *Client
defaultProjectID int
Endpoint string
}
// GetDiscoverStats => https://taigaio.github.io/taiga-doc/dist/api.html#discover-stats
func (s *StatsService) GetDiscoverStats() (*DiscoverStats, error) {
url := s.client.MakeURL(s.Endpoint, "discover")
var respDiscoverStats DiscoverStats
_, err := s.client.Request.Get(url, &respDiscoverStats)
if err != nil {
return nil, err
}
return &respDiscoverStats, nil
}
// GetSystemStats => https://taigaio.github.io/taiga-doc/dist/api.html#system-stats
func (s *StatsService) GetSystemStats() (*SystemStats, error) {
url := s.client.MakeURL(s.Endpoint, "system")
var respSystemStats SystemStats
_, err := s.client.Request.Get(url, &respSystemStats)
if err != nil {
return nil, err
}
return &respSystemStats, nil
}