trakt

package
v0.13.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 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) GetAnticipated

func (c *Client) GetAnticipated(ctx context.Context) ([]Movie, error)

GetAnticipated fetches Trakt's most anticipated movies.

func (*Client) GetBoxOffice

func (c *Client) GetBoxOffice(ctx context.Context) ([]Movie, error)

GetBoxOffice fetches Trakt's current box office movies.

func (*Client) GetCustomList

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

GetCustomList fetches a user's custom list items (movies only).

func (*Client) GetPopular

func (c *Client) GetPopular(ctx context.Context) ([]Movie, error)

GetPopular fetches Trakt's popular movies list.

func (*Client) GetTrending

func (c *Client) GetTrending(ctx context.Context) ([]Movie, error)

GetTrending fetches Trakt's trending movies (most watched right now).

func (*Client) GetWatchlist

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

GetWatchlist fetches a user's movie 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 Movie

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

Movie represents a movie from the Trakt API.

Jump to

Keyboard shortcuts

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