artwork

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: MIT Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artwork

type Artwork struct {
	ID          string
	Title       string
	Type        string
	Description string
	Image       image.URLs
	Created     time.Time
	Tags        []string
	Author      user.User

	Width  int64
	Height int64

	PageCount     int64
	CommentCount  int64
	LikeCount     int64
	ViewCount     int64
	BookmarkCount int64

	Pages []Page
	// contains filtered or unexported fields
}

Artwork data

func (*Artwork) Fetch

func (i *Artwork) Fetch() (err error)

Fetch additional data from pixiv single artwork api, only fetch once for same struct.

func (*Artwork) FetchPages

func (i *Artwork) FetchPages() (err error)

FetchPages get all pages for artwork from pixiv artwork pages api, only fetch once for same struct.

func (*Artwork) FetchPagesWithClient

func (i *Artwork) FetchPagesWithClient(c client.Client) (err error)

FetchPagesWithClient do request with given client.

func (*Artwork) FetchWithClient

func (i *Artwork) FetchWithClient(c client.Client) (err error)

FetchWithClient do fetch with given client.

func (Artwork) URL added in v0.3.0

func (i Artwork) URL() *url.URL

URL to view artwork web page.

func (Artwork) URLWithClient added in v0.3.0

func (i Artwork) URLWithClient(c client.Client) *url.URL

URLWithClient to view artwork web page.

type Page

type Page struct {
	Image  image.URLs
	Width  int64
	Height int64
}

Page is a artwork page.

type Rank

type Rank struct {
	/* required, possible rank modes:
		- daily (default)
	    - weekly
	    - monthly
	    - rookie
	    - original
	    - male
	    - female
	    - daily_r18
	    - weekly_r18
	    - male_r18
	    - female_r18
	    - r18g
	*/
	Mode string
	/* optional, possible rank content:
	    - all (default)
	    - illust
		- ugoira
		- manga
	*/
	Content string
	Date    time.Time
	Page    int
	Items   []RankItem
}

Rank contains data for one rank page.

func (*Rank) Fetch

func (rank *Rank) Fetch() (err error)

Fetch rank

func (*Rank) FetchWithClient

func (rank *Rank) FetchWithClient(c client.Client) (err error)

FetchWithClient do request with given client

func (Rank) URL added in v0.3.1

func (rank Rank) URL() *url.URL

URL to rank page.

func (Rank) URLWithClient added in v0.3.1

func (rank Rank) URLWithClient(c client.Client, q *url.Values) *url.URL

URLWithClient to rank page.

type RankItem

type RankItem struct {
	Artwork
	Rank         int
	PreviousRank int
	JSON         gjson.Result
}

RankItem contains artwork and rank info.

type SearchResult

type SearchResult struct {
	JSON gjson.Result
}

SearchResult holds search data and provide useful methods.

func Search(query string, page int) (result SearchResult, err error)

Search calls pixiv artwork search api.

func SearchWithClient

func SearchWithClient(c client.Client, query string, page int) (result SearchResult, err error)

SearchWithClient do search with given client.

func (SearchResult) Artworks

func (r SearchResult) Artworks() []Artwork

Artworks appeared in search result.

func (SearchResult) ForEach

func (r SearchResult) ForEach(iterator func(key gjson.Result, value gjson.Result) bool)

ForEach iterates through values. skips advertisement container item.

Jump to

Keyboard shortcuts

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