tmdb

package
v0.0.5-beta.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 16 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 (
	ErrNotFound      = errors.New("not found")
	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      search.Search
	Persistence persistence.Persistence
}

type Result

type Result struct {
	fx.Out
	TmdbClient *tmdb.Client
	Client     Client
}

func New

func New(p Params) (r Result, err error)

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