wallhaven-rs
A wallhaven api wrapper. I found just CLIs and such on cargo, so I might as well create one for my project
This crate was for a short period known as wallhaven-api, I then did a complete overhaul and now the code is actually nice!
Usage
Creating the client
First, you must create a WallhavenClient:
let api_key = var.ok;
let client = new?;
This will create a WallhavenClient that will either run with or without api key. You could as well just:
let client = new;
// Or
let client = with_key;
Using the client
The client has the following functions, and for more details you may check out the documentation of that function/returned model:
wallpaper(id: impl AsRef<str>)- Fetches a wallpaper by idsearch(params: Option<SearchRequest>)- Searches for wallpapers, using the specificSearchRequestcollections(username: Option<String>)- Searches for the collections of either the current user if the api key is provided (None), or some user (Some("username"))collection_items(username: impl AsRef<str>, id: u64, params: Option<CollectionItemsRequest>)- Gets the collection items for a certain user/collection, with optional search querytag(id: u64)- Fetches a tag's detailsuser_settings(&self)- Fetches the current user's settingsdownload_wallpaper(&WallpaperDetails|&Wallpaper)- Gets a stream of bytes to download that wallpaperdownload_thumbnail(thumbnail: &Thumbnails, resolution: ThumbnailResolution)- Gets a stream of bytes to download a thumbnail with a certain resolution