-
Notifications
You must be signed in to change notification settings - Fork 2
/
status.go
65 lines (57 loc) · 1.86 KB
/
status.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package radarr
import (
"encoding/json"
"fmt"
"time"
)
// SystemStatus Radarr system status response
type SystemStatus struct {
Version string `json:"version"`
BuildTime time.Time `json:"buildTime"`
IsDebug bool `json:"isDebug"`
IsProduction bool `json:"isProduction"`
IsAdmin bool `json:"isAdmin"`
IsUserInteractive bool `json:"isUserInteractive"`
StartupPath string `json:"startupPath"`
AppData string `json:"appData"`
OsName string `json:"osName"`
OsVersion string `json:"osVersion"`
IsNetCore bool `json:"isNetCore"`
IsMono bool `json:"isMono"`
IsLinux bool `json:"isLinux"`
IsOsx bool `json:"isOsx"`
IsWindows bool `json:"isWindows"`
Branch string `json:"branch"`
Authentication string `json:"authentication"`
SqliteVersion string `json:"sqliteVersion"`
MigrationVersion int `json:"migrationVersion"`
URLBase string `json:"urlBase"`
RuntimeVersion string `json:"runtimeVersion"`
RuntimeName string `json:"runtimeName"`
}
// SystemStatusService contains Radarr system operations
type SystemStatusService struct {
s *Service
}
func newSystemStatusService(s *Service) *SystemStatusService {
return &SystemStatusService{s}
}
// Get https://github.com/Radarr/Radarr/wiki/API:System-Status#get
func (s *SystemStatusService) Get() (*SystemStatus, error) {
statusURL := fmt.Sprintf("%s/api%s", s.s.url, statusURI)
resp, err := s.s.client.Get(statusURL)
if err != nil {
return nil, err
}
defer resp.Body.Close()
err = parseRadarrResponse(resp)
if err != nil {
return nil, err
}
var status SystemStatus
err = json.NewDecoder(resp.Body).Decode(&status)
if err != nil {
return nil, err
}
return &status, nil
}