jacquard-api 0.11.0

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

pub mod get_currently_playing;
pub mod next;
pub mod pause;
pub mod play;
pub mod previous;
pub mod seek;

use jacquard_common::CowStr;

#[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 SpotifyTrackView<'a> {
    ///The name of the album.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub album: Option<CowStr<'a>>,
    ///The name of the artist.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub artist: Option<CowStr<'a>>,
    ///The duration of the track in milliseconds.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration: Option<i64>,
    ///The unique identifier of the Spotify track.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub id: Option<CowStr<'a>>,
    ///The name of the track.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub name: Option<CowStr<'a>>,
    ///A URL to a preview of the track.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub preview_url: Option<CowStr<'a>>,
}

impl<'a> LexiconSchema for SpotifyTrackView<'a> {
    fn nsid() -> &'static str {
        "app.rocksky.spotify.defs"
    }
    fn def_name() -> &'static str {
        "spotifyTrackView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_spotify_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_app_rocksky_spotify_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.spotify.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("spotifyTrackView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("album"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The name of the album."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("artist"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The name of the artist."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("duration"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The unique identifier of the Spotify track.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The name of the track."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("previewUrl"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("A URL to a preview of the track."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}