steamgriddb_api/
steam_static.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
4
5/// Urls for steam static files
6pub struct SteamStaticUrls {
7    /// Steam header url
8    pub header: String,
9    /// Steam capsule url
10    pub capsule: String,    
11    /// Steam hero url
12    pub hero: String,
13    /// Steam logo url
14    pub logo: String,
15}
16
17impl SteamStaticUrls {
18
19    /// Create a new instance of SteamStaticUrls
20    pub fn new(steam_id: &str) -> Self {
21        Self{
22            header:format!("https://cdn.cloudflare.steamstatic.com/steam/apps/{steam_id}/header.jpg", steam_id=steam_id),
23            capsule:format!("https://cdn.cloudflare.steamstatic.com/steam/apps/{steam_id}/library_600x900_2x.jpg", steam_id=steam_id),
24            hero:format!("https://cdn.cloudflare.steamstatic.com/steam/apps/{steam_id}/library_hero.jpg", steam_id=steam_id),
25            logo:format!("https://cdn.cloudflare.steamstatic.com/steam/apps/{steam_id}/logo.png", steam_id=steam_id),
26        }
27    }
28}