Skip to main content

artifacts/models/
badge_schema.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5#[cfg_attr(feature = "specta", derive(specta::Type))]
6pub struct BadgeSchema {
7    /// Code of the badge. This is the badge's unique identifier (ID).
8    #[serde(rename = "code")]
9    pub code: String,
10    /// Season of the badge.
11    #[serde(rename = "season", skip_serializing_if = "Option::is_none")]
12    pub season: Option<i32>,
13    /// Description of the badge.
14    #[serde(rename = "description")]
15    pub description: String,
16}
17
18impl BadgeSchema {
19    pub fn new(code: String, description: String) -> BadgeSchema {
20        BadgeSchema {
21            code,
22            season: None,
23            description,
24        }
25    }
26}