gotmdbapi

package module
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Query is the query parameter for search queries
	Query = "query"

	// IncludeAdult is the query parameter for including adult content
	IncludeAdult = "include_adult"

	// Page is the query parameter for pagination
	Page = "page"

	// Language is the query parameter for language
	Language = "language"

	// Region is the query parameter for region
	Region = "region"

	// Year is the query parameter for year
	Year = "year"

	// PrimaryReleaseYear is the query parameter for primary release year
	PrimaryReleaseYear = "primary_release_year"

	// PrimaryReleaseYearGTE is the query parameter for primary release year greater than or equal to
	PrimaryReleaseYearGTE = "primary_release_year.gte"

	// PrimaryReleaseYearLTE is the query parameter for primary release year less than or equal to
	PrimaryReleaseYearLTE = "primary_release_year.lte"

	// Certification is the query parameter for certification
	Certification = "certification"

	// CertificationCountry is the query parameter for certification country
	CertificationCountry = "certification_country"

	// CerificationGTE is the query parameter for certification greater than or equal to
	CerificationGTE = "certification.gte"

	// CertificationLTE is the query parameter for certification less than or equal to
	CertificationLTE = "certification.lte"

	// IncludeVideo is the query parameter for including videos
	IncludeVideo = "include_video"

	// ReleaseDateGTE is the query parameter for release date greater than or equal to
	ReleaseDateGTE = "release_date.gte"

	// ReleaseDateLTE is the query parameter for release date less than or equal to
	ReleaseDateLTE = "release_date.lte"

	// SortBy is the query parameter for sorting results
	SortBy = "sort_by"

	// VoteAverageGTE is the query parameter for vote average greater than or equal to
	VoteAverageGTE = "vote_average.gte"

	// VoteAverageLTE is the query parameter for vote average less than or equal to
	VoteAverageLTE = "vote_average.lte"

	// VoteCountGTE is the query parameter for vote count greater than or equal to
	VoteCountGTE = "vote_count.gte"

	// VoteCountLTE is the query parameter for vote count less than or equal to
	VoteCountLTE = "vote_count.lte"

	// WithGenres is the query parameter for filtering by genres
	WithGenres = "with_genres"

	// WithCompanies is the query parameter for filtering by companies
	WithCompanies = "with_companies"

	// WithKeywords is the query parameter for filtering by keywords
	WithKeywords = "with_keywords"

	// WithCast is the query parameter for filtering by cast
	WithCast = "with_cast"

	// WithCrew is the query parameter for filtering by crew
	WithCrew = "with_crew"

	// WithPeople is the query parameter for filtering by people
	WithPeople = "with_people"

	// WithOriginCountry is the query parameter for filtering by origin country
	WithOriginCountry = "with_origin_country"

	// WithOriginalLanguage is the query parameter for filtering by original language
	WithOriginalLanguage = "with_original_language"

	// WatchRegion is the query parameter for watch region
	WatchRegion = "watch_region"

	// WithRuntimeGTE is the query parameter for runtime greater than or equal to
	WithRuntimeGTE = "with_runtime.gte"

	// WithRuntimeLTE is the query parameter for runtime less than or equal to
	WithRuntimeLTE = "with_runtime.lte"

	// WithWatchMonetizationTypes is the query parameter for watch monetization types
	WithWatchMonetizationTypes = "with_watch_monetization_types"

	// WithWatchProviders is the query parameter for watch providers
	WithWatchProviders = "with_watch_providers"

	// WithoutCompanies is the query parameter for excluding companies
	WithoutCompanies = "without_companies"

	// WithoutGenres is the query parameter for excluding genres
	WithoutGenres = "without_genres"

	// WithoutKeywords is the query parameter for excluding keywords
	WithoutKeywords = "without_keywords"

	// WithoutWatchProviders is the query parameter for excluding watch providers
	WithoutWatchProviders = "without_watch_providers"
)
View Source
const (
	// ImageOriginalQualityURL is the image original quality URL
	ImageOriginalQualityURL = "https://image.tmdb.org/t/p/original/%s"

	// ImageVariableQualityURL is the image variable quality URL
	ImageVariableQualityURL = "https://image.tmdb.org/t/p/w%d/%s"
)
View Source
const (
	// GetMovieCreditsURL is the TMDB API URL for getting movie credits
	GetMovieCreditsURL = "https://api.themoviedb.org/3/movie/%s/credits"

	// GetMovieDetailsURL is the TMDB API URL for getting movie details
	GetMovieDetailsURL = "https://api.themoviedb.org/3/movie/%s"

	// GetMovieReviewsURL is the TMDB API URL for getting movie reviews
	GetMovieReviewsURL = "https://api.themoviedb.org/3/movie/%s/reviews"

	// GetNowPlayingMoviesURL is the TMDB API URL for getting now playing movies
	GetNowPlayingMoviesURL = "https://api.themoviedb.org/3/movie/now_playing"

	// GetPopularMoviesURL is the TMDB API URL for getting popular movies
	GetPopularMoviesURL = "https://api.themoviedb.org/3/movie/popular"

	// GetTopRatedMoviesURL is the TMDB API URL for getting top rated movies
	GetTopRatedMoviesURL = "https://api.themoviedb.org/3/movie/top_rated"

	// GetUpcomingMoviesURL is the TMDB API URL for getting upcoming movies
	GetUpcomingMoviesURL = "https://api.themoviedb.org/3/movie/upcoming"

	// SearchMoviesURL is the TMDB API URL for searching movies
	SearchMoviesURL = "https://api.themoviedb.org/3/search/movie"

	// SimilarMoviesURL is the TMDB API URL for getting similar movies
	SimilarMoviesURL = "https://api.themoviedb.org/3/movie/%s/similar"

	// DiscoverMoviesURL is the TMDB API URL for discovering movies
	DiscoverMoviesURL = "https://api.themoviedb.org/3/discover/movie"

	// GetGenresMovieListURL is the TMDB API URL for getting the list of movie genres
	GetGenresMovieListURL = "https://api.themoviedb.org/3/genre/movie/list"
)
View Source
const (
	ErrBuildingRequest           = "error building TMDB API request: %v"
	ErrAnErrOcurredDuringRequest = "an error occurred during the TMDB API request: %v"
	ErrRequestFailed             = "TMDB API request failed with status code %d: %s"
)

Variables

View Source
var (
	ErrNilClient       = errors.New("TMDB API client is nil")
	ErrEmptyAPIKey     = errors.New("TMDB API key is nil or empty")
	ErrResponseParsing = errors.New("failed to parse TMDB API response")
)

Functions

func AddCertificationCountryQueryParameter added in v0.3.0

func AddCertificationCountryQueryParameter(
	query url.Values,
	certificationCountry string,
)

AddCertificationCountryQueryParameter adds the certification country query parameter to the HTTP request query parameters

Parameters:

- req: the HTTP request query parameters - certificationCountry: the certification country value

func AddCertificationGTEQueryParameter added in v0.3.0

func AddCertificationGTEQueryParameter(
	query url.Values,
	certificationGTE string,
)

AddCertificationGTEQueryParameter adds the certification.gte query parameter to the HTTP request query parameters

Parameters:

- query: the HTTP request query parameters - certificationGTE: the certification.gte value

func AddCertificationLTEQueryParameter added in v0.3.0

func AddCertificationLTEQueryParameter(
	query url.Values,
	certificationLTE string,
)

AddCertificationLTEQueryParameter adds the certification.lte query parameter to the HTTP request query parameters

Parameters:

- query: the HTTP request query parameters - certificationLTE: the certification.lte value

func AddCertificationQueryParameter added in v0.3.0

func AddCertificationQueryParameter(
	query url.Values,
	certification string,
)

AddCertificationQueryParameter adds the certification query parameter to the HTTP request query parameters

Parameters:

- query: the HTTP request query parameters - certification: the certification value

func AddGenreMovieListQueryParameters added in v0.3.0

func AddGenreMovieListQueryParameters(
	req *http.Request,
	queryParameters *DiscoverMoviesQueryParameters,
)

AddGenreMovieListQueryParameters adds the query parameters for genre movie lists to the HTTP request

Parameters:

- req: the HTTP request - queryParameters: the query parameters for discovering movies

func AddIncludeAdultQueryParameter added in v0.3.0

func AddIncludeAdultQueryParameter(
	query url.Values,
	includeAdult bool,
)

AddIncludeAdultQueryParameter adds the include adult query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - includeAdult: whether to include adult content

func AddIncludeVideoQueryParameter added in v0.3.0

func AddIncludeVideoQueryParameter(
	query url.Values,
	includeVideo bool,
)

AddIncludeVideoQueryParameter adds the include video query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - includeVideo: whether to include video content

func AddLanguageQueryParameter added in v0.3.0

func AddLanguageQueryParameter(
	query url.Values,
	language string,
)

AddLanguageQueryParameter adds the language query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - language: the language code (optional, defaults to "en-US")

func AddMovieListsQueryParameters added in v0.3.0

func AddMovieListsQueryParameters(
	req *http.Request,
	language string,
	page int32,
	region string,
)

AddMovieListsQueryParameters adds the query parameters for movie lists to the HTTP request

Parameters:

- req: the HTTP request - language: the language code (optional, defaults to "en-US") - page: the page number (optional, defaults to 1) - region: the region code (optional)

func AddPageQueryParameter added in v0.3.0

func AddPageQueryParameter(
	query url.Values,
	page int32,
)

AddPageQueryParameter adds the page query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - page: the page number (optional, defaults to 1)

func AddPrimaryReleaseYearGTEQueryParameter added in v0.3.0

func AddPrimaryReleaseYearGTEQueryParameter(
	query url.Values,
	primaryReleaseYearGTE int32,
)

AddPrimaryReleaseYearGTEQueryParameter adds the primary release year greater than or equal to query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - primaryReleaseYearGTE: the primary release year greater than or equal to (optional)

func AddPrimaryReleaseYearLTEQueryParameter added in v0.3.0

func AddPrimaryReleaseYearLTEQueryParameter(
	query url.Values,
	primaryReleaseYearLTE int32,
)

AddPrimaryReleaseYearLTEQueryParameter adds the primary release year less than or equal to query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - primaryReleaseYearLTE: the primary release year less than or equal to (optional)

func AddPrimaryReleaseYearQueryParameter added in v0.3.0

func AddPrimaryReleaseYearQueryParameter(
	query url.Values,
	primaryReleaseYear int32,
)

AddPrimaryReleaseYearQueryParameter adds the primary release year query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - primaryReleaseYear: the primary release year (optional)

func AddRegionQueryParameter added in v0.3.0

func AddRegionQueryParameter(
	query url.Values,
	region string,
)

AddRegionQueryParameter adds the region query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - region: the region code (optional)

func AddReleaseDateGTEQueryParameter added in v0.3.0

func AddReleaseDateGTEQueryParameter(
	query url.Values,
	releaseDateGTE string,
)

AddReleaseDateGTEQueryParameter adds the release_date.gte query parameter to the HTTP request query parameters

Parameters:

- query: the HTTP request query parameters - releaseDateGTE: the release_date.gte value

func AddReleaseDateLTEQueryParameter added in v0.3.0

func AddReleaseDateLTEQueryParameter(
	query url.Values,
	releaseDateLTE string,
)

AddReleaseDateLTEQueryParameter adds the release_date.lte query parameter to the HTTP request query parameters

Parameters:

- query: the HTTP request query parameters - releaseDateLTE: the release_date.lte value

func AddSearchMoviesQueryParameters added in v0.3.0

func AddSearchMoviesQueryParameters(
	req *http.Request,
	query string,
	includeAdult bool,
	language string,
	primaryReleaseYear int32,
	page int32,
	region string,
	year int32,
)

AddSearchMoviesQueryParameters adds the query parameters for searching movies to the HTTP request

Parameters:

- req: the HTTP request - query: the search query - includeAdult: whether to include adult content - language: the language code (optional, defaults to "en-US") - primaryReleaseYear: the primary release year (optional) - page: the page number (optional, defaults to 1) - region: the region code (optional) - year: the year (optional)

func AddSimilarMoviesQueryParameters added in v0.3.0

func AddSimilarMoviesQueryParameters(
	req *http.Request,
	language string,
	page int32,
)

AddSimilarMoviesQueryParameters adds the query parameters for similar movies to the HTTP request

Parameters:

- req: the HTTP request - language: the language code (optional, defaults to "en-US") - page: the page number (optional, defaults to 1)

func AddSortByQueryParameter added in v0.3.0

func AddSortByQueryParameter(
	query url.Values,
	sortBy SortByEnum,
)

AddSortByQueryParameter adds the sort_by query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - sortBy: the sort by value

func AddVoteAverageGTEQueryParameter added in v0.3.0

func AddVoteAverageGTEQueryParameter(
	query url.Values,
	voteAverageGTE float32,
)

AddVoteAverageGTEQueryParameter adds the vote_average.gte query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - voteAverageGTE: the vote average greater than or equal to value

func AddVoteAverageLTEQueryParameter added in v0.3.0

func AddVoteAverageLTEQueryParameter(
	query url.Values,
	voteAverageLTE float32,
)

AddVoteAverageLTEQueryParameter adds the vote_average.lte query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - voteAverageLTE: the vote average less than or equal to value

func AddVoteCountGTEQueryParameter added in v0.3.0

func AddVoteCountGTEQueryParameter(
	query url.Values,
	voteCountGTE float32,
)

AddVoteCountGTEQueryParameter adds the vote_count.gte query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - voteCountGTE: the vote count greater than or equal to value

func AddVoteCountLTEQueryParameter added in v0.3.0

func AddVoteCountLTEQueryParameter(
	query url.Values,
	voteCountLTE float32,
)

AddVoteCountLTEQueryParameter adds the vote_count.lte query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - voteCountLTE: the vote count less than or equal to value

func AddWatchRegionQueryParameter added in v0.3.0

func AddWatchRegionQueryParameter(
	query url.Values,
	watchRegion string,
)

AddWatchRegionQueryParameter adds the watch_region query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - watchRegion: the watch region code

func AddWithCastQueryParameter added in v0.3.0

func AddWithCastQueryParameter(
	query url.Values,
	withCast []string,
)

AddWithCastQueryParameter adds the with_cast query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withCast: the list of cast IDs

func AddWithCompaniesQueryParameter added in v0.3.0

func AddWithCompaniesQueryParameter(
	query url.Values,
	withCompanies []string,
)

AddWithCompaniesQueryParameter adds the with_companies query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withCompanies: the list of company IDs

func AddWithCrewQueryParameter added in v0.3.0

func AddWithCrewQueryParameter(
	query url.Values,
	withCrew []string,
)

AddWithCrewQueryParameter adds the with_crew query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withCrew: the list of crew IDs

func AddWithGenresQueryParameter added in v0.3.0

func AddWithGenresQueryParameter(
	query url.Values,
	withGenres []string,
)

AddWithGenresQueryParameter adds the with_genres query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withGenres: the list of genre IDs

func AddWithKeywordsQueryParameter added in v0.3.0

func AddWithKeywordsQueryParameter(
	query url.Values,
	withKeywords []string,
)

AddWithKeywordsQueryParameter adds the with_keywords query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withKeywords: the list of keyword IDs

func AddWithOriginCountryQueryParameter added in v0.3.0

func AddWithOriginCountryQueryParameter(
	query url.Values,
	withOriginCountry string,
)

AddWithOriginCountryQueryParameter adds the with_origin_country query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withOriginCountry: the origin country code

func AddWithOriginalLanguageQueryParameter added in v0.3.0

func AddWithOriginalLanguageQueryParameter(
	query url.Values,
	withOriginalLanguage string,
)

AddWithOriginalLanguageQueryParameter adds the with_original_language query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withOriginalLanguage: the original language code

func AddWithPeopleQueryParameter added in v0.3.0

func AddWithPeopleQueryParameter(
	query url.Values,
	withPeople []string,
)

AddWithPeopleQueryParameter adds the with_people query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withPeople: the list of people IDs

func AddWithRuntimeGTEQueryParameter added in v0.3.0

func AddWithRuntimeGTEQueryParameter(
	query url.Values,
	withRuntimeGTE int32,
)

AddWithRuntimeGTEQueryParameter adds the with_runtime.gte query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withRuntimeGTE: the runtime greater than or equal to value

func AddWithRuntimeLTEQueryParameter added in v0.3.0

func AddWithRuntimeLTEQueryParameter(
	query url.Values,
	withRuntimeLTE int32,
)

AddWithRuntimeLTEQueryParameter adds the with_runtime.lte query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withRuntimeLTE: the runtime less than or equal to value

func AddWithWatchMonetizationTypesQueryParameter added in v0.3.0

func AddWithWatchMonetizationTypesQueryParameter(
	query url.Values,
	withWatchMonetizationTypes []WatchMonetizationTypeEnums,
)

AddWithWatchMonetizationTypesQueryParameter adds the with_watch_monetization_types query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withWatchMonetizationTypes: the list of watch monetization types

func AddWithWatchProvidersQueryParameter added in v0.3.0

func AddWithWatchProvidersQueryParameter(
	query url.Values,
	withWatchProviders []string,
)

AddWithWatchProvidersQueryParameter adds the with_watch_providers query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withWatchProviders: the list of watch provider IDs

func AddWithoutCompaniesQueryParameter added in v0.3.0

func AddWithoutCompaniesQueryParameter(
	query url.Values,
	withoutCompanies string,
)

AddWithoutCompaniesQueryParameter adds the without_companies query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withoutCompanies: the list of company IDs to exclude

func AddWithoutGenresQueryParameter added in v0.3.0

func AddWithoutGenresQueryParameter(
	query url.Values,
	withoutGenres string,
)

AddWithoutGenresQueryParameter adds the without_genres query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withoutGenres: the list of genre IDs to exclude

func AddWithoutKeywordsQueryParameter added in v0.3.0

func AddWithoutKeywordsQueryParameter(
	query url.Values,
	withoutKeywords string,
)

AddWithoutKeywordsQueryParameter adds the without_keywords query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - withoutKeywords: the list of keyword IDs to exclude

func AddYearQueryParameter added in v0.3.0

func AddYearQueryParameter(
	query url.Values,
	year int32,
)

AddYearQueryParameter adds the year query parameter to the HTTP request

Parameters:

- query: the HTTP request query parameters - year: the year (optional)

Types

type AuthorDetails

type AuthorDetails struct {
	Name       string  `json:"name"`
	Username   string  `json:"username"`
	AvatarPath *string `json:"avatar_path,omitempty"`
	Rating     *int32  `json:"rating,omitempty"`
}

AuthorDetails represents the details of an author in a review

type Cast

type Cast struct {
	Adult              bool     `json:"adult"`
	Gender             *int32   `json:"gender,omitempty"`
	ID                 int32    `json:"id"`
	KnownForDepartment string   `json:"known_for_department"`
	Name               string   `json:"name"`
	OriginalName       string   `json:"original_name"`
	Popularity         *float32 `json:"popularity,omitempty"`
	ProfilePath        *string  `json:"profile_path,omitempty"`
	CreditID           string   `json:"credit_id"`
	CastID             int32    `json:"cast_id"`
	Character          string   `json:"character"`
	Order              *int32   `json:"order,omitempty"`
}

Cast represents a cast member in a movie

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the TMDB API client

func NewClient

func NewClient(apiKey string) (*Client, error)

NewClient creates a new TMDB API client

Parameters:

- apiKey: the TMDB API key

Returns:

- *Client: the TMDB API client - error: if there was an error creating the client

func (Client) DiscoverMovies added in v0.3.0

func (c Client) DiscoverMovies(
	ctx context.Context,
	queryParameters *DiscoverMoviesQueryParameters,
) (parsedResp *MovieListResponse, statusCode int, err error)

DiscoverMovies discovers movies based on various criteria

Parameters:

- ctx: the context of the request

Returns:

- (*MovieListResponse): the response containing the list of discovered movies - int: the HTTP status code - error: if there was an error discovering movies

func (Client) GetGenresMovieList added in v0.2.1

func (c Client) GetGenresMovieList(
	ctx context.Context,
	language string,
) (parsedResp *GenreListResponse, statusCode int, err error)

GetGenresMovieList fetches the list of movie genres

Parameters:

- ctx: the context of the request - language: the language code (optional, defaults to "en-US")

Returns:

- (*GenreListResponse): the response containing the list of movie genres - int: the HTTP status code - error: if there was an error fetching the movie genres

func (Client) GetMovieCredits

func (c Client) GetMovieCredits(
	ctx context.Context,
	movieID int32,
	language string,
) (parsedResp *MovieCreditsResponse, statusCode int, err error)

GetMovieCredits fetches the credits for a given movie

Parameters:

- ctx: the context of the request - movieID: the ID of the movie - language: the language code (optional, defaults to "en-US")

Returns:

- (*MovieCreditsResponse): the response containing the movie credits - int: the HTTP status code - error: if there was an error fetching the movie credits

func (Client) GetMovieDetails

func (c Client) GetMovieDetails(
	ctx context.Context,
	movieID int32,
	language string,
) (parsedResp *MovieDetailsResponse, statusCode int, err error)

GetMovieDetails fetches the details of a given movie

Parameters:

- ctx: the context of the request - movieID: the ID of the movie - language: the language code (optional, defaults to "en-US")

Returns:

- (*MovieDetailsResponse): the response containing the movie details - int: the HTTP status code - error: if there was an error fetching the movie details

func (Client) GetMovieReviews

func (c Client) GetMovieReviews(
	ctx context.Context,
	movieID int32,
	language string,
	page int32,
) (parsedResp *MovieReviewsResponse, statusCode int, err error)

GetMovieReviews fetches the reviews for a given movie

Parameters:

- ctx: the context of the request - movieID: the ID of the movie - language: the language code (optional, defaults to "en-US") - page: the page number (optional, defaults to 1)

Returns:

- (*MovieReviewsResponse): the response containing the movie reviews - int: the HTTP status code - error: if there was an error fetching the movie reviews

func (Client) GetMoviesNowPlaying

func (c Client) GetMoviesNowPlaying(
	ctx context.Context,
	language string,
	page int32,
	region string,
) (parsedResp *DateMovieListResponse, statusCode int, err error)

GetMoviesNowPlaying fetches the list of movies that are now playing in theaters

Parameters:

- ctx: the context of the request - id: the movie ID - language: the language code (optional, defaults to "en-US") - page: the page number (optional, defaults to 1) - region: the region code (optional)

Returns:

- (*DataMovieListResponse): the response containing the list of movies - int: the HTTP status code - error: if there was an error fetching the movies

func (Client) GetMoviesPopular

func (c Client) GetMoviesPopular(
	ctx context.Context,
	language string,
	page int32,
	region string,
) (parsedResp *MovieListResponse, statusCode int, err error)

GetMoviesPopular fetches the list of popular movies

Parameters:

- ctx: the context of the request - language: the language code (optional, defaults to "en-US") - page: the page number (optional, defaults to 1) - region: the region code (optional)

Returns:

- (*MovieListResponse): the response containing the list of popular movies - int: the HTTP status code - error: if there was an error fetching the movies

func (Client) GetMoviesTopRated

func (c Client) GetMoviesTopRated(
	ctx context.Context,
	language string,
	page int32,
	region string,
) (parsedResp *MovieListResponse, httpStatus int, err error)

GetMoviesTopRated fetches the list of top-rated movies

Parameters:

- ctx: the context of the request - language: the language code (optional, defaults to "en-US") - page: the page number (optional, defaults to 1) - region: the region code (optional)

Returns:

- (*MovieListResponse): the response containing the list of top-rated movies - int: the HTTP status code - error: if there was an error fetching the movies

func (Client) GetMoviesUpcoming

func (c Client) GetMoviesUpcoming(
	ctx context.Context,
	language string,
	page int32,
	region string,
) (parsedResp *DateMovieListResponse, statusCode int, err error)

GetMoviesUpcoming fetches the list of upcoming movies

Parameters:

- ctx: the context of the request - language: the language code (optional, defaults to "en-US") - page: the page number (optional, defaults to 1) - region: the region code (optional)

Returns:

- (*DateMovieListResponse): the response containing the list of upcoming movies - int: the HTTP status code - error: if there was an error fetching the movies

func (Client) SearchMovies

func (c Client) SearchMovies(
	ctx context.Context,
	query string,
	includeAdult bool,
	language string,
	primaryReleaseYear int32,
	page int32,
	region string,
	year int32,
) (parsedresp *MovieListResponse, statusCode int, err error)

SearchMovies searches for movies by query

Parameters:

- ctx: the context of the request - query: the search query - includeAdult: whether to include adult content - language: the language code (optional, defaults to "en-US") - primaryReleaseYear: the primary release year (optional) - page: the page number (optional, defaults to 1) - region: the region code (optional) - year: the year (optional)

Returns:

- (*MovieListResponse): the response containing the list of movies matching the search query - int: the HTTP status code - error: if there was an error searching for movies

func (Client) SimilarMovies

func (c Client) SimilarMovies(
	ctx context.Context,
	movieID int32,
	language string,
	page int32,
) (parsedResp *MovieListResponse, statusCode int, err error)

SimilarMovies fetches the list of movies similar to a given movie

Parameters:

- ctx: the context of the request - movieID: the ID of the movie - language: the language code (optional, defaults to "en-US") - page: the page number (optional, defaults to 1)

Returns:

- (*MovieListResponse): the response containing the list of similar movies - int: the HTTP status code - error: if there was an error fetching similar movies

type Crew

type Crew struct {
	Adult              bool     `json:"adult"`
	Gender             *int32   `json:"gender,omitempty"`
	ID                 int32    `json:"id"`
	KnownForDepartment string   `json:"known_for_department"`
	Name               string   `json:"name"`
	OriginalName       string   `json:"original_name"`
	Popularity         *float32 `json:"popularity,omitempty"`
	ProfilePath        *string  `json:"profile_path,omitempty"`
	CreditID           string   `json:"credit_id"`
	Department         string   `json:"department"`
	Job                *string  `json:"job,omitempty"`
}

Crew represents a crew member in a movie

type DateMovieListResponse

type DateMovieListResponse struct {
	Dates        DateRange     `json:"dates"`
	Page         int32         `json:"page"`
	Results      []SimpleMovie `json:"results"`
	TotalPages   int32         `json:"total_pages"`
	TotalResults int32         `json:"total_results"`
}

DateMovieListResponse represents a movie list response with date range

type DateRange

type DateRange struct {
	Maximum string `json:"maximum"`
	Minimum string `json:"minimum"`
}

DateRange represents a date range with maximum and minimum dates

type DiscoverMoviesQueryParameters added in v0.3.0

type DiscoverMoviesQueryParameters struct {
	Certification              string
	CertificationCountry       string
	CertificationGTE           string
	CertificationLTE           string
	IncludeAdult               bool
	IncludeVideo               bool
	Language                   string
	PrimaryReleaseYear         int32
	PrimaryReleaseYearGTE      int32
	PrimaryReleaseYearLTE      int32
	Page                       int32
	Region                     string
	ReleaseDateGTE             string
	ReleaseDateLTE             string
	SortBy                     SortByEnum
	VoteAverageGTE             float32
	VoteAverageLTE             float32
	VoteCountGTE               float32
	VoteCountLTE               float32
	WithGenres                 []string
	WithCompanies              []string
	WithKeywords               []string
	WithCast                   []string
	WithCrew                   []string
	WithPeople                 []string
	WithOriginCountry          string
	WithOriginalLanguage       string
	WatchRegion                string
	WithRuntimeGTE             int32
	WithRuntimeLTE             int32
	WithWatchMonetizationTypes []WatchMonetizationTypeEnums
	WithWatchProviders         []string
	WithoutCompanies           string
	WithoutGenres              string
	WithoutKeywords            string
	Year                       int32
}

DiscoverMoviesQueryParameters represents the query parameters for discovering movies

type Genre

type Genre struct {
	ID   int32  `json:"id"`
	Name string `json:"name"`
}

Genre represents a movie genre

type GenreListResponse added in v0.2.1

type GenreListResponse struct {
	Genres []Genre `json:"genres"`
}

GenreListResponse represents a genre list response

type MovieCreditsResponse

type MovieCreditsResponse struct {
	ID   int32  `json:"id"`
	Cast []Cast `json:"cast"`
	Crew []Crew `json:"crew"`
}

MovieCreditsResponse represents a movie credits response

type MovieDetailsResponse

type MovieDetailsResponse struct {
	Adult               bool                `json:"adult"`
	BackdropPath        string              `json:"backdrop_path"`
	BelongsToCollection *string             `json:"belongs_to_collection,omitempty"`
	Budget              *int64              `json:"budget,omitempty"`
	Genres              []Genre             `json:"genres"`
	Homepage            *string             `json:"homepage,omitempty"`
	ID                  int32               `json:"id"`
	ImdbID              string              `json:"imdb_id"`
	OriginalLanguage    string              `json:"original_language"`
	OriginalTitle       string              `json:"original_title"`
	Overview            string              `json:"overview"`
	Popularity          *float32            `json:"popularity,omitempty"`
	PosterPath          string              `json:"poster_path"`
	ProductionCompanies []ProductionCompany `json:"production_companies"`
	ProductionCountries []ProductionCountry `json:"production_countries"`
	ReleaseDate         string              `json:"release_date"`
	Revenue             *int64              `json:"revenue,omitempty"`
	Runtime             *int32              `json:"runtime,omitempty"`
	SpokenLanguages     []SpokenLanguage    `json:"spoken_languages"`
	Status              string              `json:"status"`
	Tagline             *string             `json:"tagline,omitempty"`
	Title               string              `json:"title"`
	Video               *bool               `json:"video,omitempty"`
	VoteAverage         *float32            `json:"vote_average,omitempty"`
	VoteCount           *int32              `json:"vote_count,omitempty"`
}

MovieDetailsResponse represents a movie details response

type MovieListResponse

type MovieListResponse struct {
	Page         int32         `json:"page"`
	Results      []SimpleMovie `json:"results"`
	TotalPages   int32         `json:"total_pages"`
	TotalResults int32         `json:"total_results"`
}

MovieListResponse represents a generic movie list response

type MovieReviewsResponse

type MovieReviewsResponse struct {
	ID           int32    `json:"id"`
	Page         int32    `json:"page"`
	Results      []Review `json:"results"`
	TotalPages   int32    `json:"total_pages"`
	TotalResults int32    `json:"total_results"`
}

MovieReviewsResponse represents a movie reviews response

type ProductionCompany

type ProductionCompany struct {
	ID            int32   `json:"id"`
	LogoPath      *string `json:"logo_path,omitempty"`
	Name          string  `json:"name"`
	OriginCountry *string `json:"origin_country,omitempty"`
}

ProductionCompany represents a movie production company

type ProductionCountry

type ProductionCountry struct {
	// nolint:revive
	ISO3166_1 string `json:"iso_3166_1"`
	Name      string `json:"name"`
}

ProductionCountry represents a movie production country

type Review

type Review struct {
	Author        string        `json:"author"`
	AuthorDetails AuthorDetails `json:"author_details"`
	Content       string        `json:"content"`
	CreatedAt     string        `json:"created_at"`
	ID            string        `json:"id"`
	UpdatedAt     string        `json:"updated_at"`
	URL           string        `json:"url"`
}

Review represents a movie review

type SimpleMovie

type SimpleMovie struct {
	Adult            bool     `json:"adult"`
	BackdropPath     string   `json:"backdrop_path"`
	GenreIDs         []int32  `json:"genre_ids"`
	ID               int32    `json:"id"`
	OriginalLanguage string   `json:"original_language"`
	OriginalTitle    string   `json:"original_title"`
	Overview         string   `json:"overview"`
	Popularity       *float32 `json:"popularity,omitempty"`
	PosterPath       string   `json:"poster_path"`
	ReleaseDate      string   `json:"release_date"`
	Title            string   `json:"title"`
	Video            bool     `json:"video"`
	VoteAverage      *float32 `json:"vote_average,omitempty"`
	VoteCount        *int32   `json:"vote_count,omitempty"`
}

SimpleMovie represents a simplified movie structure

type SortByEnum added in v0.3.2

type SortByEnum string

SortByEnum represents the sorting options for TMDB API requests

const (
	SortByPopularityAsc          SortByEnum = "popularity.asc"
	SortByPopularityDesc         SortByEnum = "popularity.desc"
	SortByPrimaryReleaseDateAsc  SortByEnum = "primary_release_date.asc"
	SortByPrimaryReleaseDateDesc SortByEnum = "primary_release_date.desc"
	SortByOriginalTitleAsc       SortByEnum = "original_title.asc"
	SortByOriginalTitleDesc      SortByEnum = "original_title.desc"
	SortByRevenueAsc             SortByEnum = "revenue.asc"
	SortByRevenueDesc            SortByEnum = "revenue.desc"
	SortByTitleAsc               SortByEnum = "title.asc"
	SortByTitleDesc              SortByEnum = "title.desc"
	SortByVoteAverageAsc         SortByEnum = "vote_average.asc"
	SortByVoteAverageDesc        SortByEnum = "vote_average.desc"
	SortByVoteCountAsc           SortByEnum = "vote_count.asc"
	SortByVoteCountDesc          SortByEnum = "vote_count.desc"
)

type SpokenLanguage

type SpokenLanguage struct {
	EnglishName string `json:"english_name"`
	// nolint:revive
	ISO639_1 string `json:"iso_639_1"`
	Name     string `json:"name"`
}

SpokenLanguage represents a spoken language in a movie

type WatchMonetizationTypeEnums added in v0.3.2

type WatchMonetizationTypeEnums string

WatchMonetizationTypeEnums represents the watch monetization types for TMDB API requests

const (
	WatchMonetizationTypeFlatrate WatchMonetizationTypeEnums = "flatrate"
	WatchMonetizationTypeFree     WatchMonetizationTypeEnums = "free"
	WatchMonetizationTypeAds      WatchMonetizationTypeEnums = "ads"
	WatchMonetizationTypeRent     WatchMonetizationTypeEnums = "rent"
	WatchMonetizationTypeBuy      WatchMonetizationTypeEnums = "buy"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL