provider

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID          = errors.New(http.StatusBadRequest, "invalid id")
	ErrInvalidURL         = errors.New(http.StatusBadRequest, "invalid url")
	ErrInvalidKeyword     = errors.New(http.StatusBadRequest, "invalid keyword")
	ErrInfoNotFound       = errors.New(http.StatusNotFound, "info not found")
	ErrImageNotFound      = errors.New(http.StatusNotFound, "image not found")
	ErrProviderNotFound   = errors.New(http.StatusNotFound, "provider not found")
	ErrIncompleteMetadata = errors.New(http.StatusInternalServerError, "incomplete metadata")
)

Functions

func RangeActorFactory

func RangeActorFactory(f func(string, ActorFactory) bool)

func RangeMovieFactory

func RangeMovieFactory(f func(string, MovieFactory) bool)

func Register added in v1.2.8

func Register[T Provider](name string, factory func() T)

Types

type ActorFactory

type ActorFactory = func() ActorProvider

type ActorProvider

type ActorProvider interface {
	// Provider should be implemented.
	Provider

	// NormalizeActorID normalizes actor ID to conform to standard.
	NormalizeActorID(id string) string

	// ParseActorIDFromURL parses actor ID from given URL.
	ParseActorIDFromURL(rawURL string) (string, error)

	// GetActorInfoByID gets actor's info by id.
	GetActorInfoByID(id string) (*model.ActorInfo, error)

	// GetActorInfoByURL gets actor's info by url.
	GetActorInfoByURL(url string) (*model.ActorInfo, error)
}

type ActorSearcher

type ActorSearcher interface {
	// SearchActor searches matched actor/s.
	SearchActor(keyword string) ([]*model.ActorSearchResult, error)
}

type Fetcher

type Fetcher interface {
	// Fetch fetches media resources from url.
	Fetch(url string) (*http.Response, error)
}

type MovieFactory

type MovieFactory = func() MovieProvider

type MovieProvider

type MovieProvider interface {
	// Provider should be implemented.
	Provider

	// NormalizeMovieID normalizes movie ID to conform to standard.
	NormalizeMovieID(id string) string

	// ParseMovieIDFromURL parses movie ID from given URL.
	ParseMovieIDFromURL(rawURL string) (string, error)

	// GetMovieInfoByID gets movie's info by id.
	GetMovieInfoByID(id string) (*model.MovieInfo, error)

	// GetMovieInfoByURL gets movie's info by url.
	GetMovieInfoByURL(url string) (*model.MovieInfo, error)
}

type MovieReviewer added in v1.2.0

type MovieReviewer interface {
	// GetMovieReviewsByID gets the user reviews of given movie id.
	GetMovieReviewsByID(id string) ([]*model.MovieReviewDetail, error)

	// GetMovieReviewsByURL gets the user reviews of given movie URL.
	GetMovieReviewsByURL(rawURL string) ([]*model.MovieReviewDetail, error)
}

type MovieSearcher

type MovieSearcher interface {
	// SearchMovie searches matched movies.
	SearchMovie(keyword string) ([]*model.MovieSearchResult, error)

	// NormalizeMovieKeyword converts movie keyword to provider-friendly form.
	NormalizeMovieKeyword(Keyword string) string
}

type Provider

type Provider interface {
	// Name returns the name of the provider.
	Name() string

	// Priority returns the matching priority of the provider.
	Priority() float64

	// SetPriority sets the provider priority to the given value.
	SetPriority(v float64)

	// URL returns the base url of the provider.
	URL() *url.URL
}

type RequestTimeoutSetter

type RequestTimeoutSetter interface {
	// SetRequestTimeout sets timeout for HTTP requests.
	SetRequestTimeout(timeout time.Duration)
}

Directories

Path Synopsis
internal
Deprecated: X/sList is deprecated due to its outdated data and WAF.
Deprecated: X/sList is deprecated due to its outdated data and WAF.

Jump to

Keyboard shortcuts

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