Documentation ¶
Index ¶
- Constants
- type Anilist
- func (p *Anilist) Authenticated() bool
- func (p *Anilist) Info() metadata.ProviderInfo
- func (p *Anilist) Logger() *logger.Logger
- func (p *Anilist) Login(ctx context.Context, token string) error
- func (p *Anilist) Logout() error
- func (p *Anilist) Search(ctx context.Context, query string) ([]metadata.Metadata, error)
- func (p *Anilist) SearchByID(ctx context.Context, id int) (metadata.Metadata, bool, error)
- func (p *Anilist) SetLogger(_logger *logger.Logger)
- func (p *Anilist) SetMangaProgress(ctx context.Context, id, chapterNumber int) error
- func (p *Anilist) String() string
- func (p *Anilist) User() metadata.User
- type Error
- type Manga
- func (m *Manga) AlternateTitles() []string
- func (m *Manga) Artists() []string
- func (m *Manga) Authors() []string
- func (m *Manga) Banner() string
- func (m *Manga) Chapters() int
- func (m *Manga) Characters() []string
- func (m *Manga) Country() string
- func (m *Manga) Cover() string
- func (m *Manga) Description() string
- func (m *Manga) EndDate() metadata.Date
- func (m *Manga) ExtraIDs() []metadata.ID
- func (m *Manga) Format() string
- func (m *Manga) Genres() []string
- func (m *Manga) ID() metadata.ID
- func (m *Manga) Letterers() []string
- func (m *Manga) Notes() string
- func (m *Manga) Publisher() string
- func (m *Manga) Score() float32
- func (m *Manga) StartDate() metadata.Date
- func (m *Manga) Status() metadata.Status
- func (m *Manga) String() string
- func (m *Manga) Tags() []string
- func (m *Manga) Title() string
- func (m *Manga) Translators() []string
- func (m *Manga) URL() string
- type Options
- type User
Constants ¶
const ( OAuthBaseURL = "https://anilist.co/api/v2/oauth/" OAuthPinURL = OAuthBaseURL + "pin" OAuthTokenURL = OAuthBaseURL + "token" OAuthAuthorizeURL = OAuthBaseURL + "authorize" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anilist ¶
type Anilist struct {
// contains filtered or unexported fields
}
Anilist is the Anilist client.
func NewAnilist ¶
NewAnilist constructs new Anilist client.
func (*Anilist) Authenticated ¶ added in v0.19.0
Authenticated returns true if the Provider is currently authenticated (user logged in).
func (*Anilist) Info ¶ added in v0.20.0
func (p *Anilist) Info() metadata.ProviderInfo
Info information about Provider.
func (*Anilist) Logger ¶ added in v0.20.0
Logger returns the set logger.
Always returns a non-nil logger.
func (*Anilist) Search ¶ added in v0.20.0
Search for metadata with the given query.
Implementation should only handle the request and and marshaling.
func (*Anilist) SearchByID ¶
SearchByID for metadata with the given id.
Implementation should only handle the request and and marshaling.
func (*Anilist) SetMangaProgress ¶
SetMangaProgress sets the reading progress for a given manga metadata id.
type Manga ¶
type Manga struct { TitleGroup struct { English string `json:"english" jsonschema:"description=English title of the manga."` Romaji string `json:"romaji" jsonschema:"description=Romanized title of the manga."` Native string `json:"native" jsonschema:"description=Native title of the manga. Usually in kanji."` } `json:"title"` AverageScore int `json:"averageScore" jsonschema:"description=Average score of the manga on Anilist."` Summary string `json:"description" jsonschema:"description=Description of the manga in html format."` CoverImage struct { ExtraLarge string `` /* 137-byte string literal not displayed */ Large string `json:"large" jsonschema:"description=URL of the large cover image."` Medium string `json:"medium" jsonschema:"description=URL of the medium cover image."` Color string `json:"color" jsonschema:"description=Average color of the cover image."` } `json:"coverImage" jsonschema:"description=Cover image of the manga."` BannerImage string `json:"bannerImage" jsonschema:"description=Banner image of the manga."` TagList []struct { Name string `json:"name" jsonschema:"description=Name of the tag."` Description string `json:"description" jsonschema:"description=Description of the tag."` Rank int `json:"rank" jsonschema:"description=Rank of the tag. How relevant it is to the manga from 1 to 100."` } `json:"tags"` GenreList []string `json:"genres" jsonschema:"description=Genres of the manga."` CharacterList struct { Nodes []struct { Name struct { Full string `json:"full" jsonschema:"description=Full name of the character."` Native string `json:"native" jsonschema:"description=Native name of the character. Usually in kanji."` } `json:"name"` } `json:"nodes"` } `json:"characters"` Staff struct { Edges []struct { Role string `json:"role" jsonschema:"description=Role of the staff member."` Node struct { Name struct { Full string `json:"full" jsonschema:"description=Full name of the staff member."` } `json:"name"` } `json:"node"` } `json:"edges"` } `json:"staff"` DateStart metadata.Date `json:"startDate" jsonschema:"description=Date the manga started publishing."` DateEnd metadata.Date `json:"endDate" jsonschema:"description=Date the manga ended publishing."` Synonyms []string `json:"synonyms" jsonschema:"description=Synonyms of the manga (Alternative titles)."` PublicationStatus metadata.Status `json:"status" jsonschema:"enum=FINISHED,enum=RELEASING,enum=NOT_YET_RELEASED,enum=CANCELLED,enum=HIATUS"` ChapterCount int `json:"chapters" jsonschema:"description=Amount of chapters the manga has when complete."` SiteURL string `json:"siteUrl" jsonschema:"description=URL of the manga on AnilistSearch."` CountryOfOrigin string `json:"countryOfOrigin" jsonschema:"description=Country of origin of the manga. ISO 3166-1 alpha-2 country code."` IDProvider int `json:"id" jsonschema:"description=ID of the manga on AnilistSearch."` IDMal int `json:"idMal" jsonschema:"description=ID of the manga on MyAnimeList."` External []struct { URL string `json:"url" jsonschema:"description=URL of the external link."` } `json:"externalLinks" jsonschema:"description=External links related to the manga."` }
Manga is a metadata.Metadata implementation for Anilist manga metadata.
Note that Manga fields don't match the incoming json fields to avoid collisions with the interface.
func (*Manga) AlternateTitles ¶ added in v0.17.0
AlternateTitles is a list of alternative titles in order of relevance.
func (*Manga) Authors ¶ added in v0.17.0
Authors (or Writers) is the list of authors, in order of relevance. Must contain at least one artist.
func (*Manga) Characters ¶
Characters is the list of characters, in order of relevance.
func (*Manga) Description ¶
Description is the description/summary for the manga.
func (*Manga) ExtraIDs ¶ added in v0.17.0
ExtraIDs is a list of extra available IDs in the metadata provider. Each extra ID must be valid (ID.Validate).
func (*Manga) Format ¶ added in v0.17.0
Format the original publication.
For example: TBP, HC, Web, Digital, etc..
func (*Manga) Letterers ¶ added in v0.17.0
Letterers is the list of letterers, in order of relevance.
func (*Manga) Score ¶ added in v0.17.0
Score is the community score for the manga.
Accepted values are between 0.0 and 5.0.
func (*Manga) Status ¶
Current status of the manga. Must be non-empty.
One of: FINISHED, RELEASING, NOT_YET_RELEASED, CANCELLED, HIATUS
func (*Manga) String ¶
String is the short representation of the manga. Must be non-empty.
At the minimum it should return "`Title` (`Year`)", else "`Title` (`Year`) [`IDCode`id-`ID`]" if available.
func (*Manga) Title ¶
Title is the English title of the manga. Must be non-empty.
If English is not available, then in in order of availability: Romaji (the romanized title) or Native (usually Kanji).
func (*Manga) Translators ¶ added in v0.17.0
Translators is the list of translators, in order of relevance.
type Options ¶
type Options struct { // HTTPClient is a http client used for Anilist API. HTTPClient *http.Client // LogWriter used for logs progress. Logger *logger.Logger }
Options is options for Anilist client.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions constructs default AnilistOptions.
type User ¶ added in v0.19.0
type User struct { IDProvider int `json:"id" jsonschema:"description=The ID of the user."` NameProvider string `json:"name" jsonschema:"description=The name of the user."` AboutProvider string `json:"about" jsonschema:"description=The bio written by user (Markdown)."` AvatarProvider struct { Large string `json:"large" jsonschema:"description=The avatar of user at its largest size."` Medium string `json:"medium" jsonschema:"description=The avatar of user at medium size."` } `json:"avatar" jsonschema:"description=The user's avatar images."` BannerImage string `json:"bannerImage" jsonschema:"description=The user's banner images."` Options struct { TitleLanguage string `` /* 134-byte string literal not displayed */ DisplayAdultContent bool `json:"displayAdultContent" jsonschema:"description=Whether the user has enabled viewing of 18+ content."` ProfileColor string `json:"profileColor" jsonschema:"description=Profile highlight color (blue, purple, pink, orange, red, green, gray)."` Timezone string `json:"timezone" jsonschema:"description=The user's timezone offset (Auth user only)."` } `json:"options" jsonschema:"The user's general options."` SiteURL string `json:"siteUrl" jsonschema:"description=The URL for the user page on the AniList website."` CreatedAt int `` /* 129-byte string literal not displayed */ UpdatedAt int `json:"updatedAt" jsonschema:"description=When the user's data was last updated."` PreviousNames []struct { Name string `json:"name" jsonschema:"description=The name of the user."` CreatedAt int `json:"createdAt" jsonschema:"description=When the user first changed from this name."` UpdatedAt int `json:"updatedAt" jsonschema:"description=When the user most recently changed from this name."` } `json:"previous_names" jsonschema:"description=The user's previously used names."` }
User is the user model for Anilist.
Note that User fields don't match the incoming json fields to avoid collisions with the interface.
func (*User) Source ¶ added in v0.20.0
Source provider of the user.
For example if coming from Anilist: IDSourceAnilist.