-
Notifications
You must be signed in to change notification settings - Fork 2
/
example_client_test.go
55 lines (47 loc) · 1.03 KB
/
example_client_test.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
package radarr_test
import (
"fmt"
"log"
"net/http"
"time"
"github.com/SkYNewZ/radarr"
)
// Instantiate a standard client
func ExampleNew_basic() {
client, err := radarr.New("https://my.radarr-instance.fr", "radarr-api-key", nil)
if err != nil {
log.Fatalln(err)
}
movie, err := client.Movies.Get(217)
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%s", movie.Title)
}
func ExampleNew_verbose() {
client, err := radarr.New("https://my.radarr-instance.fr", "radarr-api-key", nil, &radarr.ClientOptions{
Verbose: true,
})
if err != nil {
log.Fatalln(err)
}
movie, err := client.Movies.Get(217)
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%s", movie.Title)
}
// Instantiate a client with a custom HTTP client
func ExampleNew_advanced() {
client, err := radarr.New("https://my.radarr-instance.fr", "radarr-api-key", &http.Client{
Timeout: time.Second * 10,
})
if err != nil {
log.Fatalln(err)
}
movie, err := client.Movies.Get(217)
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%s", movie.Title)
}