anilist

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

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 fetches data from the AniList GraphQL API.

func New

func New() *Client

New creates a new AniList client with a 30-second HTTP timeout.

func NewWithTimeout added in v1.0.5

func NewWithTimeout(timeout time.Duration) *Client

NewWithTimeout creates a new AniList client with the given HTTP timeout.

func (*Client) FetchSeason

func (c *Client) FetchSeason(ctx context.Context, season string, year int, maxResults int, formats []string) ([]Show, error)

FetchSeason returns anime for the given season, year, and formats. Results are capped at maxResults. Paginates through AniList's 50-per-page limit.

type FuzzyDate

type FuzzyDate struct {
	Year  *int `json:"year"`
	Month *int `json:"month"`
	Day   *int `json:"day"`
}

FuzzyDate represents a partial date (year, month, day) from AniList.

type RelationBlock

type RelationBlock struct {
	Edges []RelationEdge `json:"edges"`
}

RelationBlock holds the edges wrapper.

type RelationEdge

type RelationEdge struct {
	Node         RelationNode `json:"node"`
	RelationType string       `json:"relationType"`
}

RelationEdge represents a related media entry.

type RelationNode

type RelationNode struct {
	ID    int   `json:"id"`
	IDMal *int  `json:"idMal"`
	Title Title `json:"title"`
}

RelationNode holds minimal data for a related media entry.

type Show

type Show struct {
	ID        int            `json:"id"`
	IDMal     *int           `json:"idMal"`
	Title     Title          `json:"title"`
	Format    string         `json:"format"`
	Episodes  *int           `json:"episodes"`
	Duration  *int           `json:"duration"`
	Genres    []string       `json:"genres"`
	Tags      []Tag          `json:"tags"`
	Status    string         `json:"status"`
	StartDate FuzzyDate      `json:"startDate"`
	Relations *RelationBlock `json:"relations,omitempty"`
}

Show represents an anime show from the AniList API.

func (Show) DisplayTitle

func (s Show) DisplayTitle() string

DisplayTitle returns the English title if available, falling back to romaji.

func (Show) HasTag

func (s Show) HasTag(name string) bool

HasTag returns true if the show has a tag matching the given name (case-insensitive).

func (Show) IsNew

func (s Show) IsNew() bool

IsNew returns true if the show is not a sequel or spin-off of an existing franchise. A show is considered "new" if it has no PREQUEL or PARENT relations.

func (Show) IsSeries

func (s Show) IsSeries() bool

IsSeries returns true if the show is a series (TV, ONA) rather than a movie (MOVIE, OVA, SPECIAL).

func (Show) IsWinterStart

func (s Show) IsWinterStart() bool

IsWinterStart returns true if the show's start date month falls within the winter anime season (December through March). Shows with unknown start dates are kept (returns true) since they cannot be ruled out. AniList's winter season spans December of the previous calendar year through March of the current year, so months 12, 1, 2, and 3 are valid.

func (Show) IsWithinMonths

func (s Show) IsWithinMonths(months int) bool

IsWithinMonths returns true if the show's start date is within the given number of months from now. If the start date is unknown, returns true (don't filter out shows with unknown dates).

func (Show) SkipByDuration

func (s Show) SkipByDuration() bool

SkipByDuration returns true if the show should be skipped because its per-episode duration is ≤ 10 minutes.

type Tag

type Tag struct {
	Name string `json:"name"`
}

Tag represents an AniList content tag with name and relevance rank.

type Title

type Title struct {
	English *string `json:"english"`
	Romaji  *string `json:"romaji"`
}

Title holds the english and romaji titles.

Jump to

Keyboard shortcuts

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