mangarock: github.com/bakerolls/mangarock Index | Files

package mangarock

import "github.com/bakerolls/mangarock"

Index

Package Files

mangarock.go

func WithBase Uses

func WithBase(base string) func(*Client)

WithBase sets the API base.

func WithHTTPClient Uses

func WithHTTPClient(c *http.Client) func(*Client)

WithHTTPClient makes the manga client use a given http.Client to make requests.

type Author Uses

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 Category Uses

type Category struct {
    ID   string `json:"oid"`
    Name string `json:"name"`
}

Category of a manga.

type Chapter Uses

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 Uses

type Client struct {
    // contains filtered or unexported fields
}

Client is a MangaRock Client.

func New Uses

func New(options ...func(*Client)) *Client

New returns a new MangaRock Client.

func (*Client) Author Uses

func (c *Client) Author(id string) (Author, []Manga, error)

Author returns an author and their mangas.

func (*Client) Chapter Uses

func (c *Client) Chapter(id, cid string) (Chapter, error)

Chapter returns a chapter containing its images.

func (*Client) Latest Uses

func (c *Client) Latest(page int) ([]Manga, error)

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 Uses

func (c *Client) Manga(id string) (MangaSingle, error)

Manga returns a single manga. It may contain more fields than a regular one.

func (*Client) Mangas Uses

func (c *Client) Mangas(ids []string) ([]Manga, error)

Mangas returns a slice of mangas.

func (*Client) Search Uses

func (c *Client) Search(query string) ([]Manga, error)

Search for mangas.

type Manga Uses

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 MangaSingle Uses

type MangaSingle 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"`
}

MangaSingle contains a manga with additional fields. This struct is returned by requests for a single manga.

Package mangarock imports 6 packages (graph). Updated 2019-05-03. Refresh now. Tools for package owners.