wallhaven_rs/models/response/
tag.rs

1use serde::Deserialize;
2
3use crate::Purities;
4
5/// A tag to represent a wallpaper, which is itself categorized into categories
6#[derive(Deserialize, Clone, Debug)]
7pub struct Tag {
8    /// This tag's id
9    pub id: u64,
10    /// The precise tag name
11    pub name: String,
12    /// An alias for this tag's `name`, used for fuzzy search
13    pub alias: String,
14    /// This tag's category's id
15    ///
16    /// Each tag is part of a category, for example, if two tags have the same category id, it means they are related somehow
17    ///
18    /// For example, the [weapon tag](https://wallhaven.cc/api/v1/tag/2980) has a `category_id` of 60 (which corresponds to a `category` = "Military & Weapons")
19    ///
20    /// In the same way, the [arrows tag](https://wallhaven.cc/api/v1/tag/2995) has the same `category_id` (thus, the same `category`)
21    ///
22    /// ## Note
23    ///
24    /// - There are a lot of tag categories, like, A LOT. Its not feasible to add every one of them to an enum, unfortunately.
25    /// - To my knowledge, there is no way to fetch tags from the api. I am asking the developers though!
26    pub category_id: u64,
27    /// A string representation of the `category_id`, in english
28    ///
29    /// See `category_id` for more informations
30    pub category: String,
31    /// The general purity of the tag
32    ///
33    /// As far as I'm aware of, on tags this purity can either be sfw or nsfw, no sketchy.
34    /// Do not trust this information, and if you prove me wrong please fill an issue or make a PR!
35    /// (Be sure to put an example wallpaper id for me to test)
36    ///
37    /// Even if the type is `Purities`, dont be fooled:
38    ///
39    /// It actually can only be one purity!
40    pub purity: Purities,
41    /// The date of creation of this tag
42    pub created_at: jiff::civil::DateTime,
43}