Documentation
¶
Index ¶
- func MovieURL(id int) string
- func SearchURL(query string) string
- type AuthenticateResponse
- type Client
- func (c *Client) Authenticate(ctx context.Context) (*AuthenticateResponse, error)
- func (c *Client) GetMovieCredits(ctx context.Context, id int) (*GetMovieCreditsResponse, error)
- func (c *Client) GetMovieDetail(ctx context.Context, id int) (*GetMovieDetailResponse, error)
- func (c *Client) SearchMovie(ctx context.Context, title string) (*SearchMovieResponse, error)
- type GetMovieCreditsResponse
- type GetMovieDetailResponse
- type SearchMovieResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthenticateResponse ¶
type AuthenticateResponse struct {
Success bool `json:"success"`
}
AuthenticateResponse is the response from the authentication endpoint.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client makes calls to the TMDB API.
func NewClient ¶
NewClient returns a Client that authenticates with the given API access token. It returns an error if token is empty.
func (*Client) Authenticate ¶
func (c *Client) Authenticate(ctx context.Context) (*AuthenticateResponse, error)
Authenticate validates the access token. If it is valid, `Success` will be `true`, otherwise it will be `false`.
func (*Client) GetMovieCredits ¶
GetMovieCredits returns the cast for the movie with the given TMDB ID.
func (*Client) GetMovieDetail ¶
GetMovieDetail returns detailed information for the movie with the given TMDB ID.
func (*Client) SearchMovie ¶
SearchMovie returns a list of movie results that match the provided title.
type GetMovieCreditsResponse ¶
type GetMovieCreditsResponse struct {
ID int `json:"id"`
Cast []struct {
Adult bool `json:"adult"`
Gender int `json:"gender"`
ID int `json:"id"`
KnownForDepartment string `json:"known_for_department"`
Name string `json:"name"`
OriginalName string `json:"original_name"`
Popularity float64 `json:"popularity"`
ProfilePath string `json:"profile_path"`
CastID int `json:"cast_id"`
Character string `json:"character"`
CreditID string `json:"credit_id"`
Order int `json:"order"`
} `json:"cast"`
}
GetMovieCreditsResponse is the response from the movie credits endpoint.
type GetMovieDetailResponse ¶
type GetMovieDetailResponse struct {
Adult bool `json:"adult"`
BackdropPath string `json:"backdrop_path"`
BelongsToCollection *struct {
ID int `json:"id"`
Name string `json:"name"`
PosterPath string `json:"poster_path"`
BackdropPath string `json:"backdrop_path"`
} `json:"belongs_to_collection"`
Budget int `json:"budget"`
Genres []struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"genres"`
Homepage string `json:"homepage"`
ID int `json:"id"`
IMDBID string `json:"imdb_id"`
OriginCountry []string `json:"origin_country"`
OriginalLanguage string `json:"original_language"`
OriginalTitle string `json:"original_title"`
Overview string `json:"overview"`
Popularity float64 `json:"popularity"`
PosterPath string `json:"poster_path"`
ProductionCompanies []struct {
ID int `json:"id"`
LogoPath string `json:"logo_path"`
Name string `json:"name"`
OriginCountry string `json:"origin_country"`
} `json:"production_companies"`
ProductionCountries []struct {
ISO31661 string `json:"iso_3166_1"`
Name string `json:"name"`
} `json:"production_countries"`
ReleaseDate string `json:"release_date"`
Revenue int `json:"revenue"`
Runtime int `json:"runtime"`
SpokenLanguages []struct {
EnglishName string `json:"english_name"`
ISO6391 string `json:"iso_639_1"`
Name string `json:"name"`
} `json:"spoken_languages"`
Status string `json:"status"`
Tagline string `json:"tagline"`
Title string `json:"title"`
Video bool `json:"video"`
VoteAverage float64 `json:"vote_average"`
VoteCount int `json:"vote_count"`
}
GetMovieDetailResponse is the response from the movie detail endpoint.
func (*GetMovieDetailResponse) PosterURL ¶
func (gmdr *GetMovieDetailResponse) PosterURL() string
PosterURL returns the full URL for the movie's poster image.
type SearchMovieResponse ¶
type SearchMovieResponse struct {
Page int `json:"page"`
Results []struct {
Adult bool `json:"adult"`
BackdropPath string `json:"backdrop_path"`
GenreIDs []int `json:"genre_ids"`
ID int `json:"id"`
OriginalLanguage string `json:"original_language"`
OriginalTitle string `json:"original_title"`
Overview string `json:"overview"`
Popularity float64 `json:"popularity"`
PosterPath string `json:"poster_path"`
ReleaseDate string `json:"release_date"`
Title string `json:"title"`
Video bool `json:"video"`
VoteAverage float64 `json:"vote_average"`
VoteCount int `json:"vote_count"`
} `json:"results"`
TotalPages int `json:"total_pages"`
TotalResults int `json:"total_results"`
}
SearchMovieResponse is the response from the movie search endpoint.