Documentation
¶
Overview ¶
Package mangadex is a client for the MangaDex API.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chapter ¶
type Chapter struct {
ID MaybeNumber `json:"id,omitempty"`
Volume MaybeNumber `json:"volume,omitempty"`
Chapter MaybeNumber `json:"chapter,omitempty"`
Title string `json:"title"`
LangCode string `json:"lang_code"`
MangaID MaybeNumber `json:"manga_id,omitempty"`
GroupID int `json:"group_id"`
GroupName string `json:"group_name"`
GroupID2 int `json:"group_id_2"`
GroupName2 string `json:"group_name_2"`
GroupID3 int `json:"group_id_3"`
GroupName3 string `json:"group_name_3"`
Timestamp int64 `json:"timestamp"`
// The following fields are only filled when the chapter is requested
// through the Client.Chapter function.
LangName string `json:"lang_name"`
Hash string `json:"hash"`
Server string `json:"server"`
Pages []string `json:"page_array"`
LongStrip bool `json:"long_strip"`
Status string `json:"status"`
}
Chapter contains information about a chapter. Some fields may be left empty when returned by the Manga function.
Example ¶
package main
import (
"fmt"
"log"
"github.com/bake/mangadex"
)
var md *mangadex.Client
func main() {
c, err := md.Chapter("517244")
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 Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements a way to talk to MangaDex' API.
type Manga ¶
type Manga struct {
ID MaybeNumber `json:"id,omitempty"`
CoverURL string `json:"cover_url"`
Description string `json:"description"`
Title string `json:"title"`
Artist string `json:"artist"`
Author string `json:"author"`
Status int `json:"status"`
Genres []int `json:"genres"`
LastChapter string `json:"last_chapter"`
LangName string `json:"lang_name"`
LangFlag string `json:"lang_flag"`
Hentai int `json:"hentai"`
Links map[string]string `json:"links"`
Chapters map[string]Chapter `json:"chapters"`
}
Manga contains information about a given manga.
Example ¶
package main
import (
"fmt"
"log"
"github.com/bake/mangadex"
)
var md *mangadex.Client
func main() {
m, _, err := md.Manga("23279")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s by %s", m, m.Author)
}
Output: Wonder Cat Kyuu-chan by Nitori Sasami
type MaybeNumber ¶
MaybeNumber unmarshals numbers that may be numeric, numeric strings or empty strings.
func (*MaybeNumber) UnmarshalJSON ¶
func (n *MaybeNumber) UnmarshalJSON(d []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
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.
Click to show internal directories.
Click to hide internal directories.