Documentation
¶
Index ¶
- type CastMember
- type Client
- func (c *Client) DiscoverByGenre(ctx context.Context, genreID, page int) (*PaginatedResults, error)
- func (c *Client) FetchPopular(ctx context.Context, page int) (*PaginatedResults, error)
- func (c *Client) FetchTopRated(ctx context.Context, page int) (*PaginatedResults, error)
- func (c *Client) FetchTrending(ctx context.Context, page int) (*PaginatedResults, error)
- func (c *Client) FetchUpcoming(ctx context.Context, page int) (*PaginatedResults, error)
- func (c *Client) FindByIMDbID(ctx context.Context, imdbID string) (int, string, error)
- func (c *Client) GenreList(ctx context.Context) ([]Genre, error)
- func (c *Client) GetFranchise(ctx context.Context, collectionID int) (*FranchiseDetail, error)
- func (c *Client) GetList(ctx context.Context, listID string, page int) ([]SearchResult, error)
- func (c *Client) GetMovie(ctx context.Context, tmdbID int) (*MovieDetail, error)
- func (c *Client) GetMovieExtended(ctx context.Context, tmdbID int) (*MovieDetail, error)
- func (c *Client) GetNowPlayingMovies(ctx context.Context, page int) ([]SearchResult, error)
- func (c *Client) GetPerson(ctx context.Context, personID int) (*Person, error)
- func (c *Client) GetPersonFilmography(ctx context.Context, personID int, personType string) ([]FilmographyItem, error)
- func (c *Client) GetPopularMovies(ctx context.Context, page int) ([]SearchResult, error)
- func (c *Client) GetTopRatedMovies(ctx context.Context, page int) ([]SearchResult, error)
- func (c *Client) GetTrendingMovies(ctx context.Context, window string, page int) ([]SearchResult, error)
- func (c *Client) GetUpcomingMovies(ctx context.Context, page int) ([]SearchResult, error)
- func (c *Client) SearchFranchises(ctx context.Context, query string) ([]FranchiseSearchResult, error)
- func (c *Client) SearchMovies(ctx context.Context, query string, year int) ([]SearchResult, error)
- func (c *Client) SearchPeople(ctx context.Context, query string) ([]PersonSearchResult, error)
- type CrewMember
- type FilmographyItem
- type FranchiseDetail
- type FranchiseSearchResult
- type Genre
- type MovieDetail
- type MovieRecommendation
- type PaginatedResults
- type Person
- type PersonSearchResult
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CastMember ¶
type CastMember struct {
ID int `json:"id"`
Name string `json:"name"`
Character string `json:"character"`
ProfilePath string `json:"profile_path"`
Order int `json:"order"`
}
CastMember is an actor in the movie's credits.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a TMDB API v3 HTTP client. All outbound requests are logged. The API key is never logged. Outbound calls are rate-limited and GET responses are cached for a short TTL. Client is safe for concurrent use.
func New ¶
New creates a new TMDB client. apiKey must not be empty. It is stored and used in query parameters. logger is used to log outbound requests (the key value is replaced with "***" in logged URLs).
func (*Client) DiscoverByGenre ¶
DiscoverByGenre fetches movies filtered by genre ID.
func (*Client) FetchPopular ¶
FetchPopular fetches popular movies with pagination metadata.
func (*Client) FetchTopRated ¶
FetchTopRated fetches top-rated movies with pagination metadata.
func (*Client) FetchTrending ¶
FetchTrending fetches trending movies with pagination metadata.
func (*Client) FetchUpcoming ¶
FetchUpcoming fetches upcoming movies with pagination metadata.
func (*Client) FindByIMDbID ¶
FindByIMDbID looks up a movie by its IMDb ID using the /find endpoint. Returns the TMDB ID and title, or 0/"" if not found.
func (*Client) GetFranchise ¶
GetFranchise fetches the full details of a TMDB movie collection by ID.
func (*Client) GetMovieExtended ¶
GetMovieExtended fetches movie details with credits and recommendations in a single API call using TMDB's append_to_response parameter.
func (*Client) GetNowPlayingMovies ¶
GetNowPlayingMovies fetches movies currently in theaters from TMDB. page starts at 1. Returns up to 20 results per page.
func (*Client) GetPersonFilmography ¶
func (c *Client) GetPersonFilmography(ctx context.Context, personID int, personType string) ([]FilmographyItem, error)
GetPersonFilmography returns directed films (personType="director") or top-billed acted films (personType="actor") for the given TMDB person. For actors, only credits where billing order < 5 are returned.
func (*Client) GetPopularMovies ¶
GetPopularMovies fetches the TMDB popular movies list. page starts at 1. Returns up to 20 results per page.
func (*Client) GetTopRatedMovies ¶
GetTopRatedMovies fetches the all-time highest rated movies from TMDB. page starts at 1. Returns up to 20 results per page.
func (*Client) GetTrendingMovies ¶
func (c *Client) GetTrendingMovies(ctx context.Context, window string, page int) ([]SearchResult, error)
GetTrendingMovies fetches trending movies from TMDB. window must be "day" or "week". page starts at 1.
func (*Client) GetUpcomingMovies ¶
GetUpcomingMovies fetches upcoming movies from TMDB. page starts at 1. Returns up to 20 results per page.
func (*Client) SearchFranchises ¶
func (c *Client) SearchFranchises(ctx context.Context, query string) ([]FranchiseSearchResult, error)
SearchFranchises searches TMDB for movie collections (franchises) by name.
func (*Client) SearchMovies ¶
SearchMovies searches TMDB for movies matching query. If year is non-zero it is sent as the primary_release_year filter.
func (*Client) SearchPeople ¶
SearchPeople searches TMDB for people by name.
type CrewMember ¶
type CrewMember struct {
ID int `json:"id"`
Name string `json:"name"`
Job string `json:"job"`
Department string `json:"department"`
ProfilePath string `json:"profile_path"`
}
CrewMember is a crew member (director, writer, etc.) in the movie's credits.
type FilmographyItem ¶
type FilmographyItem struct {
TMDBID int
Title string
Year int
PosterPath string
Order int // cast billing order (0 for directors)
}
FilmographyItem is one film entry in a person's filmography.
type FranchiseDetail ¶
type FranchiseDetail struct {
ID int
Name string
Parts []FilmographyItem
}
FranchiseDetail is the full response from the TMDB /collection/{id} endpoint.
type FranchiseSearchResult ¶
FranchiseSearchResult is a single result from the TMDB /search/collection endpoint.
type MovieDetail ¶
type MovieDetail struct {
ID int
IMDBId string
Title string
OriginalTitle string
Overview string
ReleaseDate string
Year int // parsed from ReleaseDate; 0 if unavailable
RuntimeMinutes int
Genres []string
PosterPath string
BackdropPath string
// Status is mapped from the TMDB status string to our internal values.
// TMDB "Released" → "released"; "In Production" / "Post Production" / anything else → "announced".
Status string
// Credits and recommendations are populated only when fetched via
// GetMovieExtended (append_to_response=credits,recommendations).
Cast []CastMember `json:"cast,omitempty"`
Crew []CrewMember `json:"crew,omitempty"`
Recommendations []MovieRecommendation `json:"recommendations,omitempty"`
}
MovieDetail is the full response from the TMDB /movie/{id} endpoint.
type MovieRecommendation ¶
type MovieRecommendation struct {
TMDBID int `json:"tmdb_id"`
Title string `json:"title"`
Year int `json:"year"`
PosterPath string `json:"poster_path"`
}
MovieRecommendation is a TMDB-recommended movie.
type PaginatedResults ¶
type PaginatedResults struct {
Results []SearchResult `json:"results"`
Page int `json:"page"`
TotalPages int `json:"total_pages"`
}
PaginatedResults wraps a list of search results with pagination metadata.
type PersonSearchResult ¶
PersonSearchResult is a single result from the TMDB person search endpoint.
type SearchResult ¶
type SearchResult struct {
ID int
Title string
OriginalTitle string
Overview string
ReleaseDate string // "YYYY-MM-DD" or empty
Year int // parsed from ReleaseDate; 0 if unavailable
PosterPath string // TMDB path; prefix with image base URL before use
BackdropPath string
Popularity float64
}
SearchResult is a single result from the TMDB movie search endpoint.