mangarock

package module
v0.0.0-...-26a2f80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 3 Imported by: 0

README

Mangarock Go API Wrapper

Build Status Coverage Status GoDoc Go Report Card

NOTICE

As announced https://mangarock.com/ will be shutdown, this library will no longer work!

Getting started

Installing
go get github.com/Girbons/mangarock
Example
package main

import (
	"fmt"

	"github.com/Girbons/mangarock"
)

func main() {
    // there are 2 ways to initialize a client
    // the first one is using `NewClient`
    client := mangarock.NewClient()

    //the other one is using `NewClientWithOptions`
    options := make(map[string]string{"country":"your country"})
    client := mangarock.NewClientWithOptions(options)

    info, err := client.Info("mrs-serie-35593")
    // SetOptions is still available
    // client.SetOptions(options)
    if err != nil {
        // do something
    }

    fmt.Println(info.Data.Author)
}
Available Methods
  • Info("mrs-series-id")
  • Pages("mrs-chapter-id")

Contribuiting

Feel free to submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

Index

Constants

View Source
const APIEndpoint = "https://api.mangarockhd.com/query/web401/"

APIEndpoint is the mangarock api endpoint :)

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name      string `json:"name"`
	OID       string `json:"oid"`
	Role      string `json:"role"`
	Thumbnail string `json:"thumbnail"`
}

Author contains the info related to a manga author

type Chapter

type Chapter struct {
	CID       int    `json:"cid"`
	Name      string `json:"name"`
	OID       string `json:"oid"`
	Order     int    `json:"order"`
	UpdatedAt int    `json:"updated_at"`
}

Chapter contains the information related to a Manga chapter

type Character

type Character struct {
	Name      string `json:"name"`
	OID       string `json:"oid"`
	Thumbnail string `json:"thumbnail"`
}

Character contains the information related to a Manga character

type Client

type Client struct {
	Client  *http.Client
	Options map[string]string
}

Client contains only the `client` by now Maybe in future it can contains an ApiKey

func NewClient

func NewClient() *Client

NewClient returns a Client instance

func NewClientWithOptions

func NewClientWithOptions(options map[string]string) *Client

NewClientWithOptions returns a Client instance with the given options

func (*Client) Get

func (c *Client) Get(endpoint string) (*http.Response, error)

Get is Client Get method

func (*Client) Info

func (c *Client) Info(comicName string) (*MangaRockInfo, error)

Info returns the info related to a manga

func (*Client) Pages

func (c *Client) Pages(comicName string) (*MangaRockPages, error)

Pages returns the pages related to a manga

func (*Client) SetOptions

func (c *Client) SetOptions(options map[string]string)

Set Additional options to the client instance

type Manga

type Manga struct {
	Author         string            `json:"author"`
	Name           string            `json:"name"`
	Description    string            `json:"description"`
	Thumbnail      string            `json:"thumbnail"`
	Cover          string            `json:"cover"`
	OID            string            `json:"oid"`
	MsID           int               `json:"msid"`
	Authors        []*Author         `json:"authors"`
	Alias          []string          `json:"alias"`
	Artworks       []string          `json:"artworks"`
	Characters     []*Character      `json:"characters"`
	Chapters       []*Chapter        `json:"chapters"`
	Categories     []int             `json:"categories"`
	Completed      bool              `json:"completed"`
	RichCategories []*RichCategory   `json:"rich_categories"`
	MrsSeries      int               `json:"mrs_series"`
	Extra          map[string]string `json:"extra"`
	LastUpdate     int               `json:"last_update"`
	Direction      int               `json:"direction"`
	Rank           int               `json:"rank"`
	Mid            int               `json:"mid"`
	TotalChapters  int               `json:"total_chapters"`
	Removed        bool              `json:"removed"`
}

Manga Struct contains all the informations returned by mangarock about a manga

type MangaRockInfo

type MangaRockInfo struct {
	Code int   `json:"code"`
	Data Manga `json:"data"`
}

MangaRockInfo is used to parse a response from the `info` endpoint Contains the information related to a Manga

type MangaRockPages

type MangaRockPages struct {
	Code int      `json:"code"`
	Data []string `json:"data"`
}

MangaRockPages is used to parse a response from `pages` endpoint Contains the link to the images related to a manga

type RichCategory

type RichCategory struct {
	Name string `json:"name"`
	OID  string `json:"oid"`
}

RichCategory contains the info related to a manga category

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL