-
Notifications
You must be signed in to change notification settings - Fork 2
/
example_movie_test.go
44 lines (36 loc) · 950 Bytes
/
example_movie_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
package radarr_test
import (
"fmt"
"log"
"time"
"github.com/SkYNewZ/radarr"
)
// Return upcoming movies by specifying period
func ExampleMovieService_Upcoming_basic() {
client, err := radarr.New("https://my.radarr-instance.fr", "radarr-api-key", nil)
if err != nil {
log.Fatalln(err)
}
movies, err := client.Movies.Upcoming()
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%+v", movies)
}
func ExampleMovieService_Upcoming_advanced() {
client, err := radarr.New("https://my.radarr-instance.fr", "radarr-api-key", nil)
if err != nil {
log.Fatalln(err)
}
fmt.Println("Search upcoming movies between April 5th and April 10th")
start := time.Date(2020, time.April, 5, 0, 0, 0, 0, time.Local)
end := time.Date(2020, time.April, 10, 0, 0, 0, 0, time.Local)
movies, err := client.Movies.Upcoming(&radarr.UpcomingOptions{
Start: &start,
End: &end,
})
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%+v", movies)
}