Documentation
¶
Index ¶
- Constants
- 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 MyAnimeList
- func (p *MyAnimeList) Authenticated() bool
- func (p *MyAnimeList) Info() metadata.ProviderInfo
- func (p *MyAnimeList) Logger() *logger.Logger
- func (p *MyAnimeList) Login(ctx context.Context, token string) error
- func (p *MyAnimeList) Logout() error
- func (p *MyAnimeList) Search(ctx context.Context, query string) ([]metadata.Metadata, error)
- func (p *MyAnimeList) SearchByID(ctx context.Context, id int) (metadata.Metadata, bool, error)
- func (p *MyAnimeList) SetLogger(_logger *logger.Logger)
- func (p *MyAnimeList) SetMangaProgress(ctx context.Context, id, chapterNumber int) error
- func (p *MyAnimeList) String() string
- func (p *MyAnimeList) User() metadata.User
- type Options
- type ReadStatus
- type Status
- type User
Constants ¶
const ( OAuthBaseURL = "https://myanimelist.net/v1/oauth2/" OAuthTokenURL = OAuthBaseURL + "token" OAuthAuthorizeURL = OAuthBaseURL + "authorize" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manga ¶
type Manga struct { IDProvider int `json:"id"` TitleProvider string `json:"title"` MainPicture struct { Large string `json:"large"` Medium string `json:"medium"` } `json:"main_picture"` AlternativeTitles struct { Synonyms []string `json:"synonyms"` En string `json:"en"` Ja string `json:"ja"` } `json:"alternative_titles"` DateStart date `json:"start_date"` DateEnd date `json:"end_date"` Synopsis string `json:"synopsis"` Mean float32 `json:"mean"` Rank int `json:"rank"` Popularity int `json:"popularity"` NSFW string `json:"nsfw" jsonschema:"enum=white,enum=gray,enum=black"` GenreList []struct { ID int `json:"id"` Name string `json:"name"` } `json:"genres"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` MediaType string `` /* 127-byte string literal not displayed */ PublicationStatus Status `json:"status"` NumVolumes int `json:"num_volumes"` NumChapters int `json:"num_chapters"` AuthorList []struct { Node authorListNode `json:"node"` Role string `json:"role"` } `json:"authors"` }
Manga is a metadata.Metadata implementation for MyAnimeList manga metadata.
Note that Manga fields don't match the incoming json fields to avoid collisions with the interface.
func (*Manga) AlternateTitles ¶
AlternateTitles is a list of alternative titles in order of relevance.
func (*Manga) Authors ¶
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 ¶
ExtraIDs is a list of extra available IDs in the metadata provider. Each extra ID must be valid (ID.Validate).
func (*Manga) Score ¶
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 ¶
Translators is the list of translators, in order of relevance.
type MyAnimeList ¶
type MyAnimeList struct {
// contains filtered or unexported fields
}
MyAnimeList is a metadata.Provider implementation for MyAnimeList.
func NewMAL ¶
func NewMAL(options Options) (*MyAnimeList, error)
NewMAL constructs new MyAnimeList client.
func (*MyAnimeList) Authenticated ¶
func (p *MyAnimeList) Authenticated() bool
Authenticated returns true if the Provider is currently authenticated (user logged in).
func (*MyAnimeList) Info ¶
func (p *MyAnimeList) Info() metadata.ProviderInfo
Info information about Provider.
func (*MyAnimeList) Logger ¶
func (p *MyAnimeList) Logger() *logger.Logger
Logger returns the set logger.
Always returns a non-nil logger.
func (*MyAnimeList) Login ¶
func (p *MyAnimeList) Login(ctx context.Context, token string) error
Login authorizes an user with the given access token.
func (*MyAnimeList) Logout ¶
func (p *MyAnimeList) Logout() error
Logout de-authorizes the currently authorized user.
func (*MyAnimeList) Search ¶
Search for metadata with the given query.
Implementation should only handle the request and and marshaling.
func (*MyAnimeList) SearchByID ¶
SearchByID for metadata with the given id. Implementation should only handle the request and and marshaling.
func (*MyAnimeList) SetLogger ¶
func (p *MyAnimeList) SetLogger(_logger *logger.Logger)
SetLogger sets logger to use for this provider.
func (*MyAnimeList) SetMangaProgress ¶
func (p *MyAnimeList) SetMangaProgress(ctx context.Context, id, chapterNumber int) error
SetMangaProgress sets the reading progress for a given manga metadata id.
func (*MyAnimeList) String ¶
func (p *MyAnimeList) String() string
func (*MyAnimeList) User ¶
func (p *MyAnimeList) User() metadata.User
User returns the currently authenticated user.
nil User means non-authenticated.
type Options ¶
type Options struct { // ClientID of the MyAnimeList API client. Required. ClientID string // NSFW if NSFW mangas should be included in the searches. NSFW bool // HTTPClient is a http client used for Anilist API. HTTPClient *http.Client // LogWriter used for logs progress. // // If Logger is nil, a new one will be created. Logger *logger.Logger }
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions constructs default AnilistOptions.
Note: the ClientID still needs to be passed separately.
type ReadStatus ¶ added in v0.20.1
type ReadStatus struct { Status string `json:"status,omitempty" jsonschema:"enum=reading,enum=completed,enum=on_hold,enum=dropped,enum=plan_to_read"` Score int `json:"score,omitempty" jsonschema:"description=0-10"` NumVolumesRead int `json:"num_volumes_read,omitempty" jsonschema:"description=0 or the number of read volumes."` NumChaptersRead int `json:"num_chapters_read,omitempty" jsonschema:"description=0 or the number of read chapters."` IsRereading bool `` /* 209-byte string literal not displayed */ StartDate string `json:"start_date,omitempty"` FinishDate string `json:"finish_date,omitempty"` Priority int `json:"priority,omitempty"` NumTimesReread int `json:"num_times_reread,omitempty"` RereadValue int `json:"reread_value,omitempty"` Tags []string `json:"tags,omitempty"` Comments string `json:"comments,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` }
TODO: change field types from string to date/date-time
ReadStatus represents the MyAnimeList manga list read status.
type User ¶
type User struct { IDProvider int `json:"id"` NameProvider string `json:"name"` Picture string `json:"picture"` Gender string `json:"gender"` Birthday string `json:"birthday"` Location string `json:"location"` JoinedAt string `json:"joined_at"` Timezone string `json:"time_zone" jsonschema:"For example 'America/Los_Angeles'"` IsSupporter bool `json:"is_supporter"` }
TODO: add AnimeStatistics TODO: change field types from string to date/date-time
User is the user model for MyAnimeList.
Note that User fields don't match the incoming json fields to avoid collisions with the interface.
func (*User) Source ¶
Source provider of the user.
For example if coming from Anilist: IDSourceAnilist.