Documentation
¶
Overview ¶
Package tvdb implements metadata.Provider against TheTVDB's v4 REST API.
Index ¶
Constants ¶
const (
// DefaultBaseURL is TheTVDB's v4 API root.
DefaultBaseURL = "https://api4.thetvdb.com/v4"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a TheTVDB v4 API client. It logs in lazily on the first lookup and reuses the resulting bearer token for tokenTTL.
func New ¶
New creates a TheTVDB client. It performs no network call: the only way it fails is an empty API key.
func (*Client) LookupShow ¶
func (c *Client) LookupShow(ctx context.Context, title string, year int) (*metadata.ShowMetadata, error)
LookupShow resolves a show against TheTVDB in two authenticated requests: GET /search to find it, then GET /series/{id}/extended, which is the only v4 route returning genres, certifications and cross-references together.
type Config ¶
type Config struct {
// APIKey is the TheTVDB v4 API key. The caller supplies it -- this
// package never reads the environment.
APIKey string
// PIN is the subscriber PIN a user-supported key requires. Leave it
// empty for a project API key.
PIN string
// BaseURL overrides DefaultBaseURL. Tests point it at an httptest
// server.
BaseURL string
}
Config configures a TheTVDB client.