Documentation
¶
Overview ¶
Package anilist is the library behind the anilist command line: the HTTP client, request shaping, and the typed data models for the AniList anime and manga database (graphql.anilist.co).
The AniList API is a GraphQL endpoint that accepts POST requests with a JSON body containing a "query" field and optional "variables". No API key or authentication required.
Index ¶
- Constants
- type Character
- type Client
- func (c *Client) Character(ctx context.Context, search string) (Character, error)
- func (c *Client) Media(ctx context.Context, id int) (Media, error)
- func (c *Client) Search(ctx context.Context, query string, mediaType string, limit int) ([]Media, error)
- func (c *Client) Top(ctx context.Context, mediaType string, limit int) ([]Media, error)
- type Config
- type Domain
- type Media
Constants ¶
const Host = "graphql.anilist.co"
Host is the AniList GraphQL API host.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Character ¶
type Character struct {
ID int `json:"id" kit:"id"`
Name string `json:"name"`
Gender string `json:"gender"`
Birth string `json:"birth,omitempty"` // formatted date of birth
}
Character is a single character record returned by the character command.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the AniList GraphQL API over HTTP.
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 anilist 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 Media ¶
type Media struct {
Rank int `json:"rank"`
ID int `json:"id" kit:"id"`
TitleRomaji string `json:"title_romaji"`
TitleEnglish string `json:"title_english"`
Type string `json:"type"` // "ANIME" or "MANGA"
Episodes int `json:"episodes"` // anime only; 0 for manga
Chapters int `json:"chapters"` // manga only; 0 for anime
Status string `json:"status"` // "FINISHED", "RELEASING", etc.
Score int `json:"score"` // averageScore 0-100
Genres []string `json:"genres"`
Description string `json:"description"` // HTML stripped, 200 char limit
SiteURL string `json:"site_url"` // e.g. https://anilist.co/anime/16498
}
Media is one anime or manga record emitted by every CLI command.