Documentation
¶
Overview ¶
Package tvmaze is the library behind the tvmaze command line: the HTTP client, request shaping, and the typed data models for the TVMaze show search and schedule endpoints.
The TVMaze public API at api.tvmaze.com requires no authentication. The Client sets a real User-Agent, paces requests at 200 ms intervals, and retries transient 429/5xx failures with exponential backoff.
Index ¶
- Constants
- type CastMember
- type Client
- func (c *Client) Cast(ctx context.Context, showID int) ([]CastMember, error)
- func (c *Client) Episodes(ctx context.Context, showID int) ([]Episode, error)
- func (c *Client) GetShow(ctx context.Context, id int) (*Show, error)
- func (c *Client) Schedule(ctx context.Context, country string, limit int) ([]Show, error)
- func (c *Client) Search(ctx context.Context, query string, limit int) ([]Show, error)
- type Config
- type Domain
- type Episode
- type Show
Constants ¶
const Host = "tvmaze.com"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CastMember ¶ added in v0.1.1
type CastMember struct {
PersonName string `json:"person_name"`
CharacterName string `json:"character_name"`
Birthday string `json:"birthday,omitempty"`
}
CastMember is one cast entry from the /shows/{id}/cast endpoint.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to TVMaze over HTTP.
func (*Client) Episodes ¶ added in v0.1.1
Episodes fetches all episodes for a show by its TVMaze ID.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the tvmaze driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Episode ¶ added in v0.1.1
type Episode struct {
ID int `json:"id"`
Name string `json:"name"`
Season int `json:"season"`
Number int `json:"number"`
Airdate string `json:"airdate,omitempty"`
Summary string `json:"summary,omitempty"`
Runtime int `json:"runtime,omitempty"`
}
Episode is one episode record from the /shows/{id}/episodes endpoint.
type Show ¶
type Show struct {
Rank int `json:"rank"`
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // "Scripted", "Animation", etc.
Genres []string `json:"genres"`
Status string `json:"status"` // "Running", "Ended", "In Development"
Premiered string `json:"premiered"` // YYYY-MM-DD
Rating float64 `json:"rating"`
Network string `json:"network"`
Summary string `json:"summary"` // HTML stripped
URL string `json:"url"` // tvmaze.com URL
}
Show is the public output record for a TV show.