api

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Doujin

type Doujin struct {
	ID       json.Number `json:"id"`
	MediaID  string      `json:"media_id"`
	NumPages int         `json:"num_pages"`
	Images   struct {
		Cover     image   `json:"cover"`
		Thumbnail image   `json:"thumbnail"`
		Pages     []image `json:"pages"`
	} `json:"images"`
	Titles struct {
		English  string `json:"english"`
		Japanese string `json:"japanese"`
		Pretty   string `json:"pretty"`
	} `json:"title"`
	Tags []struct {
		ID   json.Number `json:"id"`
		Type string      `json:"type"`
		Name string      `json:"name"`
	} `json:"tags"`
	APIImages []Image
}

Doujin a quick struct for unpacking the response from the nhentai API. Used for responses from nhentai.net/api/galleries/:magicNumber

func NewDoujin

func NewDoujin(nnn int) Doujin

NewDoujin is used to generate a doujin instance with Image instances attached at APIImages

func (*Doujin) Artist added in v0.1.3

func (d *Doujin) Artist() string

func (Doujin) DownloadZip

func (d Doujin) DownloadZip(limitRAW int, pretty bool, artist bool)

DownloadZip is used to pull the Doujin to disk as {doujin.Title.English}.cbz

type Image

type Image struct {
	MediaID  string
	Index    int
	Type     imageType
	Filename string
	URL      string
}

Image is a quick build for generating a URL and filename from the nhentai api resonse.

type Search struct {
	Result []Doujin `json:"result"`
	Pages  int      `json:"num_pages"`
}

func NewSearch

func NewSearch(query string, page int) Search

func (Search) RenderTable

func (s Search) RenderTable(pretty bool, page int)

func (Search) ReturnDoujin

func (s Search) ReturnDoujin(index int) Doujin

Jump to

Keyboard shortcuts

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