api

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient added in v0.1.6

type APIClient struct {
	BaseURL string
	Client  *http.Client
	Artist  bool
	// Buffer  chan zipImage
	Limit chan struct{}
}

func NewClient added in v0.1.6

func NewClient(args ...interface{}) (client APIClient)

func (*APIClient) NewDoujin added in v0.1.6

func (a *APIClient) NewDoujin(nnn int) Doujin

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

func (*APIClient) NewSearch added in v0.1.6

func (a *APIClient) NewSearch(query string, page int) Search

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
	Client    *APIClient
}

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

func (*Doujin) Artist added in v0.1.3

func (d *Doujin) Artist() string

func (Doujin) DownloadZip

func (d Doujin) DownloadZip()

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"`
	Client *APIClient
}

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