jacquard-api 0.11.0

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.rocksky.stats.defs
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

pub mod get_stats;


#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct StatsView<'a> {
    ///The total number of unique albums scrobbled.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub albums: Option<i64>,
    ///The total number of unique artists scrobbled.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub artists: Option<i64>,
    ///The total number of tracks marked as loved.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub loved_tracks: Option<i64>,
    ///The total number of scrobbles.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scrobbles: Option<i64>,
    ///The total number of unique tracks scrobbled.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tracks: Option<i64>,
}

impl<'a> LexiconSchema for StatsView<'a> {
    fn nsid() -> &'static str {
        "app.rocksky.stats.defs"
    }
    fn def_name() -> &'static str {
        "statsView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_stats_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_app_rocksky_stats_defs() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("app.rocksky.stats.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("statsView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("albums"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("artists"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lovedTracks"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("scrobbles"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tracks"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}