wallhaven_rs/models/response/
user_settings.rs

1use serde::Deserialize;
2use serde_with::{BoolFromInt, DefaultOnError, DisplayFromStr, serde_as};
3
4use crate::{AspectRatio, Categories, Purities, Resolution, ThumbnailResolution, ToplistRange};
5
6/// Represents user settings, mostly the default search settings
7#[serde_as]
8#[derive(Deserialize, Clone, Debug)]
9pub struct UserSettings {
10    /// The default wallpaper thumbnail resolution
11    pub thumb_size: ThumbnailResolution,
12    /// How many wallpapers per page by default
13    #[serde_as(as = "DisplayFromStr")]
14    pub per_page: u64,
15    /// Purities used by default when searching.
16    ///
17    /// See [`Purities`]
18    pub purity: Purities,
19    /// Categories used by default when searching.
20    ///
21    /// See [`Categories`]
22    pub categories: Categories,
23    /// A list of resolutions that will be included by default when searching.
24    ///
25    /// See [`Resolution`]
26    #[serde_as(as = "DefaultOnError<_>")]
27    pub resolutions: Vec<Resolution>,
28    /// A list of aspect ratios that will be included by default when searching.
29    ///
30    /// See [`AspectRatio`]
31    #[serde_as(as = "DefaultOnError<_>")]
32    pub aspect_ratios: Vec<AspectRatio>,
33    /// The toplist range used by default when searching.
34    ///
35    /// See [`ToplistRange`]
36    pub toplist_range: ToplistRange,
37    /// A list of tags that are excluded from all searches and listings
38    pub tag_blacklist: Vec<String>,
39    /// A list of usernames that are excluded from all searches and listings
40    pub user_blacklist: Vec<String>,
41    /// If AI art is filtered out.
42    #[serde_as(as = "BoolFromInt")]
43    pub ai_art_filter: bool,
44}