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;
#[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)]
#[serde(rename_all = "camelCase")]
pub struct ArtistView<'a> {
#[serde(borrow)]
pub mbid: CowStr<'a>,
#[serde(borrow)]
pub name: CowStr<'a>,
pub play_count: i64,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RecordingView<'a> {
#[serde(borrow)]
pub mbid: CowStr<'a>,
#[serde(borrow)]
pub name: CowStr<'a>,
pub play_count: i64,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReleaseView<'a> {
#[serde(borrow)]
pub mbid: CowStr<'a>,
#[serde(borrow)]
pub name: CowStr<'a>,
pub play_count: i64,
}
impl<'a> LexiconSchema for ArtistView<'a> {
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<'a> LexiconSchema for RecordingView<'a> {
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<'a> LexiconSchema for ReleaseView<'a> {
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 Name;
type PlayCount;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Mbid = Unset;
type Name = Unset;
type PlayCount = Unset;
}
pub struct SetMbid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMbid<S> {}
impl<S: State> State for SetMbid<S> {
type Mbid = Set<members::mbid>;
type Name = S::Name;
type PlayCount = S::PlayCount;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Mbid = S::Mbid;
type Name = Set<members::name>;
type PlayCount = S::PlayCount;
}
pub struct SetPlayCount<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPlayCount<S> {}
impl<S: State> State for SetPlayCount<S> {
type Mbid = S::Mbid;
type Name = S::Name;
type PlayCount = Set<members::play_count>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct mbid(());
pub struct name(());
pub struct play_count(());
}
}
pub struct ArtistViewBuilder<'a, S: artist_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ArtistView<'a> {
pub fn new() -> ArtistViewBuilder<'a, artist_view_state::Empty> {
ArtistViewBuilder::new()
}
}
impl<'a> ArtistViewBuilder<'a, artist_view_state::Empty> {
pub fn new() -> Self {
ArtistViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ArtistViewBuilder<'a, S>
where
S: artist_view_state::State,
S::Mbid: artist_view_state::IsUnset,
{
pub fn mbid(
mut self,
value: impl Into<CowStr<'a>>,
) -> ArtistViewBuilder<'a, artist_view_state::SetMbid<S>> {
self._fields.0 = Option::Some(value.into());
ArtistViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ArtistViewBuilder<'a, S>
where
S: artist_view_state::State,
S::Name: artist_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<CowStr<'a>>,
) -> ArtistViewBuilder<'a, artist_view_state::SetName<S>> {
self._fields.1 = Option::Some(value.into());
ArtistViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ArtistViewBuilder<'a, S>
where
S: artist_view_state::State,
S::PlayCount: artist_view_state::IsUnset,
{
pub fn play_count(
mut self,
value: impl Into<i64>,
) -> ArtistViewBuilder<'a, artist_view_state::SetPlayCount<S>> {
self._fields.2 = Option::Some(value.into());
ArtistViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ArtistViewBuilder<'a, S>
where
S: artist_view_state::State,
S::Mbid: artist_view_state::IsSet,
S::Name: artist_view_state::IsSet,
S::PlayCount: artist_view_state::IsSet,
{
pub fn build(self) -> ArtistView<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> ArtistView<'a> {
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 Mbid;
type Name;
type PlayCount;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Mbid = Unset;
type Name = Unset;
type PlayCount = Unset;
}
pub struct SetMbid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMbid<S> {}
impl<S: State> State for SetMbid<S> {
type Mbid = Set<members::mbid>;
type Name = S::Name;
type PlayCount = S::PlayCount;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Mbid = S::Mbid;
type Name = Set<members::name>;
type PlayCount = S::PlayCount;
}
pub struct SetPlayCount<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPlayCount<S> {}
impl<S: State> State for SetPlayCount<S> {
type Mbid = S::Mbid;
type Name = S::Name;
type PlayCount = Set<members::play_count>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct mbid(());
pub struct name(());
pub struct play_count(());
}
}
pub struct RecordingViewBuilder<'a, S: recording_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> RecordingView<'a> {
pub fn new() -> RecordingViewBuilder<'a, recording_view_state::Empty> {
RecordingViewBuilder::new()
}
}
impl<'a> RecordingViewBuilder<'a, recording_view_state::Empty> {
pub fn new() -> Self {
RecordingViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecordingViewBuilder<'a, S>
where
S: recording_view_state::State,
S::Mbid: recording_view_state::IsUnset,
{
pub fn mbid(
mut self,
value: impl Into<CowStr<'a>>,
) -> RecordingViewBuilder<'a, recording_view_state::SetMbid<S>> {
self._fields.0 = Option::Some(value.into());
RecordingViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecordingViewBuilder<'a, S>
where
S: recording_view_state::State,
S::Name: recording_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<CowStr<'a>>,
) -> RecordingViewBuilder<'a, recording_view_state::SetName<S>> {
self._fields.1 = Option::Some(value.into());
RecordingViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecordingViewBuilder<'a, S>
where
S: recording_view_state::State,
S::PlayCount: recording_view_state::IsUnset,
{
pub fn play_count(
mut self,
value: impl Into<i64>,
) -> RecordingViewBuilder<'a, recording_view_state::SetPlayCount<S>> {
self._fields.2 = Option::Some(value.into());
RecordingViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecordingViewBuilder<'a, S>
where
S: recording_view_state::State,
S::Mbid: recording_view_state::IsSet,
S::Name: recording_view_state::IsSet,
S::PlayCount: recording_view_state::IsSet,
{
pub fn build(self) -> RecordingView<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RecordingView<'a> {
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 Mbid;
type Name;
type PlayCount;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Mbid = Unset;
type Name = Unset;
type PlayCount = Unset;
}
pub struct SetMbid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMbid<S> {}
impl<S: State> State for SetMbid<S> {
type Mbid = Set<members::mbid>;
type Name = S::Name;
type PlayCount = S::PlayCount;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Mbid = S::Mbid;
type Name = Set<members::name>;
type PlayCount = S::PlayCount;
}
pub struct SetPlayCount<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPlayCount<S> {}
impl<S: State> State for SetPlayCount<S> {
type Mbid = S::Mbid;
type Name = S::Name;
type PlayCount = Set<members::play_count>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct mbid(());
pub struct name(());
pub struct play_count(());
}
}
pub struct ReleaseViewBuilder<'a, S: release_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ReleaseView<'a> {
pub fn new() -> ReleaseViewBuilder<'a, release_view_state::Empty> {
ReleaseViewBuilder::new()
}
}
impl<'a> ReleaseViewBuilder<'a, release_view_state::Empty> {
pub fn new() -> Self {
ReleaseViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReleaseViewBuilder<'a, S>
where
S: release_view_state::State,
S::Mbid: release_view_state::IsUnset,
{
pub fn mbid(
mut self,
value: impl Into<CowStr<'a>>,
) -> ReleaseViewBuilder<'a, release_view_state::SetMbid<S>> {
self._fields.0 = Option::Some(value.into());
ReleaseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReleaseViewBuilder<'a, S>
where
S: release_view_state::State,
S::Name: release_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<CowStr<'a>>,
) -> ReleaseViewBuilder<'a, release_view_state::SetName<S>> {
self._fields.1 = Option::Some(value.into());
ReleaseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReleaseViewBuilder<'a, S>
where
S: release_view_state::State,
S::PlayCount: release_view_state::IsUnset,
{
pub fn play_count(
mut self,
value: impl Into<i64>,
) -> ReleaseViewBuilder<'a, release_view_state::SetPlayCount<S>> {
self._fields.2 = Option::Some(value.into());
ReleaseViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ReleaseViewBuilder<'a, S>
where
S: release_view_state::State,
S::Mbid: release_view_state::IsSet,
S::Name: release_view_state::IsSet,
S::PlayCount: release_view_state::IsSet,
{
pub fn build(self) -> ReleaseView<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> ReleaseView<'a> {
ReleaseView {
mbid: self._fields.0.unwrap(),
name: self._fields.1.unwrap(),
play_count: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}