-
Notifications
You must be signed in to change notification settings - Fork 0
/
trakttv.go
59 lines (50 loc) · 1.15 KB
/
trakttv.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
package trakttv
import "net/http"
// Constants to remove later
const (
ProductionEndpoint = "https://api.trakt.tv"
StagingEndpoint = "http://api-staging.trakt.tv"
)
// TraktTv client
type TraktTv struct {
HTTPClient *http.Client
Endpoint string
Version int
Key string
}
// Type represents the types of data the API could return
type Type string
// Available types
const (
TypeMovie Type = "movie"
TypeShow Type = "show"
TypeEpisode Type = "episode"
TypePerson Type = "person"
TypeList Type = "list"
)
// Field represents the fields of data that you can use for search
type Field string
// Available fields
const (
FieldTitle Field = "title"
FieldPeople Field = "people"
FieldOverview Field = "overview"
)
// New returns a new tvrage client
func New(key string) *TraktTv {
return &TraktTv{
HTTPClient: http.DefaultClient,
Version: 2,
Endpoint: ProductionEndpoint,
Key: key,
}
}
// IDs holds the media object ID
type IDs struct {
Trakt int `json:"trakt"`
Slug string `json:"slug"`
ImDB string `json:"imdb"`
TmDB int `json:"tmdb"`
TvRage int `json:"tvrage"`
TvDB int `json:"tvdb"`
}