trakt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package trakt provides a minimal HTTP client for the Trakt API v2. Only the TV show endpoints needed for import lists are implemented.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Trakt API v2 HTTP client.

func New

func New(clientID string, logger *slog.Logger) *Client

New creates a new Trakt client. clientID is the Trakt API key (obtained from trakt.tv/oauth/applications). logger may be nil.

func (*Client) GetCustomListShows

func (c *Client) GetCustomListShows(ctx context.Context, username, listSlug string) ([]Show, error)

GetCustomListShows fetches a user's custom list items (TV shows only).

func (*Client) GetPopularShows

func (c *Client) GetPopularShows(ctx context.Context) ([]Show, error)

GetPopularShows fetches Trakt's popular TV shows list.

func (*Client) GetTrendingShows

func (c *Client) GetTrendingShows(ctx context.Context) ([]Show, error)

GetTrendingShows fetches Trakt's trending TV shows (most watched right now).

func (*Client) GetWatchlistShows

func (c *Client) GetWatchlistShows(ctx context.Context, username string) ([]Show, error)

GetWatchlistShows fetches a user's TV show watchlist.

func (*Client) WithBaseURL

func (c *Client) WithBaseURL(u string) *Client

WithBaseURL overrides the API base URL. Intended for tests only.

func (*Client) WithHTTPClient

func (c *Client) WithHTTPClient(hc *http.Client) *Client

WithHTTPClient overrides the underlying HTTP client. Intended for tests only.

type Show

type Show struct {
	Title string `json:"title"`
	Year  int    `json:"year"`
	IDs   struct {
		Trakt int    `json:"trakt"`
		TMDB  int    `json:"tmdb"`
		IMDB  string `json:"imdb"`
		TVDB  int    `json:"tvdb"`
	} `json:"ids"`
}

Show represents a TV show from the Trakt API.

Jump to

Keyboard shortcuts

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