Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Categories ¶
type Categories uint32
Categories specifies the enabled wallpaper categories of a search query.
const ( CatGeneral Categories = 1 << iota CatAnime CatPeople )
Wallpaper categories.
func (Categories) Key ¶
func (v Categories) Key() string
Key returns the key of the search parameter.
func (*Categories) Set ¶
func (v *Categories) Set(s string) error
Set implements the flag.Value interface. A comma-separated list of the following options is valid:
- general
- anime
- people
func (Categories) String ¶
func (v Categories) String() string
String returns a string representation of the search option.
func (Categories) Value ¶
func (v Categories) Value() string
Value returns the value of the search parameter.
type ID ¶
type ID int
ID represents the wallpaper ID of a specific wallpaper on wallhaven.cc.
func (ID) Details ¶
func (id ID) Details() (details *ImageDetail, err error)
type ImageDetail ¶
type ImageDetail struct { ImageID ID URL string UploadedOn string `json:,omitempty` Category string Purity string Views int Favorites int Link string Uploader Uploader Tags []Tag Colors []Color }
func (*ImageDetail) Download ¶
func (detail *ImageDetail) Download(dir string) (p string, err error)
func (*ImageDetail) GetImageBuffer ¶
func (detail *ImageDetail) GetImageBuffer() (io.ReadCloser, error)
func (*ImageDetail) ReadAll ¶
func (detail *ImageDetail) ReadAll() (buf []byte, err error)
type Option ¶
type Option interface { // Key returns the key of the search parameter. Key() string // Value returns the value of the search parameter. Value() string }
An Option represents a search option.
type Order ¶
type Order int
Order specifies the sorting order used in search queries.
func (*Order) Set ¶
Set implements the flag.Value interface. A comma-separated list of the following options is valid:
- asc
- desc
type Page ¶
type Page int
Page specifies the result page number.
type Purity ¶
type Purity uint32
Purity specifies the enabled purity modes of a search query.
func (*Purity) Set ¶
Set implements the flag.Value interface. A comma-separated list of the following options is valid:
- SFW
- sketchy
- NSFW
type Ratios ¶
type Ratios uint32
Ratio specifies the enabled aspect ratios of a search query.
const ( Ratio4x3 Ratios = 1 << iota Ratio5x4 Ratio16x9 Ratio16x10 Ratio21x9 Ratio32x9 Ratio48x9 Ratio9x16 Ratio10x16 )
Aspect ratios.
func (*Ratios) Set ¶
Set implements the flag.Value interface. A comma-separated list of the following options is valid:
- 4x3
- 5x4
- 16x9
- 16x10
- 21x9
- 32x9
- 48x9
type Resolutions ¶
type Resolutions uint32
Resolutions specifies the enabled screen resolution of a search query.
const ( Res1024x768 Resolutions = 1 << iota Res1280x800 Res1366x768 Res1280x960 Res1440x900 Res1600x900 Res1280x1024 Res1600x1200 Res1680x1050 Res1920x1080 Res1920x1200 Res2560x1440 Res2560x1600 Res3840x1080 Res5760x1080 Res3840x2160 )
Screen resolutions.
func (Resolutions) Key ¶
func (v Resolutions) Key() string
Key returns the key of the search parameter.
func (*Resolutions) Set ¶
func (v *Resolutions) Set(s string) error
Set implements the flag.Value interface. A comma-separated list of the following options is valid:
- 1024x768
- 1280x800
- 1366x768
- 1280x960
- 1440x900
- 1600x900
- 1280x1024
- 1600x1200
- 1680x1050
- 1920x1080
- 1920x1200
- 2560x1440
- 2560x1600
- 3840x1080
- 5760x1080
- 3840x2160
func (Resolutions) String ¶
func (v Resolutions) String() string
String returns a string representation of the search option.
func (Resolutions) Value ¶
func (v Resolutions) Value() string
Value returns the value of the search parameter.
type SearchInfo ¶
type SearchInfo struct { CurrentPage int TotalPages int End bool Results []SearchResult }
type SearchResult ¶
type Sorting ¶
type Sorting int
Sorting specifies the sorting method used in search queries.
Sorting methods.
func (*Sorting) Set ¶
Set implements the flag.Value interface. A comma-separated list of the following options is valid:
- relevance
- random
- date_added
- views
- favorites
type WallHaven ¶
type WallHaven struct { }
func (*WallHaven) Search ¶
func (wh *WallHaven) Search(query string, options ...Option) (result *SearchInfo, err error)
Search searches for wallpapers based on the given query and search options.
func (*WallHaven) UserUploads ¶
func (wh *WallHaven) UserUploads(user string, options ...Option) (result *SearchInfo, err error)