Documentation ¶
Overview ¶
Package mangadex is a client for the MangaDex API.
Index ¶
- type Chapter
- type ChapterOptions
- type Client
- func (c *Client) Chapter(ctx context.Context, id int, opts *ChapterOptions) (Chapter, error)
- func (c *Client) Follows(ctx context.Context, opts *FollowsOptions) ([]Follow, error)
- func (c *Client) Group(ctx context.Context, id int, opts *GroupOptions) (Group, error)
- func (c *Client) GroupChapters(ctx context.Context, id int, opts *GroupChaptersOptions) ([]PreviewChapter, error)
- func (c *Client) Manga(ctx context.Context, id int, opts *MangaOptions) (Manga, error)
- func (c *Client) MangaChapters(ctx context.Context, id int, opts *MangaChaptersOptions) ([]PreviewChapter, error)
- func (c *Client) MangaCovers(ctx context.Context, id int, opts *MangaCoversOptions) ([]Cover, error)
- func (c *Client) Relations(ctx context.Context, opts *RelationsOptions) ([]Relation, error)
- func (c *Client) Tag(ctx context.Context, id int, opts *TagOptions) (Tag, error)
- func (c *Client) Tags(ctx context.Context, opts *TagsOptions) ([]Tag, error)
- func (c *Client) User(ctx context.Context, id int, opts *UserOptions) (User, error)
- func (c *Client) UserChapters(ctx context.Context, id int, opts *UserChaptersOptions) ([]PreviewChapter, error)
- type Cover
- type Follow
- type FollowsOptions
- type Group
- type GroupChaptersOptions
- type GroupOptions
- type Manga
- type MangaChaptersOptions
- type MangaCoversOptions
- type MangaOptions
- type Member
- type OptionFunc
- type PreviewChapter
- type PreviewGroup
- type Relation
- type RelationsOptions
- type Tag
- type TagOptions
- type TagsOptions
- type Timestamp
- type User
- type UserChaptersOptions
- type UserOptions
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chapter ¶
type Chapter struct { PreviewChapter Status string `json:"status"` Pages []string `json:"pages"` Server string `json:"server"` ServerFallback string `json:"serverFallback"` }
Chapter contains a chapter.
Example ¶
ctx := context.TODO() opts := mangadex.ChapterOptions{ Saver: true, // Use low quality images. } c, err := md.Chapter(ctx, 517244, &opts) if err != nil { log.Fatal(err) } fmt.Printf("%s (Volume %s, Chapter %s)", c, c.Volume, c.Chapter)
Output: Cool Day (Volume 3, Chapter 253)
type ChapterOptions ¶
type ChapterOptions struct { Server string `url:"server,omitempty"` // Override location-based server assignment. Possible values: na, na2. Saver bool `url:"saver,omitempty"` // Use low quality images (data saver). MarkRead bool `url:"mark_read,omitempty"` // Mark the chapter as read. }
ChapterOptions contains options that can be passed to the endpoint.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements a way to talk to MangaDex' API.
func (*Client) GroupChapters ¶
func (c *Client) GroupChapters(ctx context.Context, id int, opts *GroupChaptersOptions) ([]PreviewChapter, error)
GroupChapters returns partial information about the chapters belonging to the group.
func (*Client) MangaChapters ¶
func (c *Client) MangaChapters(ctx context.Context, id int, opts *MangaChaptersOptions) ([]PreviewChapter, error)
MangaChapters returns partial information about the chapters belonging to a manga.
func (*Client) MangaCovers ¶
func (c *Client) MangaCovers(ctx context.Context, id int, opts *MangaCoversOptions) ([]Cover, error)
MangaCovers returns a list of covers belonging to a manga.
func (*Client) UserChapters ¶
func (c *Client) UserChapters(ctx context.Context, id int, opts *UserChaptersOptions) ([]PreviewChapter, error)
UserChapters partial information about the chapters uploaded by the user.
type FollowsOptions ¶
type FollowsOptions struct{}
FollowsOptions contains options that can be passed to the endpoint.
type Group ¶
type Group struct { PreviewGroup AltNames string `json:"altNames"` Language string `json:"language"` Leader Member `json:"leader"` Members []Member `json:"members"` Description string `json:"description"` Website string `json:"website"` Discord string `json:"discord"` IRCServer string `json:"ircServer"` IRCChannel string `json:"ircChannel"` Email string `json:"email"` Founded string `json:"founded"` Likes int `json:"likes"` Follows int `json:"follows"` Views int `json:"views"` Chapters int `json:"chapters"` ThreadID int `json:"threadId"` ThreadPosts int `json:"threadPosts"` IsLocked bool `json:"isLocked"` IsInactive bool `json:"isInactive"` Delay int `json:"delay"` LastUpdated Timestamp `json:"lastUpdated"` Banner string `json:"banner"` }
Group contains information about a given group.
type GroupChaptersOptions ¶
GroupChaptersOptions contains options that can be passed to the endpoint.
type GroupOptions ¶
type GroupOptions struct{}
GroupOptions contains options that can be passed to the endpoint.
type Manga ¶
type Manga struct { ID int `json:"id"` Title string `json:"title"` AltTitles []string `json:"altTitles"` Description string `json:"description"` Artist []string `json:"artist"` Author []string `json:"author"` Publication struct { Language string `json:"language"` Status int `json:"status"` Demographic int `json:"demographic"` } `json:"publication"` Tags []int `json:"tags"` LastChapter string `json:"lastChapter"` LastVolume string `json:"lastVolume"` IsHentai bool `json:"isHentai"` Links map[string]string `json:"links"` Relations []struct { ID int `json:"id"` Title string `json:"title"` Type int `json:"type"` IsHentai bool `json:"isHentai"` } `json:"relations"` Rating struct { Bayesian float64 `json:"bayesian"` Mean float64 `json:"mean"` Users int `json:"users"` } `json:"rating"` Views int `json:"views"` Follows int `json:"follows"` Comments int `json:"comments"` LastUploaded Timestamp `json:"lastUploaded"` MainCover string `json:"mainCover"` }
Manga contains information about a given manga.
Example ¶
ctx := context.TODO() m, err := md.Manga(ctx, 23279, nil) if err != nil { log.Fatal(err) } fmt.Printf("%s by %s", m, m.Author[0])
Output: Wonder Cat Kyuu-chan by Nitori Sasami
type MangaChaptersOptions ¶
MangaChaptersOptions contains options that can be passed to the endpoint.
type MangaCoversOptions ¶
type MangaCoversOptions struct{}
MangaCoversOptions contains options that can be passed to the endpoint.
type MangaOptions ¶
type MangaOptions struct{}
MangaOptions contains options that can be passed to the endpoint.
type OptionFunc ¶
type OptionFunc func(*Client)
An OptionFunc can be used to modify the Tapas client.
func WithHTTPClient ¶
func WithHTTPClient(c *http.Client) OptionFunc
WithHTTPClient makes the manga client use a given http.Client to make requests.
func WithPath ¶
func WithPath(path string) OptionFunc
WithPath replaces the default path. Might be used on a new API version.
type PreviewChapter ¶
type PreviewChapter struct { ID int `json:"id"` Hash string `json:"hash"` MangaID int `json:"mangaId"` MangaTitle string `json:"mangaTitle"` Volume string `json:"volume"` Chapter string `json:"chapter"` Title string `json:"title"` Language string `json:"language"` Groups []PreviewGroup `json:"groups"` Uploader int `json:"uploader"` Timestamp Timestamp `json:"timestamp"` Comments int `json:"comments"` Views int `json:"views"` }
PreviewChapter contains a chapter without images.
func (PreviewChapter) String ¶
func (c PreviewChapter) String() string
type PreviewGroup ¶
PreviewGroup contains limited information about a group.
func (PreviewGroup) String ¶
func (g PreviewGroup) String() string
func (*PreviewGroup) UnmarshalJSON ¶
func (g *PreviewGroup) UnmarshalJSON(d []byte) error
UnmarshalJSON implements the json.Unmarshaler interface allowing for interpreting []int as []Group while ignoring names. This is necessary since groups in /manga/{id}/chapters only contain IDs.
type RelationsOptions ¶
type RelationsOptions struct{}
RelationsOptions contains options that can be passed to the endpoint.
type Tag ¶
type Tag struct { ID int `json:"id"` Name string `json:"name"` Group string `json:"group"` Description string `json:"description"` }
Tag contains information about a tag.
type TagOptions ¶
type TagOptions struct{}
TagOptions contains options that can be passed to the endpoint.
type TagsOptions ¶
type TagsOptions struct{}
TagsOptions contains options that can be passed to the endpoint.
type Timestamp ¶
Timestamp contains a time.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON interprets int64 as a Unix timestamp and unmarshals it into time.Time.
type User ¶
type User struct { ID int `json:"id"` Username string `json:"username"` LevelID int `json:"levelId"` Joined Timestamp `json:"joined"` LastSeen Timestamp `json:"lastSeen"` Website string `json:"website"` Biography string `json:"biography"` Views int `json:"views"` Uploads int `json:"uploads"` Premium bool `json:"premium"` MdAtHome int `json:"mdAtHome"` Avatar string `json:"avatar"` }
User contains information about a given user.
type UserChaptersOptions ¶
UserChaptersOptions contains options that can be passed to the endpoint.
type UserOptions ¶
type UserOptions struct{}
UserOptions contains options that can be passed to the endpoint.