Documentation
¶
Index ¶
- Constants
- func ConvertMRItoPNG(path string) error
- func Decode(r io.Reader) (image.Image, error)
- func DecodeConfig(r io.Reader) (image.Config, error)
- func DecodeRaw(r io.Reader) (io.Reader, int, error)
- func NormalizeOneDigitNumber(order int) string
- func SaveChapter(chapter *Chapter, path string) error
- func WithOptions(options map[string]string) func(*Client)
- type Author
- type Category
- type Chapter
- type Client
- func (c *Client) Author(id string) (Author, []Manga, error)
- func (c *Client) Chapter(id, cid string) (Chapter, error)
- func (c *Client) Latest(page int) ([]Manga, error)
- func (c *Client) Manga(id string) (SingleManga, error)
- func (c *Client) Mangas(ids []string) ([]Manga, error)
- func (c *Client) Search(query string) ([]string, error)
- type Manga
- type Response
- type SingleManga
Constants ¶
const ( // APIURL is the mangarock api url APIURL = "https://api.mangarockhd.com/query/web401" // APIMETAURL is mangarock's meta url APIMETAURL = "https://api.mangarockhd.com/meta" )
Variables ¶
This section is empty.
Functions ¶
func ConvertMRItoPNG ¶
ConvertMRItoPNG converts .mri files to .png files
func DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a MRI. To recreate the original header it has to read the whole stream.
func DecodeRaw ¶
DecodeRaw reads a MRI image from r, returns its original format (WEBP) as an io.Reader and its size in bytes. Can be used if there is no need for an image.Image.
func NormalizeOneDigitNumber ¶
NormalizeOneDigitNumber inserts '0' in front of one digit numbers [0-9].
func SaveChapter ¶
SaveChapter saves given chapter slice
func WithOptions ¶
WithOptions allow creating client with additional options. IE: country
Types ¶
type Author ¶
type Author struct { ID string `json:"oid"` Name string `json:"name"` Thumbnail string `json:"thumbnail"` // Only available if requested through a manga Role string `json:"role"` }
Author of a manga.
type Chapter ¶
type Chapter struct { ID string `json:"oid"` Name string `json:"name"` // Fields only available if requested as a single object Order int `json:"order"` // Fields available if requested as chapter Pages []string `json:"pages"` }
Chapter of a manga.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the mangarock client
func (*Client) Latest ¶
Latest returns the latest mangas. It only uses the manga IDs and requests a list like the one that would be returned by a search. Fields like recently added chapters are missing, but authors are added.
func (*Client) Manga ¶
func (c *Client) Manga(id string) (SingleManga, error)
Manga returns a single manga. It may contain more fields than a regular one.
type Manga ¶
type Manga struct { ID string `json:"oid"` Name string `json:"name"` Author Author `json:"-"` Authors []Author `json:"authors"` AuthorIDs []string `json:"author_ids"` Genres []string `json:"genres"` Rank int `json:"rank"` UpdatedChapters int `json:"updated_chapters"` NewChapters []Chapter `json:"new_chapters"` Completed bool `json:"cmpleted"` Thumbnail string `json:"thumbnail"` Updated time.Time `json:"updated_at"` }
Manga contains a manga. This struct is returned by endpoints listing mangas.
type Response ¶
type Response struct { Code int `json:"code"` Data json.RawMessage `json:"data"` }
Response is the response of the mangarock web api
type SingleManga ¶
type SingleManga struct { Manga Description string `json:"description"` Chapters []Chapter `json:"chapters"` Categories []Category `json:"rich_categories"` Cover string `json:"cover"` Artworks []string `json:"artworks"` Aliases []string `json:"alias"` }
SingleManga contains a manga with additional fields. This struct is returned by requests for a single manga.