tmdb

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const SourceImdb = "imdb"
View Source
const SourceTmdb = "tmdb"
View Source
const SourceTvdb = "tvdb"

Variables

View Source
var (
	ErrUnknownSource = errors.New("unknown source")
)

Functions

func MovieDetailsToMovieModel

func MovieDetailsToMovieModel(details tmdb.MovieDetails) (movie model.Content, err error)

func TvShowDetailsToTvShowModel

func TvShowDetailsToTvShowModel(details tmdb.TVDetails) (movie model.Content, err error)

Types

type Client

type Client interface {
	MovieClient
	TvShowClient
}

type Config

type Config struct {
	ApiKey         string
	RateLimit      time.Duration
	RateLimitBurst int
}

func NewDefaultConfig

func NewDefaultConfig() Config

type MovieClient

type MovieClient interface {
	SearchMovie(ctx context.Context, p SearchMovieParams) (model.Content, error)
	GetMovieByExternalId(ctx context.Context, source, id string) (model.Content, error)
}

type Params

type Params struct {
	fx.In
	Config Config
	Logger *zap.SugaredLogger
	Search lazy.Lazy[search.Search]
}

type Result

type Result struct {
	fx.Out
	Client lazy.Lazy[Client]
}

func New

func New(p Params) Result

type SearchMovieParams

type SearchMovieParams struct {
	Title                string
	Year                 model.Year
	IncludeAdult         bool
	LevenshteinThreshold uint
}

type SearchTvShowParams

type SearchTvShowParams struct {
	Name                 string
	FirstAirDateYear     model.Year
	IncludeAdult         bool
	LevenshteinThreshold uint
}

type TvShowClient

type TvShowClient interface {
	SearchTvShow(ctx context.Context, p SearchTvShowParams) (model.Content, error)
	GetTvShowByExternalId(ctx context.Context, source, id string) (model.Content, error)
}

Jump to

Keyboard shortcuts

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