Documentation
¶
Index ¶
- Variables
- func FetchWallpaper(wallpaper Wallpaper, creds *Credentials) (string, error)
- func GetCachedCurrent() string
- func GetValidResolutions() []string
- func IsValidResolution(resolution string) bool
- func LoadCache() error
- func SaveCache() error
- func SetCachedCurrent(id string)
- type Credentials
- type Wallpaper
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidResolution happens when the requested resolution doesn't exist // on the website. ErrInvalidResolution = errors.New("invalid resolution") // ErrNoWallpapersFound happens when the server response is parsed successfully, // but no valid items are found. ErrNoWallpapersFound = errors.New("zero wallpapers returned from server") )
View Source
var ( // ErrInvalidCredentials happens when the credentials were rejected by the // server. ErrInvalidCredentials = errors.New("got unauthorized from server") )
Functions ¶
func FetchWallpaper ¶
func FetchWallpaper(wallpaper Wallpaper, creds *Credentials) (string, error)
FetchWallpaper downloads the given wallpaper, optionally with the provided credentials.
func GetCachedCurrent ¶
func GetCachedCurrent() string
GetCachedCurrent gets the current wallpaper ID from the cache.
func GetValidResolutions ¶
func GetValidResolutions() []string
GetValidResolutions returns the list of all valid resolutions.
func IsValidResolution ¶
IsValidResolution checks if the given resolution is valid.
func SetCachedCurrent ¶
func SetCachedCurrent(id string)
SetCachedCurrent sets the current wallpaper ID in the cache.
Types ¶
type Credentials ¶
Credentials holds the username and password used to authorize in the members section of the website.
func (*Credentials) Validate ¶
func (c *Credentials) Validate() error
Validate tries to load a page and thus verify the credentials.
type Wallpaper ¶
Wallpaper is a single wallpaper image that can be downloaded from the website.
func GetFreebiesIndex ¶
GetFreebiesIndex returns the list of all wallpaper URLs that are available for free.
Click to show internal directories.
Click to hide internal directories.