themoviedbapi

package
v0.0.0-...-ea0be71 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

themoviedb.org ("TMDb") REST API client

Index

Constants

View Source
const (
	MediaTypeMovie = "movie"
	MediaTypeTv    = "tv"
)

Variables

This section is empty.

Functions

func ImagePath

func ImagePath(path string, width ImageSize) string

width=original|w500|...

Types

type Client

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

func New

func New(apiKey string) *Client

func (*Client) GetEpisodeExternalIds

func (c *Client) GetEpisodeExternalIds(
	ctx context.Context,
	tvId string,
	seasonNumber int,
	episodeNumber int,
) (*ExternalIds, error)

func (*Client) GetSeasonEpisodes

func (c *Client) GetSeasonEpisodes(ctx context.Context, seasonNumber int, tvId string) ([]Episode, error)

doesn't support returning external IDs, but the "get one episode" does.

func (*Client) MultiSearch

func (c *Client) MultiSearch(ctx context.Context, query string) ([]MultiSearchResult, error)

func (*Client) OpenMovie

func (c *Client) OpenMovie(ctx context.Context, id string) (*Movie, error)

func (*Client) OpenMovieByImdbId

func (c *Client) OpenMovieByImdbId(ctx context.Context, imdbId string) (*Movie, error)

func (*Client) OpenTv

func (c *Client) OpenTv(ctx context.Context, id string) (*Tv, error)

func (*Client) OpenTvByImdbId

func (c *Client) OpenTvByImdbId(ctx context.Context, imdbId string) (*Tv, error)

type Episode

type Episode struct {
	Id            uint64 `json:"id"`
	SeasonNumber  int    `json:"season_number"`
	EpisodeNumber int    `json:"episode_number"`
	Name          string `json:"name"`
	Overview      string `json:"overview"`
	AirDate       string `json:"air_date"` // yyyy-mm-dd
	StillPath     string `json:"still_path"`
}

type ExternalIds

type ExternalIds struct {
	Id     int64  `json:"id"`
	ImdbId string `json:"imdb_id"`
}

type ImageSize

type ImageSize string
const (
	ImageSizeOriginal ImageSize = "original"
)

type Movie

type Movie struct {
	Id             int64       `json:"id"`
	ExternalIds    ExternalIds `json:"external_ids"`
	Title          string      `json:"title"`
	OriginalTitle  string      `json:"original_title"`
	Overview       string      `json:"overview"`
	RuntimeMinutes int         `json:"runtime"`
	ReleaseDate    string      `json:"release_date"` // yyyy-mm-dd
	RevenueDollars int64       `json:"revenue"`
	BackdropPath   string      `json:"backdrop_path"`
}

type MultiSearchResult

type MultiSearchResult struct {
	Id           int64  `json:"id"`
	MediaType    string `json:"media_type"`
	Title        string `json:"title"`          // when movie
	Name         string `json:"name"`           // when TV
	ReleaseDate  string `json:"release_date"`   // when movie, yyyy-mm-dd
	FirstAirDate string `json:"first_air_date"` // when TV, yyyy-mm-dd
}

type Tv

type Tv struct {
	Id           int64       `json:"id"`
	Name         string      `json:"name"`
	Overview     string      `json:"overview"`
	BackdropPath string      `json:"backdrop_path"`
	PosterPath   string      `json:"poster_path"`
	Homepage     string      `json:"homepage"`
	ExternalIds  ExternalIds `json:"external_ids"`
}

Jump to

Keyboard shortcuts

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