File tree 5 files changed +115
-0
lines changed
5 files changed +115
-0
lines changed Original file line number Diff line number Diff line change 1
1
package lidarr
2
2
3
3
import (
4
+ "context"
5
+ "fmt"
4
6
"strings"
5
7
6
8
"golift.io/starr"
@@ -42,3 +44,24 @@ func New(config *starr.Config) *Lidarr {
42
44
43
45
return & Lidarr {APIer : config }
44
46
}
47
+
48
+ // bp means base path. You'll see it a lot in these files.
49
+ const bpPing = "/ping" // ping has no api or version prefix.
50
+
51
+ // Ping returns an error if the starr instance does not respond with a 200 to an HTTP /ping request.
52
+ func (l * Lidarr ) Ping () error {
53
+ return l .PingContext (context .Background ())
54
+ }
55
+
56
+ // PingContext returns an error if the starr instance does not respond with a 200 to an HTTP /ping request.
57
+ func (l * Lidarr ) PingContext (ctx context.Context ) error {
58
+ req := starr.Request {URI : bpPing }
59
+
60
+ resp , err := l .Get (ctx , req )
61
+ if err != nil {
62
+ return fmt .Errorf ("api.Get(%s): %w" , & req , err )
63
+ }
64
+ defer resp .Body .Close ()
65
+
66
+ return nil
67
+ }
Original file line number Diff line number Diff line change 1
1
package prowlarr
2
2
3
3
import (
4
+ "context"
5
+ "fmt"
4
6
"strings"
5
7
6
8
"golift.io/starr"
@@ -24,3 +26,24 @@ func New(config *starr.Config) *Prowlarr {
24
26
25
27
return & Prowlarr {APIer : config }
26
28
}
29
+
30
+ // bp means base path. You'll see it a lot in these files.
31
+ const bpPing = "/ping" // ping has no api or version prefix.
32
+
33
+ // Ping returns an error if the Prowlarr instance does not respond with a 200 to an HTTP /ping request.
34
+ func (p * Prowlarr ) Ping () error {
35
+ return p .PingContext (context .Background ())
36
+ }
37
+
38
+ // PingContext returns an error if the Prowlarr instance does not respond with a 200 to an HTTP /ping request.
39
+ func (p * Prowlarr ) PingContext (ctx context.Context ) error {
40
+ req := starr.Request {URI : bpPing }
41
+
42
+ resp , err := p .Get (ctx , req )
43
+ if err != nil {
44
+ return fmt .Errorf ("api.Get(%s): %w" , & req , err )
45
+ }
46
+ defer resp .Body .Close ()
47
+
48
+ return nil
49
+ }
Original file line number Diff line number Diff line change 1
1
package radarr
2
2
3
3
import (
4
+ "context"
5
+ "fmt"
4
6
"strings"
5
7
6
8
"golift.io/starr"
@@ -41,3 +43,24 @@ func New(config *starr.Config) *Radarr {
41
43
42
44
return & Radarr {APIer : config }
43
45
}
46
+
47
+ // bp means base path. You'll see it a lot in these files.
48
+ const bpPing = "ping" // ping has no api or version prefix.
49
+
50
+ // Ping returns an error if the starr instance does not respond with a 200 to an HTTP /ping request.
51
+ func (r * Radarr ) Ping () error {
52
+ return r .PingContext (context .Background ())
53
+ }
54
+
55
+ // PingContext returns an error if the starr instance does not respond with a 200 to an HTTP /ping request.
56
+ func (r * Radarr ) PingContext (ctx context.Context ) error {
57
+ req := starr.Request {URI : bpPing }
58
+
59
+ resp , err := r .Get (ctx , req )
60
+ if err != nil {
61
+ return fmt .Errorf ("api.Get(%s): %w" , & req , err )
62
+ }
63
+ defer resp .Body .Close ()
64
+
65
+ return nil
66
+ }
Original file line number Diff line number Diff line change 1
1
package readarr
2
2
3
3
import (
4
+ "context"
5
+ "fmt"
4
6
"strings"
5
7
6
8
"golift.io/starr"
@@ -42,3 +44,24 @@ func New(config *starr.Config) *Readarr {
42
44
43
45
return & Readarr {APIer : config }
44
46
}
47
+
48
+ // bp means base path. You'll see it a lot in these files.
49
+ const bpPing = "/ping" // ping has no api or version prefix.
50
+
51
+ // Ping returns an error if the starr instance does not respond with a 200 to an HTTP /ping request.
52
+ func (r * Readarr ) Ping () error {
53
+ return r .PingContext (context .Background ())
54
+ }
55
+
56
+ // PingContext returns an error if the starr instance does not respond with a 200 to an HTTP /ping request.
57
+ func (r * Readarr ) PingContext (ctx context.Context ) error {
58
+ req := starr.Request {URI : bpPing }
59
+
60
+ resp , err := r .Get (ctx , req )
61
+ if err != nil {
62
+ return fmt .Errorf ("api.Get(%s): %w" , & req , err )
63
+ }
64
+ defer resp .Body .Close ()
65
+
66
+ return nil
67
+ }
Original file line number Diff line number Diff line change 1
1
package sonarr
2
2
3
3
import (
4
+ "context"
5
+ "fmt"
4
6
"strings"
5
7
6
8
"golift.io/starr"
@@ -39,3 +41,24 @@ func New(config *starr.Config) *Sonarr {
39
41
40
42
return & Sonarr {APIer : config }
41
43
}
44
+
45
+ // bp means base path. You'll see it a lot in these files.
46
+ const bpPing = "/ping" // ping has no api or version prefix.
47
+
48
+ // Ping returns an error if the starr instance does not respond with a 200 to an HTTP /ping request.
49
+ func (s * Sonarr ) Ping () error {
50
+ return s .PingContext (context .Background ())
51
+ }
52
+
53
+ // PingContext returns an error if the starr instance does not respond with a 200 to an HTTP /ping request.
54
+ func (s * Sonarr ) PingContext (ctx context.Context ) error {
55
+ req := starr.Request {URI : bpPing }
56
+
57
+ resp , err := s .Get (ctx , req )
58
+ if err != nil {
59
+ return fmt .Errorf ("api.Get(%s): %w" , & req , err )
60
+ }
61
+ defer resp .Body .Close ()
62
+
63
+ return nil
64
+ }
You can’t perform that action at this time.
0 commit comments