pub mod get_latest;
pub mod get_top_artists;
pub mod get_top_releases;
pub mod get_user_top_artists;
pub mod get_user_top_releases;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ArtistView<S: BosStr = DefaultStr> {
pub mbid: S,
pub name: S,
pub play_count: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct RecordingView<S: BosStr = DefaultStr> {
pub mbid: S,
pub name: S,
pub play_count: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReleaseView<S: BosStr = DefaultStr> {
pub mbid: S,
pub name: S,
pub play_count: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for ArtistView<S> {
fn nsid() -> &'static str {
"fm.teal.alpha.stats.defs"
}
fn def_name() -> &'static str {
"artistView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_teal_alpha_stats_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for RecordingView<S> {
fn nsid() -> &'static str {
"fm.teal.alpha.stats.defs"
}
fn def_name() -> &'static str {
"recordingView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_teal_alpha_stats_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ReleaseView<S> {
fn nsid() -> &'static str {
"fm.teal.alpha.stats.defs"
}
fn def_name() -> &'static str {
"releaseView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_fm_teal_alpha_stats_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod artist_view_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Mbid;
type PlayCount;
type Name;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Mbid = Unset;
type PlayCount = Unset;
type Name = Unset;
}
pub struct SetMbid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetMbid<St> {}
impl<St: State> State for SetMbid<St> {
type Mbid = Set<members::mbid>;
type PlayCount = St::PlayCount;
type Name = St::Name;
}
pub struct SetPlayCount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPlayCount<St> {}
impl<St: State> State for SetPlayCount<St> {
type Mbid = St::Mbid;
type PlayCount = Set<members::play_count>;
type Name = St::Name;
}
pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetName<St> {}
impl<St: State> State for SetName<St> {
type Mbid = St::Mbid;
type PlayCount = St::PlayCount;
type Name = Set<members::name>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct mbid(());
pub struct play_count(());
pub struct name(());
}
}
pub struct ArtistViewBuilder<S: BosStr, St: artist_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<S>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ArtistView<S> {
pub fn new() -> ArtistViewBuilder<S, artist_view_state::Empty> {
ArtistViewBuilder::new()
}
}
impl<S: BosStr> ArtistViewBuilder<S, artist_view_state::Empty> {
pub fn new() -> Self {
ArtistViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ArtistViewBuilder<S, St>
where
St: artist_view_state::State,
St::Mbid: artist_view_state::IsUnset,
{
pub fn mbid(
mut self,
value: impl Into<S>,
) -> ArtistViewBuilder<S, artist_view_state::SetMbid<St>> {
self._fields.0 = Option::Some(value.into());
ArtistViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ArtistViewBuilder<S, St>
where
St: artist_view_state::State,
St::Name: artist_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<S>,
) -> ArtistViewBuilder<S, artist_view_state::SetName<St>> {
self._fields.1 = Option::Some(value.into());
ArtistViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ArtistViewBuilder<S, St>
where
St: artist_view_state::State,
St::PlayCount: artist_view_state::IsUnset,
{
pub fn play_count(
mut self,
value: impl Into<i64>,
) -> ArtistViewBuilder<S, artist_view_state::SetPlayCount<St>> {
self._fields.2 = Option::Some(value.into());
ArtistViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ArtistViewBuilder<S, St>
where
St: artist_view_state::State,
St::Mbid: artist_view_state::IsSet,
St::PlayCount: artist_view_state::IsSet,
St::Name: artist_view_state::IsSet,
{
pub fn build(self) -> ArtistView<S> {
ArtistView {
mbid: self._fields.0.unwrap(),
name: self._fields.1.unwrap(),
play_count: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ArtistView<S> {
ArtistView {
mbid: self._fields.0.unwrap(),
name: self._fields.1.unwrap(),
play_count: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_fm_teal_alpha_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("fm.teal.alpha.stats.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("artistView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("mbid"), SmolStr::new_static("name"),
SmolStr::new_static("playCount")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("mbid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("MusicBrainz artist ID"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Artist name")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("playCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("recordingView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("mbid"), SmolStr::new_static("name"),
SmolStr::new_static("playCount")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("mbid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("MusicBrainz recording ID"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Recording/track name"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("playCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("releaseView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("mbid"), SmolStr::new_static("name"),
SmolStr::new_static("playCount")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("mbid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("MusicBrainz release ID"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Release/album name")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("playCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod recording_view_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Name;
type PlayCount;
type Mbid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Name = Unset;
type PlayCount = Unset;
type Mbid = Unset;
}
pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetName<St> {}
impl<St: State> State for SetName<St> {
type Name = Set<members::name>;
type PlayCount = St::PlayCount;
type Mbid = St::Mbid;
}
pub struct SetPlayCount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPlayCount<St> {}
impl<St: State> State for SetPlayCount<St> {
type Name = St::Name;
type PlayCount = Set<members::play_count>;
type Mbid = St::Mbid;
}
pub struct SetMbid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetMbid<St> {}
impl<St: State> State for SetMbid<St> {
type Name = St::Name;
type PlayCount = St::PlayCount;
type Mbid = Set<members::mbid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct name(());
pub struct play_count(());
pub struct mbid(());
}
}
pub struct RecordingViewBuilder<S: BosStr, St: recording_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<S>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> RecordingView<S> {
pub fn new() -> RecordingViewBuilder<S, recording_view_state::Empty> {
RecordingViewBuilder::new()
}
}
impl<S: BosStr> RecordingViewBuilder<S, recording_view_state::Empty> {
pub fn new() -> Self {
RecordingViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordingViewBuilder<S, St>
where
St: recording_view_state::State,
St::Mbid: recording_view_state::IsUnset,
{
pub fn mbid(
mut self,
value: impl Into<S>,
) -> RecordingViewBuilder<S, recording_view_state::SetMbid<St>> {
self._fields.0 = Option::Some(value.into());
RecordingViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordingViewBuilder<S, St>
where
St: recording_view_state::State,
St::Name: recording_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<S>,
) -> RecordingViewBuilder<S, recording_view_state::SetName<St>> {
self._fields.1 = Option::Some(value.into());
RecordingViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordingViewBuilder<S, St>
where
St: recording_view_state::State,
St::PlayCount: recording_view_state::IsUnset,
{
pub fn play_count(
mut self,
value: impl Into<i64>,
) -> RecordingViewBuilder<S, recording_view_state::SetPlayCount<St>> {
self._fields.2 = Option::Some(value.into());
RecordingViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordingViewBuilder<S, St>
where
St: recording_view_state::State,
St::Name: recording_view_state::IsSet,
St::PlayCount: recording_view_state::IsSet,
St::Mbid: recording_view_state::IsSet,
{
pub fn build(self) -> RecordingView<S> {
RecordingView {
mbid: self._fields.0.unwrap(),
name: self._fields.1.unwrap(),
play_count: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> RecordingView<S> {
RecordingView {
mbid: self._fields.0.unwrap(),
name: self._fields.1.unwrap(),
play_count: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod release_view_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Name;
type Mbid;
type PlayCount;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Name = Unset;
type Mbid = Unset;
type PlayCount = Unset;
}
pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetName<St> {}
impl<St: State> State for SetName<St> {
type Name = Set<members::name>;
type Mbid = St::Mbid;
type PlayCount = St::PlayCount;
}
pub struct SetMbid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetMbid<St> {}
impl<St: State> State for SetMbid<St> {
type Name = St::Name;
type Mbid = Set<members::mbid>;
type PlayCount = St::PlayCount;
}
pub struct SetPlayCount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPlayCount<St> {}
impl<St: State> State for SetPlayCount<St> {
type Name = St::Name;
type Mbid = St::Mbid;
type PlayCount = Set<members::play_count>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct name(());
pub struct mbid(());
pub struct play_count(());
}
}
pub struct ReleaseViewBuilder<S: BosStr, St: release_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<S>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ReleaseView<S> {
pub fn new() -> ReleaseViewBuilder<S, release_view_state::Empty> {
ReleaseViewBuilder::new()
}
}
impl<S: BosStr> ReleaseViewBuilder<S, release_view_state::Empty> {
pub fn new() -> Self {
ReleaseViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReleaseViewBuilder<S, St>
where
St: release_view_state::State,
St::Mbid: release_view_state::IsUnset,
{
pub fn mbid(
mut self,
value: impl Into<S>,
) -> ReleaseViewBuilder<S, release_view_state::SetMbid<St>> {
self._fields.0 = Option::Some(value.into());
ReleaseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReleaseViewBuilder<S, St>
where
St: release_view_state::State,
St::Name: release_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<S>,
) -> ReleaseViewBuilder<S, release_view_state::SetName<St>> {
self._fields.1 = Option::Some(value.into());
ReleaseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReleaseViewBuilder<S, St>
where
St: release_view_state::State,
St::PlayCount: release_view_state::IsUnset,
{
pub fn play_count(
mut self,
value: impl Into<i64>,
) -> ReleaseViewBuilder<S, release_view_state::SetPlayCount<St>> {
self._fields.2 = Option::Some(value.into());
ReleaseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReleaseViewBuilder<S, St>
where
St: release_view_state::State,
St::Name: release_view_state::IsSet,
St::Mbid: release_view_state::IsSet,
St::PlayCount: release_view_state::IsSet,
{
pub fn build(self) -> ReleaseView<S> {
ReleaseView {
mbid: self._fields.0.unwrap(),
name: self._fields.1.unwrap(),
play_count: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ReleaseView<S> {
ReleaseView {
mbid: self._fields.0.unwrap(),
name: self._fields.1.unwrap(),
play_count: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}