Documentation
¶
Overview ¶
Package jikan is the library behind the jikan command line: the HTTP client, request shaping, and the typed data models for the Jikan API (api.jikan.moe), the unofficial open-source MyAnimeList proxy.
No API key is required. The client paces itself to ~2.5 req/s to stay under Jikan's 3 req/s rate limit, and retries transient 429/5xx failures with exponential backoff.
Index ¶
Constants ¶
const Host = "api.jikan.moe"
Host is the Jikan API host.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anime ¶
type Anime struct {
Rank int `json:"rank"`
MalID int `json:"mal_id"`
Title string `json:"title"`
TitleEn string `json:"title_english"`
Score float64 `json:"score"`
Episodes int `json:"episodes"` // 0 when unknown/ongoing
Type string `json:"type"` // "TV", "Movie", "OVA", "ONA", "Special", "Music"
Season string `json:"season"` // "spring", "summer", "fall", "winter"
Year int `json:"year"`
Status string `json:"status"` // "Finished Airing", "Currently Airing", "Not yet aired"
Genres []string `json:"genres"`
URL string `json:"url"` // myanimelist.net URL
}
Anime is one anime entry returned by the Jikan API. Episodes is 0 when the API reports null (ongoing series with unknown count).
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the Jikan API over HTTP.
func (*Client) Search ¶
Search returns anime matching the query string. Pass limit <= 0 to use the API default of 25.
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. Rate is set to 400 ms (~2.5 req/s) to stay under Jikan's 3 req/s limit.
type Domain ¶
type Domain struct{}
Domain is the jikan 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.