server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	GetDoujinshi(bookID int) (gnhentai.Doujinshi, error)
	SetDoujinshi(bookID int, d gnhentai.Doujinshi) error

	GetPage(bookID, n int) (io.ReadCloser, error)
	SetPage(bookID int, image io.ReadCloser) error

	GetCover(bookID int) (io.ReadCloser, error)
	SetCover(bookID int, image io.ReadCloser) error

	GetThumbnail(bookID int) (io.ReadCloser, error)
	SetThumbnail(bookID int, image io.ReadCloser) error

	Search(q string) ([]gnhentai.Doujinshi, error)
	SetSearch(q string, result []gnhentai.Doujinshi) error

	SearchByTag(tag gnhentai.Tag) ([]gnhentai.Doujinshi, error)
	SetSearchByTag(tag gnhentai.Tag, result []gnhentai.Doujinshi) error

	Related(bookID int) ([]gnhentai.Doujinshi, error)
	SetRelated(bookID int, result []gnhentai.Doujinshi) error
}

type Option

type Option func(c *Server)

func WithCache

func WithCache(cache Cache) Option

func WithLogger

func WithLogger(logger zerolog.Logger) Option

type Server

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

func NewServer

func NewServer(client gnhentai.Client, downloader gnhentai.Downloader, options ...Option) *Server

func (Server) GetBookByID

func (s Server) GetBookByID(w http.ResponseWriter, req *http.Request)

func (Server) GetCoverByID

func (s Server) GetCoverByID(w http.ResponseWriter, req *http.Request)

func (Server) GetPageByID

func (s Server) GetPageByID(w http.ResponseWriter, req *http.Request)

func (Server) GetThumbnailByID

func (s Server) GetThumbnailByID(w http.ResponseWriter, req *http.Request)

func (Server) Register

func (s Server) Register(r chi.Router)

func (Server) Related

func (s Server) Related(w http.ResponseWriter, req *http.Request)

func (Server) Search

func (s Server) Search(w http.ResponseWriter, req *http.Request)

func (Server) SearchByTag

func (s Server) SearchByTag(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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